:root {
  --bg: #020705;
  --panel: rgba(2, 10, 6, 0.76);
  --panel-strong: rgba(2, 7, 5, 0.94);
  --green: #35c96c;
  --green-soft: #79f1a8;
  --cream: #f3eed9;
  --muted: #b8cab8;
  --line: rgba(121, 241, 168, 0.24);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  position: relative;
  overflow-x: hidden;
  background: #000;
  color: var(--cream);
  font-family: "Archivo Black", "Inter", "Arial Black", sans-serif;
}

body::before {
  content: none;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.game-shell {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 18px;
}

.game-stage {
  width: min(1500px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 16px;
}

.game-topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  min-height: 48px;
  flex-wrap: wrap;
}

.site-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px 16px;
  flex: 1 1 420px;
  flex-wrap: wrap;
  color: rgba(243, 238, 217, 0.82);
  font-weight: 600;
}

.site-nav a {
  color: inherit;
  text-decoration: none;
  transition: color 160ms ease, transform 160ms ease;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--green-soft);
}

.site-nav a:hover {
  transform: translateY(-1px);
}

.hud {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.hud > span,
.music-toggle,
.scoreboard,
.start-panel {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(10px);
}

.hud > span,
.music-toggle {
  min-width: 104px;
  padding: 10px 12px;
  border-radius: 8px;
  text-align: center;
  color: var(--green-soft);
  font-weight: 700;
}

.robin-call-meter {
  --call-fill: 100%;
  position: relative;
  min-width: 48px !important;
  width: 48px;
  min-height: 44px;
  display: inline-grid;
  place-items: center;
  padding: 8px !important;
  overflow: hidden;
  color: var(--green-soft);
}

.robin-call-meter::before {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: var(--call-fill);
  background: linear-gradient(180deg, rgba(121, 241, 168, 0.25), rgba(53, 201, 108, 0.76));
  transition: height 160ms ease;
}

.robin-call-meter.is-ready {
  border-color: rgba(204, 255, 0, 0.75);
  box-shadow:
    0 18px 60px rgba(0, 0, 0, 0.42),
    0 0 18px rgba(204, 255, 0, 0.28);
}

.robin-call-icon {
  position: relative;
  z-index: 1;
  width: 27px;
  height: 19px;
  filter: drop-shadow(0 0 6px rgba(204, 255, 0, 0.42));
}

.robin-call-icon::before,
.robin-call-icon::after {
  content: "";
  position: absolute;
  top: 5px;
  width: 17px;
  height: 10px;
  border-radius: 100% 6px 100% 4px;
  background: #f3eed9;
  border: 2px solid #031008;
}

.robin-call-icon::before {
  left: 0;
  transform: rotate(-28deg);
}

.robin-call-icon::after {
  right: 0;
  transform: scaleX(-1) rotate(-28deg);
}

.robin-call-meter.is-ready .robin-call-icon::before,
.robin-call-meter.is-ready .robin-call-icon::after {
  background: #ccff00;
}

.music-toggle {
  min-height: 44px;
  color: var(--cream);
}

.music-toggle[aria-pressed="true"] {
  color: #04130b;
  background: linear-gradient(135deg, #79f1a8, #35c96c);
}

.health-meter {
  min-width: 180px;
}

.health-track {
  display: block;
  width: 100%;
  height: 7px;
  margin-top: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.58);
}

#healthFill {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #d7f7b4, #35c96c);
  box-shadow: 0 0 16px rgba(121, 241, 168, 0.55);
  transition: width 140ms ease;
}

.canvas-wrap {
  position: relative;
  min-width: 0;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #010604;
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.64);
  touch-action: none;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
}

.start-panel {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(460px, calc(100% - 32px));
  transform: translate(-50%, -50%);
  padding: 26px;
  border-radius: 8px;
  text-align: center;
}

.start-panel.is-hidden {
  display: none;
}

