/* Animal Dash — same toy-box look as the rest of the arcade */

:root {
  --ink: #33261f;
  --cream: #fff6e8;
  --sun: #ffc93c;
  --coral: #ff6b6b;
  --coral-deep: #e04848;
  --blue: #3d7bd9;
  --leaf: #6dbf67;
  --panel: rgba(255, 246, 232, 0.94);
  --shadow: 0 6px 0 rgba(51, 38, 31, 0.25);
  --font-display: 'Lilita One', 'Comic Sans MS', cursive;
  --font-body: 'Baloo 2', 'Comic Sans MS', cursive;
}

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

html, body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  font-family: var(--font-body);
  background: #4f9ec4;
  color: var(--ink);
  user-select: none;
  -webkit-user-select: none;
}
@media (pointer: coarse) {
  html, body { overflow: visible; touch-action: pan-y; }
  body { height: auto; min-height: calc(100vh + 2px); }
  @supports (min-height: 100lvh) {
    body { min-height: calc(100lvh + 2px); }
  }
  #dash-hud { touch-action: none; }
}

#stage { position: fixed; inset: 0; }
#game { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.hidden { display: none !important; }

/* ---------- screens ---------- */
.screen {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: clamp(6px, 1.6vh, 18px);
  padding: env(safe-area-inset-top) 16px env(safe-area-inset-bottom);
  z-index: 20; overflow-y: auto; touch-action: pan-y;
}

#dash-title {
  font-family: var(--font-display);
  font-size: clamp(36px, 8.5vmin, 88px);
  line-height: 1; letter-spacing: 2px;
  color: var(--sun);
  -webkit-text-stroke: clamp(1.5px, 0.4vmin, 3.5px) var(--ink);
  text-shadow: 0 clamp(3px, 0.9vmin, 8px) 0 var(--ink);
}
#dash-title span { display: inline-block; animation: pop-in .6s cubic-bezier(.2,1.6,.4,1) backwards; }
#dash-title span:nth-child(odd) { color: var(--coral); }
#dash-title span:nth-child(3n) { color: var(--leaf); }
#dash-title span:nth-child(1){animation-delay:.05s}#dash-title span:nth-child(2){animation-delay:.1s}
#dash-title span:nth-child(3){animation-delay:.15s}#dash-title span:nth-child(4){animation-delay:.2s}
#dash-title span:nth-child(5){animation-delay:.25s}#dash-title span:nth-child(6){animation-delay:.3s}
#dash-title span:nth-child(7){animation-delay:.4s}#dash-title span:nth-child(8){animation-delay:.45s}
#dash-title span:nth-child(9){animation-delay:.5s}#dash-title span:nth-child(10){animation-delay:.55s}
@keyframes pop-in { 0% { transform: translateY(-70px) scale(.3); opacity: 0; } 100% { transform: none; opacity: 1; } }

.tagline {
  font-weight: 800; font-size: clamp(12px, 2.3vmin, 21px);
  color: var(--cream); text-shadow: 0 2px 0 rgba(51,38,31,.4);
}

