/* ==========================================================================
   VEXTHRONE — War of the Fallen Kings
   ========================================================================== */

@font-face { font-family: 'Cinzel'; font-weight: 400 900; font-display: swap; src: url(../fonts/cinzel-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215; }
@font-face { font-family: 'Cinzel'; font-weight: 400 900; font-display: swap; src: url(../fonts/cinzel-latin-ext.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Lato'; font-weight: 400; font-display: swap; src: url(../fonts/lato-400.woff2) format('woff2'); }
@font-face { font-family: 'Lato'; font-weight: 700; font-display: swap; src: url(../fonts/lato-700.woff2) format('woff2'); }
@font-face { font-family: 'Lato'; font-weight: 900; font-display: swap; src: url(../fonts/lato-900.woff2) format('woff2'); }

:root {
  --bg0: #060b17;
  --bg1: #0b1530;
  --bg2: #132650;
  --navy: #14243f;
  --gold: #e8b64c;
  --gold-hi: #ffe39a;
  --gold-lo: #a8761f;
  --cream: #f6ecd6;
  --crimson: #b3232f;
  --crimson-hi: #ff4d5e;
  --steel: #8fb7ff;
  --green: #5df2a0;
  --text: #eef1f8;
  --muted: #98a4c0;
  --panel: rgba(12, 21, 44, 0.84);
  --line: rgba(232, 182, 76, 0.32);
  --radius: 14px;
  --f-title: 'Cinzel', Georgia, 'Times New Roman', serif;
  --f-body: 'Lato', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --ease-out: cubic-bezier(.2, .8, .3, 1);
  --ease-back: cubic-bezier(.2, .9, .3, 1.25);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; height: 100%; }
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--f-body);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(1200px 700px at 50% -10%, rgba(64, 104, 196, .28), transparent 60%),
    radial-gradient(900px 600px at 50% 120%, rgba(179, 35, 47, .18), transparent 60%),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, .018) 0 2px, transparent 2px 26px),
    repeating-linear-gradient(-45deg, rgba(255, 255, 255, .018) 0 2px, transparent 2px 26px),
    linear-gradient(180deg, var(--bg1), var(--bg0));
  background-attachment: fixed;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, .55) 100%);
  z-index: 1;
}
body.in-game { overflow: hidden; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
a { color: var(--gold-hi); }
img { max-width: 100%; }
:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 2px; }
.hidden { display: none !important; }
.is-hidden { visibility: hidden !important; }
.muted { color: var(--muted); }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ico { width: 1.2em; height: 1.2em; fill: currentColor; flex: none; vertical-align: -0.2em; }
.noscript { text-align: center; padding: 40px; }

.stage { position: relative; z-index: 2; min-height: 100vh; min-height: 100dvh; }
.fx-canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 72; }
.fx-layer { position: fixed; inset: 0; pointer-events: none; z-index: 70; overflow: hidden; }

/* ---------------------------------------------------------------- splash */
.splash { position: fixed; inset: 0; display: grid; place-content: center; justify-items: center; gap: 18px; }
.splash-crest { width: 120px; aspect-ratio: 5 / 7; border-radius: 10px; background: url(../img/card-back.webp) center / cover; box-shadow: 0 0 60px rgba(232, 182, 76, .4); animation: crestPulse 1.6s ease-in-out infinite; }
.splash-title { font: 800 22px/1 var(--f-title); letter-spacing: .35em; color: var(--gold); }
@keyframes crestPulse { 50% { transform: scale(1.05); box-shadow: 0 0 90px rgba(232, 182, 76, .6); } }

/* ---------------------------------------------------------------- generic UI */
.panel {
  position: relative;
  background: linear-gradient(180deg, rgba(22, 36, 70, .92), rgba(10, 18, 38, .92));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .06) inset, 0 20px 50px rgba(0, 0, 0, .45);
  padding: 22px;
  backdrop-filter: blur(6px);
}
.panel::before, .panel::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid var(--gold);
  opacity: .7;
  pointer-events: none;
}
.panel::before { top: 6px; left: 6px; border-right: 0; border-bottom: 0; border-top-left-radius: 6px; }
.panel::after { bottom: 6px; right: 6px; border-left: 0; border-top: 0; border-bottom-right-radius: 6px; }

