/* Harbor Lights design system. Single source of tokens for hub + all games (R-Q). */

@font-face { font-family: 'Fredoka'; font-weight: 500; font-display: swap; src: url('../assets/fonts/fredoka-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Fredoka'; font-weight: 600; font-display: swap; src: url('../assets/fonts/fredoka-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Fredoka'; font-weight: 700; font-display: swap; src: url('../assets/fonts/fredoka-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Nunito'; font-weight: 400; font-display: swap; src: url('../assets/fonts/nunito-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Nunito'; font-weight: 600; font-display: swap; src: url('../assets/fonts/nunito-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Nunito'; font-weight: 800; font-display: swap; src: url('../assets/fonts/nunito-latin-800-normal.woff2') format('woff2'); }

:root {
  --harbor: #0E2F48;        /* deep harbor: ink, night sea */
  --harbor-2: #164A6E;
  --harbor-3: #2A6F96;
  --lamp: #F7B13C;          /* lighthouse amber: primary action */
  --lamp-deep: #C77E12;
  --buoy: #D9443A;          /* buoy red: alerts, stripes */
  --buoy-deep: #9E2A22;
  --glass: #79D2C0;         /* sea glass: success, chips */
  --glass-deep: #2E8F7C;
  --sail: #F5FAFF;          /* surfaces */
  --sky-top: #FFD9A0;
  --sky-mid: #F59E7B;
  --sea-top: #3C8DB5;
  --ink-soft: #4A6377;

  --font-display: 'Fredoka', 'Trebuchet MS', 'Segoe UI', sans-serif;
  --font-body: 'Nunito', 'Segoe UI', system-ui, sans-serif;

  --step--1: 0.875rem;
  --step-0: 1rem;
  --step-1: 1.25rem;
  --step-2: 1.6rem;
  --step-3: 2.1rem;
  --step-4: 2.8rem;

  --r-pill: 999px;
  --r-panel: 22px;
  --r-tile: 14px;
  --lip: 0 5px 0;           /* the chunky button lip */
  --shadow-float: 0 14px 30px -12px rgba(8, 30, 48, 0.55);
  --focus: 0 0 0 3px var(--sail), 0 0 0 6px var(--harbor);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur: 220ms;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--harbor); }
body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.5;
  color: var(--harbor);
  background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-mid) 34%, var(--sea-top) 34.1%, var(--harbor-2) 75%, var(--harbor) 100%) fixed;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.15; margin: 0; letter-spacing: 0.005em; }
p { margin: 0 0 0.75em; max-width: 65ch; }
button { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--focus); }
[hidden] { display: none !important; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Buttons: one primary voice (lamp), one quiet voice (sail), one danger. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5em;
  min-height: 48px; padding: 0.55em 1.4em;
  border: 0; border-radius: var(--r-pill); cursor: pointer;
  font-family: var(--font-display); font-weight: 600; font-size: var(--step-1);
  color: var(--harbor); background: var(--lamp);
  box-shadow: var(--lip) var(--lamp-deep), var(--shadow-float);
  transition: transform var(--dur) var(--ease-bounce), box-shadow var(--dur);
  touch-action: manipulation; user-select: none;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--lamp-deep); }
