:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #03121d;
  color: #f4fbff;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-width: 320px;
  min-height: 100%;
  margin: 0;
}

body {
  min-height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 15%, rgba(21, 118, 164, 0.2), transparent 42%),
    linear-gradient(180deg, #061d2b 0%, #020b12 100%);
}

button,
kbd {
  font: inherit;
}

.page-shell {
  width: 100vw;
  height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
}

.game-shell {
  --game-aspect: 1.25;
  position: relative;
  width: min(calc(100vw - 36px), calc((100vh - 68px) * var(--game-aspect)));
  aspect-ratio: var(--game-aspect);
  overflow: hidden;
  isolation: isolate;
  border: 1px solid rgba(164, 226, 255, 0.3);
  border-radius: 18px;
  background: #061a28;
  box-shadow:
    0 26px 80px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset;
}

.game-shell:fullscreen {
  width: 100vw;
  height: 100vh;
  aspect-ratio: auto;
  border: 0;
  border-radius: 0;
}

#game-canvas {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
  image-rendering: auto;
}

.water-glass,
.vignette,
.hud,
.screen-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.water-glass {
  z-index: 2;
  opacity: 0;
  background: linear-gradient(180deg, rgba(31, 186, 227, 0.02), rgba(0, 34, 84, 0.11));
  mix-blend-mode: color;
  transition: opacity 300ms ease;
}

.vignette {
  z-index: 7;
  opacity: 0;
  background: radial-gradient(
    ellipse at center,
    rgba(0, 0, 0, 0) 28%,
    rgba(0, 0, 0, 0.06) 52%,
    rgba(0, 0, 0, 0.72) 83%,
    rgba(0, 0, 0, 0.98) 100%
  );
  transition: opacity 120ms linear;
}

.hud {
  z-index: 10;
  padding: clamp(12px, 2.2vw, 24px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.hud-top {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 18px;
}

.interaction-prompt,
.toast {
  border: 1px solid rgba(211, 242, 255, 0.28);
  background: rgba(3, 21, 34, 0.72);
  box-shadow: 0 8px 30px rgba(0, 7, 16, 0.24);
  backdrop-filter: blur(10px);
}

.breath-panel {
  width: min(35vw, 286px);
  filter: drop-shadow(0 9px 18px rgba(0, 11, 24, 0.34));
}

.breath-label {
  display: block;
  margin: 0 0 -4px 14px;
  color: rgba(235, 250, 255, 0.92);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.19em;
  text-shadow: 0 2px 8px #001424;
}

.breath-svg {
  display: block;
  width: 100%;
  overflow: visible;
}

.breath-track {
  fill: rgba(3, 25, 42, 0.76);
}

.breath-outline {
  fill: none;
  stroke: rgba(214, 246, 255, 0.84);
  stroke-width: 2;
}

.breath-empty-label {
  display: none;
  fill: rgba(247, 250, 252, 0.9);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.16em;
}

.breath-shine {
  fill: none;
  stroke: rgba(255, 255, 255, 0.38);
  stroke-width: 2;
  stroke-linecap: round;
}

.breath-bubbles circle {
  fill: rgba(218, 250, 255, 0.28);
  stroke: rgba(242, 253, 255, 0.94);
  stroke-width: 2;
}

.interaction-prompt,
.toast {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 12px;
  padding: 10px 15px;
  font-weight: 750;
  letter-spacing: 0.02em;
  text-align: center;
  white-space: nowrap;
}

.interaction-prompt {
  bottom: 108px;
  color: #f4fcff;
  font-size: clamp(12px, 1.8vw, 15px);
}

.interaction-prompt kbd {
  display: inline-grid;
  min-width: 26px;
  height: 26px;
  margin-right: 7px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.52);
  border-radius: 7px;
  background: rgba(130, 223, 255, 0.18);
  box-shadow: 0 2px 0 rgba(255, 255, 255, 0.2) inset;
}

.toast {
  top: 82px;
  color: #bdeeff;
  opacity: 1;
  transition: opacity 180ms ease;
}

.hotbar {
  align-self: center;
  display: grid;
  grid-template-columns: repeat(9, minmax(34px, 54px));
  gap: 4px;
  pointer-events: auto;
}

.hotbar-slot {
  position: relative;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 2px solid rgba(211, 239, 248, 0.42);
  border-radius: 7px;
  background: linear-gradient(145deg, rgba(7, 27, 41, 0.88), rgba(2, 13, 24, 0.9));
  box-shadow:
    0 4px 13px rgba(0, 0, 0, 0.34),
    0 0 0 2px rgba(0, 0, 0, 0.18) inset;
}

.hotbar-slot.selected {
  border-color: #f7fcff;
  background: linear-gradient(145deg, rgba(32, 116, 151, 0.95), rgba(7, 35, 53, 0.95));
  box-shadow:
    0 0 0 2px rgba(91, 216, 255, 0.82),
    0 7px 22px rgba(0, 8, 20, 0.45);
  transform: translateY(-4px);
}

.slot-number {
  position: absolute;
  top: 2px;
  left: 5px;
  color: rgba(225, 246, 255, 0.72);
  font-size: 9px;
  font-weight: 800;
}

.slot-icon {
  width: 78%;
  height: 78%;
}

.slot-count {
  position: absolute;
  right: 4px;
  bottom: 2px;
  color: white;
  font-size: 12px;
  font-weight: 900;
  text-shadow: 0 1px 3px #000, 0 0 4px #000;
}

.screen-overlay {
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  pointer-events: auto;
  background:
    radial-gradient(circle at 50% 35%, rgba(20, 143, 188, 0.2), transparent 43%),
    rgba(1, 13, 22, 0.74);
  backdrop-filter: blur(6px);
}

.screen-overlay[hidden] {
  display: none;
}

.debug-panel {
  position: absolute;
  z-index: 30;
  top: 62px;
  left: 14px;
  max-width: min(520px, calc(100% - 28px));
  max-height: 55%;
  margin: 0;
  padding: 10px 12px;
  overflow: auto;
  border: 1px solid rgba(150, 227, 255, 0.35);
  border-radius: 9px;
  background: rgba(0, 11, 20, 0.86);
  color: #b9f2ff;
  font: 11px/1.42 ui-monospace, SFMono-Regular, Consolas, monospace;
  pointer-events: none;
  white-space: pre-wrap;
}

.menu-card {
  width: min(92%, 580px);
  padding: clamp(25px, 5vw, 48px);
  border: 1px solid rgba(190, 237, 255, 0.26);
  border-radius: 24px;
  background: linear-gradient(155deg, rgba(8, 43, 61, 0.91), rgba(2, 17, 29, 0.94));
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.52);
  text-align: center;
}

