body {
  margin: 0;
  overflow: hidden;
  /* Prevent scrollbars */
  font-family: sans-serif;
  background-color: #222;
  color: #eee;
}

#game-container {
  display: grid;
  grid-template-columns: 1fr 300px;
  /* Main view (remaining space) and Flight Strips (fixed 300px) */
  grid-template-rows: 1fr auto;
  /* Main view (remaining space) and Comms (auto height) */
  gap: 10px;
  /* Gap between panels */
  height: 100vh;
  /* Full viewport height */
  padding: 10px;
  box-sizing: border-box;
}

#main-panel-wrapper {
  grid-column: 1 / 2;
  /* Spans the first column */
  grid-row: 1 / 2;
  /* Spans the first row */
  display: flex;
  flex-direction: column;
  background-color: #333;
  border-radius: 8px;
  overflow: hidden;
  height: 100%;
  /* Added to ensure it takes full height of its grid cell */
}

#tabs {
  display: flex;
  background-color: #444;
  border-bottom: 1px solid #555;
  justify-content: space-between;
  /* Pushes items to ends */
  align-items: center;
  /* Vertically aligns items */
}

.tab-button {
  padding: 10px 15px;
  border: none;
  background-color: transparent;
  color: #ccc;
  cursor: pointer;
  font-size: 1em;
  transition: background-color 0.2s, color 0.2s;
}

.tab-button:hover {
  background-color: #555;
  color: #fff;
}

.tab-button.active {
  background-color: #666;
  color: #fff;
}

#main-view {
  flex-grow: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: #000;
  /* Canvas background */
  height: 100%;
  /* Added to ensure it takes full height of parent */
}

#canvas-container {
  display: flex;
  flex-grow: 1;
  height: 100%;
  position: relative;
  /* For splitter positioning */
}

#canvas-3d {
  height: 100%;
  display: block;
  min-width: 0;
  /* Allow shrinking */
}

#canvas-radar {
  flex-grow: 1;
  flex-basis: 0;
  /* Allows flex-grow to work correctly */
  height: 100%;
  display: block;
  min-width: 0;
  /* Allow shrinking */
}

#canvas-splitter {
  width: 10px;
  cursor: ew-resize;
  background-color: #555;
  flex-shrink: 0;
  /* Prevent splitter from shrinking */
}

/* Full view states */
#canvas-container.full-3d #canvas-radar {
  display: none;
}

#canvas-container.full-radar #canvas-3d {
  display: none;
}

#canvas-container.full-3d #canvas-3d,
#canvas-container.full-radar #canvas-radar {
  flex-basis: 100%;
}

#flight-strips-panel {
  grid-column: 2 / 3;
  /* Spans the second column */
  grid-row: 1 / 3;
  /* Spans both rows */
  background-color: #333;
  border-radius: 8px;
  padding: 15px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#flight-strips-panel h2 {
  margin-top: 0;
  margin-bottom: 0;
  color: #fff;
  font-size: 1.2em;
}

#flight-strips-content {
  flex-grow: 1;
  overflow-y: auto;
  /* Enable scrolling for flight strips */
  background-color: #2a2a2a;
  border-radius: 4px;
  padding: 10px;
}

#atc-communications-panel {
  grid-column: 1 / 2;
  /* Spans the first column */
  grid-row: 2 / 3;
  /* Spans the second row */
  background-color: #333;
  border-radius: 8px;
  padding: 15px;
  display: flex;
  flex-direction: column;
  max-height: 200px;
  /* Limit height */
  min-height: 200px;
  box-sizing: border-box;
  /* Ensure it's there */
}

#atc-text-display {
  display: flex;
  background-color: #2a2a2a;
  border-radius: 4px;
  padding: 10px;
  height: 100%;
  flex-direction: column-reverse;
  color: #ddd;
  overflow-y: auto;
}

#atc-text-input {
  flex-grow: 1;
  /* Makes input take remaining space */
  padding: 10px;
  border: 1px solid #555;
  border-radius: 4px;
  background-color: #444;
  color: #eee;
  font-size: 1em;
  outline: none;
}

#atc-text-input::placeholder {
  color: #aaa;
}

.options-container {
  position: relative;
  display: inline-block;
  /* To make it only as wide as its content */
}

.options-menu {
  position: absolute;
  top: 100%;
  /* Position below the button */
  right: 0;
  /* Align to the right of the button */
  background-color: #444;
  border: 1px solid #555;
  border-radius: 4px;
  min-width: 150px;
  z-index: 100;
  /* Ensure it's above other content */
  padding: 5px 0;
}

.options-menu.hidden {
  display: none;
}

.option-item {
  padding: 8px 15px;
  cursor: pointer;
  color: #ccc;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.option-item:hover {
  background-color: #555;
  color: #fff;
}

.runway-item {
  padding: 5px 15px;
  cursor: pointer;
  color: #ccc;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 10px;
}

.runway-item:hover {
  background-color: #555;
  color: #fff;
}

.option-indicator {
  font-weight: bold;
  color: #aaffaa;
  /* Green tick */
  margin-left: 10px;
}

/* Layout adjustments when flight strips are split out */
#game-container.strips-split-out {
  grid-template-columns: 1fr;
  /* Main view takes full width */
}

#game-container.strips-split-out #flight-strips-panel {
  display: none;
  /* Hide the flight strips panel */
}

/* Comms Input and Push-to-Talk */
.comms-input-container {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  flex-shrink: 0;
}

.ptt-button {
  padding: 10px 15px;
  border: none;
  background-color: #4a4a4a;
  color: #fff;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  transition: background-color 0.1s, transform 0.1s;
  user-select: none;
  /* Prevent text selection when double clicking/holding */
  min-width: 155px;
  /* Prevent shrinking when text changes */
}

.ptt-button:hover {
  background-color: #5a5a5a;
}

.ptt-button:active {
  background-color: #d9534f;
  /* Red when pressed */
  transform: scale(0.98);
}

.ptt-button:disabled {
  background-color: #333;
  color: #777;
  cursor: not-allowed;
  transform: none;
}

.ptt-button.recording {
  background-color: #d9534f;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% {
    opacity: 1;
  }

  50% {
    opacity: 0.8;
  }

  100% {
    opacity: 1;
  }
}