.btn:disabled { cursor: not-allowed; filter: saturate(0.3); opacity: 0.7; transform: none; }
.btn--quiet { background: var(--sail); box-shadow: var(--lip) #B9CBDB, var(--shadow-float); }
.btn--quiet:active { box-shadow: 0 1px 0 #B9CBDB; }
.btn--glass { background: var(--glass); box-shadow: var(--lip) var(--glass-deep), var(--shadow-float); }
.btn--glass:active { box-shadow: 0 1px 0 var(--glass-deep); }
.btn--danger { background: var(--buoy-deep); color: var(--sail); box-shadow: var(--lip) #6E1C16, var(--shadow-float); }
.btn--small { min-height: 44px; font-size: var(--step-0); padding: 0.4em 1em; }
.btn--icon { width: 48px; min-height: 48px; padding: 0; font-size: var(--step-1); }

/* Top bar: currencies + navigation. */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap;
  padding: 0.6rem clamp(0.75rem, 3vw, 1.5rem);
  background: linear-gradient(180deg, rgba(14, 47, 72, 0.92), rgba(14, 47, 72, 0.78));
  color: var(--sail);
  backdrop-filter: blur(6px);
}
.topbar__title { font-family: var(--font-display); font-size: var(--step-1); font-weight: 600; margin-right: auto; white-space: nowrap; min-width: 0; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 0.5rem; color: var(--sail); text-decoration: none; }
@media (max-width: 480px) {
  .topbar { display: grid; grid-template-columns: 1fr auto; row-gap: 0.4rem; }
  .topbar .wallet { grid-column: 1 / -1; grid-row: 2; }
  .chip { min-height: 32px; padding-right: 0.6rem; }
}
.wallet { display: flex; gap: 0.5rem; flex-wrap: wrap; list-style: none; margin: 0; padding: 0; }
.chip {
  display: inline-flex; align-items: center; gap: 0.35rem;
  min-height: 36px; padding: 0.15rem 0.8rem 0.15rem 0.35rem;
  border-radius: var(--r-pill); background: rgba(245, 250, 255, 0.14);
  font-family: var(--font-display); font-weight: 600; font-variant-numeric: tabular-nums;
}
.chip svg { width: 26px; height: 26px; flex: none; }
.chip--bump { animation: bump 420ms var(--ease-bounce); }
@keyframes bump { 40% { transform: scale(1.18); } }

/* Panels and dialogs. */
.panel { background: var(--sail); border-radius: var(--r-panel); box-shadow: var(--shadow-float); padding: clamp(1rem, 3vw, 1.6rem); }
dialog.modal {
  border: 0; padding: 0; max-width: min(520px, calc(100vw - 2rem)); width: 100%;
  border-radius: var(--r-panel); background: var(--sail); color: var(--harbor);
  box-shadow: 0 30px 60px -20px rgba(4, 18, 30, 0.7);
}
dialog.modal::backdrop { background: rgba(8, 24, 38, 0.62); }
dialog.modal[open] { animation: pop 260ms var(--ease-bounce); }
@keyframes pop { from { transform: scale(0.9); opacity: 0; } }
.modal__body { padding: 1.5rem clamp(1rem, 4vw, 1.8rem) 1.2rem; }
.modal__title { font-size: var(--step-2); margin-bottom: 0.6rem; }
.modal__actions { display: flex; gap: 0.75rem; flex-wrap: wrap; justify-content: flex-end; padding: 0 clamp(1rem, 4vw, 1.8rem) 1.4rem; }
.help-list { padding-left: 1.2rem; margin: 0 0 1rem; }
.help-list li { margin-bottom: 0.45rem; }

/* Toasts announce results to everyone, including screen readers (role=status). */
.toasts { position: fixed; left: 50%; bottom: max(1rem, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 50; display: grid; gap: 0.5rem; width: min(420px, calc(100vw - 2rem)); pointer-events: none; }
.toast { background: var(--harbor); color: var(--sail); border-radius: 16px; padding: 0.75rem 1rem; font-weight: 700; box-shadow: var(--shadow-float); animation: toast-in 260ms var(--ease-bounce); }
.toast--good { background: #1F6F5C; }
.toast--bad { background: var(--buoy-deep); }
@keyframes toast-in { from { transform: translateY(16px); opacity: 0; } }

/* Celebration burst (win moments): CSS-only confetti of lamp/glass/buoy flecks. */
.burst { position: fixed; inset: 0; pointer-events: none; z-index: 40; overflow: hidden; }
.burst i { position: absolute; top: 45%; left: 50%; width: 10px; height: 14px; border-radius: 3px; animation: fleck 1.4s ease-out forwards; }
@keyframes fleck { to { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); opacity: 0; } }

.page { width: min(1100px, 100%); margin: 0 auto; padding: 1rem clamp(0.75rem, 3vw, 1.5rem) 3rem; }
.muted { color: var(--ink-soft); }
.on-dark { color: var(--sail); }

@media (prefers-reduced-motion: reduce) {
  /* Long Haul (body.lh) and LIGHTLINE (body.ll) are exempt: they calm their own motion -- slower,
     smaller, never frozen (L-33). */
  :not(.lh, .lh *, .ll, .ll *), :not(.lh, .lh *, .ll, .ll *)::before, :not(.lh, .lh *, .ll, .ll *)::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
}
