:root {
  --ink: #070b18;
  --ink-2: #0c1226;
  --panel: #101a34;
  --rule: #223055;
  --rule-soft: #18213f;
  --brass: #c9a227;
  --brass-dim: #8a7020;
  --text: #e9edf8;
  --muted: #8b99bd;
  --danger: #ff6b6b;
  --ok: #5ad19a;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: ui-sans-serif, system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  min-height: 100vh;
  background:
    radial-gradient(1200px 700px at 15% -10%, #16224a 0%, transparent 60%),
    radial-gradient(900px 600px at 100% 0%, #0f2a3d 0%, transparent 55%),
    var(--ink);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

.plate { max-width: 1180px; margin: 0 auto; padding: 40px 24px 64px; }

/* ------------------------------------------------------------------ en-tête */

.masthead { border-bottom: 1px solid var(--rule); padding-bottom: 22px; margin-bottom: 30px; }

.eyebrow {
  margin: 0 0 10px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--brass);
}

.masthead h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(34px, 6vw, 58px);
  letter-spacing: .01em;
  line-height: 1;
}

.lede { margin: 12px 0 0; max-width: 58ch; color: var(--muted); }

/* ------------------------------------------------------------------- layout */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, .85fr);
  gap: 36px;
  align-items: start;
}

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; gap: 28px; }
  .plate { padding: 28px 16px 48px; }
}

/* -------------------------------------------------------------------- board */

.board-wrap { min-width: 0; }

