/* ==================================================================
   Crypt Clash
   Palette: aged inkwell violet, oxidised copper, gilt brass.
   Ember orange is reserved for damage and danger. Nothing else.
   ================================================================== */

:root {
  --ink:        #17131f;
  --ink-2:      #1e1829;
  --ink-3:      #2a2239;
  --ink-4:      #372c4a;
  --vellum:     #e6dcc3;
  --vellum-2:   #b9ad93;
  --muted:      #8d84a0;
  --verdigris:  #4f9d8b;
  --verdigris-2:#2f6d60;
  --brass:      #c8a24a;
  --brass-2:    #8a6f30;
  --ember:      #d1503a;
  --torch:      #f0a03c;

  --r:    6px;
  --r-lg: 12px;
  --gut:  clamp(14px, 2.4vw, 26px);

  --font-display: "Grenze Gotisch", "Iowan Old Style", Georgia, serif;
  --font-body: "Alegreya Sans", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-sc: "Alegreya Sans SC", var(--font-body);
  --font-mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Menlo, monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(1100px 620px at 50% -10%, #241d33 0%, transparent 62%),
    radial-gradient(760px 520px at 88% 108%, #1d2a2a 0%, transparent 58%),
    var(--ink);
  color: var(--vellum);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* faint tooth so the flat panels read as pressed vellum, not plastic */
.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 1; opacity: .045;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}

.mono { font-family: var(--font-mono); letter-spacing: .1em; }

/* ---------------- screens ---------------- */
.screen { display: none; position: relative; z-index: 2; min-height: 100dvh; }
.screen.is-on { display: block; }

/* ---------------- buttons & fields ---------------- */
.btn {
  font-family: var(--font-sc);
  font-size: 15px; font-weight: 700; letter-spacing: .06em;
  color: var(--vellum);
  background: var(--ink-3);
  border: 1px solid var(--ink-4);
  border-radius: var(--r);
  padding: 11px 18px;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .08s ease;
}
.btn:hover:not(:disabled) { background: var(--ink-4); border-color: var(--verdigris-2); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .38; cursor: not-allowed; }
.btn--primary {
  background: linear-gradient(180deg, var(--verdigris) 0%, var(--verdigris-2) 100%);
  border-color: #63b8a4; color: #06120f;
}
.btn--primary:hover:not(:disabled) { background: linear-gradient(180deg, #5fb3a0 0%, #38806f 100%); border-color: #7fcbb8; }
.btn--ghost { background: transparent; border-color: var(--ink-4); color: var(--vellum-2); }
.btn--ghost:hover:not(:disabled) { color: var(--vellum); background: var(--ink-2); }
.btn--sm { padding: 7px 13px; font-size: 13px; }

.linkish {
  background: none; border: 0; color: var(--muted); cursor: pointer;
  font-family: var(--font-sc); font-size: 14px; letter-spacing: .07em;
  border-bottom: 1px solid var(--ink-4); padding: 2px 0; margin-top: 26px;
}
.linkish:hover { color: var(--verdigris); border-color: var(--verdigris); }

.field { display: block; margin-bottom: 16px; }
.field__label {
  display: block; font-family: var(--font-sc); font-size: 12px;
  letter-spacing: .13em; color: var(--muted); margin-bottom: 6px;
}
.field input, .field select {
  width: 100%; padding: 11px 13px;
  background: #120e19; color: var(--vellum);
  border: 1px solid var(--ink-4); border-radius: var(--r);
  font-family: inherit; font-size: 16px;
}
.field input::placeholder { color: #574d69; }
.field input:focus, .field select:focus { outline: 2px solid var(--verdigris); outline-offset: 1px; border-color: transparent; }
.field--inline { display: flex; align-items: center; gap: 12px; }
.field--inline .field__label { margin: 0; }
.field--inline select { width: auto; min-width: 84px; }

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

.msg { min-height: 20px; margin: 10px 0 0; font-size: 14px; color: var(--muted); }
.msg--bad { color: var(--ember); }
.msg--good { color: var(--verdigris); }

/* ---------------- gate ---------------- */
.screen--gate { display: none; place-items: center; padding: var(--gut); }
.screen--gate.is-on { display: grid; }
.gate { width: 100%; max-width: 720px; text-align: center; }

.brand__eyebrow {
  font-family: var(--font-sc); font-size: 12px; letter-spacing: .28em;
  color: var(--brass-2); margin: 0 0 10px; text-transform: uppercase;
}
.brand__mark {
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(52px, 12vw, 104px); line-height: .92; margin: 0;
  color: var(--vellum);
  text-shadow: 0 0 42px rgba(240,160,60,.16);
}
.brand__line { color: var(--muted); margin: 12px 0 34px; font-size: 17px; }

.gate__panel {
  background: linear-gradient(180deg, rgba(42,34,57,.72), rgba(30,24,41,.72));
  border: 1px solid var(--ink-4); border-top: 2px solid var(--brass-2);
  border-radius: var(--r-lg); padding: 26px; text-align: left;
  box-shadow: 0 24px 60px -30px #000;
}
.gate__cols { display: grid; grid-template-columns: 1fr auto 1fr; gap: 20px; align-items: start; }
.gate__h { font-family: var(--font-sc); font-size: 13px; letter-spacing: .14em; color: var(--brass); margin: 0 0 12px; }
.gate__col .btn { width: 100%; margin-top: 4px; }
.gate__rule { position: relative; align-self: stretch; display: grid; place-items: center; }
.gate__rule::before { content: ""; position: absolute; inset: 0 50%; width: 1px; background: var(--ink-4); }
.gate__rule span {
  position: relative; background: #241d31; color: var(--muted);
  font-family: var(--font-sc); font-size: 12px; padding: 4px 7px; border-radius: 20px;
}

/* ---------------- top bar ---------------- */
.topbar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 12px var(--gut); border-bottom: 1px solid var(--ink-3);
  background: rgba(23,19,31,.86); backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 20;
}
.topbar__mark { font-family: var(--font-display); font-size: 22px; color: var(--vellum); }
.topbar__right { display: flex; gap: 8px; }
.codechip {
  display: flex; align-items: center; gap: 9px; margin-left: auto;
  background: var(--ink-2); border: 1px solid var(--ink-4);
  border-radius: 24px; padding: 5px 6px 5px 14px;
}
.codechip__label { font-family: var(--font-sc); font-size: 11px; letter-spacing: .16em; color: var(--muted); }
.codechip strong { font-size: 18px; color: var(--brass); }

/* live action banner */
.live-bar {
  text-align: center; padding: 7px var(--gut);
  font-family: var(--font-sc); font-size: 12px; letter-spacing: .08em;
  color: var(--vellum); background: rgba(79,157,139,.15); border-bottom: 1px solid var(--verdigris);
  transition: opacity .35s ease; opacity: 0;
}
.live-bar[hidden] { display: none; }
.live-bar.is-show { opacity: 1; }
.live-bar.is-fade { opacity: 0; }

/* ---------------- lobby ---------------- */
.lobby {
  display: grid; grid-template-columns: minmax(260px, 340px) 1fr;
  gap: var(--gut); padding: var(--gut); max-width: 1240px; margin: 0 auto;
}
.sec {
  font-family: var(--font-sc); font-size: 13px; letter-spacing: .15em;
  color: var(--brass); margin: 0 0 14px; padding-bottom: 8px;
  border-bottom: 1px solid var(--ink-3);
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
}
.sec--tight { margin-bottom: 8px; }
.sec__note { color: var(--muted); letter-spacing: .04em; font-weight: 500; text-transform: none; }

.roster { list-style: none; margin: 0 0 20px; padding: 0; display: grid; gap: 7px; }
.roster li {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 13px; background: var(--ink-2);
  border: 1px solid var(--ink-3); border-left: 3px solid var(--ink-4);
  border-radius: var(--r);
}
.roster li.is-me { border-left-color: var(--verdigris); }
.roster__name { font-weight: 700; }
.roster__hero { color: var(--muted); font-size: 14px; margin-left: auto; text-align: right; }
.roster__hero--none { color: var(--brass-2); font-style: italic; }
.dot { display: inline-block; vertical-align: middle; width: 7px; height: 7px; border-radius: 50%; background: var(--verdigris); flex: none; }
.dot--off { background: #4a4159; }
.tag {
  font-family: var(--font-sc); font-size: 10px; letter-spacing: .12em;
  background: var(--brass-2); color: #100c17; padding: 2px 6px; border-radius: 3px;
}
.tag--bot { background: var(--verdigris); color: #0c1512; }
.seat__tag {
  font-family: var(--font-sc); font-size: 9px; letter-spacing: .1em;
  background: var(--verdigris); color: #0c1512; padding: 1px 5px; border-radius: 3px;
  align-self: flex-start;
}

.botbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 14px; }
.botbar__label { font-family: var(--font-sc); font-size: 11px; letter-spacing: .1em; color: var(--muted); margin-right: 2px; }
.botbar .btn { flex: none; }

.heroes { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.hero {
  position: relative; text-align: left; cursor: pointer;
  background: var(--ink-2); border: 1px solid var(--ink-3);
  border-radius: var(--r-lg); padding: 0; overflow: hidden;
  color: inherit; font: inherit; display: flex; flex-direction: column;
  transition: border-color .15s ease, transform .12s ease;
}
.hero:hover { transform: translateY(-2px); border-color: var(--ink-4); }
.hero.is-picked { border-color: var(--tint, var(--verdigris)); box-shadow: 0 0 0 1px var(--tint, var(--verdigris)); }
.hero__art { display: block; aspect-ratio: 1/1; background: var(--ink-3); position: relative; overflow: hidden; }
.hero__art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero__art--empty { aspect-ratio: auto; height: 64px; }
.hero__art--empty::after {
  content: attr(data-initial); position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 40px; color: var(--tint, var(--muted)); opacity: .4;
}
.hero__body { padding: 12px 14px 14px; }
.hero__name { font-family: var(--font-display); font-size: 20px; line-height: 1.15; margin: 0; color: var(--vellum); }
.hero__title { font-family: var(--font-sc); font-size: 11px; letter-spacing: .12em; color: var(--tint, var(--brass)); margin: 4px 0 8px; display: block; }
.hero__blurb { font-size: 13.5px; color: var(--muted); margin: 0; line-height: 1.45; }
.hero__taken {
  position: absolute; top: 8px; right: 8px; background: rgba(23,19,31,.9);
  border: 1px solid var(--ink-4); border-radius: 20px; padding: 3px 9px;
  font-family: var(--font-sc); font-size: 11px; letter-spacing: .08em; color: var(--vellum-2);
}

/* ---------------- table ---------------- */
.table { padding: var(--gut); max-width: 1400px; margin: 0 auto; }
.foes { display: grid; grid-template-columns: repeat(auto-fit, minmax(178px, 1fr)); gap: 11px; margin-bottom: var(--gut); }

.seat {
  position: relative; background: var(--ink-2);
  border: 1px solid var(--ink-3); border-radius: var(--r-lg);
  padding: 12px; transition: box-shadow .3s ease, border-color .3s ease, opacity .3s ease;
}
.seat__head { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.seat__av {
  display: block;
  width: 40px; height: 40px; border-radius: var(--r); flex: none;
  background: var(--ink-3); overflow: hidden; position: relative;
  border: 1px solid var(--ink-4);
}
.seat__av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.seat__av--empty::after {
  content: attr(data-initial); position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--font-display); font-size: 22px; color: var(--tint, var(--muted));
}
.seat__id { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.seat__name { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seat__hero { font-family: var(--font-sc); font-size: 10.5px; letter-spacing: .1em; color: var(--tint, var(--muted)); }

/* health */
.hpbar { height: 9px; background: #100c17; border-radius: 5px; overflow: hidden; border: 1px solid var(--ink-4); }
.hpbar__fill { display: block; height: 100%; background: linear-gradient(90deg, var(--ember), #e37a4d); transition: width .45s cubic-bezier(.22,1,.36,1); }
.hpnum { display: flex; justify-content: space-between; align-items: baseline; margin: 7px 0 4px; }
.hpnum b { font-family: var(--font-display); font-size: 21px; line-height: 1; }
.hpnum span { font-family: var(--font-sc); font-size: 11px; letter-spacing: .1em; color: var(--muted); }

/* --- SIGNATURE: the shield rank ---------------------------------
   Slabs sit in break order. The leftmost is what the next hit eats. */
.rank { display: flex; gap: 3px; align-items: flex-end; margin-top: 10px; min-height: 30px; flex-wrap: wrap; }
.slab {
  position: relative; min-width: 22px; height: 28px; padding: 0 5px;
  display: grid; place-items: center;
  background: linear-gradient(180deg, #3d5f7a 0%, #24384a 100%);
  border: 1px solid #547a97; border-bottom-width: 3px;
  border-radius: 3px 3px 5px 5px;
  font-family: var(--font-display); font-size: 16px; color: #dceaf5;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.16);
}
.slab--next { border-color: var(--brass); box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 0 0 1px var(--brass-2); }
.slab--chipped { background: linear-gradient(180deg, #3d5f7a var(--worn, 0%), #1b2a38 var(--worn, 0%)); }
.slab::after {
  content: ""; position: absolute; left: 3px; right: 3px; top: 4px; height: 1px;
  background: rgba(255,255,255,.14);
}
.rank__none { font-family: var(--font-sc); font-size: 11px; letter-spacing: .1em; color: #4a4159; }

.seat__foot {
  display: flex; gap: 12px; margin-top: 10px; padding-top: 9px;
  border-top: 1px solid var(--ink-3);
  font-family: var(--font-sc); font-size: 11px; letter-spacing: .07em; color: var(--muted);
}
.seat__foot b { color: var(--vellum-2); font-family: var(--font-body); font-weight: 700; }

/* the only warm light on the board is whoever's turn it is */
.seat--active {
  border-color: var(--torch);
  box-shadow: 0 0 0 1px var(--torch), 0 0 34px -8px rgba(240,160,60,.55);
}
.seat--active::before {
  content: "playing"; position: absolute; top: -8px; left: 12px;
  background: var(--torch); color: #1a1108;
  font-family: var(--font-sc); font-size: 10px; font-weight: 700;
  letter-spacing: .14em; padding: 1px 8px; border-radius: 3px;
}
.seat--dead { opacity: .34; filter: grayscale(1); }
.seat--dead::after {
  content: "fallen"; position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--font-display); font-size: 26px; color: var(--ember);
  letter-spacing: .1em; background: rgba(18,14,25,.55); border-radius: var(--r-lg);
}
.seat--targetable { cursor: pointer; border-color: var(--verdigris); }
.seat--targetable:hover { box-shadow: 0 0 0 2px var(--verdigris); transform: translateY(-2px); }
.seat--hit { animation: hit .5s ease; }
@keyframes hit {
  0%, 100% { transform: translateX(0); }
  18% { transform: translateX(-6px); box-shadow: 0 0 0 2px var(--ember); }
  46% { transform: translateX(5px); box-shadow: 0 0 0 2px var(--ember); }
  74% { transform: translateX(-3px); }
}

/* ---------------- lower half ---------------- */
.table__lower { display: grid; grid-template-columns: 1fr minmax(210px, 280px); gap: var(--gut); align-items: start; }
.plinth {
  background: linear-gradient(180deg, rgba(42,34,57,.8), rgba(30,24,41,.8));
  border: 1px solid var(--ink-4); border-top: 2px solid var(--brass-2);
  border-radius: var(--r-lg); padding: 14px;
  display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center;
}
.plinth__av { display: block; width: 62px; height: 62px; border-radius: var(--r); overflow: hidden; background: var(--ink-3); position: relative; border: 1px solid var(--ink-4); }
.plinth__av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.plinth__av--empty::after { content: attr(data-initial); position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-display); font-size: 32px; color: var(--tint, var(--muted)); }
.plinth__name { font-family: var(--font-display); font-size: 24px; line-height: 1.1; }
.plinth__hero { font-family: var(--font-sc); font-size: 11px; letter-spacing: .12em; color: var(--tint, var(--brass)); }
.plinth__piles { text-align: right; font-family: var(--font-sc); font-size: 11px; letter-spacing: .08em; color: var(--muted); }
.plinth__piles b { color: var(--vellum); font-family: var(--font-body); }

.turnbar { display: flex; align-items: center; gap: 12px; margin: 16px 0 10px; flex-wrap: wrap; }
.prompt { margin: 0; flex: 1; min-width: 200px; font-size: 15px; color: var(--vellum-2); }
.prompt--go { color: var(--torch); font-weight: 700; }

/* ---------------- cards ---------------- */
.hand { display: flex; gap: 10px; flex-wrap: wrap; align-items: stretch; min-height: 200px; }
.hand__empty { color: var(--muted); font-style: italic; padding: 30px 4px; }

.card {
  width: 138px; flex: none; text-align: left; cursor: pointer;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, #2b2339 0%, #201a2c 100%);
  border: 1px solid var(--ink-4); border-radius: 9px; overflow: hidden;
  color: inherit; font: inherit; padding: 0;
  transition: transform .13s cubic-bezier(.22,1,.36,1), box-shadow .13s ease, border-color .13s ease;
}
.card:hover:not(:disabled) { transform: translateY(-7px); border-color: var(--brass-2); box-shadow: 0 14px 26px -14px #000; }
.card:disabled { opacity: .45; cursor: not-allowed; }
.card.is-armed { border-color: var(--torch); box-shadow: 0 0 0 2px var(--torch), 0 14px 26px -14px #000; transform: translateY(-7px); }

.card__art { display: block; flex: none; aspect-ratio: 1/1; background: #16111f; position: relative; overflow: hidden; }
.card__art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card__art--empty {
  background:
    repeating-linear-gradient(135deg, rgba(255,255,255,.024) 0 7px, transparent 7px 14px),
    linear-gradient(180deg, var(--tint, #3a3050) 0%, #16111f 100%);
}
.card__art--empty::after {
  content: ""; position: absolute; inset: 26%;
  border: 1px solid rgba(230,220,195,.16); border-radius: 50%;
}
.card__band {
  padding: 7px 9px 5px;
  border-top: 1px solid var(--tint, var(--brass-2));
  background: rgba(0,0,0,.22);
}
.card__name { font-family: var(--font-display); font-size: 16px; line-height: 1.08; margin: 0; }
.card__pips { display: flex; gap: 4px; flex-wrap: wrap; padding: 7px 9px 0; }
.pip {
  display: inline-flex; align-items: center; gap: 3px;
  font-family: var(--font-display); font-size: 13px; line-height: 1;
  padding: 3px 5px; border-radius: 3px;
  background: var(--ink); border: 1px solid var(--ink-4);
}
.pip svg { width: 12px; height: 12px; }
.pip--atk, .pip--all, .pip--drain { color: var(--ember); border-color: #4a2a26; }
.pip--shield, .pip--break { color: #7fb4d6; border-color: #2b4256; }
.pip--heal { color: #6fc48f; border-color: #2a4b36; }
.pip--draw, .pip--discard { color: var(--brass); border-color: #4a3c1c; }
.pip--play { color: var(--torch); border-color: #59401f; }
.pip--recoil { color: var(--muted); border-color: var(--ink-4); }
.card__text { margin: 7px 9px 10px; font-size: 12.5px; line-height: 1.32; color: var(--vellum-2); flex: 1 0 auto; min-height: 33px; }

/* ---------------- chronicle ---------------- */
.chronicle {
  background: var(--ink-2); border: 1px solid var(--ink-3);
  border-radius: var(--r-lg); padding: 13px; max-height: 460px; display: flex; flex-direction: column;
}
.log { list-style: none; margin: 0; padding: 0; overflow-y: auto; font-size: 13.5px; line-height: 1.42; }
.log li { padding: 5px 0; border-bottom: 1px solid rgba(55,44,74,.5); color: var(--vellum-2); }
.log li:last-child { border-bottom: 0; }
.log li.is-turn { color: var(--torch); font-family: var(--font-sc); letter-spacing: .06em; }
.log li.is-fall { color: var(--ember); font-weight: 700; }

/* ---------------- curtain ---------------- */
.curtain { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: rgba(14,11,19,.9); padding: var(--gut); }
.curtain[hidden] { display: none; }
.curtain__box {
  background: var(--ink-2); border: 1px solid var(--brass-2);
  border-radius: var(--r-lg); padding: 34px; text-align: center; max-width: 440px;
}
.curtain__crown { color: var(--brass); margin-bottom: 10px; }
.curtain__title { font-family: var(--font-display); font-size: 40px; line-height: 1.05; margin: 0 0 8px; }
.curtain__sub { color: var(--muted); margin: 0 0 24px; }
.curtain__btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ---------------- rules sheet ---------------- */
.sheet { position: fixed; inset: 0; z-index: 50; background: rgba(14,11,19,.86); display: grid; place-items: center; padding: var(--gut); overflow-y: auto; }
.sheet[hidden] { display: none; }
.sheet__panel {
  position: relative; background: var(--ink-2); border: 1px solid var(--ink-4);
  border-top: 2px solid var(--brass-2); border-radius: var(--r-lg);
  padding: 30px; max-width: 620px; width: 100%;
}
.sheet__x { position: absolute; top: 12px; right: 14px; background: none; border: 0; color: var(--muted); font-size: 28px; line-height: 1; cursor: pointer; }
.sheet__x:hover { color: var(--vellum); }
.sheet__h { font-family: var(--font-display); font-size: 30px; margin: 0 0 16px; }
.sheet__h3 { font-family: var(--font-sc); font-size: 13px; letter-spacing: .14em; color: var(--brass); margin: 26px 0 12px; }
.rules { margin: 0; padding-left: 20px; display: grid; gap: 11px; color: var(--vellum-2); font-size: 15px; }
.rules b { color: var(--vellum); }
.legend { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.legend li { display: flex; align-items: center; gap: 9px; font-size: 13.5px; color: var(--vellum-2); }

/* ---------------- codex (hero deck browser) ---------------- */
.sheet__panel--wide { max-width: 940px; }
.sheet__lede { color: var(--muted); font-size: 14px; margin: 0 0 18px; max-width: 60ch; }
.codex__tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 20px; }
.codex__tab {
  cursor: pointer; font: inherit; color: var(--vellum-2);
  background: var(--ink-3); border: 1px solid var(--ink-4); border-radius: 20px;
  padding: 7px 14px 7px 11px; font-family: var(--font-sc); font-size: 12px; letter-spacing: .05em;
  display: inline-flex; align-items: center; gap: 8px;
  transition: border-color .12s ease, color .12s ease, background .12s ease;
}
.codex__tab::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--tint, var(--muted)); flex: none; }
.codex__tab:hover { color: var(--vellum); border-color: var(--tint, var(--ink-4)); }
.codex__tab.is-on { color: var(--vellum); border-color: var(--tint, var(--brass)); background: color-mix(in srgb, var(--tint, #fff) 12%, var(--ink-3)); box-shadow: inset 0 0 0 1px var(--tint, var(--brass)); }

.codex__hero { border-left: 3px solid var(--tint, var(--brass)); padding-left: 14px; margin-bottom: 18px; }
.codex__hero-name { font-family: var(--font-display); font-size: 26px; color: var(--vellum); margin: 0; line-height: 1.1; }
.codex__hero-title { font-family: var(--font-sc); font-size: 12px; letter-spacing: .12em; color: var(--tint, var(--brass)); margin-top: 3px; }
.codex__hero-blurb { color: var(--muted); font-size: 14px; margin: 8px 0 0; max-width: 62ch; }
.codex__hero-tally { font-family: var(--font-sc); font-size: 11px; letter-spacing: .08em; color: var(--vellum-2); margin-top: 8px; }

.codex__cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(224px, 1fr)); gap: 10px; }
.codex__card {
  background: var(--ink-3); border: 1px solid var(--ink-4);
  border-left: 3px solid var(--tint, var(--brass)); border-radius: var(--r);
  padding: 0 0 13px; overflow: hidden;
}
.codex__card-art { display: block; aspect-ratio: 1/1; background: #16111f; position: relative; overflow: hidden; }
.codex__card-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.codex__card-art--empty {
  background:
    repeating-linear-gradient(135deg, rgba(255,255,255,.024) 0 7px, transparent 7px 14px),
    linear-gradient(180deg, var(--tint, #3a3050) 0%, #16111f 100%);
}
.codex__card-art--empty::after {
  content: ""; position: absolute; inset: 26%;
  border: 1px solid rgba(230,220,195,.16); border-radius: 50%;
}
.codex__card > .codex__card-head,
.codex__card > .codex__card-pips,
.codex__card > .codex__card-text { margin-left: 13px; margin-right: 13px; }
.codex__card > .codex__card-head { margin-top: 11px; }
.codex__card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.codex__card-name { font-family: var(--font-display); font-size: 17px; color: var(--vellum); line-height: 1.12; }
.codex__count { font-family: var(--font-sc); font-size: 11px; letter-spacing: .06em; color: var(--muted); flex: none; }
.codex__card-pips { display: flex; gap: 4px; flex-wrap: wrap; padding: 9px 0 0; margin: 0; }
.codex__card-text { font-size: 13px; color: var(--vellum-2); margin: 9px 0 0; line-height: 1.42; }

.gate__links { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; }
.sec__link { margin-left: auto; font-size: 12px; }

/* ---------------- responsive ---------------- */
@media (max-width: 900px) {
  .lobby, .table__lower { grid-template-columns: 1fr; }
  .chronicle { max-height: 220px; order: 3; }
  .gate__cols { grid-template-columns: 1fr; }
  .gate__rule { height: 1px; }
  .gate__rule::before { inset: 50% 0; width: auto; height: 1px; }
}
@media (max-width: 560px) {
  .foes { grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); gap: 8px; }
  .card { width: 118px; }
  .plinth { grid-template-columns: auto 1fr; }
  .plinth__piles { grid-column: 1 / -1; text-align: left; }
  .brand__line { font-size: 15px; }
  .topbar { gap: 8px; }
  .codechip { padding-left: 10px; }
}

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