.btn {
  --b: var(--line);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 9px 18px;
  border-radius: 10px;
  border: 1px solid var(--b);
  background: linear-gradient(180deg, #1c3263, #12224a);
  color: var(--text);
  font-weight: 700;
  letter-spacing: .02em;
  overflow: hidden;
  transition: transform .15s var(--ease-out), box-shadow .2s, filter .2s;
  box-shadow: 0 2px 0 rgba(0, 0, 0, .4), 0 0 0 0 rgba(232, 182, 76, 0);
  text-decoration: none;
}
.btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0, 0, 0, .45), 0 0 0 1px rgba(232, 182, 76, .5); }
.btn:active:not(:disabled) { transform: translateY(1px) scale(.98); }
.btn:disabled { opacity: .45; filter: grayscale(.6); }
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, .35) 50%, transparent 65%);
  transform: translateX(-120%);
}
.btn:hover:not(:disabled)::after { transform: translateX(120%); transition: transform .7s ease; }
.btn.gold {
  color: #2a1a03;
  border-color: #ffe9a8;
  background: linear-gradient(180deg, #fff1bd 0%, #f3c65a 38%, #d49a2c 62%, #b37a1c 100%);
  text-shadow: 0 1px 0 rgba(255, 255, 255, .45);
  box-shadow: 0 2px 0 #7a5212, 0 8px 22px rgba(232, 182, 76, .25);
}
.btn.gold:hover:not(:disabled) { box-shadow: 0 3px 0 #7a5212, 0 10px 30px rgba(232, 182, 76, .45); filter: brightness(1.06); }
.btn.ghost { background: transparent; border-color: rgba(255, 255, 255, .18); }
.btn.danger { background: linear-gradient(180deg, #b3232f, #7a1420); border-color: #ff6b77; }
.btn.big { min-height: 52px; font-size: 17px; padding: 12px 26px; font-family: var(--f-title); font-weight: 800; letter-spacing: .06em; }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: rgba(10, 18, 38, .7); color: var(--gold-hi); }
.icon-btn:hover { background: rgba(232, 182, 76, .15); }

.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
input[type=text], input[type=password], .code-input, .lang-select {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(232, 182, 76, .28);
  background: rgba(4, 9, 22, .7);
  color: var(--text);
  transition: border-color .2s, box-shadow .2s;
}
input:focus, select:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(232, 182, 76, .2); }
.form-error { min-height: 1.4em; color: #ff8a95; font-weight: 700; font-size: 14px; margin: 4px 0 10px; }
.form-hint { font-size: 13px; color: var(--muted); margin: -4px 0 8px; }
.tabs { display: flex; gap: 6px; margin-bottom: 18px; padding: 4px; border-radius: 12px; background: rgba(0, 0, 0, .3); }
.tab { flex: 1; min-height: 40px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-weight: 800; letter-spacing: .04em; }
.tab.on { background: linear-gradient(180deg, #24407c, #172c5a); color: var(--gold-hi); box-shadow: 0 0 0 1px var(--line); }

.lang-pick { display: inline-flex; align-items: center; gap: 8px; color: var(--gold-hi); }
.lang-select { width: auto; min-height: 36px; padding: 6px 10px; }

.toasts { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 120; display: grid; gap: 8px; width: min(92vw, 440px); pointer-events: none; }
.toast { padding: 12px 16px; border-radius: 12px; background: rgba(12, 22, 46, .95); border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0, 0, 0, .5); font-weight: 700; text-align: center; }
.toast.error { border-color: #ff6b77; color: #ffd0d4; }

/* ---------------------------------------------------------------- division badge */
.div-badge { width: 30px; height: auto; flex: none; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .5)); }
.div-badge.sm { width: 22px; }
.div-badge.big { width: 68px; }
.div-badge.xl { width: 104px; filter: drop-shadow(0 0 18px rgba(232, 182, 76, .35)) drop-shadow(0 6px 10px rgba(0, 0, 0, .5)); }
.div-badge.d-silver.xl { filter: drop-shadow(0 0 18px rgba(201, 210, 222, .4)) drop-shadow(0 6px 10px rgba(0, 0, 0, .5)); }
.div-badge.d-bronze.xl { filter: drop-shadow(0 0 18px rgba(205, 127, 50, .4)) drop-shadow(0 6px 10px rgba(0, 0, 0, .5)); }
.div-roman { font: 900 15px var(--f-title); fill: rgba(25, 15, 2, .85); }
.d-gold { color: #ffd36b; }
.d-silver { color: #d9e1ec; }
.d-bronze { color: #e9a066; }

/* ---------------------------------------------------------------- cards */
.card {
  position: relative;
  width: 100%;
  aspect-ratio: 5 / 7;
  container-type: inline-size;
  border-radius: 8% / 5.7%;
  user-select: none;
  -webkit-user-select: none;
  transform-style: preserve-3d;
}
.card .c-inner {
  position: absolute;
  inset: 0;
  border-radius: 8cqw;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 6px 14px rgba(0, 0, 0, .35);
}
.card.face .c-inner {
  background:
    radial-gradient(140% 90% at 50% 0%, #fffaf0 0%, #f6ecd6 55%, #e3cfa4 100%);
  box-shadow:
    inset 0 0 0 1.6cqw #f8efdb,
    inset 0 0 0 2.2cqw rgba(176, 128, 40, .85),
    inset 0 0 0 2.8cqw #f8efdb,
    inset 0 0 18cqw rgba(140, 100, 40, .22),
    0 1px 2px rgba(0, 0, 0, .5),
    0 6px 14px rgba(0, 0, 0, .35);
}
.card.red { color: #b3232f; }
.card.black { color: #16213b; }
.c-corner { position: absolute; display: flex; flex-direction: column; align-items: center; gap: 1cqw; z-index: 2; }
.c-corner.tl { top: 5cqw; left: 5.5cqw; }
.c-corner.br { bottom: 5cqw; right: 5.5cqw; transform: rotate(180deg); }
.c-rank { font: 800 18cqw/0.95 var(--f-title); letter-spacing: -0.04em; text-shadow: 0 1px 0 rgba(255, 255, 255, .7); }
.c-csuit { width: 11cqw; height: 11cqw; }
.c-pips { position: absolute; inset: 15% 19% 15% 19%; }
.c-pip { position: absolute; width: 17cqw; height: 17cqw; transform: translate(-50%, -50%); filter: drop-shadow(0 .5cqw .4cqw rgba(0, 0, 0, .25)); }
.c-pip.inv { transform: translate(-50%, -50%) rotate(180deg); }
.c-ace { position: absolute; inset: 0; display: grid; place-items: center; }
.c-ace::before { content: ''; position: absolute; width: 62cqw; aspect-ratio: 1; border-radius: 50%; border: 1cqw solid rgba(176, 128, 40, .45); box-shadow: 0 0 0 2.5cqw rgba(176, 128, 40, .12); }
.c-ace-pip { width: 44cqw; height: 44cqw; filter: drop-shadow(0 1.2cqw 1.4cqw rgba(0, 0, 0, .3)); }
.c-court { position: absolute; inset: 15% 15%; }
.cc-frame {
  position: absolute;
  inset: 0;
  border-radius: 5cqw;
  overflow: hidden;
  border: 1.4cqw solid #c9952e;
  box-shadow: inset 0 0 0 .8cqw rgba(255, 230, 160, .5), 0 1cqw 2cqw rgba(0, 0, 0, .35);
  background: linear-gradient(160deg, #213d78 0%, #0e1d40 70%);
}
.card.red .cc-frame { background: linear-gradient(160deg, #8a1a26 0%, #3c0a12 75%); }
.cc-glow { position: absolute; inset: -20%; background: radial-gradient(circle at 50% 45%, rgba(255, 211, 107, .45), transparent 55%); }
.cc-emblem { position: absolute; left: 50%; top: 47%; width: 54cqw; height: 54cqw; transform: translate(-50%, -50%); fill: url(#g-gold); filter: drop-shadow(0 0 2.5cqw rgba(255, 211, 107, .55)) drop-shadow(0 1cqw 1cqw rgba(0, 0, 0, .5)); }
.cc-suit { position: absolute; width: 11cqw; height: 11cqw; color: #ffe39a; opacity: .9; }
.cc-suit.tl { top: 3cqw; left: 3cqw; }
.cc-suit.br { bottom: 3cqw; right: 3cqw; transform: rotate(180deg); }
.cc-letter { position: absolute; right: 4cqw; bottom: -4cqw; font: 900 34cqw/1 var(--f-title); color: rgba(255, 230, 160, .12); }
.c-ability {
  position: absolute;
  left: 50%;
  bottom: 3.2cqw;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 1.5cqw;
  padding: .8cqw 3.5cqw;
  border-radius: 99px;
  font: 900 8.5cqw/1.1 var(--f-body);
  background: linear-gradient(180deg, #213a6e, #12224a);
  color: #ffe39a;
  box-shadow: 0 0 0 .6cqw rgba(232, 182, 76, .7);
  z-index: 3;
  white-space: nowrap;
}
.s-H .c-ability, .s-D .c-ability { background: linear-gradient(180deg, #9b1f2c, #5e0f18); }
.c-ab-ico { width: 8.5cqw; height: 8.5cqw; }
.r-J .c-ability, .r-Q .c-ability, .r-K .c-ability { bottom: 1.5cqw; }
.c-shine {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--mx, 30%) var(--my, 0%), rgba(255, 255, 255, .55), rgba(255, 255, 255, 0) 45%);
  mix-blend-mode: soft-light;
  opacity: .5;
  pointer-events: none;
  transition: opacity .25s;
}
.c-foil { position: absolute; inset: 0; pointer-events: none; opacity: 0; }
.r-J .c-foil, .r-Q .c-foil, .r-K .c-foil, .card.fort .c-foil {
  opacity: .22;
  background: linear-gradient(115deg, transparent 20%, rgba(255, 120, 200, .6) 35%, rgba(120, 220, 255, .6) 45%, rgba(255, 240, 140, .6) 55%, transparent 70%);
  background-size: 250% 100%;
  mix-blend-mode: color-dodge;
  animation: foil 6s linear infinite;
}
@keyframes foil { from { background-position: 150% 0; } to { background-position: -100% 0; } }
@container (max-width: 66px) {
  .c-ability { display: none; }
  .c-rank { font-size: 20cqw; }
}
.card.back .c-inner { background: #0e1c3c url(../img/card-back.webp) center / cover; box-shadow: inset 0 0 0 1.5cqw rgba(232, 182, 76, .35), 0 1px 2px rgba(0, 0, 0, .5), 0 6px 14px rgba(0, 0, 0, .35); }

/* flip container used during flights */
.flip3d { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; }
.f-side { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.f-back { transform: rotateY(180deg); }
.f-side > .card { width: 100%; height: 100%; }

/* treasury card (sideways) */
.tcard { position: relative; width: calc(var(--tw, 60px) * 1.4); height: var(--tw, 60px); }
.tcard > .card { position: absolute; left: 50%; top: 50%; width: var(--tw, 60px); transform: translate(-50%, -50%) rotate(90deg); }
.t-bonus {
  position: absolute;
  right: -6px;
  top: -6px;
  z-index: 3;
  min-width: 26px;
  height: 26px;
  padding: 0 5px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  font: 900 13px/1 var(--f-body);
  color: #2a1a03;
  background: linear-gradient(180deg, #fff1bd, #e2a83a);
  box-shadow: 0 0 0 2px #6b470e, 0 3px 8px rgba(0, 0, 0, .5);
}
.t-bonus.s-D { color: #fff; background: linear-gradient(180deg, #9be7ff, #2f7fd8); box-shadow: 0 0 0 2px #133c73, 0 0 12px rgba(155, 231, 255, .6); }

/* ==========================================================================
   AUTH & PAGES
   ========================================================================== */
.screen { position: relative; min-height: 100vh; min-height: 100dvh; }
.screen.center { display: grid; place-items: center; padding: 20px; }
.panel.narrow { max-width: 420px; text-align: center; }
.title { font: 800 clamp(26px, 4vw, 40px)/1.1 var(--f-title); margin: 0 0 6px; background: linear-gradient(180deg, #fff4c9, #e8b64c 60%, #a8761f); -webkit-background-clip: text; background-clip: text; color: transparent; letter-spacing: .04em; }
.title-sm { font: 800 26px var(--f-title); color: var(--gold); }
.subtitle { margin: 0 0 22px; color: var(--muted); }

.auth { display: flex; flex-direction: column; padding: 16px; }
.auth-top { display: flex; justify-content: flex-end; }
.auth-wrap { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 440px); gap: clamp(20px, 5vw, 70px); align-items: center; max-width: 1040px; width: 100%; margin: 0 auto; padding: 10px 0 30px; }
.auth-art, .hero-art { position: relative; display: grid; place-items: center; }
.title-art { position: relative; width: min(100%, 360px); height: auto; border-radius: 16px; box-shadow: 0 30px 80px rgba(0, 0, 0, .6), 0 0 0 1px rgba(232, 182, 76, .4); animation: artFloat 6s ease-in-out infinite; z-index: 1; }
.art-glow { position: absolute; width: 80%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle, rgba(232, 182, 76, .35), transparent 65%); filter: blur(20px); animation: glowPulse 4s ease-in-out infinite; }
@keyframes artFloat { 50% { transform: translateY(-10px) rotate(-.5deg); } }
@keyframes glowPulse { 50% { transform: scale(1.12); opacity: .7; } }
.auth-panel { width: 100%; }
.foot { text-align: center; color: var(--muted); font-size: 13px; padding-bottom: 6px; }

.topnav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px clamp(12px, 3vw, 28px);
  background: linear-gradient(180deg, rgba(6, 11, 23, .95), rgba(6, 11, 23, .75));
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font: 800 18px var(--f-title); letter-spacing: .2em; color: var(--gold); }
.brand img { flex: none; width: 36px; height: 36px; border-radius: 8px; box-shadow: 0 0 12px rgba(232, 182, 76, .4); }
.nav-links { display: flex; gap: 4px; margin: 0 auto; }
.nav-link { display: flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 10px; color: var(--muted); text-decoration: none; font-weight: 700; transition: color .2s, background .2s; }
.nav-link:hover { color: var(--text); background: rgba(255, 255, 255, .05); }
.nav-link.on { color: var(--gold-hi); background: rgba(232, 182, 76, .12); box-shadow: inset 0 -2px 0 var(--gold); }
.nav-user { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.nav-name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.lobby-main, .page { max-width: 1180px; margin: 0 auto; padding: clamp(14px, 3vw, 30px); display: grid; gap: 22px; }
.page.narrow { max-width: 820px; }
.page-title { display: flex; align-items: center; gap: 12px; font: 800 clamp(24px, 3.4vw, 34px) var(--f-title); color: var(--gold-hi); margin: 6px 0 0; }
.page-title .ico { width: 1em; height: 1em; color: var(--gold); }

.hero { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: 22px; align-items: center; }
.hero .title-art { width: min(100%, 300px); }
.player-card { display: grid; gap: 14px; }
.pc-top { display: flex; align-items: center; gap: 18px; }
.pc-name { font: 800 clamp(22px, 3vw, 30px)/1.1 var(--f-title); }
.pc-div { font: 800 15px var(--f-title); letter-spacing: .08em; text-transform: uppercase; }
.pc-rating { color: var(--muted); }
.pc-rating b { color: var(--text); font-size: 20px; }
.tier-bar { height: 12px; border-radius: 8px; background: rgba(0, 0, 0, .45); box-shadow: inset 0 0 0 1px rgba(232, 182, 76, .25); overflow: hidden; }
.tier-fill { height: 100%; border-radius: 8px; background: linear-gradient(90deg, #a8761f, #ffd36b, #fff4c9); box-shadow: 0 0 14px rgba(255, 211, 107, .6); position: relative; }
.tier-fill::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .6), transparent); animation: barShine 2.6s infinite; }
@keyframes barShine { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.pc-next { font-size: 14px; color: var(--muted); }
.pc-stats, .prof-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.stat { display: grid; justify-items: center; padding: 10px 6px; border-radius: 10px; background: rgba(0, 0, 0, .25); border: 1px solid rgba(255, 255, 255, .06); }
.stat b { font: 800 20px var(--f-title); color: var(--gold-hi); }
.stat span { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; text-align: center; }

.active-banner { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 14px 18px; border-color: var(--gold); }
.active-banner > span { flex: 1; font-weight: 800; }
.active-banner.pulse { animation: bannerPulse 2s ease-in-out infinite; }
@keyframes bannerPulse { 50% { box-shadow: 0 0 0 1px var(--gold), 0 0 30px rgba(232, 182, 76, .35); } }

.modes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.mode-card { display: flex; flex-direction: column; gap: 10px; transition: transform .25s var(--ease-out), box-shadow .25s; overflow: hidden; }
.mode-card:hover { transform: translateY(-4px); box-shadow: 0 0 0 1px var(--gold), 0 24px 60px rgba(0, 0, 0, .5), 0 0 40px rgba(232, 182, 76, .15); }
.mode-card h2 { margin: 0; font: 800 22px var(--f-title); color: var(--gold-hi); }
.mode-card p { margin: 0; color: var(--muted); flex: 1; }
.mode-icon { width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; font-size: 28px; color: #2a1a03; background: radial-gradient(circle at 35% 30%, #fff4c9, #e8b64c 55%, #8a5c14); box-shadow: 0 0 0 3px rgba(0, 0, 0, .35), 0 0 24px rgba(232, 182, 76, .45); }
.m-friends .mode-icon { background: radial-gradient(circle at 35% 30%, #c8dcff, #5d8ce0 55%, #1d3a7a); color: #071430; }
.m-bots .mode-icon { background: radial-gradient(circle at 35% 30%, #ffc9cf, #d8434f 55%, #6b0f18); color: #2a0408; }
.mode-actions { display: grid; gap: 10px; }
.join-row { display: flex; gap: 8px; }
.code-input { text-transform: uppercase; letter-spacing: .3em; font-weight: 900; text-align: center; }
.bot-row { display: grid; gap: 8px; }
.bot-btn { justify-content: space-between; }
.bot-btn small { color: var(--muted); font-weight: 400; }
.bot-btn.lv-easy { --b: rgba(93, 242, 160, .35); }
.bot-btn.lv-normal { --b: rgba(255, 211, 107, .45); }
.bot-btn.lv-hard { --b: rgba(255, 93, 115, .5); }

/* matchmaking overlays */
.mm-overlay { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px; background: radial-gradient(circle at center, rgba(10, 20, 45, .85), rgba(2, 5, 12, .95)); }
.mm-box { width: min(440px, 100%); display: grid; justify-items: center; gap: 14px; text-align: center; padding: 30px 24px; }
.mm-title { margin: 0; font: 800 24px var(--f-title); color: var(--gold-hi); }
.mm-time { font: 800 34px var(--f-title); font-variant-numeric: tabular-nums; }
.mm-info { color: var(--muted); }
.seeker { position: relative; width: 170px; height: 170px; display: grid; place-items: center; }
.seek-ring { position: absolute; inset: 0; border-radius: 50%; border: 2px solid transparent; border-top-color: var(--gold); border-left-color: rgba(232, 182, 76, .3); animation: spin 1.6s linear infinite; }
.seek-ring.r2 { inset: 16px; animation-duration: 2.4s; animation-direction: reverse; border-top-color: var(--steel); }
.seek-ring.r3 { inset: 32px; animation-duration: 3.2s; border-top-color: var(--crimson-hi); }
.seek-crest { width: 70px; aspect-ratio: 5 / 7; border-radius: 8px; background: url(../img/card-back.webp) center / cover; box-shadow: 0 0 30px rgba(232, 182, 76, .5); animation: crestPulse 1.4s ease-in-out infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.found-title { font: 900 clamp(30px, 6vw, 56px) var(--f-title); letter-spacing: .08em; background: linear-gradient(180deg, #fff4c9, #e8b64c 60%, #a8761f); -webkit-background-clip: text; background-clip: text; color: transparent; padding: 20px; }
.mm-overlay.found .mm-box { background: none; border: 0; box-shadow: none; }
.mm-overlay.found .mm-box::before, .mm-overlay.found .mm-box::after { display: none; }
.code-tiles { display: flex; gap: 8px; perspective: 600px; }
.code-tile { width: 46px; height: 58px; display: grid; place-items: center; border-radius: 10px; font: 900 28px var(--f-title); color: #2a1a03; background: linear-gradient(180deg, #fff1bd, #d49a2c); box-shadow: 0 3px 0 #7a5212, 0 8px 20px rgba(0, 0, 0, .4); }
.room-btns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

/* leaderboard */
.lb-tabs { max-width: 520px; }
.tab.t-gold.on { color: #ffd36b; }
.tab.t-silver.on { color: #e3e9f2; }
.tab.t-bronze.on { color: #f0a868; }
.lb-box { padding: 10px; overflow-x: auto; }
.lb-table { width: 100%; border-collapse: collapse; }
.lb-table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); }
.lb-table td { padding: 10px 12px; border-bottom: 1px solid rgba(255, 255, 255, .05); }
.lb-table td.div { display: flex; align-items: center; gap: 8px; }
.lb-table .rank { font: 800 18px var(--f-title); width: 50px; }
.lb-table .name { font-weight: 800; }
.lb-table .rating { font: 800 17px var(--f-title); color: var(--gold-hi); }
.lb-table tr.top1 .rank { color: #ffd36b; text-shadow: 0 0 12px rgba(255, 211, 107, .8); }
.lb-table tr.top2 .rank { color: #e3e9f2; }
.lb-table tr.top3 .rank { color: #f0a868; }
.lb-table tr.me { background: linear-gradient(90deg, rgba(232, 182, 76, .18), transparent); }
.lb-me { text-align: center; padding: 14px; color: var(--gold-hi); font-weight: 800; }
.empty-note { text-align: center; color: var(--muted); padding: 20px; }
.loading { text-align: center; padding: 30px; color: var(--muted); }

/* profile */
.profile-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 18px; }
.prof-card { display: grid; justify-items: center; gap: 10px; text-align: center; }
.prof-stats { grid-template-columns: repeat(3, 1fr); width: 100%; }
.prof-history h2, .acct-form h2 { margin: 0 0 12px; font: 800 20px var(--f-title); color: var(--gold-hi); }
.history { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.hist { display: grid; grid-template-columns: 70px 1fr auto 52px 60px; gap: 10px; align-items: center; padding: 9px 12px; border-radius: 10px; background: rgba(0, 0, 0, .25); border-left: 3px solid var(--muted); font-size: 14px; }
.hist.win { border-left-color: var(--green); }
.hist.loss { border-left-color: var(--crimson-hi); }
.hist-res { font-weight: 900; text-transform: uppercase; font-size: 12px; letter-spacing: .06em; }
.hist.win .hist-res { color: var(--green); }
.hist.loss .hist-res { color: var(--crimson-hi); }
.hist-opp { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-mode, .hist-date { color: var(--muted); font-size: 12px; }
.hist-delta { font-weight: 900; text-align: right; }
.up { color: var(--green); }
.down { color: var(--crimson-hi); }
.acct-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.danger-zone h2 { color: #ff8a95 !important; }

/* settings */
.settings { display: grid; gap: 4px; }
.set-row { display: grid; grid-template-columns: 200px 1fr; gap: 16px; align-items: center; padding: 14px 4px; border-bottom: 1px solid rgba(255, 255, 255, .06); }
.set-label { font-weight: 800; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.seg-btn { padding: 8px 14px; border-radius: 9px; border: 1px solid rgba(255, 255, 255, .15); background: rgba(0, 0, 0, .25); font-weight: 700; }
.seg-btn.on { border-color: var(--gold); color: var(--gold-hi); background: rgba(232, 182, 76, .14); }
.toggle { width: 58px; height: 32px; border-radius: 16px; border: 1px solid var(--line); background: rgba(0, 0, 0, .4); position: relative; }
.toggle span { position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #586480; transition: transform .25s var(--ease-back), background .2s; }
.toggle.on span { transform: translateX(26px); background: linear-gradient(180deg, #fff1bd, #d49a2c); }
input[type=range] { width: min(320px, 100%); accent-color: var(--gold); }
.set-anim { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

/* rules */
.rules { display: grid; gap: 26px; }
.rule-sec { position: relative; padding-left: 64px; }
.rule-num { position: absolute; left: 0; top: 0; width: 46px; height: 46px; display: grid; place-items: center; border-radius: 50%; font: 900 17px var(--f-title); color: #2a1a03; background: radial-gradient(circle at 35% 30%, #fff4c9, #e8b64c 60%, #8a5c14); }
.rule-sec h2 { margin: 0 0 8px; font: 800 22px var(--f-title); color: var(--gold-hi); }
.rule-sec p { margin: 0 0 8px; color: #d5dbea; }
.rule-suits { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.rule-suit { display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: 12px; background: rgba(0, 0, 0, .25); }
.rule-suit p { margin: 2px 0 0; font-size: 14px; }
.rule-card { width: 64px; flex: none; }
.rules-overlay { position: fixed; inset: 0; z-index: 95; display: grid; place-items: center; padding: 14px; background: rgba(2, 5, 12, .8); }
.rules-pop { width: min(760px, 100%); max-height: 90vh; overflow-y: auto; padding-top: 36px; }
.rules-pop .close { position: absolute; top: 10px; right: 10px; z-index: 2; }

/* ==========================================================================
   GAME
   ========================================================================== */
.game-screen { position: fixed; inset: 0; min-height: 0; height: 100vh; height: 100dvh; overflow: hidden; overflow: clip; overscroll-behavior: none; }
body.in-game, html:has(body.in-game) { overflow: hidden; overscroll-behavior: none; }
.game {
  --cw: clamp(34px, min(7.4vw, 10vh), 118px);
  --ch: calc(var(--cw) * 1.4);
  --tw: calc(var(--cw) * .72);
  --hw: clamp(58px, min(9.2vw, 15.5vh), 140px);
  --bl: clamp(10px, 2vh, 22px);
  position: relative;
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  overflow: hidden;
  overflow: clip;
}
.game::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 70% 55% at 50% 50%, rgba(40, 66, 130, .35), transparent 70%),
    radial-gradient(ellipse 50% 40% at 50% 50%, rgba(232, 182, 76, .06), transparent 70%);
}

/* HUD */
.hud-top { position: relative; z-index: 6; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; padding: 8px clamp(8px, 2vw, 20px) 0; }
.hud-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.hud-btns { display: flex; gap: 6px; justify-self: end; }
.hud-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 11px; border: 1px solid var(--line); background: rgba(8, 15, 32, .8); color: var(--gold-hi); transition: transform .15s, background .2s; }
.hud-btn:hover:not(:disabled) { transform: translateY(-2px); background: rgba(232, 182, 76, .16); }
.hud-btn.danger { color: #ff8a95; }
.hud-btn.off { color: var(--muted); }
.hud-btn:disabled { opacity: .4; }
.turn-info { text-align: center; }
.ti-turn { font: 700 12px var(--f-body); letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.ti-who { font: 800 clamp(14px, 1.8vw, 19px) var(--f-title); letter-spacing: .08em; }
.ti-who.mine { color: var(--gold-hi); text-shadow: 0 0 16px rgba(255, 211, 107, .6); }
.ti-who.theirs { color: var(--steel); }

.plate { display: flex; align-items: center; gap: 10px; min-width: 0; max-width: 300px; padding: 6px 14px 6px 8px; border-radius: 14px; background: linear-gradient(180deg, rgba(22, 36, 70, .9), rgba(9, 16, 34, .9)); border: 1px solid rgba(255, 255, 255, .1); transition: box-shadow .3s, border-color .3s; position: relative; }
.plate.active { border-color: var(--gold); box-shadow: inset 0 1px 0 #d5a8674d, 0 0 16px #c797482e; }
.plate-badge { display: grid; place-items: center; }
.plate-badge .div-badge { width: 36px; }
.plate-text { min-width: 0; }
.plate-name { font: 800 15px var(--f-title); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plate-sub { font-size: 12px; color: var(--muted); white-space: nowrap; }
.bot-badge { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: #2a0408; background: radial-gradient(circle at 35% 30%, #ffc9cf, #d8434f 55%, #6b0f18); font-size: 20px; }
.bot-badge.big { width: 80px; height: 80px; font-size: 44px; }
.online-dot { width: 10px; height: 10px; border-radius: 50%; background: #6b7280; flex: none; }
.online-dot.on { background: var(--green); box-shadow: 0 0 8px var(--green); }
.opp-timer { font: 800 16px var(--f-title); color: var(--steel); font-variant-numeric: tabular-nums; }
.opp-timer.urgent { color: var(--crimson-hi); animation: urgent 1s infinite; }
@keyframes urgent { 50% { opacity: .45; } }

/* Table */
.table { position: relative; z-index: 3; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 0; }
.table-glow { position: absolute; inset: 6% 18%; border-radius: 50%; background: radial-gradient(ellipse, rgba(232, 182, 76, .07), transparent 70%); pointer-events: none; }
.opp-hand { display: flex; justify-content: center; height: calc(var(--cw) * .42); margin-bottom: 6px; overflow: visible; }
.ohc { width: calc(var(--cw) * .5); margin: 0 calc(var(--cw) * -.16); transform: translateY(calc(-42% - var(--lift, 0px))) rotate(var(--rot, 0deg)); transform-origin: 50% 0; }
.hint { min-height: 1.5em; margin-top: 6px; font-size: 14px; color: var(--muted); text-align: center; letter-spacing: .03em; }

.board {
  --gap: clamp(5px, 1.1vh, 14px);
  position: relative;
  display: grid;
  grid-template-columns: var(--cw) repeat(3, var(--cw)) calc(var(--tw) * 1.42);
  grid-template-rows: var(--ch) var(--ch) var(--bl) var(--ch) var(--ch);
  column-gap: calc(var(--gap) * 1.7);
  row-gap: var(--gap);
  justify-content: center;
  padding: calc(var(--gap) * 1.2) calc(var(--gap) * 2);
  border-radius: 22px;
  background:
    radial-gradient(ellipse at 50% 50%, rgba(30, 52, 104, .45), rgba(6, 12, 26, .55) 75%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .015) 0 1px, transparent 1px 40px);
  box-shadow: inset 0 0 0 1px rgba(232, 182, 76, .2), inset 0 0 80px rgba(0, 0, 0, .55), 0 30px 60px rgba(0, 0, 0, .35);
}
.board .r1 { grid-row: 1; }
.board .r2 { grid-row: 2; }
.board .r3 { grid-row: 4; }
.board .r4 { grid-row: 5; }
.board .lane-0 { grid-column: 2; }
.board .lane-1 { grid-column: 3; }
.board .lane-2 { grid-column: 4; }
.board .fort-slot { grid-column: 3; }
.board .pile { grid-column: 1; }
.board .rt-opp { grid-column: 5; grid-row: 1 / 3; }
.board .rt-me { grid-column: 5; grid-row: 4 / 6; }
.battle-line {
  grid-column: 1 / -1;
  grid-row: 3;
  align-self: center;
  position: relative;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(232, 182, 76, .7) 20%, #ffe39a 50%, rgba(232, 182, 76, .7) 80%, transparent);
  box-shadow: 0 0 14px rgba(232, 182, 76, .6);
}
.bl-gem { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff4c9, #e8b64c 60%, #6b470e); color: #2a1a03; font-size: 15px; box-shadow: 0 0 16px rgba(232, 182, 76, .8); }

.slot, .fort-slot { position: relative; width: var(--cw); height: var(--ch); border-radius: 8px; }
.slot > .card, .fort-slot > .card { position: absolute; inset: 0; transition: transform .2s var(--ease-out); }
.slot.empty {
  display: grid;
  place-items: center;
  border: 1.5px dashed rgba(232, 182, 76, .28);
  background: radial-gradient(circle, rgba(0, 0, 0, .25), rgba(0, 0, 0, .45));
  box-shadow: inset 0 0 18px rgba(0, 0, 0, .6);
}
.slot-empty { display: grid; justify-items: center; gap: 2px; color: rgba(232, 182, 76, .32); font: 800 calc(var(--cw) * .12) var(--f-title); letter-spacing: .12em; }
.slot-empty .ico { width: calc(var(--cw) * .32); height: calc(var(--cw) * .32); }
.slot.theirs.empty { border-color: rgba(255, 93, 115, .3); }
.def-badge {
  position: absolute;
  right: -7px;
  bottom: -7px;
  z-index: 4;
  min-width: calc(var(--cw) * .3);
  height: calc(var(--cw) * .3);
  padding: 0 4px;
  display: grid;
  place-items: center;
  font: 900 calc(var(--cw) * .16)/1 var(--f-title);
  color: #fff;
  background: linear-gradient(180deg, #3b527f, #1a2a4f);
  border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
  box-shadow: 0 0 0 2px rgba(232, 182, 76, .8), 0 3px 8px rgba(0, 0, 0, .55);
}
.def-badge.spade { background: linear-gradient(180deg, #6f9df0, #23458f); box-shadow: 0 0 0 2px #cfe0ff, 0 0 10px rgba(143, 183, 255, .7); }
.slot.mine:not(.empty):hover > .card, .slot.theirs:not(.empty):hover > .card { transform: translateY(-4px) scale(1.04); }

.fort-slot { cursor: default; }
.fort-aura { position: absolute; inset: -18%; border-radius: 30%; background: radial-gradient(circle, rgba(255, 211, 107, .45), transparent 65%); animation: aura 3s ease-in-out infinite; pointer-events: none; }
.fort-slot.theirs .fort-aura { background: radial-gradient(circle, rgba(143, 183, 255, .35), transparent 65%); }
@keyframes aura { 50% { transform: scale(1.12); opacity: .65; } }
.card.fort .c-inner { box-shadow: inset 0 0 0 1.6cqw #f8efdb, inset 0 0 0 2.6cqw #e8b64c, inset 0 0 0 3.2cqw #f8efdb, 0 0 0 1.5px #ffe39a, 0 0 22px rgba(255, 211, 107, .55), 0 10px 20px rgba(0, 0, 0, .5); }
.fort-def { position: absolute; left: 50%; bottom: -10px; transform: translateX(-50%); z-index: 4; display: flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 99px; font: 900 calc(var(--cw) * .15) var(--f-title); color: #2a1a03; background: linear-gradient(180deg, #fff1bd, #d49a2c); box-shadow: 0 0 0 2px #6b470e, 0 4px 10px rgba(0, 0, 0, .5); white-space: nowrap; }
.fort-slot.exposed .fort-aura { background: radial-gradient(circle, rgba(255, 77, 94, .6), transparent 65%); animation: danger 1s ease-in-out infinite; }
.fort-slot.exposed::after { content: ''; position: absolute; inset: 0; border-radius: 8px; pointer-events: none; z-index: 3; background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 50 70'><path d='M25 0 22 14 28 22 20 33 27 44 23 70M22 14 12 18M28 22 40 26M20 33 8 38M27 44 38 52' fill='none' stroke='rgba(20,10,10,.55)' stroke-width='1.4'/></svg>") center / 100% 100%; }
@keyframes danger { 50% { opacity: .5; transform: scale(1.18); } }
.fort-slot.king-ready { cursor: pointer; }
.fort-slot.king-ready > .card { animation: kingReady 1.4s ease-in-out infinite; }
.fort-slot.selected > .card { transform: translateY(-8px) scale(1.06); box-shadow: 0 0 0 3px var(--gold-hi), 0 0 30px rgba(255, 211, 107, .8); border-radius: 8px; }
@keyframes kingReady { 50% { filter: drop-shadow(0 0 12px rgba(255, 211, 107, .9)); transform: translateY(-3px); } }
.king-tag { position: absolute; left: 50%; top: -14px; transform: translateX(-50%); z-index: 5; padding: 2px 8px; border-radius: 99px; font: 900 10px var(--f-body); letter-spacing: .04em; white-space: nowrap; color: #2a1a03; background: var(--gold-hi); box-shadow: 0 0 12px rgba(255, 211, 107, .8); }

.pile { position: relative; width: var(--cw); height: var(--ch); }
.pile > .card { position: absolute; inset: 0; }
.pile .stack.s3 { transform: translate(-4px, 4px) rotate(-3deg); }
.pile .stack.s2 { transform: translate(-2px, 2px) rotate(-1.5deg); }
.pile-empty { position: absolute; inset: 0; border-radius: 8px; border: 1.5px dashed rgba(255, 255, 255, .15); }
.pile-count { position: absolute; top: -8px; right: -8px; z-index: 3; min-width: 24px; height: 24px; padding: 0 6px; display: grid; place-items: center; border-radius: 12px; font: 900 12px var(--f-body); background: #0b1530; border: 1px solid var(--gold); color: var(--gold-hi); }
.pile-label { position: absolute; left: 0; right: 0; bottom: -18px; text-align: center; font: 800 10px var(--f-body); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.pile.discard > .card { filter: brightness(.82) saturate(.8); transform: rotate(4deg); }

.treasury { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 4px; border-radius: 12px; background: linear-gradient(180deg, rgba(0, 0, 0, .22), rgba(0, 0, 0, .1)); box-shadow: inset 0 0 0 1px rgba(232, 182, 76, .14); }
.tre-head { display: flex; align-items: center; gap: 5px; font: 900 11px var(--f-body); color: var(--gold); letter-spacing: .06em; }
.tre-head .ico { width: 16px; height: 16px; }
.tre-list { --trH: calc(var(--ch) * 2 + var(--gap) - 30px); position: relative; width: calc(var(--tw) * 1.4); height: var(--trH); }
.tre-list .tcard { position: absolute; left: 0; top: calc(var(--i) * min(var(--tw) * .64, (var(--trH) - var(--tw)) / max(var(--n) - 1, 1))); transition: top .3s var(--ease-out); }
.tre-list .tcard:hover { z-index: 9; transform: translateX(-6px) scale(1.06); }

/* Targets */
.tgt { cursor: pointer; }
.tgt::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 10px;
  border: 1px solid var(--tc, #e6bf85);
  box-shadow: 0 0 10px color-mix(in srgb, var(--tc, #e6bf85) 55%, transparent);
  opacity: .65;
  animation: targetReveal .24s var(--ease-out);
  transition: opacity .16s, box-shadow .16s;
  z-index: 6;
  pointer-events: none;
}
.tgt-build, .tgt-save { --tc: rgba(255, 211, 107, .9); }
.tgt-discard { --tc: rgba(255, 140, 60, .85); }
.tgt-win { --tc: rgba(93, 242, 160, .95); }
.tgt-risky { --tc: rgba(255, 211, 107, .95); }
.tgt-lose { --tc: rgba(255, 77, 94, .9); }
.tgt:hover::before, .tgt.hover::before { opacity: 1; box-shadow: 0 0 13px var(--tc, #e6bf85); }
.tgt:hover > .card, .tgt.hover > .card { transform: translateY(-4px) scale(1.05); }
@keyframes targetReveal { from { opacity: 0; } }
.tgt-label {
  position: absolute;
  left: 50%;
  top: -14px;
  transform: translateX(-50%);
  z-index: 8;
  padding: 3px 9px;
  border-radius: 99px;
  font: 900 11px var(--f-body);
  white-space: nowrap;
  color: #07101f;
  background: var(--tc, #ffd36b);
  box-shadow: 0 4px 10px rgba(0, 0, 0, .5);
  pointer-events: none;
}

/* Hand */
.hud-bottom { position: relative; z-index: 8; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: end; gap: 10px; padding: 0 clamp(8px, 2vw, 20px) 8px; }
.hud-bottom .plate { align-self: end; margin-bottom: 8px; }
.hand { display: flex; justify-content: center; align-items: flex-end; height: calc(var(--hw) * 1.12); padding: 0 calc(var(--hw) * .25); }
.hc {
  position: relative;
  width: var(--hw);
  flex: none;
  margin: 0 calc(var(--hw) * -.17);
  cursor: grab;
  touch-action: none;
}
/* The hit area stays still while the card artwork lifts. */
.hc::before { content: ''; position: absolute; inset: -30% 0 -20%; }
.hc .card {
  pointer-events: none;
  transform-origin: 50% 88%;
  transform: translateY(var(--hand-y, calc(14% + var(--lift, 0px)))) rotate(var(--hand-angle, var(--rot, 0deg))) scale(var(--hand-scale, 1));
  transition: transform .34s cubic-bezier(.18,.72,.25,1);
}
.hc .c-inner::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 4;
  border-radius: inherit;
  box-shadow: inset 0 0 0 2px #f3d49cba, inset 0 0 16px #d89d554d;
  opacity: 0;
  pointer-events: none;
  transition: opacity .24s;
}
.hand.playable .hc .c-inner { box-shadow: inset 0 0 0 1.3cqw #32251d, inset 0 0 0 2.35cqw #c6a064, 0 2px 2px #000a, 0 8px 15px #0009; }
.hand:not(.playable) .hc .c-inner { filter: brightness(.9); }
@media (hover: hover) {
  .hc:hover .card { --hand-y: -20%; --hand-angle: 0deg; --hand-scale: 1.14; z-index: 100 !important; }
  .hc:hover .c-inner::after { opacity: .68; }
  .hc:hover .c-shine { animation: handSheen .43s var(--ease-out); }
  .hc.selected:hover .card { z-index: 100 !important; }
}
.hc.selected .card { --hand-y: -24%; --hand-angle: 0deg; --hand-scale: 1.16; z-index: 99 !important; filter: drop-shadow(0 7px 11px #000b) drop-shadow(0 0 7px #ddb4737d); }
.hc.selected .c-inner::after { opacity: 1; }
.drag-ghost { position: fixed; left: 0; top: 0; z-index: 95; pointer-events: none; filter: drop-shadow(0 16px 18px #000b); will-change: transform; }
.drag-ghost > .card { height: 100%; }
@keyframes handSheen {
  0% { opacity: 0; transform: translateX(-80%); }
  42% { opacity: .5; }
  100% { opacity: 0; transform: translateX(75%); }
}

/* Action panel */
.action-panel { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-bottom: 8px; }
.gems { display: flex; gap: 7px; }
.gem { width: 16px; height: 16px; transform: rotate(45deg); border-radius: 3px; background: #1a2440; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .15); transition: all .3s; }
.gem.on { background: linear-gradient(135deg, #fff4c9, #ffd36b 40%, #c08a2a); box-shadow: 0 0 12px rgba(255, 211, 107, .9), inset 0 0 0 1px #fff4c9; }
.flags { display: grid; gap: 4px; }
.flag { display: flex; align-items: center; gap: 5px; font: 800 11px var(--f-body); letter-spacing: .04em; color: var(--gold-hi); }
.flag .ico { width: 14px; height: 14px; }
.flag.used { color: #586480; text-decoration: line-through; }
.end-btn {
  position: relative;
  width: clamp(78px, 9vh, 96px);
  height: clamp(78px, 9vh, 96px);
  border-radius: 50%;
  border: 0;
  display: grid;
  place-content: center;
  gap: 0;
  color: #2a1a03;
  background: radial-gradient(circle at 35% 28%, #fff4c9, #f3c65a 45%, #b37a1c 85%);
  box-shadow: 0 4px 0 #6b470e, 0 10px 26px rgba(0, 0, 0, .55), 0 0 0 4px rgba(10, 18, 38, .9);
  font: 900 12px/1.1 var(--f-title);
  letter-spacing: .04em;
  transition: transform .15s, filter .2s;
}
.end-btn:hover:not(:disabled) { transform: translateY(-2px) scale(1.04); }
.end-btn:active:not(:disabled) { transform: translateY(2px) scale(.97); }
.end-btn:disabled { filter: grayscale(.85) brightness(.55); }
.end-btn.ready { box-shadow: 0 4px 0 #6b470e, 0 0 21px #e3b36170, 0 0 0 4px #201b1b; }
.end-btn.armed { background: radial-gradient(circle at 35% 28%, #ffd0d4, #e2414f 50%, #7a1420 90%); color: #fff; }
.end-label { max-width: 70px; text-align: center; }
.end-time { font: 800 11px var(--f-body); opacity: .75; font-variant-numeric: tabular-nums; }
.end-ring { position: absolute; inset: -7px; width: calc(100% + 14px); height: calc(100% + 14px); transform: rotate(-90deg); pointer-events: none; }
.end-ring circle { fill: none; stroke-width: 4; }
.ring-bg { stroke: rgba(255, 255, 255, .08); }
.ring-fg { stroke: #ffe39a; stroke-linecap: round; filter: drop-shadow(0 0 4px rgba(255, 211, 107, .9)); transition: stroke-dashoffset .2s linear; }
.end-btn.urgent .ring-fg { stroke: var(--crimson-hi); filter: drop-shadow(0 0 6px rgba(255, 77, 94, 1)); }
.end-btn.urgent .end-time { font-weight: 900; }

/* Targeting arrow */
.target-arrow { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 66; overflow: visible; }
.ta-line { fill: none; stroke: #e4bf86; stroke-width: 2; stroke-linecap: round; opacity: .8; }
.ta-glow { fill: none; stroke: #d69a5470; stroke-width: 8; stroke-linecap: round; filter: blur(3px); }
.target-arrow.locked .ta-line { stroke-width: 3; opacity: 1; }
.target-arrow.win .ta-line { stroke: #b7d7ac; }
.target-arrow.win .ta-glow { stroke: #80ab7e77; }
.target-arrow.lose .ta-line { stroke: #e59b8d; }
.target-arrow.lose .ta-glow { stroke: #b95b5477; }

/* Modals inside the game */
.g-overlay { position: fixed; inset: 0; z-index: 30; pointer-events: none; }
.g-overlay > * { pointer-events: auto; }
.g-modals { position: fixed; inset: 0; z-index: 85; pointer-events: none; }
.g-modal { position: absolute; inset: 0; display: grid; place-items: center; padding: 14px; background: rgba(2, 5, 12, .62); backdrop-filter: blur(3px); pointer-events: auto; }
.g-modal-box { width: min(440px, 100%); max-height: 92vh; overflow-y: auto; padding: 22px; border-radius: 18px; background: linear-gradient(180deg, rgba(24, 40, 78, .97), rgba(8, 15, 32, .97)); border: 1px solid var(--gold); box-shadow: 0 30px 80px rgba(0, 0, 0, .7), 0 0 40px rgba(232, 182, 76, .2); text-align: center; }
.g-modal-box.wide { width: min(620px, 100%); }
.g-modal-box h2 { margin: 0 0 10px; font: 900 clamp(20px, 3vw, 28px) var(--f-title); color: var(--gold-hi); letter-spacing: .06em; }
.g-modal-box p { margin: 0 0 14px; color: #c9d1e4; }
.danger-title { color: var(--crimson-hi) !important; text-shadow: 0 0 20px rgba(255, 77, 94, .7); animation: urgent .8s infinite; }
.ap-duel { display: flex; justify-content: center; align-items: flex-start; gap: clamp(10px, 3vw, 30px); margin: 8px 0 14px; }
.ap-side { display: grid; justify-items: center; gap: 6px; }
.ap-card { width: clamp(80px, 16vw, 120px); }
.ap-vs { align-self: center; font-size: 34px; color: var(--gold); filter: drop-shadow(0 0 10px rgba(232, 182, 76, .8)); }
.ap-num { font: 900 38px/1 var(--f-title); }
.ap-num.atk { color: #ffb3a0; text-shadow: 0 0 18px rgba(255, 93, 60, .7); }
.ap-num.def { color: #cfe0ff; text-shadow: 0 0 18px rgba(143, 183, 255, .7); }
.ap-parts { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; max-width: 160px; }
.chip { display: inline-block; padding: 2px 8px; border-radius: 99px; font: 900 11px var(--f-body); background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .18); white-space: nowrap; }
.chip.k-spades { background: rgba(143, 183, 255, .2); border-color: #8fb7ff; color: #dbe7ff; }
.chip.k-clubs { background: rgba(93, 242, 160, .18); border-color: var(--green); color: #c9ffe2; }
.chip.k-treasure { background: rgba(255, 211, 107, .2); border-color: var(--gold); color: var(--gold-hi); }
.chip.k-king, .chip.k-fort { background: rgba(255, 211, 107, .25); border-color: var(--gold-hi); color: #fff4c9; }
.ap-sub { font-weight: 800; color: var(--gold-hi); margin-bottom: 8px; }
.ap-tr { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 12px; }
.ap-tr-opt { --tw: 46px; padding: 8px; border-radius: 12px; border: 2px solid rgba(255, 255, 255, .12); background: rgba(0, 0, 0, .3); display: grid; place-items: center; min-width: 76px; min-height: 64px; transition: transform .15s, border-color .2s; }
.ap-tr-opt:hover { transform: translateY(-2px); }
.ap-tr-opt.on { border-color: var(--gold); box-shadow: 0 0 16px rgba(232, 182, 76, .5); }
.ap-tr-opt.none span { font-weight: 800; font-size: 13px; color: var(--muted); }
.ap-verdict { margin: 6px 0 14px; padding: 8px 12px; border-radius: 10px; font-weight: 900; }
.ap-verdict.win { background: rgba(93, 242, 160, .14); color: var(--green); }
.ap-verdict.risky { background: rgba(255, 211, 107, .14); color: var(--gold-hi); }
.ap-verdict.lose { background: rgba(255, 77, 94, .14); color: #ff8a95; }
.ap-actions { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.pick-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-bottom: 14px; }
.pick { --tw: 50px; padding: 6px; border-radius: 12px; border: 2px solid transparent; background: rgba(0, 0, 0, .25); transition: transform .15s, border-color .15s; }
.pick:hover { transform: translateY(-3px); border-color: rgba(232, 182, 76, .6); }
.pick.on { border-color: var(--crimson-hi); box-shadow: 0 0 16px rgba(255, 77, 94, .6); transform: translateY(-4px); }
.hand-pick .pick { width: 74px; }
.def-opts { display: grid; gap: 8px; margin-bottom: 10px; }
.def-opt { --tw: 46px; display: flex; align-items: center; gap: 14px; padding: 10px 14px; border-radius: 12px; border: 2px solid rgba(143, 183, 255, .5); background: rgba(30, 60, 120, .35); font-weight: 900; text-align: left; transition: transform .15s, box-shadow .2s; }
.def-opt:hover { transform: translateY(-2px); box-shadow: 0 0 20px rgba(143, 183, 255, .5); }
.prompt-bar { height: 5px; margin-top: 14px; border-radius: 3px; background: linear-gradient(90deg, var(--crimson-hi), var(--gold)); transform-origin: left; }

.emote-pop { position: absolute; top: 56px; right: clamp(8px, 2vw, 20px); z-index: 50; display: grid; gap: 6px; padding: 10px; border-radius: 14px; background: rgba(8, 15, 32, .96); border: 1px solid var(--line); box-shadow: 0 20px 40px rgba(0, 0, 0, .5); }
.emote-btn { padding: 8px 14px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .1); background: rgba(255, 255, 255, .04); font-weight: 800; text-align: left; }
.emote-btn:hover { background: rgba(232, 182, 76, .15); }
.emote-bubble { position: fixed; z-index: 75; max-width: 240px; padding: 10px 16px; border-radius: 16px; font-weight: 900; background: #fff8e6; color: #1a2540; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); transform-origin: left bottom; }
.emote-bubble.theirs { transform-origin: left top; }
.net-warn { position: absolute; top: 60px; left: 50%; transform: translateX(-50%); z-index: 90; padding: 8px 16px; border-radius: 10px; background: #7a1420; font-weight: 800; animation: urgent 1s infinite; }

/* Match scenes share the same painted hall and use separate lighting. */
.cinematic-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: var(--scene-shade, radial-gradient(ellipse at 50% 48%, #19120f24, #0d0b0a9e 100%)),
    url(../img/throne-hall.webp) center 56% / cover #171311;
}
.arena {
  --duel-card: clamp(38px, min(var(--cw) * 1.86, 23vw, 33dvh), 192px);
  --duel-treasure: calc(var(--duel-card) * .42);
  position: absolute;
  inset: 0;
  z-index: 30;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: clamp(6px, 2.6dvh, 23px);
  padding: 12px;
  overflow: hidden;
}
.arena.closing { pointer-events: none; }
.arena.fort-battle { --duel-card: clamp(42px, min(var(--cw) * 2.08, 24vw, 36dvh), 216px); }
.ar-dim { --scene-shade: radial-gradient(ellipse at 50% 46%, #17131178, #0b0909bf 86%); }
.fort-battle .ar-dim { --scene-shade: radial-gradient(ellipse at 48% 44%, #471e1680, #100c0be6 90%); }
.ar-stage { --tre-gap: clamp(4px, 1.5vw, 12px); position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; justify-items: center; max-width: 100%; gap: clamp(3px, 1dvh, 9px) clamp(8px, 3vw, 39px); }
.ar-side { --tre-rail: calc(var(--duel-treasure) + var(--tre-gap)); display: contents; }
.ar-side.atk > * { grid-column: 1; }
.ar-side.def > * { grid-column: 3; }
.ar-side.atk > :is(.ar-label, .ar-power, .ar-chips) { margin-inline-start: var(--tre-rail); }
.ar-side.def > :is(.ar-label, .ar-power, .ar-chips) { margin-inline-end: var(--tre-rail); }
.ar-label { grid-row: 1; max-width: var(--duel-card); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; font: 800 clamp(.68rem, 1.7vw, .93rem) var(--f-title); letter-spacing: .075em; }
.ar-side.atk .ar-label { color: #efc7ab; }
.ar-side.def .ar-label { color: #cfdee0; }
.ar-cardrow { grid-row: 2; display: flex; align-items: center; gap: var(--tre-gap); }
.ar-card { position: relative; width: var(--duel-card); aspect-ratio: 5 / 7; }
.ar-card > .card { position: absolute; inset: 0; }
.ar-side.atk .ar-card .c-inner { box-shadow: 0 0 1px 1px #c18a637d, 0 12px 23px #070504b8, 0 0 26px #b0613338; }
.ar-side.def .ar-card .c-inner { box-shadow: 0 0 1px 1px #a0b8ba7d, 0 12px 23px #070504b8, 0 0 26px #7da1ae36; }
.ar-tr { display: grid; gap: 6px; width: var(--duel-treasure); }
.ar-side.atk .ar-tr { order: -1; }
.ar-trcard { width: 100%; aspect-ratio: 5 / 7; position: relative; }
.ar-trcard > .card { position: absolute; inset: 0; }
.ar-power { grid-row: 3; }
.ar-num { font: 800 clamp(1.9rem, 6.7dvh, 4rem)/1 var(--f-title); color: #efd0a1; text-shadow: 0 4px 19px #000b; font-variant-numeric: tabular-nums; }
.ar-side.def .ar-num { color: #cfe0e6; }
.ar-chips { grid-row: 4; align-self: start; display: flex; flex-wrap: wrap; align-content: start; justify-content: center; gap: 4px; min-height: 2.45rem; width: var(--duel-card); }
.ar-vs { grid-area: 2 / 2; display: grid; place-items: center; font-size: clamp(14px, 3.6vmin, 32px); color: #d6ab72; }
.ar-status { position: relative; align-self: start; min-height: 1.5em; text-align: center; font: 800 clamp(.77rem, 2.6vw, .99rem)/1.35 var(--f-title); letter-spacing: .07em; color: var(--gold-hi); opacity: 0; transition: opacity .23s; }
.ar-status.on { opacity: 1; }
.ar-side .ar-card.ar-winner .c-inner { box-shadow: 0 0 1px 1px #ebcd966e, 0 9px 26px #070504a8, 0 0 28px #d6a05b62; }
.crack-overlay { position: absolute; inset: 0; z-index: 5; pointer-events: none; background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 50 70'><path d='M26 0 23 12 30 20 21 30 29 41 24 52 28 70M23 12 9 16M30 20 44 23M21 30 5 36M29 41 46 49M24 52 12 60' fill='none' stroke='rgba(15,8,8,.8)' stroke-width='1.3'/><path d='M26 0 23 12 30 20 21 30 29 41 24 52 28 70' fill='none' stroke='rgba(255,255,255,.5)' stroke-width='.5' transform='translate(.6 .4)'/></svg>") center / 100% 100%; }

/* ==========================================================================
   EFFECTS
   ========================================================================== */
.fx-ghost { position: fixed; z-index: 2; pointer-events: none; will-change: transform; transform-origin: center; perspective: 900px; transform-style: preserve-3d; }
.fx-ghost > .card, .fx-ghost > .flip3d { width: 100%; height: 100%; }
.fx-ghost.arena-ghost { z-index: 3; }
.hc .c-shine, .fx-ghost .c-shine {
  z-index: 3;
  opacity: 0;
  mix-blend-mode: screen;
  background: linear-gradient(111deg, transparent 25%, #bb935633 43%, #f5deaa96 50%, #f5deaa28 57%, transparent 72%);
}
.fx-flight-shadow { position: fixed; z-index: 1; pointer-events: none; background: radial-gradient(ellipse at 50% 61%, #040302cc, #0403026b 43%, transparent 74%); will-change: transform, opacity; }
.fx-light { position: fixed; z-index: 3; pointer-events: none; background: radial-gradient(ellipse at center, var(--light-color), transparent 66%); mix-blend-mode: screen; }
.fx-shock { position: fixed; z-index: 3; border-radius: 50%; pointer-events: none; border: 1px solid var(--c, #d9b27b); box-shadow: 0 0 13px -6px var(--c, #d9b27b); }
.fx-shock.shield { background: radial-gradient(ellipse, transparent 54%, #91abbf40 72%, transparent 77%); }
.fx-shard { position: fixed; z-index: 4; pointer-events: none; will-change: transform; }
.fx-float { position: fixed; z-index: 6; pointer-events: none; font: 800 clamp(.83rem, 2.5vw, 1.3rem) var(--f-title); white-space: nowrap; letter-spacing: .045em; color: #efebe1; text-shadow: 0 2px 2px #090605, 0 1px 10px #090605; }
.fx-float.gold { color: #f4d6a6; }
.fx-float.diamond, .fx-float.s-S { color: #d4e6eb; }
.fx-stamp, .fx-banner {
  position: fixed;
  z-index: 8;
  max-width: calc(100% - 24px);
  pointer-events: none;
  text-align: center;
  text-wrap: balance;
  color: #f3d8ad;
  text-shadow: 0 2px 16px #000;
  background: radial-gradient(ellipse at center, #1a130fee 15%, #18110dda 50%, transparent 75%);
}
.fx-stamp { translate: -50% -50%; width: max-content; padding: 10px 24px; font: 800 clamp(1.1rem, 3.9vw, 2.4rem)/1.1 var(--f-title); letter-spacing: .1em; }
.fx-stamp.steel { color: #d1e4e9; }
.fx-stamp.big { font-size: clamp(1.2rem, 5.3vw, 3.5rem); }
.fx-banner { left: 50%; top: clamp(49px, 13dvh, 123px); width: min(100%, 560px); translate: -50% 0; padding: 10px 18px 13px; }
.fx-banner::before, .fx-stamp::after { content: ''; display: block; width: min(70%, 260px); height: 1px; margin: 0 auto 8px; background: linear-gradient(90deg, transparent, currentColor, transparent); opacity: .52; }
.fx-stamp::after { margin: 8px auto 0; }
.fx-banner.opp { color: #d3e2e5; }
.fx-banner-title { font: 800 clamp(1rem, 4.6vw, 2.65rem)/1.1 var(--f-title); letter-spacing: .085em; }
.fx-banner-sub { margin-bottom: 4px; font: 800 .74rem var(--f-body); letter-spacing: .22em; text-transform: uppercase; opacity: .8; }
.fx-letterbox .lb-top, .fx-letterbox .lb-bot { position: fixed; left: 0; right: 0; height: clamp(12px, 5dvh, 49px); z-index: 9; background: #080706; transition: transform .36s var(--ease-out); }
.fx-letterbox .lb-top { top: 0; transform: translateY(-100%); }
.fx-letterbox .lb-bot { bottom: 0; transform: translateY(100%); }
.fx-letterbox.on .lb-top, .fx-letterbox.on .lb-bot { transform: none; }

/* VS intro */
.vs-screen { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; overflow: hidden; background: #100c0a; }
.vs-bg { --scene-shade: radial-gradient(ellipse at 50% 48%, #130f0db3 4%, #150e0c52 65%, #080707b3); }
.vs-stage { position: relative; display: grid; width: min(calc(100% - 24px), 900px); grid-template-columns: minmax(0, 1fr) clamp(34px, 9vw, 92px) minmax(0, 1fr); align-items: start; gap: clamp(5px, 3vw, 29px); }
.vs-side { --emblem-width: clamp(46px, 10vw, 110px); display: grid; justify-items: center; min-width: 0; gap: clamp(8px, 2dvh, 18px); }
.vs-emblem { display: grid; place-items: center; height: calc(var(--emblem-width) * 1.125); }
.vs-side .div-badge.big, .vs-side .bot-badge.big { width: var(--emblem-width); filter: drop-shadow(0 7px 12px #000a); }
.vs-side .bot-badge.big { height: auto; aspect-ratio: 1; font-size: clamp(22px, 4.5vw, 45px); color: #ebca91; border: 1px solid #b8945f; background: radial-gradient(circle at 36% 25%, #756045, #372b21 72%); box-shadow: inset 0 0 0 4px #33271e, inset 0 0 0 5px #ae855e80; }
.vs-name { max-width: 100%; font: 800 clamp(.92rem, min(3.8vw, 26rem / var(--name-length, 8)), 2.65rem)/1.12 var(--f-title); letter-spacing: .05em; text-align: center; text-wrap: balance; text-shadow: 0 2px 4px #000, 0 0 22px #000; overflow-wrap: anywhere; }
.vs-side.left .vs-name { color: #f1d4a7; }
.vs-side.right .vs-name { color: #dae6e9; }
.vs-mid { align-self: center; display: grid; gap: 7px; justify-items: center; color: #c9a071; font: 800 .74rem var(--f-title); letter-spacing: .14em; text-shadow: 0 2px 10px #000; }
.vs-mid .ico { font-size: clamp(18px, 4vw, 36px); }
.vs-mid::before, .vs-mid::after { content: ''; width: 1px; height: clamp(14px, 5dvh, 43px); background: linear-gradient(transparent, #bf94679e, transparent); }

/* Result */
.result { position: absolute; inset: 0; z-index: 60; display: grid; place-items: center; align-items: safe center; padding: 16px; background: #100c0b; overflow: hidden auto; }
.res-scene { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.res-bg { --scene-shade: radial-gradient(ellipse at 50% 39%, #271a10b3, #0c0b0aeb 83%); }
.result.loss .res-bg { --scene-shade: radial-gradient(ellipse at 50% 40%, #301610c4, #0c0a0af0 84%); }
.result.draw .res-bg { --scene-shade: radial-gradient(ellipse at 50% 40%, #142025ad, #0a0d10eb 83%); }
.res-box { position: relative; margin: auto; display: grid; justify-items: center; gap: 12px; text-align: center; width: min(740px, 100%); }
.res-title { max-width: 100%; font: 800 clamp(1.9rem, 8vw, 5.8rem)/1 var(--f-title); letter-spacing: .075em; text-transform: uppercase; text-wrap: balance; overflow-wrap: anywhere; color: #f1d3a3; text-shadow: 0 2px 2px #29180e, 0 6px 34px #0a0604; }
.result.loss .res-title { color: #e1aa99; }
.result.draw .res-title { color: #d6e2e5; }
.res-box::before, .res-box::after { content: ''; width: min(66%, 285px); height: 1px; background: linear-gradient(90deg, transparent, #c3a273cc, transparent); }
.res-box::before { margin-bottom: 5px; }
.res-box::after { margin-top: 8px; }
.res-reason { color: #e0d7cb; font-size: 1rem; }
.res-stats { display: grid; justify-items: center; gap: 8px; min-height: 40px; }
.res-badge { perspective: 600px; }
.res-rating-row { display: flex; align-items: baseline; gap: 12px; }
.res-rating { font: 900 44px var(--f-title); font-variant-numeric: tabular-nums; }
.res-delta { font: 900 26px var(--f-title); }
.res-div { font: 800 16px var(--f-title); letter-spacing: .1em; text-transform: uppercase; color: var(--gold-hi); }
.res-note { color: var(--muted); font-size: 14px; }
.res-promo { padding: 6px 16px; border-radius: 99px; font: 900 14px var(--f-title); letter-spacing: .1em; text-transform: uppercase; color: #2a1a03; background: linear-gradient(180deg, #fff1bd, #d49a2c); box-shadow: 0 0 24px rgba(255, 211, 107, .7); }
.res-promo.down { color: #fff; background: linear-gradient(180deg, #e2414f, #7a1420); box-shadow: none; }
.res-actions { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin-top: 10px; }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 980px) {
  .modes { grid-template-columns: 1fr; }
  .hero { grid-template-columns: 1fr; }
  .hero-art { display: none; }
  .profile-grid, .acct-grid { grid-template-columns: 1fr; }
  .nav-link span { display: none; }
  .nav-links { margin: 0; }
  .topnav { justify-content: space-between; }
}
@media (max-width: 760px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-art .title-art { width: min(58vw, 230px); }
  .brand span, .nav-name { display: none; }
  .pc-stats { grid-template-columns: repeat(2, 1fr); }
  .hide-sm { display: none; }
  .set-row { grid-template-columns: 1fr; gap: 8px; }
  .hist { grid-template-columns: 56px 1fr auto 44px; }
  .hist-date { display: none; }
  .rule-sec { padding-left: 0; padding-top: 56px; }
  .rule-suits { grid-template-columns: 1fr; }
}
@media (max-aspect-ratio: 4 / 5) {
  .game { --cw: clamp(38px, min(13.6vw, 8.4vh), 110px); --hw: clamp(56px, min(18.5vw, 13vh), 130px); }
  .hud-bottom { grid-template-columns: 1fr auto; grid-template-areas: 'plate actions' 'hand hand'; }
  .hud-bottom .plate { grid-area: plate; margin: 0; align-self: center; }
  .hud-bottom .hand { grid-area: hand; }
  .hud-bottom .action-panel { grid-area: actions; margin: 0; }
  .hud-top { grid-template-columns: 1fr auto; }
  .turn-info { display: none; }
  .plate { max-width: 200px; padding: 4px 10px 4px 6px; }
  .plate-badge .div-badge, .bot-badge { width: 28px; height: auto; }
  .bot-badge { height: 28px; font-size: 16px; }
  .end-btn { width: 70px; height: 70px; font-size: 10px; }
  .hud-btn { width: 36px; height: 36px; }
  .flags { display: none; }
  .tgt-label { font-size: 9px; padding: 2px 6px; top: -12px; }
  .cinematic-bg { background-position: center, 19% 56%; }
}
@media (max-height: 520px) and (min-aspect-ratio: 4 / 3) {
  .game { --cw: clamp(30px, 9.2vh, 80px); --hw: clamp(48px, 17vh, 90px); }
  .opp-hand { display: none; }
  .hint { display: none; }
  .hud-top { padding-top: 4px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* The Fallen Kings: a shared palette and illustrated card art. */
:root {
  --bg0: #0b0a0c; --bg1: #171316; --bg2: #302525; --navy: #211c20;
  --gold: #bd9756; --gold-hi: #f1d59b; --gold-lo: #765530;
  --text: #eee9df; --muted: #b2a69a; --line: rgba(193, 151, 87, .36);
  --panel: rgba(26, 22, 23, .94);
}
body {
  background: radial-gradient(ellipse at 50% -15%, #42352f, transparent 58%),
    radial-gradient(ellipse at 85% 100%, #32191a, transparent 48%),
    repeating-linear-gradient(90deg, transparent 0 79px, rgba(200, 162, 102, .025) 80px),
    #0b0a0c;
}
.panel, .plate, .g-modal-box { background: linear-gradient(160deg, rgba(48, 39, 37, .97), rgba(17, 15, 17, .98)); }
.btn, .tab.on, .hud-btn { background: linear-gradient(180deg, #44332c, #211b1b); }
.board { background: radial-gradient(ellipse at center, #302c29, #141216 78%); }
.game::before { background: radial-gradient(ellipse at center, rgba(98, 70, 51, .28), transparent 70%); }
.title-art, .hero .title-art { width: min(100%, 520px); border-radius: 6px; }
.brand-crest { display: block; flex: none; width: 38px; height: 38px; background: url(../img/vexthrone-dark-logo.webp) 50% 24% / 260% auto; border-radius: 50%; border: 1px solid var(--line); }
.splash-crest { aspect-ratio: 1; border-radius: 50%; background: url(../img/vexthrone-dark-logo.webp) 50% 25% / 260% auto; }
.card { --art-x: 0%; --art-y: 0%; }
.card.s-H { --art-x: 33.333%; }
.card.s-C { --art-x: 66.667%; }
.card.s-D { --art-x: 100%; }
.card.r-Q, .card.r-5, .card.r-6, .card.r-7 { --art-y: 50%; }
.card.r-K, .card.r-8, .card.r-9, .card.r-T, .card.r-A { --art-y: 100%; }
.card.face .c-inner { background: #211b1b; box-shadow: inset 0 0 0 1.4cqw #30251f, inset 0 0 0 2.5cqw #b7935c, 0 5px 14px #0009; }
.card.face .c-inner::before {
  content: ''; position: absolute; inset: 3%; border-radius: 5cqw;
  background: linear-gradient(rgba(10, 9, 10, .35), rgba(10, 9, 10, .56)), url(../img/court-dark-fantasy.webp) var(--art-x) var(--art-y) / 400% 300%;
}
.card.red, .card.black { color: #f4e6c8; }
.c-rank { text-shadow: 0 1px 2px #000, 0 0 3cqw #000; }
.c-pip, .c-ace-pip { filter: drop-shadow(0 1px 2px #000) drop-shadow(0 0 2cqw #000); }
.card.red .c-pip, .card.red .c-ace-pip, .card.red .c-csuit { color: #ffb4a0; }
.cc-frame, .card.red .cc-frame { border-color: #bd9756; background: url(../img/court-dark-fantasy.webp) var(--art-x) var(--art-y) / 400% 300%; }
.cc-glow, .cc-emblem, .cc-suit, .cc-letter { display: none; }
.c-foil { display: none; }
.card.back .c-inner { background: #171316 url(../img/card-back-dark-v2.webp) center / cover; box-shadow: 0 5px 14px #0009; }
.opp-connection { position: absolute; z-index: 91; top: 58px; left: 50%; transform: translateX(-50%); width: max-content; max-width: min(92vw, 490px); padding: 9px 14px; border: 1px solid #b7814b; border-radius: 6px; background: #261b17f2; color: #ffe2b0; text-align: center; font-weight: 700; box-shadow: 0 8px 24px #0009; }
.net-warn { top: 110px; max-width: 90vw; text-align: center; }
@media (max-width: 760px) {
  .brand .brand-crest { display: block; }
  .auth-art .title-art { width: min(100%, 420px); }
  .nav-links { gap: 0; }
  .nav-link { padding-inline: 8px; }
  .panel { padding: 18px; }
  .opp-connection { top: 48px; font-size: 13px; }
}
@media (max-width: 380px) {
  .nav-link { padding-inline: 5px; }
  .topnav { gap: 4px; padding-inline: 6px; }
  .hud-top { gap: 4px; padding-inline: 4px; }
  .hud-btns { gap: 3px; }
  .hud-btn { width: 32px; height: 36px; }
  .plate { gap: 4px; }
  .plate-sub { display: none; }
}
@media (max-aspect-ratio: 4 / 5) {
  .game { --cw: max(26px, min(13.6vw, 7.5dvh, (100dvh - 200px) / 6.5)); --hw: max(45px, min(18vw, 12dvh)); }
  .board { --gap: clamp(3px, .8vh, 10px); }
  .hud-bottom { gap: 2px; padding-bottom: max(5px, env(safe-area-inset-bottom)); }
  .action-panel { gap: 6px; }
  .end-btn { width: clamp(52px, 8dvh, 70px); height: clamp(52px, 8dvh, 70px); }
  .hand { max-width: 100%; }
}
@media (max-height: 520px) and (min-aspect-ratio: 4 / 3) {
  .game { --cw: max(24px, min(7.6dvh, (100dvh - 110px) / 6.5)); --hw: max(40px, min(14dvh, 82px)); }
  .board { --gap: 3px; }
  .end-btn { width: 58px; height: 58px; }
  .hud-bottom { padding-bottom: 3px; }
}
.seek-crest { background: url(../img/card-back-dark-v2.webp) center / cover; }
@media (max-height: 520px) {
  .res-box { gap: 5px; }
  .res-title { font-size: clamp(28px, 7vh, 48px); }
  .res-badge .div-badge.big { width: 44px; }
  .res-rating { font-size: 28px; }
  .res-actions { margin-top: 2px; }
}