.board {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 2px;
  aspect-ratio: 1;
  padding: 10px;
  background: linear-gradient(180deg, var(--ink-2), #080d1d);
  border: 1px solid var(--rule);
  border-radius: 3px;
  box-shadow: inset 0 0 60px rgba(0, 0, 0, .6);
}

.cell {
  position: relative;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: default;
}

.cell:focus-visible { outline: 2px solid var(--brass); outline-offset: 1px; z-index: 2; }

/* lucarnes */

.portal {
  cursor: pointer;
  font-family: var(--mono);
  font-size: clamp(8px, 1.05vw, 12px);
  color: var(--muted);
  background: #0a1024;
  border: 1px solid var(--rule-soft);
  transition: background-color .15s, color .15s, border-color .15s;
}

.portal:hover:not(:disabled) { background: #16223f; color: var(--text); border-color: var(--brass-dim); }
.portal:disabled { cursor: default; }

.portal .seal {
  position: absolute;
  inset: 14%;
  border-radius: 50%;
  opacity: 0;
  transform: scale(.4);
  transition: opacity .25s ease, transform .25s cubic-bezier(.2, .9, .3, 1.4);
}

.portal.used .seal { opacity: 1; transform: scale(1); box-shadow: 0 0 10px 1px currentColor; }
.portal.used .num { position: relative; z-index: 1; color: #06090f; opacity: .8; font-weight: 700; }
.portal.dark .seal { box-shadow: inset 0 0 0 1px #3a3f52; }
.portal.dark .num { color: #8791a8; }
.portal.firing { box-shadow: 0 0 0 1px var(--brass); }

/* champ */

.field {
  cursor: pointer;
  background: #0e1631;
  border: 1px solid #16204043;
  transition: background-color .15s;
}

.field:hover:not(:disabled) { background: #1a2751; }

.field .body {
  width: 62%;
  aspect-ratio: 1;
  border-radius: 50%;
  opacity: 0;
  transform: scale(.3);
  transition: opacity .18s, transform .18s cubic-bezier(.2, .9, .3, 1.4);
  background: radial-gradient(circle at 32% 30%, #ffe9a8, var(--brass) 45%, #6c5310 100%);
}

.field.marked .body { opacity: 1; transform: scale(1); }
.field.truth { background: #1a2751; }
.field.truth .body {
  opacity: 1; transform: scale(1);
  background: radial-gradient(circle at 32% 30%, #cfe0ff, #6f86b8 45%, #253352 100%);
}
.field.hit .body { background: radial-gradient(circle at 32% 30%, #d9ffe9, var(--ok) 45%, #145c3d 100%); }
.field.miss .body { background: radial-gradient(circle at 32% 30%, #ffd9d9, var(--danger) 45%, #6b1d1d 100%); }

/* mode test */

.board.reveal .field.spy::before {
  content: "";
  position: absolute;
  inset: 16%;
  border-radius: 50%;
  border: 1px dashed #7fa0dd;
  opacity: .85;
  pointer-events: none;
}

.field.beam { background: var(--beam, #1a2751); }

.badge {
  margin-left: 10px;
  padding: 2px 7px;
  border: 1px solid var(--brass-dim);
  border-radius: 2px;
  color: #ffd970;
  font-size: 9.5px;
  letter-spacing: .18em;
}

.lab { border: 1px solid var(--rule); border-left: 3px solid #7fa0dd; padding: 14px 16px; }
.lab .section-title { color: #9db8e8; }
.lab .actions { margin-bottom: 10px; }
.lab-note { margin: 0; font-size: 12.5px; color: var(--muted); }

.corner { background: transparent; }
.corner::after {
  content: "";
  width: 5px; height: 5px;
  border-top: 1px solid var(--rule);
  border-left: 1px solid var(--rule);
  opacity: .8;
}

.hint { margin: 14px 0 0; font-size: 13px; color: var(--muted); }

/* ------------------------------------------------------------------ console */

.console { display: grid; gap: 22px; }

.readout {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin: 0;
  background: var(--rule);
  border: 1px solid var(--rule);
}

.readout > div { background: var(--panel); padding: 12px 14px; }

.readout dt {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}

.readout dd {
  margin: 4px 0 0;
  font-family: var(--serif);
  font-size: 28px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.readout .of { font-size: 14px; color: var(--muted); }

.actions { display: flex; gap: 10px; flex-wrap: wrap; }

.btn {
  flex: 1 1 auto;
  padding: 11px 16px;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--rule);
  border-radius: 2px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s;
}

.btn:hover:not(:disabled) { border-color: var(--brass); color: var(--brass); }
.btn:disabled { opacity: .4; cursor: not-allowed; }

.btn-primary { background: var(--brass); border-color: var(--brass); color: #1a1405; font-weight: 600; }
.btn-primary:hover:not(:disabled) { background: #e0b834; border-color: #e0b834; color: #1a1405; }

/* journal */

.section-title {
  margin: 0 0 10px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--brass);
}

.journal {
  margin: 0; padding: 0; list-style: none;
  max-height: 320px; overflow-y: auto;
  border-top: 1px solid var(--rule-soft);
}

.journal li {
  display: grid;
  grid-template-columns: 22px 14px 1fr;
  align-items: center;
  gap: 10px;
  padding: 8px 2px;
  border-bottom: 1px solid var(--rule-soft);
  font-family: var(--mono);
  font-size: 12.5px;
  animation: slide-in .25s ease both;
}

@keyframes slide-in { from { opacity: 0; transform: translateY(-4px); } }

.journal .idx { color: var(--muted); font-size: 10px; }
.journal .dot { width: 12px; height: 12px; border-radius: 50%; box-shadow: 0 0 8px currentColor; }
.journal .dot.dark { box-shadow: inset 0 0 0 1px #444a60; }
.journal .what { color: var(--muted); }
.journal .what b { color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; }

.empty { margin: 10px 0 0; font-size: 13px; color: var(--muted); }

/* verdict */

.verdict {
  padding: 16px 18px;
  border: 1px solid var(--rule);
  border-left: 3px solid var(--brass);
  background: var(--panel);
  animation: slide-in .3s ease both;
}

.verdict h2 { margin: 0 0 6px; font-family: var(--serif); font-weight: 400; font-size: 24px; }
.verdict p { margin: 0; color: var(--muted); font-size: 13.5px; }
.verdict .score { font-family: var(--mono); color: var(--brass); font-size: 13px; letter-spacing: .08em; }
.verdict.lost { border-left-color: var(--danger); }
.verdict.lost h2 { color: var(--danger); }
.verdict.note { border-left-color: var(--muted); }

/* règles */

.rules { border-top: 1px solid var(--rule); padding-top: 14px; }
.rules summary {
  cursor: pointer;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--brass);
}
.rules ul { margin: 12px 0 0; padding-left: 18px; color: var(--muted); font-size: 13.5px; }
.rules li { margin-bottom: 7px; }
.rules b { color: var(--text); font-weight: 600; }

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