/* =========================================================
   Feed the Queen — game page styles (HUD + menus).
   The game itself is drawn on the canvas by js/game.js.
   ========================================================= */

:root {
  --aurora: #7C3AED;
  --ocean: #3B82F6;
  --pearl: #EAEAF2;
  --graphite: #1A1B2E;

  --pearl-dim: rgba(234, 234, 242, 0.7);
  --pearl-faint: rgba(234, 234, 242, 0.08);
  --line: rgba(234, 234, 242, 0.14);
  --gradient: linear-gradient(135deg, var(--aurora), var(--ocean));
  --honey: #F5B82E; /* game-only colour for nectar */

  --font-head: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-asian: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

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

/* Elements with display:flex/grid would otherwise ignore the hidden attribute */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--graphite);
  color: var(--pearl);
  font-family: var(--font-body);
  /* Stop the page scrolling, zooming or selecting text while playing */
  touch-action: none;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* ---------- HUD ---------- */
.hud {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  padding: calc(10px + env(safe-area-inset-top)) calc(12px + env(safe-area-inset-right)) 0 calc(12px + env(safe-area-inset-left));
  pointer-events: none; /* touches pass through to the canvas… */
}
.hud__group { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: stretch; }
.hud__group--right { justify-content: flex-end; }

.pill {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.6rem;
  border-radius: 12px;
  background: rgba(26, 27, 46, 0.62);
  border: 1px solid var(--line);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.hearts span { font-size: 1.15rem; line-height: 1; color: rgba(234, 234, 242, 0.22); }
.hearts span.on { color: var(--aurora); text-shadow: 0 0 8px rgba(124, 58, 237, 0.9); }

/* Little honey-drop pips for nectar carried */
.pips i {
  display: inline-block;
  width: 11px;
  height: 14px;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  border: 1.5px solid rgba(234, 234, 242, 0.45);
}
.pips i.on {
  background: radial-gradient(circle at 35% 35%, #FFE08A, #E8A21A);
  border-color: #FFD36B;
  box-shadow: 0 0 6px rgba(255, 200, 80, 0.7);
}

.load { font-size: 0.8rem; color: #FFD36B; margin-left: 0.15rem; }

/* Tiny honey jars: filled = earned today */
.jars { display: flex; gap: 4px; padding-top: 4px; }
.jars i {
  position: relative;
  display: inline-block;
  width: 10px;
  height: 12px;
  border-radius: 2px 2px 4px 4px;
  border: 1.5px solid rgba(234, 234, 242, 0.4);
}
.jars i::before {
  content: "";
  position: absolute;
  left: -2px; right: -2px; top: -5px;
  height: 3px;
  border-radius: 2px;
  background: rgba(234, 234, 242, 0.4);
}
.jars i.on { background: linear-gradient(#FFD36B, #E8A21A); border-color: #FFD36B; }
.jars i.on::before { background: var(--aurora); }

/* Field name banner */
.zone-banner {
  position: fixed;
  left: 50%;
  top: 26%;
  transform: translate(-50%, 10px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s, transform 0.5s;
  text-shadow: 0 2px 12px rgba(26, 27, 46, 0.8), 0 0 2px rgba(26, 27, 46, 0.9);
}
.zone-banner.show { opacity: 1; transform: translate(-50%, 0); }
.zone-banner b { font: 700 clamp(1.6rem, 5vw, 2.6rem) var(--font-head); letter-spacing: 0.02em; }
.zone-banner span { font-family: var(--font-asian); font-size: 1.1rem; letter-spacing: 0.4em; }
.zone-banner small { font-size: 0.85rem; color: #FFE08A; font-weight: 600; }

.stat { flex-direction: column; align-items: flex-start; gap: 0.1rem; min-width: 64px; }
.stat__label {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ocean);
}
.stat__value { font-size: 0.85rem; color: var(--pearl-dim); white-space: nowrap; }
.stat__value b { color: var(--pearl); }
.bar { display: block; width: 100%; height: 4px; border-radius: 4px; background: var(--pearl-faint); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--gradient); transition: width 0.2s; }

.icon-btn {
  pointer-events: auto; /* …except the pause button */
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(26, 27, 46, 0.62);
  color: var(--pearl);
  font-size: 0.85rem;
  cursor: pointer;
}

/* ---------- Toast messages ---------- */
.toast {
  position: fixed;
  left: 50%;
  top: calc(84px + env(safe-area-inset-top));
  transform: translate(-50%, -10px);
  max-width: calc(100% - 2rem);
  padding: 0.6rem 1.2rem;
  border-radius: 999px;
  background: var(--gradient);
  box-shadow: 0 10px 30px rgba(124, 58, 237, 0.45);
  font-weight: 600;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Menus ---------- */
.overlay {
  position: fixed;
  inset: 0;
  display: grid;
  padding: calc(1rem + env(safe-area-inset-top)) 1rem calc(1rem + env(safe-area-inset-bottom));
  background: rgba(26, 27, 46, 0.5);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  overflow-y: auto;
  touch-action: pan-y;
}
.panel {
  margin: auto;
  width: min(460px, 100%);
  padding: 1.6rem;
  border-radius: 24px;
  text-align: center;
  /* gradient border trick: graphite fill + gradient behind the border */
  border: 1.5px solid transparent;
  background:
    linear-gradient(rgba(26, 27, 46, 0.94), rgba(26, 27, 46, 0.94)) padding-box,
    var(--gradient) border-box;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}
.panel__logo { margin: 0 auto 0.6rem; border-radius: 22%; }
.panel h1, .panel h2 { font-family: var(--font-head); margin: 0; line-height: 1.1; }
.panel h1 { font-size: 2.2rem; }
.panel h2 { font-size: 2rem; margin-bottom: 0.8rem; }
.panel__cn { font-family: var(--font-asian); letter-spacing: 0.3em; color: var(--pearl-dim); margin: 0.3rem 0 1rem; }

.howto { list-style: none; padding: 0; margin: 0 0 1rem; text-align: left; display: grid; gap: 0.5rem; }
.howto li { display: flex; gap: 0.7rem; align-items: center; padding: 0.55rem 0.7rem; border-radius: 12px; background: var(--pearl-faint); }
.howto span { font-size: 1.3rem; }
.howto p { margin: 0; font-size: 0.9rem; color: var(--pearl-dim); line-height: 1.4; }
.howto b { color: var(--pearl); }

.rates { margin: 0 0 0.3rem; font-weight: 600; }

/* Game picker tabs on the start screen */
.panel__kicker {
  margin: 0 0 0.8rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ocean);
}
.game-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
  padding: 0.3rem;
  margin-bottom: 1.1rem;
  border-radius: 14px;
  background: var(--pearl-faint);
}
.game-tabs button {
  padding: 0.65rem 0.4rem;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--pearl-dim);
  font: 600 0.9rem var(--font-body);
  cursor: pointer;
}
.game-tabs button[aria-selected="true"] { background: var(--gradient); color: var(--pearl); }
.game-tabs button:focus-visible { outline: 2px solid var(--ocean); outline-offset: 2px; }
.new-best { margin: 0 0 0.5rem; font: 700 1.2rem var(--font-head); color: #FFE08A; }
.account-line { margin: 0.8rem 0 0; font-size: 0.85rem; color: var(--pearl-dim); }
.account-line a { color: var(--ocean); }
.account-line b { color: var(--pearl); }
.btn:disabled { opacity: 0.5; cursor: wait; transform: none; }
.fineprint, .keys { margin: 0; font-size: 0.75rem; color: var(--pearl-dim); }
.keys { margin-top: 1rem; }

.panel__buttons { display: flex; flex-wrap: wrap; gap: 0.6rem; justify-content: center; margin-top: 1.2rem; }
.panel__buttons--stack { flex-direction: column; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.85em 1.5em;
  border-radius: 999px;
  border: 1px solid transparent;
  font: 600 1rem var(--font-body);
  color: var(--pearl);
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s;
}
.btn:hover { transform: translateY(-2px); }
.btn--primary { background: var(--gradient); box-shadow: 0 8px 30px rgba(124, 58, 237, 0.45); }
.btn--ghost { background: var(--pearl-faint); border-color: var(--line); }

.big { font-size: 1.1rem; color: var(--pearl-dim); margin: 0 0 1rem; }
.big b { color: var(--pearl); font-size: 1.6rem; }
.summary { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; margin: 0; }
.summary div { padding: 0.6rem; border-radius: 12px; background: var(--pearl-faint); }
.summary dt { font-size: 0.75rem; color: var(--pearl-dim); }
.summary dd { margin: 0; font: 700 1.3rem var(--font-head); }

/* ---------- Small screens ---------- */
@media (max-width: 560px) {
  .stat { min-width: 0; padding: 0.3rem 0.45rem; }
  .stat__label { font-size: 0.55rem; }
  .stat__value { font-size: 0.75rem; }
  .icon-btn { width: 36px; height: 36px; }
  .jars i { width: 8px; height: 10px; }
}
/* Phones held sideways: short screens */
@media (max-height: 500px) {
  .panel { padding: 1rem 1.2rem; }
  .panel__logo { display: none; }
  .panel h1 { font-size: 1.6rem; }
  .howto { grid-template-columns: 1fr 1fr; }
  .howto p { font-size: 0.78rem; }
  .keys { display: none; }
}
