/* Beaver Dash — shell around the canvas, in the Beaver Games palette. */

:root {
  --bg: #12101c;
  --raise: #1b1830;
  --line: #2b2646;
  --line-mid: #3b3560;
  --ink: #f6efe3;
  --soft: #cfc7e4;
  --dim: #9a92b8;
  --ghost: #6f6795;
  --amber: #ffb43d;
  --red: #ff5240;
  --teal: #43e0c0;
  --purple: #7b5cff;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Space Grotesk', ui-rounded, system-ui, sans-serif;
  overscroll-behavior: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

body {
  position: fixed;
  inset: 0;
}

#game {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

#app {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.is-hidden {
  display: none !important;
}

.noscript-note {
  position: relative;
  z-index: 1;
  padding: 24px;
  font-size: 16px;
}

/* ---------------------------------------------------------------------- hud */

.hud {
  position: absolute;
  inset: 0;
}

.hud-left {
  position: absolute;
  top: calc(var(--safe-top) + 12px);
  left: 14px;
}

.hud-score {
  font-weight: 700;
  font-size: 26px;
  letter-spacing: 0.02em;
  text-shadow: 2px 2px 0 rgba(12, 10, 20, 0.8);
  font-variant-numeric: tabular-nums;
}

.hud-sub {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 13px;
  color: var(--dim);
  letter-spacing: 0.08em;
}

.hud-phase {
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ghost);
  border-left: 1px solid var(--line-mid);
  padding-left: 8px;
}

.hud-right {
  position: absolute;
  top: calc(var(--safe-top) + 12px);
  right: calc(var(--safe-right) + 56px);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.hud-acorns {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 18px;
  text-shadow: 2px 2px 0 rgba(12, 10, 20, 0.8);
  font-variant-numeric: tabular-nums;
}

.hud-acorn-dot {
  width: 12px;
  height: 14px;
  background: #c98d4e;
  border-radius: 50% 50% 60% 60%;
  border-top: 4px solid #57391c;
}

.hud-chips {
  display: flex;
  gap: 6px;
  min-height: 22px;
}

.chip {
  display: grid;
  place-items: center;
  min-width: 30px;
  height: 22px;
  padding: 0 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  border: 2px solid currentColor;
  background: rgba(12, 10, 20, 0.72);
}

.chip-mult {
  color: var(--teal);
}

.chip-shield {
  color: var(--teal);
  font-size: 14px;
  animation: chip-pulse 1.6s ease-in-out infinite;
}

@keyframes chip-pulse {
  50% {
    opacity: 0.55;
  }
}

.btn-pause {
  position: absolute;
  top: calc(var(--safe-top) + 10px);
  right: calc(var(--safe-right) + 12px);
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  pointer-events: auto;
  background: rgba(12, 10, 20, 0.6);
  border: 2px solid var(--line-mid);
  color: var(--soft);
  font-family: inherit;
  font-size: 11px;
  letter-spacing: 0.1em;
  cursor: pointer;
}

.btn-pause:active {
  border-color: var(--amber);
  color: var(--amber);
}

.milestone {
  position: absolute;
  top: 24%;
  left: 0;
  right: 0;
  margin: 0;
  text-align: center;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.14em;
  color: var(--teal);
  text-shadow: 2px 2px 0 rgba(12, 10, 20, 0.8);
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.milestone.is-live {
  opacity: 1;
  transform: translateY(-6px);
}

/* First-run coaching, one line at a time, then never again. */
.coach {
  position: absolute;
  bottom: calc(var(--safe-bottom) + 18px);
  left: 12px;
  right: 12px;
  margin: 0;
  text-align: center;
  font-size: 13px;
  letter-spacing: 0.06em;
  color: var(--soft);
  text-shadow: 2px 2px 0 rgba(12, 10, 20, 0.9);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.coach.is-live {
  opacity: 1;
}

/* -------------------------------------------------------------------- panels */

.panel-wrap {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: calc(var(--safe-top) + 16px) 16px calc(var(--safe-bottom) + 16px);
  pointer-events: auto;
  background: linear-gradient(rgba(18, 16, 28, 0.5), rgba(18, 16, 28, 0.85));
  overflow-y: auto;
}

.panel {
  width: 100%;
  max-width: 380px;
  background: var(--raise);
  border: 2px solid var(--line);
  box-shadow: 10px 10px 0 rgba(0, 0, 0, 0.45);
  padding: 26px 22px;
  text-align: center;
}

.kicker {
  margin: 0 0 10px;
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--teal);
  font-weight: 700;
}

.title {
  margin: 0 0 14px;
  font-size: clamp(38px, 12vw, 54px);
  line-height: 0.95;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--amber);
  text-shadow: 4px 4px 0 var(--red);
}

.title-sm {
  margin: 0 0 6px;
  font-size: 32px;
  color: var(--amber);
  text-shadow: 3px 3px 0 var(--red);
}

.copy {
  margin: 0 0 22px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--soft);
}

