/* Minesweeper — Manu Arcade
   Palette + type borrowed from the manugames.com manuscript design system,
   but this is in-game UI: it gets its own cozy treatment (soft corners, warmth).
   No em dashes in any on-screen copy by house style. */

:root {
  /* Manuscript palette (verified against manu-website/src/styles/manuscript.css) */
  --parchment: #f1e6c8;
  --parchment-warm: #ebdcb4;
  --parchment-deep: #dfcb98;
  --parchment-shadow: #c9b483;
  --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;
  --amber: #d99441;

  --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;
  /* Candlelit parchment ground: warm spill upper-left, glow upper-right,
     oxblood pool at the foot, vignette to the corners. */
  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;
}

#app {
  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);
}

/* ---- 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;
}

/* ---- Console / toolbar -------------------------------------------------- */
.console {
  width: 100%;
  max-width: 720px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: clamp(8px, 2vw, 18px);
}

.difficulties { display: flex; flex-wrap: wrap; gap: 6px; justify-self: start; }
.diff {
  font-family: var(--caps);
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: 12px;
  color: var(--ink-light);
  background: transparent;
  border: 1px solid transparent;
  padding: 6px 9px;
  cursor: pointer;
  border-radius: 6px;
  transition: color .2s var(--ease), background .2s var(--ease), border-color .2s var(--ease);
}
.diff:hover { color: var(--oxblood); }
.diff[aria-pressed="true"] {
  color: var(--oxblood);
  border-color: rgba(90,26,31,.35);
  background: rgba(90,26,31,.06);
}

.gauges { display: flex; align-items: center; gap: clamp(10px, 2vw, 18px); justify-self: 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;
  min-width: 64px;
}
.gauge:first-child { justify-content: flex-end; }
.gauge-glyph { font-size: .7em; color: var(--oxblood); transform: translateY(-1px); }
.gauge:last-child .gauge-glyph { color: var(--gold-deep); }

.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); }
.seal-face { line-height: 1; transition: transform .3s var(--ease); }
.seal.win .seal-face { transform: rotate(360deg) scale(1.1); }
.seal.lose { background: radial-gradient(circle at 38% 32%, #6b5a48, #3a2e22 60%, #1a1410 100%); }

.toggles { display: flex; gap: 6px; justify-self: end; }
.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; }

/* ---- Board ------------------------------------------------------------- */
.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 {
  display: block;
  touch-action: manipulation;
  cursor: pointer;
  border-radius: 6px;
  max-width: 100%;
}

.hint {
  text-align: center;
  color: var(--ink-light);
  font-size: 14px;
  padding: 2px 6px 0;
  line-height: 1.45;
  max-width: 560px;
  margin: 2px auto 0;
  opacity: 1;
  transition: opacity .5s var(--ease);
}
.hint p { margin: 0; }
.hint strong { color: var(--oxblood); font-weight: 600; }
.hint.gone { opacity: 0; pointer-events: none; }

/* ---- Colophon ---------------------------------------------------------- */
.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; }

/* ---- 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: fade-in .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: 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; }
.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);
}
.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;
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes 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 (max-width: 560px) {
  .console { grid-template-columns: 1fr; justify-items: center; gap: 12px; }
  .difficulties, .toggles { justify-self: center; }
}

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