.start-panel h1,
.scoreboard h2 {
  margin: 0;
  font-family: "Archivo Black", "Inter", "Arial Black", sans-serif;
  text-transform: uppercase;
}

.start-panel h1 {
  font-size: clamp(2rem, 6vw, 3.2rem);
  line-height: 0.92;
}

.start-panel form {
  margin-top: 20px;
}

.start-panel label {
  display: block;
  margin-bottom: 8px;
  color: var(--green-soft);
  font-size: 0.82rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.start-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.start-row input,
.start-row button,
.scoreboard button {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.start-row input {
  width: 100%;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--cream);
  outline: 0;
}

.start-row input:focus {
  border-color: rgba(121, 241, 168, 0.58);
}

.start-row button,
.scoreboard button {
  padding: 0 18px;
  background: linear-gradient(135deg, #12602f, #35c96c);
  color: var(--cream);
  font-weight: 800;
}

.start-panel p {
  margin: 16px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.scoreboard {
  display: flex;
  min-height: 0;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border-radius: 8px;
}

.scoreboard h2 {
  margin-bottom: 6px;
  font-size: 1.15rem;
  color: var(--green-soft);
}

.scoreboard-status {
  margin: 0 0 14px;
  color: rgba(243, 238, 217, 0.7);
  font-size: 0.78rem;
  line-height: 1.35;
}

.scoreboard ol {
  margin: 0;
  padding-left: 24px;
}

.scoreboard li {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.35;
}

.scoreboard strong {
  color: var(--cream);
}

.scoreboard button {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
}

@media (max-width: 1020px) {
  .game-stage {
    grid-template-columns: 1fr;
  }

  .game-topbar {
    justify-content: center;
  }

  .site-nav,
  .hud {
    flex: 1 1 100%;
  }

  .scoreboard {
    min-height: 180px;
  }
}

@media (max-width: 900px) {
  .game-topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
  }

  .site-nav,
  .hud {
    flex: 1 1 auto;
    width: 100%;
  }

  .site-nav {
    justify-content: flex-start;
  }

  .hud {
    justify-content: stretch;
  }
}

@media (max-width: 640px) {
  html,
  body {
    width: 100%;
    overflow-x: hidden;
  }

  .game-shell {
    width: 100%;
    overflow-x: hidden;
    align-items: start;
    justify-items: stretch;
    padding: 10px;
  }

  .game-stage {
    width: min(100%, 370px);
    min-width: 0;
    margin-inline: 0;
    gap: 10px;
  }

  .game-topbar {
    align-items: flex-start;
  }

  .site-nav {
    display: flex;
    flex-direction: column;
    align-self: flex-start;
    width: auto;
    max-width: 100%;
    min-width: 0;
    gap: 6px;
    font-size: 0.78rem;
    line-height: 1.35;
  }

  .site-nav a {
    min-width: 0;
    text-align: left;
    white-space: normal;
  }

  .site-nav a[aria-current="page"] {
    grid-column: auto;
  }

  .hud {
    width: 100%;
    min-width: 0;
    justify-content: stretch;
    gap: 6px;
  }

  .hud > span,
  .music-toggle {
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
    min-height: 40px;
    padding: 8px 7px;
    font-size: 0.72rem;
  }

  .health-meter {
    min-width: 0;
  }

  .canvas-wrap,
  .scoreboard {
    width: 100%;
    min-width: 0;
  }

  .start-panel {
    width: min(340px, calc(100% - 18px));
    max-height: calc(100% - 12px);
    overflow: auto;
    padding: 18px;
  }

  .start-panel h1 {
    font-size: clamp(1.6rem, 9vw, 2.35rem);
  }

  .start-panel form {
    margin-top: 14px;
  }

  .start-row {
    grid-template-columns: 1fr;
  }

  .start-row input,
  .start-row button,
  .scoreboard button {
    min-height: 44px;
  }

  .start-panel p {
    font-size: 0.88rem;
    line-height: 1.4;
  }

  .scoreboard {
    padding: 14px;
  }
}
