/* =====================================================================
   Sigil Clash - fixed "aged paper" theme.
   Everything pretends to be a duelling ledger on a sheet of warm paper:
   cream vellum ground, sepia ink type, parchment grimoire cards and gold
   riposte wax seals. No glass, no center theming. The shared base.css is
   loaded (back chip + resets) but glass.css deliberately is not: this
   game keeps its own chrome (.c-bar, .c-btn, .c-modal and friends).
   ===================================================================== */

:root {
  --stone-hi: #f3e9d1;
  --stone: #e9dcbc;
  --stone-lo: #d7c49a;
  --stone-line: rgba(96, 74, 44, .09);
  --carve: #d8c79c;

  --parch: #f4ecd5;
  --parch-lo: #ddcca4;
  --ink: #2b2417;
  --ink-soft: #6e604a;

  --gold: #96690f;
  --gold-deep: #6a4a10;
  --violet: #7a4a2a;
  --steel: #443522;
  --azure: #2f6f9e;
  --blood: #a83224;

  --font-body: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
  --font-serif: Georgia, "Iowan Old Style", "Times New Roman", serif;
  --font-mono: ui-monospace, "Cascadia Mono", Consolas, "Courier New", monospace;

  /* Base scale: width of one cast card on the floor. Everything derives
     from it; grows with width but capped by viewport height so the whole
     stack (rival, clash, history, your hand) fits one screen. */
  --u: clamp(46px, min(11vw, calc((100vh - 250px) / 5.2)), 110px);
}

/* ---------- The arena ---------- */
body.sc-page {
  margin: 0;
  min-height: 100vh;
  color: var(--steel);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  background-color: var(--stone);
  background-image:
    radial-gradient(110% 62% at 50% -14%, rgba(176, 132, 70, .16), transparent 60%),
    radial-gradient(70% 46% at 50% 52%, rgba(214, 176, 106, .1), transparent 70%),
    repeating-linear-gradient(0deg, var(--stone-line) 0 1px, transparent 1px 30px),
    repeating-linear-gradient(90deg, var(--stone-line) 0 1px, transparent 1px 30px),
    radial-gradient(92% 62% at 50% 122%, rgba(120, 90, 40, .07), transparent 74%),
    linear-gradient(180deg, var(--stone-hi), var(--stone) 55%, var(--stone-lo));
  background-attachment: fixed;
}
body.sc-page *,
body.sc-page *::before,
body.sc-page *::after { box-sizing: border-box; }

.sc-app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: none;
}

/* ---------- Top bar: a carved lintel ---------- */
.c-bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 10px clamp(12px, 3vw, 26px) 11px;
  color: var(--ink);
  background: linear-gradient(180deg, #efe4c9, #e3d3ad 70%, #d6c199);
  border-bottom: 1px solid rgba(138, 106, 23, .35);
  box-shadow: 0 8px 22px rgba(120, 95, 55, .16), inset 0 1px 0 rgba(255, 255, 255, .7);
}
/* Two rivets of ward-light holding the lintel lit. */
.c-bar::before,
.c-bar::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  transform: translateY(-50%);
  background: radial-gradient(circle at 35% 30%, #fff2cf, var(--gold) 55%, #8a6a17);
  box-shadow: 0 0 10px 2px rgba(184, 134, 11, .35);
  pointer-events: none;
}
.c-bar::before { left: 8px; }
.c-bar::after { right: 8px; }