.mode-row { display: flex; gap: clamp(8px, 1.6vw, 18px); }
.mode-btn {
  font-family: var(--font-display);
  font-size: clamp(14px, 2.6vmin, 22px);
  letter-spacing: 1px;
  color: var(--ink); background: var(--panel);
  border: 4px solid var(--ink); border-radius: 16px;
  box-shadow: 0 4px 0 rgba(51,38,31,.25);
  padding: clamp(6px, 1.2vmin, 12px) clamp(14px, 2.6vw, 30px);
  cursor: pointer;
  display: flex; flex-direction: column; align-items: center; line-height: 1.05;
}
.mode-btn small { font-family: var(--font-body); font-weight: 700; font-size: .55em; opacity: .7; }
.mode-btn.selected { background: #fff; box-shadow: 0 0 0 4px var(--sun), 0 4px 0 rgba(51,38,31,.25); }

#pick-panels { display: flex; gap: clamp(10px, 2vw, 28px); flex-wrap: wrap; justify-content: center; }
.pick-panel {
  background: var(--panel);
  border: 4px solid var(--ink); border-radius: 18px;
  box-shadow: var(--shadow);
  padding: clamp(6px, 1.2vmin, 14px) clamp(10px, 1.6vmin, 18px);
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.pick-panel.p1 { border-color: var(--coral-deep); }
.pick-panel.p2 { border-color: var(--blue); }
.pick-title {
  font-family: var(--font-display);
  font-size: clamp(13px, 2.4vmin, 20px);
  letter-spacing: 1px;
}
.pick-panel.p1 .pick-title { color: var(--coral-deep); }
.pick-panel.p2 .pick-title { color: var(--blue); }
.pick-row { display: flex; gap: clamp(5px, 1vw, 12px); }
.pick-face {
  background: none; border: 3.5px solid transparent; border-radius: 50%;
  padding: 2px; cursor: pointer;
  transition: transform .1s;
}
.pick-face:active { transform: scale(.92); }
.pick-face.selected { border-color: var(--ink); background: #fff; }
.pick-face canvas { width: clamp(44px, 8.5vmin, 84px); height: clamp(44px, 8.5vmin, 84px); display: block; }
#panel-p2.cpu-pick .pick-face { pointer-events: none; opacity: .55; }
#panel-p2.cpu-pick .pick-face.selected { opacity: 1; }

.big-btn {
  font-family: var(--font-display);
  font-size: clamp(19px, 3.4vmin, 32px); letter-spacing: 1.5px;
  color: var(--ink); background: linear-gradient(180deg, #ffd95e, var(--sun));
  border: 4px solid var(--ink); border-radius: 20px;
  padding: clamp(8px, 1.4vh, 15px) clamp(26px, 4.6vw, 50px);
  box-shadow: var(--shadow); cursor: pointer;
}
.big-btn:active { transform: translateY(4px); box-shadow: 0 2px 0 rgba(51,38,31,.25); }
.btn-column { display: flex; flex-direction: column; gap: 10px; align-items: center; }

.back-btn, .back-link {
  font-family: var(--font-body); font-weight: 800;
  font-size: clamp(12px, 2.2vmin, 18px);
  color: var(--cream); background: rgba(51,38,31,.35);
  border: 3px solid rgba(255,246,232,.6); border-radius: 999px;
  padding: 6px 18px; cursor: pointer; text-decoration: none;
}

/* ---------- HUD ---------- */
#dash-hud {
  position: absolute;
  top: calc(6px + env(safe-area-inset-top));
  left: calc(10px + env(safe-area-inset-left));
  right: calc(10px + env(safe-area-inset-right));
  display: flex; align-items: center; justify-content: center; gap: 10px;
  z-index: 10; pointer-events: none;
}
.hud-pill {
  font-family: var(--font-display);
  font-size: clamp(13px, 2.4vmin, 21px);
  background: var(--panel); border: 3px solid var(--ink); border-radius: 999px;
  padding: 3px 14px; box-shadow: 0 3px 0 rgba(51,38,31,.25);
  white-space: nowrap;
}
.hud-pill.trophy.p1 { border-color: var(--coral-deep); margin-right: auto; }
.hud-pill.trophy.p2 { border-color: var(--blue); margin-left: auto; }
#hud-btns { display: flex; gap: 8px; pointer-events: auto; }
.icon-btn {
  width: clamp(30px, 5vmin, 42px); height: clamp(30px, 5vmin, 42px);
  border-radius: 50%; border: 3px solid var(--ink);
  background: var(--panel); font-family: var(--font-display);
  font-size: clamp(13px, 2.4vmin, 19px); color: var(--ink);
  box-shadow: 0 3px 0 rgba(51,38,31,.25); cursor: pointer;
}

/* ---------- countdown + tap zones ---------- */
#countdown {
  position: absolute; left: 50%; top: 42%;
  transform: translate(-50%, -50%);
  font-family: var(--font-display);
  font-size: clamp(80px, 22vmin, 220px);
  color: var(--cream);
  -webkit-text-stroke: 4px var(--ink);
  text-shadow: 0 8px 0 var(--ink);
  z-index: 14; pointer-events: none;
  animation: count-pop .9s ease-out infinite;
}
@keyframes count-pop { 0% { transform: translate(-50%, -50%) scale(.4); opacity: 0; } 25% { transform: translate(-50%, -50%) scale(1.15); opacity: 1; } 45% { transform: translate(-50%, -50%) scale(1); } 100% { transform: translate(-50%, -50%) scale(1); opacity: .9; } }

#zone-hints { position: absolute; inset: 0; z-index: 12; display: flex; pointer-events: none; }
#zone-left, #zone-right {
  flex: 1; display: flex; align-items: flex-end; justify-content: center;
  padding-bottom: 12vh;
}
#zone-left { background: rgba(224, 72, 72, .13); border-right: 3px dashed rgba(51,38,31,.3); }
#zone-right { background: rgba(61, 123, 217, .13); }
#zone-left span, #zone-right span {
  font-family: var(--font-display);
  font-size: clamp(15px, 3vmin, 30px);
  color: var(--cream); background: rgba(51,38,31,.7);
  border-radius: 999px; padding: .3em .9em;
  animation: hint-bob 1s ease-in-out infinite;
}
#zone-hints.single #zone-right { display: none; }
#zone-hints.single #zone-left { background: none; border: none; }
@keyframes hint-bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