.menu-card.compact {
  max-width: 390px;
}

.eyebrow {
  margin: 0 0 8px;
  color: #72d9fb;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  color: #f5fdff;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-shadow: 0 4px 22px rgba(65, 209, 255, 0.28);
}

h1 {
  font-size: clamp(38px, 7vw, 72px);
}

h2 {
  font-size: clamp(30px, 5vw, 50px);
}

.menu-copy {
  max-width: 440px;
  margin: 14px auto 22px;
  color: rgba(229, 247, 255, 0.77);
  line-height: 1.5;
}

.controls-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px 14px;
  margin: 0 0 24px;
  color: rgba(229, 248, 255, 0.86);
  font-size: 13px;
  text-align: left;
}

.controls-grid span {
  display: flex;
  align-items: center;
  gap: 8px;
}

kbd {
  flex: 0 0 auto;
  padding: 4px 7px;
  border: 1px solid rgba(211, 246, 255, 0.34);
  border-radius: 6px;
  background: rgba(132, 222, 255, 0.1);
  color: #dff8ff;
  font-size: 11px;
  font-weight: 850;
}

button {
  min-width: 190px;
  padding: 13px 22px;
  border: 1px solid rgba(224, 249, 255, 0.72);
  border-radius: 999px;
  background: linear-gradient(180deg, #61d3f3, #198ec3);
  color: #031722;
  cursor: pointer;
  font-weight: 950;
  letter-spacing: 0.08em;
  box-shadow: 0 10px 28px rgba(27, 167, 214, 0.28);
}

button:disabled {
  cursor: wait;
  filter: saturate(0.4);
  opacity: 0.65;
}

button:not(:disabled):hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

.load-status {
  min-height: 18px;
  margin: 12px 0 0;
  color: rgba(201, 238, 249, 0.62);
  font-size: 12px;
}

.footer-note {
  position: fixed;
  bottom: 3px;
  margin: 0;
  color: rgba(178, 221, 237, 0.43);
  font-size: 10px;
  letter-spacing: 0.06em;
}

@media (max-width: 620px) {
  .page-shell {
    padding: 0;
  }

  .game-shell {
    width: 100vw;
    border: 0;
    border-radius: 0;
  }

  .controls-grid {
    grid-template-columns: 1fr;
  }

  .hotbar {
    grid-template-columns: repeat(9, minmax(28px, 1fr));
    width: 100%;
  }

  .footer-note {
    display: none;
  }
}