.c-bar__brand { display: flex; align-items: center; gap: 9px; }
.c-bar__brand svg { display: block; filter: drop-shadow(0 1px 3px rgba(138, 106, 23, .4)); }
.c-bar__title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(19px, 3vw, 26px);
  font-weight: 700;
  letter-spacing: .01em;
  color: #3a2b1a;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .35);
}
.c-bar__stats { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.stat {
  font-size: 11.5px;
  letter-spacing: .03em;
  color: rgba(74, 59, 42, .72);
}
.stat b {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}
.c-bar__controls { display: flex; align-items: center; gap: 6px; margin-left: auto; }

/* Buttons read as inscribed parchment tags with a gold edge. */
.c-btn {
  appearance: none;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: .01em;
  padding: 6px 12px;
  border-radius: 5px;
  color: #3a2b1a;
  background: linear-gradient(180deg, #f4ecda, #e7dcc0);
  border: 1px solid rgba(138, 106, 23, .45);
  box-shadow: 0 2px 0 rgba(150, 130, 95, .35), 0 5px 14px rgba(120, 90, 40, .16), inset 0 1px 0 rgba(255, 255, 255, .7);
  cursor: pointer;
  transition: transform .06s ease, box-shadow .12s ease, filter .12s ease;
}
.c-btn:hover { filter: brightness(1.04); }
.c-btn:active { transform: translateY(1px); box-shadow: 0 1px 0 rgba(150, 130, 95, .35); }
.c-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.c-btn--primary {
  color: #241503;
  background: linear-gradient(180deg, #ffd76a, #d8a92e);
  border-color: #8a6a17;
  box-shadow: 0 2px 0 #8a6a17, 0 5px 14px rgba(200, 160, 50, .3);
  text-shadow: 0 1px 0 rgba(255, 255, 255, .35);
}

/* ---------- Floor ---------- */
.sc-floor {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-evenly;
  gap: clamp(6px, 1.6vh, 16px);
  width: min(100%, 760px);
  margin: 0 auto;
  padding: clamp(8px, 1.8vh, 18px) clamp(10px, 3vw, 22px) clamp(10px, 2vh, 20px);
  position: relative;
}
/* The great sigil ring painted under the clash. */
.sc-floor::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 44%;
  width: min(78vw, 560px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 1px dashed rgba(150, 100, 50, .3);
  box-shadow: 0 0 0 14px rgba(150, 100, 50, .05), inset 0 0 60px rgba(150, 100, 50, .08);
  pointer-events: none;
}

/* ---------- Sides: rival above, you below ---------- */
.sc-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: max(4px, calc(var(--u) * .07));
  width: 100%;
}
.sc-side__head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}
.sc-side__tag {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: rgba(74, 59, 42, .6);
}
.sc-side__name {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 700;
  color: #3a2b1a;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .3);
}
.sc-side--you .sc-side__name { display: none; }

/* Riposte armed: a gold halo chip that pulses when your next blade would riposte. */
.sc-aura {
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #2c1c04;
  background: linear-gradient(180deg, #ffe49a, var(--gold));
  border: 1px solid #8a6a17;
  box-shadow: 0 0 12px 2px rgba(184, 134, 11, .4);
  animation: scAura 1.4s ease-in-out infinite alternate;
}
.sc-aura[hidden] { display: none; }

/* Grimoire counts: how many blades / shields / lances the side still holds. */
.sc-grim {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: rgba(66, 52, 38, .85);
}
.sc-grim i { font-style: normal; font-size: 13px; opacity: .85; }
.sc-grim b { color: var(--steel); font-weight: 700; margin-right: 6px; }
.sc-grim .grim-b { color: var(--steel); }
.sc-grim .grim-s { color: var(--azure); }
.sc-grim .grim-l { color: #2f8f7d; }

/* Life as ten pips: lit = standing, faded = gone. */
.sc-life { display: flex; align-items: center; gap: max(3px, calc(var(--u) * .045)); }
.sc-pip {
  width: max(7px, calc(var(--u) * .115));
  height: max(7px, calc(var(--u) * .115));
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe9b0, var(--gold) 60%, #7a5a12);
  box-shadow: 0 0 8px rgba(184, 134, 11, .4);
  transition: opacity .25s ease, transform .25s ease, box-shadow .25s ease, background .25s ease;
}
.sc-pip.is-out {
  background: #e0d3b4;
  box-shadow: inset 0 0 0 1px rgba(74, 59, 42, .25);
  opacity: .8;
  transform: scale(.82);
}
.sc-life.is-hurt { animation: scShake .32s ease; }
.sc-life.is-heal { animation: scHeal .5s ease; }
.sc-life__num {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  min-width: 2ch;
  text-align: right;
}

/* ---------- Arcana pips: the tempo bar under each life row ---------- */
.sc-arca {
  display: flex;
  align-items: center;
  gap: max(3px, calc(var(--u) * .05));
  margin-top: max(3px, calc(var(--u) * .04));
}
.sc-arcp {
  width: max(6px, calc(var(--u) * .1));
  height: max(6px, calc(var(--u) * .1));
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f4e5ff, #8b5fd6 60%, #4c2a80);
  box-shadow: 0 0 6px rgba(139, 95, 214, .6), inset 0 0 0 1px rgba(255, 255, 255, .35);
  transition: opacity .25s ease, transform .25s ease, box-shadow .25s ease;
}
.sc-arcp.is-out {
  background: #d7c7a2;
  box-shadow: inset 0 0 0 1px rgba(74, 59, 42, .25);
  opacity: .55;
  transform: scale(.78);
}
.sc-arca__num {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: #5a3d80;
  font-variant-numeric: tabular-nums;
  min-width: 1.5ch;
  text-align: right;
  margin-left: 4px;
}

/* ---------- Arcana action row ---------- */
.sc-actions {
  display: flex;
  gap: max(6px, calc(var(--u) * .07));
  justify-content: center;
  margin-top: max(4px, calc(var(--u) * .06));
  flex-wrap: wrap;
}
.sc-act {
  appearance: none;
  font: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: max(3px, calc(var(--u) * .04)) max(8px, calc(var(--u) * .1));
  border-radius: calc(var(--u) * .06);
  background: linear-gradient(180deg, #f5ead2, #dfceac);
  border: 1px solid #a48a5a;
  box-shadow: 0 4px 10px rgba(92, 70, 44, .18), inset 0 1px 0 rgba(255, 255, 255, .55);
  color: var(--ink);
  transition: transform .1s ease, box-shadow .15s ease, filter .2s ease;
}
.sc-act:hover:not(:disabled),
.sc-act:focus-visible:not(:disabled) {
  transform: translateY(calc(var(--u) * -.02));
  box-shadow: 0 6px 14px rgba(92, 70, 44, .22), inset 0 1px 0 rgba(255, 255, 255, .65);
}
.sc-act:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.sc-act__lbl {
  font-family: var(--font-serif);
  font-size: max(11px, calc(var(--u) * .13));
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.sc-act__cost {
  font-family: var(--font-mono);
  font-size: max(9px, calc(var(--u) * .105));
  color: #5a3d80;
}
.sc-act--ward { border-color: #2f6f3f; }
.sc-act--ward .sc-act__lbl { color: #2f6f3f; }
.sc-act--scry { border-color: #5a3d80; }
.sc-act--scry .sc-act__lbl { color: #5a3d80; }
.sc-act--emp { border-color: var(--gold-deep); }
.sc-act--emp .sc-act__lbl { color: var(--gold-deep); }
.sc-act:disabled {
  cursor: default;
  filter: saturate(.35) brightness(.94);
  opacity: .6;
  box-shadow: 0 3px 8px rgba(92, 70, 44, .12), inset 0 1px 0 rgba(255, 255, 255, .35);
}
.sc-act.is-used {
  background: linear-gradient(180deg, #ede2c6, #c9b58a);
  filter: saturate(.6) brightness(.92);
}

/* ---------- Scry reveal panel ---------- */
.sc-scry {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: max(4px, calc(var(--u) * .05)) 0 max(2px, calc(var(--u) * .03));
  padding: max(4px, calc(var(--u) * .05)) max(10px, calc(var(--u) * .12));
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(139, 95, 214, .18), rgba(139, 95, 214, .08));
  border: 1px dashed rgba(90, 61, 128, .5);
  color: #3d2660;
  animation: scScryIn .35s ease-out both;
}
.sc-scry[hidden] { display: none; }
.sc-scry__cap {
  font-family: var(--font-serif);
  font-size: max(10px, calc(var(--u) * .12));
  letter-spacing: .08em;
  text-transform: uppercase;
  opacity: .8;
}
.sc-scry__card {
  width: max(18px, calc(var(--u) * .22));
  height: max(18px, calc(var(--u) * .22));
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.sc-scry__card svg { width: 100%; height: 100%; display: block; }
.sc-scry__label {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: max(12px, calc(var(--u) * .15));
  color: #3d2660;
}

/* ---------- The clash row ---------- */
.sc-clash {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 4vw, 34px);
  width: 100%;
}
.sc-slot {
  position: relative;
  width: calc(var(--u) * 1.15);
  height: calc(var(--u) * 1.62);
  border-radius: calc(var(--u) * .07);
  border: 1px dashed rgba(120, 92, 52, .3);
  background: rgba(120, 95, 55, .1);
  display: grid;
  place-items: center;
}
.sc-slot__cap {
  position: absolute;
  top: -18px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: rgba(74, 59, 42, .6);
}

/* The revealed cast card. */
.sc-cast {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--ink);
  background: linear-gradient(180deg, #f6eed9, var(--parch) 60%, var(--parch-lo));
  border: 1px solid #a9926a;
  box-shadow: 0 8px 20px rgba(92, 70, 44, .22), inset 0 1px 0 rgba(255, 255, 255, .7);
  animation: scFlipIn .34s cubic-bezier(.2, .8, .3, 1.08) both;
}
.sc-cast.is-back {
  background:
    radial-gradient(60% 45% at 50% 40%, rgba(255, 215, 106, .28), transparent 70%),
    linear-gradient(180deg, #6e5836, #4a3a24);
  border-color: rgba(120, 92, 52, .7);
  box-shadow: 0 8px 20px rgba(92, 70, 44, .25), inset 0 0 0 4px rgba(255, 215, 106, .25);
}
.sc-cast.is-back::after {
  content: "";
  width: 46%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 2px dashed rgba(255, 215, 106, .7);
}
.sc-cast svg { width: 52%; height: auto; }
.sc-cast__label {
  font-family: var(--font-serif);
  font-size: max(11px, calc(var(--u) * .14));
  font-weight: 700;
  letter-spacing: .06em;
}
.sc-cast.is-riposte { box-shadow: 0 0 0 2px var(--gold), 0 8px 20px rgba(92, 70, 44, .22), 0 0 26px 6px rgba(184, 134, 11, .4); }
.sc-cast.is-hit { animation: scHitShake .3s ease; }
.sc-cast.is-block { box-shadow: 0 0 0 2px var(--azure), 0 8px 20px rgba(92, 70, 44, .22), 0 0 22px 5px rgba(47, 111, 158, .4); }
.sc-cast.is-lance { box-shadow: 0 0 0 2px #2f8f7d, 0 8px 20px rgba(92, 70, 44, .22), 0 0 22px 5px rgba(47, 143, 125, .38); }
.sc-cast.is-charged { box-shadow: 0 0 0 3px var(--gold), 0 0 22px 8px rgba(184, 134, 11, .55), 0 8px 20px rgba(92, 70, 44, .22); animation: scChargeGlow 1.1s ease-in-out infinite alternate; }
.sc-cast.is-charged::before {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: inherit;
  background: radial-gradient(circle at 50% 50%, rgba(255, 215, 106, .35), transparent 70%);
  pointer-events: none;
}

/* Floating damage numbers over a slot. */
.sc-float {
  position: absolute;
  z-index: 3;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: max(15px, calc(var(--u) * .22));
  font-weight: 700;
  color: var(--blood);
  text-shadow: 0 1px 2px rgba(255, 255, 255, .85);
  pointer-events: none;
  animation: scFloat 1s ease-out both;
}
.sc-float.is-gold { color: var(--gold); text-shadow: 0 1px 2px rgba(255, 255, 255, .85); }

.sc-centre {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: min(46vw, 300px);
}
.sc-round {
  font-family: var(--font-serif);
  font-size: 12px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--gold-deep);
}
.sc-verdict {
  margin: 0;
  text-align: center;
  font-size: clamp(12.5px, 2vw, 15px);
  font-weight: 600;
  color: var(--steel);
  min-height: 2.6em;
}
.sc-verdict b { color: var(--gold); }
.sc-verdict .bad { color: var(--blood); }
.sc-verdict.is-flash { animation: scFlash .4s ease; }

/* ---------- History strip: last exchanges, both faces public ---------- */
.sc-history {
  display: flex;
  justify-content: center;
  gap: 8px;
  min-height: calc(var(--u) * .34);
  flex-wrap: wrap;
}
.sc-mark {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  color: rgba(66, 52, 38, .75);
}
.sc-mark i {
  font-style: normal;
  width: calc(var(--u) * .22);
  height: calc(var(--u) * .3);
  border-radius: 3px;
  display: grid;
  place-items: center;
  font-size: max(9px, calc(var(--u) * .13));
  font-weight: 700;
  color: var(--ink);
  background: var(--parch);
  border: 1px solid #a9926a;
}
.sc-mark i.s { background: linear-gradient(180deg, #6fb6de, #3d7ea6); border-color: #1d4a66; color: #eaf6ff; }
.sc-mark i.l { background: linear-gradient(180deg, #7fcfa4, #2f8f7d); border-color: #1e5f52; color: #eaf6ff; }
.sc-mark i.r { box-shadow: 0 0 0 1.5px var(--gold), 0 0 8px rgba(184, 134, 11, .45); }
.sc-mark i[data-c] { box-shadow: 0 0 0 1.5px var(--gold), 0 0 8px rgba(184, 134, 11, .55); outline: 1px dashed rgba(184, 134, 11, .6); outline-offset: 2px; }
.sc-mark__vs { font-family: var(--font-mono); font-size: 10px; opacity: .6; }

/* ---------- Your hand: the three cards you may cast ---------- */
.sc-hand { display: flex; gap: clamp(10px, 3vw, 22px); }
.sc-card {
  appearance: none;
  position: relative;
  width: calc(var(--u) * 1.15);
  padding: max(6px, calc(var(--u) * .08)) max(4px, calc(var(--u) * .05)) max(5px, calc(var(--u) * .07));
  border-radius: calc(var(--u) * .07);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  color: var(--ink);
  background: linear-gradient(180deg, #f8f0dd, var(--parch) 55%, var(--parch-lo));
  border: 1px solid #a9926a;
  box-shadow: 0 10px 22px rgba(92, 70, 44, .2), inset 0 1px 0 rgba(255, 255, 255, .75);
  transition: transform .1s ease, box-shadow .15s ease, filter .15s ease;
  font: inherit;
}
.sc-card:hover,
.sc-card:focus-visible {
  transform: translateY(calc(var(--u) * -.05)) rotate(-1deg);
  box-shadow: 0 16px 28px rgba(92, 70, 44, .24), inset 0 1px 0 rgba(255, 255, 255, .75);
}
.sc-card:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.sc-card:active { transform: translateY(calc(var(--u) * -.02)); }
.sc-card--blade:hover { box-shadow: 0 16px 28px rgba(92, 70, 44, .24), 0 0 18px 3px rgba(120, 100, 160, .3); }
.sc-card--shield:hover { box-shadow: 0 16px 28px rgba(92, 70, 44, .24), 0 0 18px 3px rgba(47, 111, 158, .32); }
.sc-card--lance:hover { box-shadow: 0 16px 28px rgba(92, 70, 44, .24), 0 0 18px 3px rgba(47, 143, 125, .34); }
.sc-card.is-charged {
  box-shadow: 0 10px 22px rgba(92, 70, 44, .2), 0 0 22px 6px rgba(184, 134, 11, .55);
  border-color: var(--gold-deep);
  animation: scChargeGlow 1.1s ease-in-out infinite alternate;
}
.sc-card__art { width: 58%; }
.sc-card__art svg { width: 100%; height: auto; display: block; }
.sc-card__label {
  font-family: var(--font-serif);
  font-size: max(11px, calc(var(--u) * .135));
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.sc-card__n {
  position: absolute;
  top: max(4px, calc(var(--u) * .05));
  left: max(6px, calc(var(--u) * .07));
  font-family: var(--font-mono);
  font-size: max(9px, calc(var(--u) * .11));
  font-weight: 700;
  color: var(--ink-soft);
}
.sc-card__key {
  position: absolute;
  top: max(4px, calc(var(--u) * .05));
  right: max(6px, calc(var(--u) * .07));
  width: 1.5em;
  height: 1.5em;
  display: grid;
  place-items: center;
  border-radius: 4px;
  border: 1px solid rgba(58, 46, 32, .3);
  font-family: var(--font-mono);
  font-size: max(9px, calc(var(--u) * .105));
  color: var(--ink-soft);
}
.sc-card.is-armed { box-shadow: 0 10px 22px rgba(92, 70, 44, .2), 0 0 18px 4px rgba(184, 134, 11, .45); border-color: var(--gold-deep); }
.sc-card.is-off {
  cursor: default;
  filter: saturate(.4) brightness(.94);
  transform: none;
  box-shadow: 0 6px 14px rgba(92, 70, 44, .16);
}

.sc-hint {
  margin: 0;
  max-width: 46ch;
  text-align: center;
  font-size: 11.5px;
  color: rgba(74, 59, 42, .62);
}

/* ---------- Modals ---------- */
.c-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  padding: 18px;
  overflow-y: auto;            /* the overlay scrolls, never the card */
  overscroll-behavior: contain;
}
.c-modal[hidden] { display: none; }
.c-modal__backdrop {
  position: fixed;
  inset: 0;
  background: rgba(60, 48, 32, .42);
  cursor: pointer;
}
.c-modal__panel {
  position: relative;
  z-index: 1;
  margin: auto;                /* centres AND lets a too-tall card scroll */
  width: min(94vw, 520px);
  color: var(--ink);
  background: linear-gradient(180deg, #f8f1df, var(--parch) 62%, #e7d8b8);
  border-radius: 7px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .8),
    0 0 0 1px rgba(120, 90, 40, .5),
    0 0 30px rgba(140, 100, 50, .18),
    0 24px 56px rgba(60, 46, 28, .3);
  animation: scSheet .26s ease-out both;
}
/* A gold chain loop at the top of every card. */
.c-modal__panel::before {
  content: "";
  position: absolute;
  top: -10px;
  left: 50%;
  width: 26px;
  height: 12px;
  transform: translateX(-50%);
  border-radius: 8px 8px 0 0;
  border: 3px solid var(--gold-deep);
  border-bottom: none;
  pointer-events: none;
}
.sc-rules { width: min(94vw, 600px); }
.c-modal__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px 10px;
  border-bottom: 1px solid rgba(120, 90, 40, .3);
}
.c-modal__head h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 20px;
  letter-spacing: -.01em;
  color: #33291d;
}
.c-modal__x {
  margin-left: auto;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  border: 1px solid rgba(120, 90, 40, .45);
  background: linear-gradient(180deg, #fff8e8, #ecdfc2);
  color: #4a3f2c;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.c-modal__x:hover { filter: brightness(1.05); }
/* The author display:grid above would beat the [hidden] attribute on its own. */
.c-modal__x[hidden] { display: none; }
.c-modal__body { padding: 12px 20px 4px; font-size: 13px; line-height: 1.55; color: #3d3324; }
.c-modal__body h3 {
  margin: 14px 0 5px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: rgba(82, 66, 46, .66);
}
.c-modal__body ul { margin: 0 0 8px; padding-left: 16px; }
.c-modal__body li { margin-bottom: 4px; }
.c-modal__body li::marker { color: rgba(201, 162, 39, .8); }
.c-modal__body b { color: #241a12; }
.c-modal__body kbd {
  padding: 0 4px;
  border-radius: 2px;
  border: 1px solid rgba(120, 90, 40, .45);
  background: rgba(255, 255, 255, .6);
  font-family: var(--font-mono);
  font-size: 11px;
}
.c-modal__lead { margin: 0 0 10px; font-size: 13px; }
.c-modal__note {
  margin: 12px 0 2px;
  font-size: 11px;
  color: rgba(82, 66, 46, .72);
}
.c-modal__foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 18px 14px;
}

/* ---------- Flow contents ---------- */
.sc-flow-lead { margin: 0 0 12px; font-size: 13px; }
.sc-end { text-align: center; padding: 4px 0 2px; }
.sc-end__big {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 700;
  color: #33291d;
  margin: 0 0 4px;
}
.sc-end__sub { margin: 0 0 12px; font-size: 12.5px; color: var(--ink-soft); }
.sc-end__stats { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.sc-end__stat {
  min-width: 88px;
  padding: 7px 10px;
  border-radius: 5px;
  background: rgba(255, 255, 255, .5);
  border: 1px dashed rgba(120, 90, 40, .45);
}
.sc-end__stat b { display: block; font-family: var(--font-mono); font-size: 17px; line-height: 1.2; color: #241a12; }
.sc-end__stat span { font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-soft); }
.sc-vs {
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 10px;
  font-family: var(--font-serif);
  font-size: 15px;
  margin: 0 0 12px;
  color: #33291d;
}
.sc-vs b { color: var(--violet); }

/* ---------- Toast ---------- */
.c-toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 80;
  padding: 8px 16px;
  transform: translateX(-50%);
  border-radius: 6px;
  background: linear-gradient(180deg, #f8f1df, #e9dabd);
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: 0 0 0 1px rgba(120, 90, 40, .5), 0 12px 26px rgba(60, 46, 28, .28);
  animation: scToast .22s ease-out both;
}
.c-toast[hidden] { display: none; }

/* ---------- Motion ---------- */
@keyframes scAura {
  from { box-shadow: 0 0 8px 1px rgba(184, 134, 11, .3); }
  to { box-shadow: 0 0 16px 4px rgba(184, 134, 11, .5); }
}
@keyframes scSheet {
  from { opacity: 0; transform: translateY(10px); }
}
@keyframes scFlipIn {
  from { transform: rotateY(90deg) scale(.92); opacity: 0; }
  to { transform: rotateY(0deg) scale(1); opacity: 1; }
}
@keyframes scFloat {
  from { opacity: 0; transform: translate(-50%, 8px); }
  30% { opacity: 1; }
  to { opacity: 0; transform: translate(-50%, -30px); }
}
@keyframes scHitShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  55% { transform: translateX(4px); }
  80% { transform: translateX(-2px); }
}
@keyframes scShake {
  0%, 100% { transform: translateX(0); }
  30% { transform: translateX(-4px); }
  60% { transform: translateX(3px); }
}
@keyframes scFlash {
  0% { transform: scale(1); }
  40% { transform: scale(1.06); }
  100% { transform: scale(1); }
}
@keyframes scToast {
  from { opacity: 0; transform: translate(-50%, 10px); }
}
@keyframes scHeal {
  0% { filter: none; }
  40% { filter: drop-shadow(0 0 8px rgba(70, 180, 110, .8)) brightness(1.08); }
  100% { filter: none; }
}
@keyframes scScryIn {
  from { opacity: 0; transform: translateY(-6px) scale(.94); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes scChargeGlow {
  from { box-shadow: 0 0 0 3px var(--gold), 0 0 14px 4px rgba(184, 134, 11, .35), 0 8px 20px rgba(92, 70, 44, .22); }
  to { box-shadow: 0 0 0 3px var(--gold), 0 0 26px 10px rgba(184, 134, 11, .65), 0 8px 20px rgba(92, 70, 44, .22); }
}

/* ---------- Responsive ---------- */
/* Large screens are handled fluidly by --u; these only shave things down for
   narrow phones. */
@media (max-width: 560px) {
  .c-bar { gap: 8px; padding: 8px 10px 9px; }
  .c-bar__title { font-size: 18px; }
  .c-bar__stats { gap: 9px; }
  .stat { font-size: 10.5px; }
  .c-bar__controls { gap: 4px; }
  .c-btn { padding: 5px 8px; font-size: 11px; }
  .sc-history { display: none; }
  .sc-hint { padding: 0 14px; }
  .c-modal__body { padding: 10px 14px 4px; }
  .c-modal__head { padding: 12px 14px 9px; }
  .c-modal__foot { padding: 8px 14px 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .sc-aura,
  .sc-cast,
  .sc-float,
  .sc-card,
  .sc-scry,
  .c-modal__panel,
  .c-toast {
    animation: none;
    transition: none;
  }
  .sc-life.is-hurt { animation: none; }
  .sc-life.is-heal { animation: none; }
  .sc-cast.is-charged { animation: none; }
  .sc-card.is-charged { animation: none; }
}