/* ---------- end ---------- */
.end-box {
  background: var(--panel); border: 4px solid var(--ink); border-radius: 22px;
  box-shadow: var(--shadow);
  padding: clamp(14px, 2.6vmin, 30px) clamp(22px, 4vmin, 44px);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  text-align: center;
}
#winner-face { width: clamp(90px, 18vmin, 190px); height: clamp(90px, 18vmin, 190px); animation: winner-bob 1.4s ease-in-out infinite; }
@keyframes winner-bob { 0%,100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-10px) rotate(3deg); } }
#end-title { font-family: var(--font-display); font-size: clamp(22px, 4.6vmin, 40px); }
#end-sub { font-weight: 800; font-size: clamp(12px, 2.3vmin, 19px); opacity: .8; }

#rotate-hint {
  position: absolute; inset: 0; z-index: 40;
  background: rgba(51,38,31,.85); color: var(--cream);
  display: none; align-items: center; justify-content: center; text-align: center;
  font-family: var(--font-display); font-size: clamp(22px, 6vw, 40px);
  line-height: 1.5; padding: 30px; pointer-events: none;
}
@media (orientation: portrait) and (max-width: 620px) {
  #rotate-hint.armed { display: flex !important; }
}

/* ---------- short screens ---------- */
@media (max-height: 520px) {
  .screen { gap: 5px; }
  #dash-title { font-size: clamp(24px, 7.5vmin, 38px); }
  .tagline { font-size: 10px; }
  .mode-btn { font-size: 12px; padding: 4px 12px; border-width: 3px; }
  .pick-panel { padding: 4px 8px; border-width: 3px; gap: 3px; }
  .pick-title { font-size: 11px; }
  .pick-face canvas { width: 36px; height: 36px; }
  .big-btn { font-size: 15px; padding: 5px 22px; border-width: 3px; }
  .back-btn, .back-link { font-size: 10px; padding: 3px 11px; }
  .hud-pill { font-size: 11px; padding: 1px 10px; border-width: 2.5px; }
  .icon-btn { width: 26px; height: 26px; font-size: 11px; border-width: 2.5px; }
  .end-box { padding: 8px 20px; gap: 4px; }
  #end-title { font-size: 18px; }
  #end-sub { font-size: 10px; }
}
