/* Manu Arcade shared shell: tokens, candlelit ground, and common chrome
   (masthead, gauges, seal button, toggles, framed panel, overlay, colophon).
   Borrowed from the manugames.com manuscript design system. In-game UI gets
   its own cozy treatment (soft corners, warmth). No em dashes in on-screen copy. */

:root {
  --parchment: #f1e6c8;
  --parchment-warm: #ebdcb4;
  --parchment-deep: #dfcb98;
  --parchment-shadow: #c9b483;
  --cream: #f6eed6;
  --ink: #1a1410;
  --ink-soft: #3a2e22;
  --ink-light: #6b5a48;
  --ink-rule: #7a6850;
  --oxblood: #5a1a1f;
  --oxblood-deep: #3d0f12;
  --oxblood-bright: #7a2228;
  --gold: #c89c3a;
  --gold-deep: #9c7826;
  --gold-bright: #e3b754;
  --forest: #1f3326;
  --forest-bright: #2f4a39;
  --amber: #d99441;
  /* Manuscript-pigment ramp for game accents (lapis, verdigris, vermilion,
     violet, sienna, teal, umber, ink). Distinguishable and on-brand. */
  --pig-1: #2f6d8c; --pig-2: #2f4a39; --pig-3: #7a2228; --pig-4: #4a3b8c;
  --pig-5: #9c4a26; --pig-6: #2f7d7d; --pig-7: #5a3a22; --pig-8: #3a2e22;

  --display: "Cormorant Garamond", "EB Garamond", Garamond, Georgia, serif;
  --body: "EB Garamond", Garamond, Georgia, serif;
  --caps: "IM Fell English SC", "Cormorant Garamond", Georgia, serif;
  --hand: "IM Fell English", "EB Garamond", Georgia, serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }

body {
  font-family: var(--body);
  color: var(--ink-soft);
  background-color: #e7d8b0;
  background-image:
    radial-gradient(120% 90% at 12% 0%, rgba(217,148,65,.20), rgba(217,148,65,0) 42%),
    radial-gradient(120% 90% at 92% 4%, rgba(227,183,84,.16), rgba(227,183,84,0) 46%),
    radial-gradient(140% 120% at 50% 118%, rgba(90,26,31,.16), rgba(90,26,31,0) 50%),
    radial-gradient(150% 130% at 50% 50%, rgba(0,0,0,0), rgba(58,46,34,.18) 100%),
    linear-gradient(180deg, #efe1bd 0%, #e7d8b0 60%, #e0cfa3 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "liga" 1, "dlig" 1, "kern" 1;
  -webkit-tap-highlight-color: transparent;
}

.vh, .skip-link:not(:focus) {
  position: absolute !important; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}
.skip-link:focus {
  position: fixed; top: 10px; left: 10px; z-index: 50;
  background: var(--oxblood); color: var(--parchment);
  padding: 8px 14px; font-family: var(--caps); letter-spacing: .14em;
  text-transform: uppercase; font-size: 12px; text-decoration: none;
}

.arcade {
  max-width: 1100px; margin: 0 auto;
  padding: clamp(14px, 3vw, 30px) clamp(12px, 3vw, 28px) 40px;
  display: flex; flex-direction: column; align-items: center;
  gap: clamp(12px, 2.4vw, 22px);
}

/* Back-to-arcade link sits top-left of a game. */
.arcade-back {
  align-self: flex-start;
  font-family: var(--caps); text-transform: uppercase; letter-spacing: .16em;
  font-size: 12px; color: var(--ink-light); text-decoration: none;
  transition: color .2s var(--ease);
}
.arcade-back:hover { color: var(--oxblood); }

/* Masthead */
.masthead { text-align: center; }
.eyebrow {
  font-family: var(--caps); text-transform: uppercase; letter-spacing: .26em;
  font-size: 12px; color: var(--oxblood); margin: 0 0 6px;
}
.masthead h1 {
  font-family: var(--display); font-weight: 500; font-style: italic;
  color: var(--ink); font-size: clamp(40px, 8vw, 76px); line-height: .96; margin: 0;
}
.subtitle {
  font-family: var(--hand); font-style: italic; color: var(--ink-light);
  font-size: clamp(15px, 2vw, 19px); margin: 6px 0 0;
}

/* HUD row + gauges + the wax-seal action button */
.hud { display: flex; align-items: center; gap: clamp(10px, 2vw, 20px); flex-wrap: wrap; justify-content: center; }
.gauge {
  display: inline-flex; align-items: baseline; gap: 7px;
  font-variant-numeric: tabular-nums; font-size: clamp(20px, 3.4vw, 26px);
  color: var(--ink); font-family: var(--display); font-weight: 600;
}
.gauge-glyph { font-size: .7em; color: var(--oxblood); transform: translateY(-1px); }

.seal {
  width: clamp(46px, 9vw, 58px); height: clamp(46px, 9vw, 58px);
  border-radius: 50%; border: none; cursor: pointer;
  background: radial-gradient(circle at 38% 32%, var(--oxblood-bright), var(--oxblood) 55%, var(--oxblood-deep) 100%);
  box-shadow: inset 0 1px 0 rgba(227,183,84,.35), inset 0 -3px 8px rgba(0,0,0,.35), 0 4px 10px rgba(61,15,18,.35);
  color: var(--gold-bright); font-size: 1.4em; display: grid; place-items: center;
  transition: transform .18s var(--ease), filter .18s var(--ease);
}
.seal:hover { filter: brightness(1.08); }
.seal:active { transform: scale(.92) rotate(-6deg); }

.toggle {
  font-family: var(--caps); text-transform: uppercase; letter-spacing: .12em;
  font-size: 12px; color: var(--ink-light); background: transparent;
  border: 1px solid rgba(122,104,80,.35); padding: 6px 10px; cursor: pointer;
  border-radius: 6px;
  transition: color .2s var(--ease), background .2s var(--ease), border-color .2s var(--ease);
}
.toggle:hover { color: var(--oxblood); border-color: rgba(90,26,31,.4); }
.toggle[aria-pressed="true"] { color: var(--parchment); background: var(--oxblood); border-color: var(--oxblood); }
#mute-toggle .toggle-off { display: none; }
#mute-toggle[aria-pressed="true"] .toggle-on { display: none; }
#mute-toggle[aria-pressed="true"] .toggle-off { display: inline; }

/* Framed playfield panel */
.board-frame {
  position: relative; padding: clamp(10px, 2vw, 18px); border-radius: 12px;
  background: linear-gradient(180deg, rgba(255,255,255,.10), rgba(0,0,0,.04)), var(--parchment-deep);
  box-shadow: inset 0 0 0 1px rgba(200,156,58,.55), inset 0 0 0 3px rgba(122,104,80,.22),
    0 18px 40px rgba(58,46,34,.28), 0 3px 8px rgba(58,46,34,.22);
  max-width: 100%;
}
.board-frame canvas { display: block; touch-action: manipulation; border-radius: 6px; max-width: 100%; }

/* Overlay */
.overlay {
  position: fixed; inset: 0; display: grid; place-items: center;
  background: radial-gradient(120% 120% at 50% 30%, rgba(26,20,16,.32), rgba(26,20,16,.55));
  z-index: 30; animation: arcade-fade .4s var(--ease);
}
.overlay[hidden] { display: none; }
.overlay-card {
  background: radial-gradient(120% 80% at 20% 0%, rgba(217,148,65,.18), rgba(217,148,65,0) 50%), var(--parchment);
  border-radius: 12px; padding: clamp(24px, 4vw, 40px); width: min(440px, 90vw); text-align: center;
  box-shadow: inset 0 0 0 1px rgba(200,156,58,.6), inset 0 0 0 4px rgba(122,104,80,.2), 0 30px 70px rgba(26,20,16,.5);
  animation: arcade-rise .5s var(--ease);
}
.overlay-eyebrow { font-family: var(--caps); text-transform: uppercase; letter-spacing: .26em; font-size: 12px; color: var(--oxblood); margin: 0 0 8px; }
.overlay-card h2 { font-family: var(--display); font-style: italic; font-weight: 500; color: var(--ink); font-size: clamp(30px, 5vw, 44px); line-height: 1.02; margin: 0 0 12px; }
.overlay-stats { font-size: 17px; color: var(--ink-soft); margin: 0 0 22px; line-height: 1.5; }
.overlay-stats b { color: var(--oxblood); font-weight: 600; }
.overlay-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.btn {
  font-family: var(--caps); text-transform: uppercase; letter-spacing: .14em; font-size: 13px;
  padding: 11px 18px; border-radius: 7px; border: 1px solid var(--oxblood);
  background: var(--oxblood); color: var(--parchment); cursor: pointer;
  transition: background .2s var(--ease), transform .12s var(--ease); text-decoration: none; display: inline-block;
}
.btn:hover { background: var(--oxblood-deep); }
.btn:active { transform: translateY(1px) scale(.98); }
.btn.ghost { background: transparent; color: var(--oxblood); }
.btn.ghost:hover { background: rgba(90,26,31,.08); }
.overlay-toast { margin: 14px 0 0; font-size: 13px; color: var(--forest); font-family: var(--caps); letter-spacing: .1em; text-transform: uppercase; }

/* Colophon / Tideward funnel */
.colophon { margin-top: 10px; text-align: center; font-family: var(--hand); font-style: italic; color: var(--ink-light); font-size: 16px; }
.colophon a { color: var(--oxblood); text-decoration: none; border-bottom: 1px solid rgba(90,26,31,.3); }
.colophon a:hover { color: var(--oxblood-bright); }
.colophon .tideward { font-style: normal; font-family: var(--caps); text-transform: uppercase; letter-spacing: .1em; font-size: 13px; border: none; }

@keyframes arcade-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes arcade-rise { from { opacity: 0; transform: translateY(16px) scale(.97); } to { opacity: 1; transform: none; } }

:focus-visible { outline: 2px solid var(--oxblood); outline-offset: 3px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
