:root {
  --bg-deep: #15342e;
  --panel-bg: rgba(24, 43, 37, 0.92);
  --panel-surface: rgba(34, 59, 51, 0.88);
  --brass: #e0b75e;
  --brass-bright: #f5d37a;
  --amber: #e09f3e;
  --parchment: #f4f0d7;
  --parchment-muted: #c8c4ab;
  --ok: #7bf2c8;
  --ink: #12211d;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  min-height: -webkit-fill-available;
  overflow: hidden;
  background-color: var(--bg-deep);
  color: var(--parchment);
  font-family: "Courier New", Courier, monospace;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.viewport {
  position: relative;
  width: 100%;
  height: 100%;
  height: 100dvh;
  min-height: -webkit-fill-available;
  overflow: hidden;
}

#ocean {
  display: block;
  width: 100%;
  height: 100%;
  cursor: pointer;
  touch-action: none;
}

.radio-scene-art {
  position: absolute;
  left: 50%;
  bottom: calc(0.5rem + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 4;
  display: block;
  width: clamp(145px, 16vw, 210px);
  height: auto;
  pointer-events: none;
  user-select: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 260ms ease, visibility 0s linear 260ms;
}

.radio-scene-art.is-visible {
  opacity: 1;
  visibility: visible;
  transition: opacity 260ms ease, visibility 0s linear;
}

@media (prefers-reduced-motion: reduce) {
  .radio-scene-art,
  .radio-scene-art.is-visible {
    transition: none;
  }
}

.touch-controls {
  position: absolute;
  left: calc(1rem + env(safe-area-inset-left, 0px));
  bottom: calc(4.9rem + env(safe-area-inset-bottom, 0px));
  z-index: 13;
  width: 132px;
  height: 184px;
  display: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.touch-joystick {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 132px;
  height: 132px;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}

.touch-joystick svg {
  display: block;
  width: 100%;
  height: 100%;
}

.touch-joystick-shadow {
  fill: rgba(4, 17, 16, 0.36);
}

.touch-joystick-track {
  fill: rgba(21, 52, 46, 0.66);
  stroke: #c69b4c;
  stroke-width: 3;
}

.touch-joystick-guide {
  fill: none;
  stroke: rgba(244, 215, 143, 0.32);
  stroke-width: 1.5;
  stroke-dasharray: 3 5;
}

.touch-joystick-thumb-shadow {
  fill: rgba(4, 17, 16, 0.5);
}

.touch-joystick-thumb-face {
  fill: #d5ac5c;
  stroke: #fff0bc;
  stroke-width: 2.5;
}

.touch-joystick-thumb-mark {
  fill: none;
  stroke: rgba(255, 247, 220, 0.72);
  stroke-width: 2;
  stroke-linecap: round;
}

.touch-interact-button {
  position: absolute;
  top: 0;
  right: 0;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 8px;
  color: #f4d78f;
  background: rgba(21, 52, 46, 0.9);
  border: 2px solid #c69b4c;
  border-radius: 50%;
  box-shadow: 0 2px 5px rgba(5, 16, 15, 0.42);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.touch-interact-button svg {
  display: block;
  width: 100%;
  height: 100%;
}

.touch-interact-button:active,
.touch-interact-button:focus-visible {
  color: #fff4d1;
  background: #47776a;
  outline: 2px solid #fff4d1;
  outline-offset: 2px;
}

@media (max-width: 640px) {
  .radio-scene-art {
    width: clamp(108px, 31vw, 145px);
  }
}

@media (max-width: 760px), (pointer: coarse) {
  .touch-controls {
    display: block;
  }
}

.masthead {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  padding-top: calc(0.75rem + env(safe-area-inset-top, 0px));
  padding-left: calc(1rem + env(safe-area-inset-left, 0px));
  padding-right: calc(1rem + env(safe-area-inset-right, 0px));
  padding-bottom: 0.5rem;
  pointer-events: none;
  z-index: 10;
}

.inspector-panel {
  pointer-events: auto;
  background: var(--panel-bg);
  border: 1.5px solid var(--brass);
  border-radius: 10px;
  box-shadow: 0 6px 18px rgba(8, 16, 14, 0.55);
}

.zoom-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: flex-start;
  flex: 0 0 auto;
  margin-left: auto;
  min-width: 8ch;
  padding: 0.55rem 0.75rem;
  background: #fbf6e8;
  color: #1a1815;
  border: 2.5px solid #1a1815;
  border-radius: 12px;
  box-shadow: 3px 3px 0 #1a1815;
  font-family: "Trebuchet MS", "Comic Sans MS", sans-serif;
  font-size: 0.86rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  opacity: 1;
  visibility: visible;
  transition: opacity 480ms ease, visibility 0s linear;
}

.zoom-indicator.is-faded {
  opacity: 0;
  visibility: hidden;
  transition: opacity 480ms ease, visibility 0s linear 480ms;
}

@media (prefers-reduced-motion: reduce) {
  .zoom-indicator,
  .zoom-indicator.is-faded {
    transition: none;
  }
}

.game-logo {
  display: block;
  width: clamp(150px, 21vw, 220px);
  height: auto;
  flex: 0 1 auto;
  margin-right: auto;
  pointer-events: none;
  user-select: none;
}

.control-select {
  background: var(--panel-surface);
  color: var(--parchment);
  border: 1px solid var(--brass);
  border-radius: 6px;
  padding: 0.28rem 0.45rem;
  font-family: inherit;
  font-size: 0.76rem;
}

.hud-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--panel-surface);
  color: var(--parchment);
  border: 1px solid var(--brass);
  border-radius: 6px;
  padding: 0.36rem 0.65rem;
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.15s ease, transform 0.1s ease;
}

.hud-btn:hover,
.hud-btn:focus-visible {
  background: #2f564a;
  outline: 2px solid var(--brass-bright);
  outline-offset: 1px;
}

.hud-btn svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.inspector-panel {
  position: absolute;
  top: calc(4.8rem + env(safe-area-inset-top, 0px));
  right: calc(1rem + env(safe-area-inset-right, 0px));
  bottom: calc(4.6rem + env(safe-area-inset-bottom, 0px));
  width: min(390px, calc(100vw - 2rem));
  padding: 0.85rem;
  overflow-y: auto;
  z-index: 12;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.inspector-panel[hidden] {
  display: none;
}

.inspector-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(224, 183, 94, 0.35);
  padding-bottom: 0.45rem;
}

.inspector-header h2 {
  margin: 0;
  font-size: 0.98rem;
  color: var(--brass-bright);
}

.inspector-section {
  background: var(--panel-surface);
  border: 1px solid rgba(224, 183, 94, 0.32);
  border-radius: 8px;
  padding: 0.6rem;
}

.inspector-section h3 {
  margin: 0 0 0.4rem 0;
  font-size: 0.82rem;
  color: var(--brass-bright);
}

.inspector-section p {
  margin: 0 0 0.45rem 0;
  font-size: 0.75rem;
  line-height: 1.35;
}

.item-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.38rem 0.5rem;
  background: rgba(15, 29, 25, 0.58);
  border: 1px solid rgba(224, 183, 94, 0.25);
  border-radius: 6px;
  font-size: 0.75rem;
}

.toast-banner {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(0.85rem + env(safe-area-inset-bottom, 0px));
  background: #1d3830;
  color: var(--brass-bright);
  border: 1.5px solid var(--brass);
  border-radius: 8px;
  padding: 0.42rem 0.85rem;
  font-size: 0.78rem;
  font-weight: bold;
  z-index: 15;
  pointer-events: none;
}

.toast-banner[hidden] {
  display: none;
}