.copy-dim {
  color: var(--dim);
  margin-bottom: 16px;
}

/* The four verbs, one per line — the whole control scheme at a glance. */
.verbs {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
  text-align: left;
  display: grid;
  gap: 7px;
}

.verbs li {
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--dim);
  padding-left: 14px;
  position: relative;
}

.verbs li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 7px;
  width: 5px;
  height: 5px;
  background: var(--teal);
}

.verbs b {
  color: var(--soft);
}

.c-heron {
  color: #b9b1d4;
}

.c-dam {
  color: #b07c4a;
}

.btn-big {
  display: block;
  width: 100%;
  padding: 18px;
  background: var(--amber);
  color: var(--bg);
  border: 2px solid var(--bg);
  box-shadow: 6px 6px 0 var(--red);
  font-family: inherit;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.btn-big:active {
  transform: translate(3px, 3px);
  box-shadow: 2px 2px 0 var(--red);
}

.best {
  margin: 14px 0 16px;
  font-size: 13px;
  color: var(--dim);
  letter-spacing: 0.06em;
}

/* Landscape genuinely shows more of the approaching forest, so say so — but
   only on a narrow screen held upright, and only on the menu. */
.rotate-tip {
  display: none;
  margin: 12px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--teal);
  letter-spacing: 0.04em;
}

@media (orientation: portrait) and (max-width: 620px) {
  .rotate-tip {
    display: block;
  }
}

.menu-row {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.menu-row-top {
  margin-top: 14px;
}

.btn-small {
  padding: 11px 14px;
  background: var(--bg);
  color: var(--soft);
  border: 2px solid var(--line-mid);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  text-decoration: none;
}

.btn-small:active {
  border-color: var(--amber);
  color: var(--amber);
}

.btn-link {
  display: inline-block;
}

.btn-center {
  margin-top: 12px;
}

/* ---------------------------------------------------------------- game over */

.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.result-grid > div {
  background: var(--bg);
  border: 2px solid var(--line);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.result-grid span {
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ghost);
}

.result-grid b {
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.extra {
  margin: 0 0 16px;
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--teal);
  min-height: 15px;
}

.name-form {
  margin-bottom: 16px;
  text-align: left;
}

.name-label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ghost);
  margin-bottom: 6px;
}

.name-row {
  display: flex;
  gap: 8px;
}

.name-input {
  flex: 1;
  min-width: 0;
  padding: 12px;
  background: var(--bg);
  border: 2px solid var(--line-mid);
  color: var(--ink);
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  outline: none;
}

.name-input:focus {
  border-color: var(--amber);
}

/* Narrow screens: the HUD is read at arm's length on a small display, and the
   pause button is a thumb target. */
@media (max-width: 620px) {
  .hud-score {
    font-size: 30px;
  }

  .hud-acorns {
    font-size: 20px;
  }

  .btn-pause {
    width: 46px;
    height: 46px;
  }

  .hud-right {
    right: calc(var(--safe-right) + 64px);
  }

  .coach {
    font-size: 14px;
  }
}

/* Short landscape (phone held sideways): tighten the panel so it still fits
   without scrolling. */
@media (max-height: 460px) {
  .panel {
    padding: 16px 18px;
    max-width: 440px;
  }

  .title {
    font-size: clamp(28px, 8vh, 38px);
    margin-bottom: 8px;
  }

  .verbs {
    grid-template-columns: 1fr 1fr;
    margin-bottom: 12px;
  }

  .btn-big {
    padding: 13px;
  }

  .best {
    margin: 10px 0 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .chip-shield {
    animation: none;
  }

  .milestone,
  .coach {
    transition: none;
  }
}
