/* ───────────── tokens ───────────── */
:root {
  --bg: #060a12;
  --panel: rgba(13, 20, 33, 0.74);
  --panel-2: rgba(20, 30, 47, 0.8);
  --panel-solid: #0d1421;
  --line: rgba(255, 255, 255, 0.07);
  --line-2: rgba(255, 255, 255, 0.12);
  --gold-line: rgba(200, 170, 110, 0.28);
  --text: #e9eef6;
  --text-2: #b9c5d4;
  --muted: #7f90a6;
  --gold: #c8aa6e;
  --gold-hi: #f0d9a4;
  --cyan: #0ac8b9;
  --blue: #3d8bff;
  --blue-hi: #8bbcff;
  --red: #ff4d5e;
  --red-hi: #ff9aa5;
  --win: #3ddc97;
  --lose: #ff6b7a;
  --warn: #ffb547;
  --radius: 16px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --font: "Pretendard Variable", Pretendard, "Malgun Gothic", "맑은 고딕", "Apple SD Gothic Neo", "Segoe UI", system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--font);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}
input, textarea, select { user-select: text; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
button:disabled { cursor: not-allowed; }
a { color: var(--gold-hi); }
svg { display: block; }
.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.pad { padding: 16px; }
em { font-style: normal; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: rgba(200, 170, 110, 0.35); }
::selection { background: rgba(200, 170, 110, 0.35); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ───────────── backdrop ───────────── */
.backdrop { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
.backdrop-img {
  position: absolute; inset: -4%;
  background: url("/assets/hero.jpg") center 30% / cover no-repeat;
  filter: brightness(0.42) saturate(1.15) blur(1px);
  animation: kenburns 46s ease-in-out infinite alternate;
  transition: opacity 0.9s var(--ease);
}
.backdrop-split { position: absolute; inset: 0; display: grid; grid-template-columns: 1fr 1fr; opacity: 0; transition: opacity 0.9s var(--ease); }
.split-blue, .split-red { background-size: cover; background-position: center; filter: brightness(0.32) saturate(1.2); }
.split-blue { background-image: linear-gradient(90deg, rgba(20, 60, 140, 0.5), transparent), url("/assets/blue.jpg"); animation: drift-l 30s ease-in-out infinite alternate; }
.split-red { background-image: linear-gradient(270deg, rgba(140, 20, 40, 0.5), transparent), url("/assets/red.jpg"); animation: drift-r 30s ease-in-out infinite alternate; }
.is-result .backdrop-img { opacity: 0; }
.is-result .backdrop-split { opacity: 1; }
#particles { position: absolute; inset: 0; pointer-events: none; }
.backdrop-veil {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 50% -10%, rgba(200, 170, 110, 0.12), transparent 55%),
    linear-gradient(180deg, rgba(6, 10, 18, 0.35), rgba(6, 10, 18, 0.88) 70%, #060a12);
}
@keyframes kenburns { from { transform: scale(1) translate(0, 0); } to { transform: scale(1.09) translate(-1.5%, 1%); } }
@keyframes drift-l { from { transform: scale(1.05); } to { transform: scale(1.12) translateX(-2%); } }
@keyframes drift-r { from { transform: scale(1.05); } to { transform: scale(1.12) translateX(2%); } }

/* ───────────── top bar ───────────── */
.topbar {
  height: 68px; display: flex; align-items: center; gap: 24px; padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(6, 10, 18, 0.85), rgba(6, 10, 18, 0.55));
  backdrop-filter: blur(14px);
  position: relative; z-index: 5;
  animation: drop-in 0.6s var(--ease) both;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 210px; }
.brand-mark { width: 34px; height: 34px; position: relative; display: grid; place-items: center; }
.brand-mark::before, .brand-mark::after, .brand-mark span {
  content: ""; position: absolute; inset: 4px; border: 1.5px solid var(--gold); transform: rotate(45deg);
}
.brand-mark::after { inset: 9px; background: var(--gold); border: 0; box-shadow: 0 0 18px rgba(200, 170, 110, 0.7); animation: pulse-gem 3s ease-in-out infinite; }
.brand-mark span { inset: 0; border-color: rgba(200, 170, 110, 0.35); animation: spin 14s linear infinite; }
@keyframes pulse-gem { 50% { box-shadow: 0 0 28px rgba(240, 217, 164, 0.95); transform: rotate(45deg) scale(0.86); } }
.brand-title { font-weight: 800; letter-spacing: 0.22em; font-size: 15px; color: var(--gold-hi); }
.brand-sub { font-size: 11px; color: var(--muted); letter-spacing: 0.08em; }

.tabs { position: relative; display: flex; gap: 4px; margin: 0 auto; padding: 4px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); border-radius: 999px; }
.tab { position: relative; z-index: 1; display: flex; align-items: center; gap: 8px; padding: 8px 18px; border-radius: 999px; color: var(--muted); font-weight: 600; transition: color 0.25s; }
.tab:hover:not(:disabled) { color: var(--text); }
.tab.is-active { color: #1a1206; }
.tab:disabled { opacity: 0.4; }
.tab-num { width: 18px; height: 18px; display: grid; place-items: center; border-radius: 50%; font-size: 11px; border: 1px solid currentColor; }
.tab em { font-size: 11px; background: rgba(200, 170, 110, 0.22); color: var(--gold-hi); border-radius: 999px; padding: 0 6px; }
.tab.is-active em { background: rgba(27, 19, 7, 0.2); color: #1b1307; }
.tab em:empty { display: none; }
.tab-glider { position: absolute; top: 4px; bottom: 4px; left: 0; border-radius: 999px; background: linear-gradient(135deg, var(--gold-hi), var(--gold)); box-shadow: 0 4px 18px rgba(200, 170, 110, 0.35); transition: transform 0.45s var(--spring), width 0.45s var(--spring); }

.top-actions { display: flex; align-items: center; gap: 10px; min-width: 210px; justify-content: flex-end; }
.provider-chip { display: flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line-2); font-size: 12px; color: var(--text-2); transition: border-color 0.2s, background 0.2s; }
.provider-chip:hover { border-color: var(--gold-line); background: rgba(200, 170, 110, 0.06); }
.provider-chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 10px var(--gold); }
.provider-chip.is-riot i { background: var(--win); box-shadow: 0 0 10px var(--win); }
.icon-btn { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; color: var(--text-2); transition: background 0.2s, color 0.2s, transform 0.2s; text-decoration: none; }
.icon-btn:hover { background: rgba(255, 255, 255, 0.07); color: var(--text); }
.icon-btn:active { transform: scale(0.92); }
.icon-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn.spin svg { animation: spin 0.9s linear infinite; }

/* ───────────── views ───────────── */
.view { position: absolute; inset: 68px 0 0 0; padding: 20px 24px 22px; display: none; }
.view.is-active { display: grid; animation: view-in 0.45s var(--ease) both; }
@keyframes view-in { from { opacity: 0; transform: translateY(10px); } }
@keyframes drop-in { from { opacity: 0; transform: translateY(-12px); } }
@keyframes spin { to { transform: rotate(360deg); } }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); backdrop-filter: blur(16px) saturate(1.2); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 16px 10px; }
.panel-head h2 { margin: 0; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.panel-head h2 em { font-size: 12px; color: var(--muted); font-weight: 500; }
.head-actions { display: flex; gap: 8px; }

/* ───────────── buttons ───────────── */
.btn {
  position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 16px; border-radius: 10px; font-weight: 600; white-space: nowrap;
  transition: transform 0.18s var(--ease), background 0.2s, border-color 0.2s, box-shadow 0.25s, color 0.2s;
}
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn:active:not(:disabled) { transform: scale(0.96); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-ghost { border: 1px solid var(--line-2); background: rgba(255, 255, 255, 0.03); color: var(--text-2); }
.btn-ghost:hover { border-color: var(--gold-line); color: var(--text); background: rgba(200, 170, 110, 0.07); }
.btn-ghost.is-on { border-color: var(--gold); color: var(--gold-hi); background: rgba(200, 170, 110, 0.12); }
.btn-gold { background: linear-gradient(135deg, var(--gold-hi), var(--gold)); color: #1b1307; box-shadow: 0 6px 20px rgba(200, 170, 110, 0.25); }
.btn-gold:hover { box-shadow: 0 8px 28px rgba(200, 170, 110, 0.45); transform: translateY(-1px); }
.btn-danger { border: 1px solid rgba(255, 77, 94, 0.35); color: var(--red-hi); background: rgba(255, 77, 94, 0.06); }
.btn-danger:hover { background: rgba(255, 77, 94, 0.15); }
.btn-blue, .btn-red { flex: 1; height: 44px; color: white; font-size: 15px; }
.btn-blue { background: linear-gradient(135deg, #5aa0ff, #2563eb); box-shadow: 0 6px 22px rgba(61, 139, 255, 0.35); }
.btn-red { background: linear-gradient(135deg, #ff6f7d, #e11d48); box-shadow: 0 6px 22px rgba(255, 77, 94, 0.35); }
.btn-blue:hover, .btn-red:hover { transform: translateY(-2px); filter: brightness(1.08); }
.ripple { position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: rgba(255, 255, 255, 0.45); pointer-events: none; animation: ripple 0.6s ease-out forwards; }
@keyframes ripple { to { transform: scale(40); opacity: 0; } }

/* ───────────── roster view ───────────── */
#view-roster { grid-template-columns: 300px minmax(0, 1fr); gap: 20px; }
.pool { display: flex; flex-direction: column; min-height: 0; animation: slide-r 0.55s var(--ease) both; }
@keyframes slide-r { from { opacity: 0; transform: translateX(-18px); } }
.search { margin: 0 12px 8px; display: flex; align-items: center; gap: 8px; padding: 0 12px; height: 38px; border-radius: 10px; background: rgba(0, 0, 0, 0.25); border: 1px solid var(--line); transition: border-color 0.2s; }
.search:focus-within { border-color: var(--gold-line); }
.search svg { width: 16px; height: 16px; fill: none; stroke: var(--muted); stroke-width: 2; }
.search input { flex: 1; background: none; border: 0; outline: 0; color: var(--text); font: inherit; }
.pool-list { flex: 1; overflow-y: auto; padding: 4px 8px; display: flex; flex-direction: column; gap: 2px; }
.pool-row {
  display: grid; grid-template-columns: 20px 30px minmax(0, 1fr) auto 28px; align-items: center; gap: 10px;
  padding: 7px 8px; border-radius: 10px; cursor: pointer; border: 1px solid transparent;
  transition: background 0.18s, border-color 0.18s, transform 0.18s;
}
.pool-row:hover { background: rgba(255, 255, 255, 0.05); transform: translateX(2px); }
.pool-row.is-on { background: linear-gradient(90deg, rgba(200, 170, 110, 0.14), rgba(200, 170, 110, 0.02)); border-color: rgba(200, 170, 110, 0.22); }
.pool-row.is-loading .avatar { animation: breathe 1.2s ease-in-out infinite; }
.check { width: 18px; height: 18px; border-radius: 6px; border: 1.5px solid var(--line-2); display: grid; place-items: center; transition: background 0.2s, border-color 0.2s; }
.is-on .check { background: var(--gold); border-color: var(--gold); animation: pop 0.3s var(--spring); }
.check svg { width: 13px; height: 13px; fill: none; stroke: #1b1307; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.pool-name { min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.pool-name b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pool-name small { color: var(--muted); font-size: 11px; }
.pool-tier { font-size: 11.5px; color: var(--tc); font-weight: 600; white-space: nowrap; }
.row-edit { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; color: var(--muted); opacity: 0; transition: opacity 0.15s, background 0.15s; }
.row-edit .i { width: 15px; height: 15px; }
.pool-row:hover .row-edit { opacity: 1; }
.row-edit:hover { background: rgba(255, 255, 255, 0.08); color: var(--text); }
.pool-hint { margin: 0; padding: 12px 16px 16px; font-size: 11.5px; color: var(--muted); border-top: 1px solid var(--line); }
.pool-hint b { color: var(--text-2); font-weight: 500; }
.empty-pool { padding: 40px 16px; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.empty-orb { width: 56px; height: 56px; border-radius: 50%; border: 1.5px dashed var(--gold-line); animation: spin 12s linear infinite; }
@keyframes pop { 0% { transform: scale(0.6); } 100% { transform: scale(1); } }
@keyframes breathe { 50% { opacity: 0.45; } }

.lineup { display: flex; flex-direction: column; gap: 14px; min-width: 0; min-height: 0; }
.lineup-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.lineup-head h1 { margin: 0 0 6px; font-size: 24px; letter-spacing: -0.01em; }
.ready { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.ready-bar { width: 180px; height: 6px; border-radius: 6px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.ready-bar span { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--gold), var(--gold-hi)); box-shadow: 0 0 12px rgba(240, 217, 164, 0.6); transition: width 0.6s var(--spring); }

.slots { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); gap: 12px; }

/* player card */
.card {
  --tc: #5b6b80;
  position: relative; overflow: hidden; min-height: 0;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 14px 12px 10px; border-radius: var(--radius); cursor: pointer;
  background:
    radial-gradient(120% 70% at 50% 0%, color-mix(in srgb, var(--tc) 22%, transparent), transparent 70%),
    linear-gradient(180deg, rgba(18, 27, 43, 0.92), rgba(10, 15, 25, 0.92));
  border: 1px solid var(--line);
  transition: transform 0.3s var(--ease), border-color 0.3s, box-shadow 0.3s;
}
.card.enter { animation: card-in 0.6s var(--spring) both; animation-delay: calc(var(--i) * 45ms); }
.card.leave { animation: card-out 0.22s ease-in forwards; }
@keyframes card-in { from { opacity: 0; transform: translateY(24px) scale(0.92) rotateX(18deg); } }
@keyframes card-out { to { opacity: 0; transform: scale(0.85) translateY(8px); } }
.card:not(.card-empty):hover { transform: translateY(-5px); border-color: color-mix(in srgb, var(--tc) 60%, transparent); box-shadow: 0 14px 36px rgba(0, 0, 0, 0.45), 0 0 0 1px color-mix(in srgb, var(--tc) 25%, transparent), 0 0 32px color-mix(in srgb, var(--tc) 22%, transparent); }
.card-glow { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 0.3s; background: radial-gradient(240px circle at var(--mx, 50%) var(--my, 0%), color-mix(in srgb, var(--tc) 20%, transparent), transparent 60%); }
.card:hover .card-glow { opacity: 1; }
.card::after { content: ""; position: absolute; left: 18%; right: 18%; top: 0; height: 2px; border-radius: 0 0 4px 4px; background: var(--tc); box-shadow: 0 0 16px var(--tc); opacity: 0.85; }
.card-x { position: absolute; top: 8px; right: 8px; z-index: 2; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; color: var(--muted); opacity: 0; transform: scale(0.8); transition: opacity 0.2s, transform 0.2s, background 0.2s; }
.card-x .i { width: 14px; height: 14px; }
.card:hover .card-x { opacity: 1; transform: scale(1); }
.card-x:hover { background: rgba(255, 77, 94, 0.18); color: var(--red-hi); }
.card-top { position: relative; display: flex; justify-content: center; width: 100%; }
.card-avatar { position: relative; width: 70px; height: 70px; display: grid; place-items: center; flex: none; }
.card-avatar .avatar { width: 62px; height: 62px; }
.card-avatar .ring { position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(from 210deg, var(--tc), transparent 40%, var(--tc) 70%, transparent); -webkit-mask: radial-gradient(circle, transparent 32px, #000 33px); mask: radial-gradient(circle, transparent 32px, #000 33px); }
.is-loading .card-avatar .ring { animation: spin 1.1s linear infinite; background: conic-gradient(var(--gold-hi), transparent 60%); }
.lvl { position: absolute; bottom: -4px; left: 50%; transform: translateX(-50%); font-size: 10px; padding: 0 6px; border-radius: 999px; background: #0b111c; border: 1px solid var(--line-2); color: var(--text-2); }
.card-champs { position: absolute; right: 0; top: 4px; display: flex; flex-direction: column; gap: 3px; }
.card-champs img { width: 20px; height: 20px; border-radius: 6px; border: 1px solid var(--line-2); opacity: 0.85; }
.card-name { margin-top: 10px; font-size: 15px; font-weight: 700; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-tag { font-size: 11px; color: var(--muted); }
.card-tier { margin-top: 6px; }
.card-score { margin-top: 2px; display: flex; align-items: baseline; gap: 2px; }
.card-score b { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; background: linear-gradient(180deg, #fff, color-mix(in srgb, var(--tc) 50%, #fff)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.card-score b.dim { color: var(--muted); background: none; -webkit-text-fill-color: var(--muted); }
.card-score small { color: var(--muted); font-size: 11px; }
.card-row { margin-top: 6px; display: flex; align-items: center; gap: 6px; justify-content: center; flex-wrap: wrap; }
.card-pos { display: flex; align-items: center; gap: 3px; padding: 2px 5px; border-radius: 8px; border: 1px solid transparent; transition: border-color 0.2s, background 0.2s; }
.card-pos:hover { border-color: var(--gold-line); background: rgba(200, 170, 110, 0.08); }
.card-pos em { font-size: 10.5px; color: var(--muted); }
.card-pos.is-empty { border: 1px dashed rgba(255, 255, 255, 0.18); }
.card-pos.is-empty:hover em { color: var(--gold-hi); }
.pos-wrap.is-sugg { color: var(--gold); opacity: 0.6; border: 1px dashed var(--gold-line); }
.card-cur { font-size: 10.5px; color: var(--muted); margin-top: 1px; }
.mode-hint { margin: -2px 0 0; font-size: 11.5px; color: var(--muted); line-height: 1.5; }
.notice b { color: #ffe2b0; }

/* position popover */
.pos-pop { position: fixed; z-index: 40; width: 340px; padding: 12px; border-radius: 14px; background: linear-gradient(180deg, #142035, #0d1524); border: 1px solid var(--gold-line); box-shadow: 0 18px 50px rgba(0, 0, 0, 0.6); display: flex; flex-direction: column; gap: 8px; opacity: 0; transform: translateY(-6px) scale(0.97); transition: opacity 0.18s, transform 0.25s var(--spring); }
.pos-pop.in { opacity: 1; transform: none; }
.pp-head { display: flex; flex-direction: column; line-height: 1.3; }
.pp-head small { font-size: 11px; color: var(--muted); }
.pp-row { display: flex; align-items: center; gap: 8px; }
.pos-row button.is-sugg { border-style: dashed; border-color: rgba(200, 170, 110, 0.55); color: var(--gold); }
.pp-suggest { height: 32px; border-radius: 9px; font-size: 12.5px; font-weight: 700; color: #1b1307; background: linear-gradient(135deg, var(--gold-hi), var(--gold)); transition: transform 0.15s, box-shadow 0.2s; }
.pp-suggest:hover { box-shadow: 0 6px 18px rgba(200, 170, 110, 0.35); transform: translateY(-1px); }

/* bulk position table */
.modal:has(#bulk-rows) { width: min(960px, 100%); }
.bulk .pos-row button span { font-size: 10px; white-space: nowrap; }
.bulk { display: flex; flex-direction: column; gap: 6px; max-height: 60vh; overflow-y: auto; padding-right: 4px; }
.bulk-row { display: grid; grid-template-columns: 130px 1fr 1fr 150px; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 12px; background: rgba(255, 255, 255, 0.025); border: 1px solid var(--line); animation: rise 0.3s var(--ease) both; }
.bulk-row.is-missing { border-color: rgba(255, 181, 71, 0.25); }
.bulk-who { display: flex; align-items: center; gap: 8px; min-width: 0; }
.bulk-who span { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.bulk-who b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bulk-who small { font-size: 11px; color: var(--muted); }
.bulk .pos-row button { padding: 5px 1px 4px; }
.bulk .pos-row button .pos { width: 18px; height: 18px; }
.bulk .pos-row-sub button.is-active { color: var(--text); border-color: rgba(255, 255, 255, 0.35); background: rgba(255, 255, 255, 0.07); }
.bulk-sugg .pp-suggest { width: 100%; font-size: 11.5px; }
.card-form { margin-top: auto; padding-top: 6px; display: flex; flex-direction: column; align-items: center; gap: 3px; min-height: 30px; }
.card-form small { font-size: 10.5px; color: var(--muted); }
.card-status { width: 100%; margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); font-size: 10.5px; color: var(--muted); display: flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 22px; }
.card-status.is-err { color: var(--lose); }
.card-status.is-warn { color: var(--warn); }
.card-status.is-loading { color: var(--gold-hi); }
.card.is-loading::before { content: ""; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(240, 217, 164, 0.09) 50%, transparent 70%); background-size: 250% 100%; animation: shimmer 1.4s linear infinite; pointer-events: none; }
@keyframes shimmer { from { background-position: 150% 0; } to { background-position: -100% 0; } }
.card.is-warn { border-color: rgba(255, 181, 71, 0.25); }
.card-empty { justify-content: center; gap: 6px; border: 1.5px dashed rgba(255, 255, 255, 0.1); background: rgba(255, 255, 255, 0.015); color: var(--muted); transition: border-color 0.25s, color 0.25s, background 0.25s, transform 0.25s; }
.card-empty:hover { border-color: var(--gold-line); color: var(--gold-hi); background: rgba(200, 170, 110, 0.05); transform: translateY(-3px); }
.card-empty .plus { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-size: 26px; font-weight: 300; border: 1.5px solid currentColor; transition: transform 0.35s var(--spring); }
.card-empty:hover .plus { transform: rotate(90deg) scale(1.08); }
.card-empty small { font-size: 11px; opacity: 0.7; }

.avatar { border-radius: 50%; object-fit: cover; flex: none; background: #121b2a; }
.avatar-txt { display: grid; place-items: center; font-weight: 700; color: white; font-size: 13px; background: radial-gradient(circle at 30% 25%, color-mix(in srgb, var(--c, #4d5d73) 85%, white 15%), color-mix(in srgb, var(--c, #4d5d73) 55%, #000)); text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5); }

.tier-badge { --tc: #6b7a90; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: color-mix(in srgb, var(--tc) 80%, white); white-space: nowrap; }
.tier-badge i { width: 9px; height: 9px; transform: rotate(45deg); background: var(--tc); box-shadow: 0 0 8px var(--tc); border-radius: 2px; }
.chip { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; font-size: 11px; background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); color: var(--text-2); }
.chip-xs { padding: 0 6px; font-size: 10.5px; }
.pos-wrap { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 6px; }
.pos-wrap.is-main { background: rgba(200, 170, 110, 0.14); color: var(--gold-hi); }
.pos-wrap.is-sub { color: var(--muted); width: 18px; height: 18px; }
.pos { width: 100%; height: 100%; }
.pos-bg { fill: none; stroke: currentColor; opacity: 0.25; stroke-width: 1.5; }
.pos-hl { fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.lock { color: var(--gold); display: grid; }
.lock .i { width: 13px; height: 13px; }
.form { display: flex; gap: 2px; }
.form i { width: 7px; height: 7px; border-radius: 2px; }
.form i.w { background: var(--win); box-shadow: 0 0 6px rgba(61, 220, 151, 0.4); }
.form i.l { background: rgba(255, 107, 122, 0.75); }
.spinner { width: 12px; height: 12px; border-radius: 50%; border: 2px solid rgba(240, 217, 164, 0.25); border-top-color: var(--gold-hi); animation: spin 0.7s linear infinite; display: inline-block; flex: none; }

/* balance bar */
.balance-bar { display: grid; grid-template-columns: auto minmax(0, 1fr) 250px; gap: 22px; align-items: center; padding: 14px 14px 14px 20px; animation: rise 0.6s var(--ease) 0.15s both; }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }
.field-label { font-size: 11px; color: var(--muted); margin-bottom: 6px; letter-spacing: 0.04em; }
.segmented { position: relative; display: inline-flex; padding: 4px; border-radius: 12px; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--line); }
.segmented button { position: relative; z-index: 1; padding: 7px 14px; border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--muted); transition: color 0.25s; }
.segmented button.is-active { color: #1b1307; }
.seg-glider { position: absolute; top: 4px; bottom: 4px; left: 4px; width: 0; border-radius: 9px; background: linear-gradient(135deg, var(--gold-hi), var(--gold)); transition: transform 0.4s var(--spring), width 0.4s var(--spring); }
.seg-sm button { padding: 6px 14px; font-size: 12.5px; }
.toggles { display: flex; flex-wrap: wrap; gap: 6px; }
.toggle { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 999px; font-size: 12.5px; color: var(--muted); border: 1px solid var(--line-2); transition: all 0.2s; }
.toggle::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: 0.5; transition: all 0.2s; }
.toggle:hover { color: var(--text); border-color: var(--gold-line); }
.toggle.is-on { color: var(--gold-hi); border-color: rgba(200, 170, 110, 0.45); background: rgba(200, 170, 110, 0.1); }
.toggle.is-on::before { opacity: 1; box-shadow: 0 0 8px var(--gold-hi); }
.toggle-rule::before { display: none; }
.toggle em { background: var(--gold); color: #1b1307; border-radius: 999px; font-size: 11px; padding: 0 6px; font-weight: 700; }
.toggle em:empty { display: none; }

.cta {
  position: relative; overflow: hidden; height: 66px; border-radius: 14px; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; align-items: center; column-gap: 12px; padding: 0 20px; text-align: left;
  background: linear-gradient(135deg, #3b3220, #241e12); color: rgba(240, 217, 164, 0.45); border: 1px solid rgba(200, 170, 110, 0.2);
  transition: transform 0.25s var(--ease), box-shadow 0.3s, filter 0.3s;
}
.cta svg { grid-row: span 2; width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.cta-text { font-size: 18px; font-weight: 800; letter-spacing: 0.04em; position: relative; }
.cta small { font-size: 11px; opacity: 0.75; position: relative; }
.cta.is-ready { background: linear-gradient(135deg, #f6e2b0, #c8aa6e 55%, #a3803f); color: #1b1307; border-color: transparent; box-shadow: 0 10px 34px rgba(200, 170, 110, 0.35); animation: cta-breathe 2.6s ease-in-out infinite; }
.cta.is-ready:hover { transform: translateY(-2px) scale(1.01); box-shadow: 0 14px 44px rgba(200, 170, 110, 0.55); }
.cta.is-ready:hover svg { animation: wiggle 0.5s var(--ease); }
.cta-glow { position: absolute; inset: 0; background: linear-gradient(110deg, transparent 35%, rgba(255, 255, 255, 0.55) 50%, transparent 65%); background-size: 250% 100%; opacity: 0; }
.cta.is-ready .cta-glow { opacity: 1; animation: shimmer 2.8s ease-in-out infinite; }
@keyframes cta-breathe { 50% { box-shadow: 0 10px 44px rgba(240, 217, 164, 0.55); } }
@keyframes wiggle { 30% { transform: rotate(-12deg); } 60% { transform: rotate(8deg); } }

/* ───────────── drawer ───────────── */
.scrim { position: fixed; inset: 0; background: rgba(3, 6, 12, 0.55); backdrop-filter: blur(3px); opacity: 0; pointer-events: none; transition: opacity 0.3s; z-index: 20; }
.scrim.is-on { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(480px, 100vw); z-index: 21; display: flex; flex-direction: column;
  background: linear-gradient(180deg, #0f1828, #0a111d); border-left: 1px solid var(--gold-line); box-shadow: -30px 0 80px rgba(0, 0, 0, 0.5);
  transform: translateX(105%); transition: transform 0.45s var(--ease);
}
.drawer.is-open { transform: none; }
.drawer-head { position: relative; flex: none; overflow: hidden; }
.dh-art { position: absolute; inset: 0; background: radial-gradient(90% 140% at 15% 0%, color-mix(in srgb, var(--tc) 35%, transparent), transparent 70%), url("/assets/rift.png") center / cover; opacity: 0.7; }
.dh-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(15, 24, 40, 0.3), #0f1828); }
.dh-main { position: relative; display: flex; gap: 14px; align-items: center; padding: 22px 16px 16px 20px; }
.dh-avatar { position: relative; flex: none; }
.dh-avatar .avatar { width: 72px; height: 72px; box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1), 0 8px 24px rgba(0, 0, 0, 0.5); }
.dh-text { flex: 1; min-width: 0; }
.dh-name { font-size: 20px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dh-name small { font-size: 13px; color: var(--muted); font-weight: 500; margin-left: 4px; }
.dh-sub { display: flex; align-items: center; gap: 10px; margin-top: 2px; }
.dh-score { color: var(--gold-hi); font-size: 13px; }
.dh-meta { margin-top: 4px; font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.dh-meta .err { color: var(--lose); }
.dh-actions { display: flex; gap: 2px; align-self: flex-start; }
.drawer-body { flex: 1; overflow-y: auto; padding: 4px 20px 20px; }
.drawer.is-open .dsec { animation: rise 0.45s var(--ease) both; }
.drawer.is-open .dsec:nth-child(2) { animation-delay: 0.04s; }
.drawer.is-open .dsec:nth-child(3) { animation-delay: 0.08s; }
.drawer.is-open .dsec:nth-child(4) { animation-delay: 0.12s; }
.drawer.is-open .dsec:nth-child(5) { animation-delay: 0.16s; }
.drawer.is-open .dsec:nth-child(6) { animation-delay: 0.2s; }
.drawer.is-open .dsec:nth-child(7) { animation-delay: 0.24s; }
.dsec { padding: 16px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.dsec:last-child { border-bottom: 0; }
.dsec-title { font-size: 12px; font-weight: 700; color: var(--gold); letter-spacing: 0.06em; display: flex; align-items: baseline; gap: 8px; }
.hint { font-size: 11px; color: var(--muted); font-weight: 400; letter-spacing: 0; }
.sub-title { font-size: 11.5px; color: var(--text-2); font-weight: 600; margin-top: 6px; }
.grid-2 { display: grid; grid-template-columns: 1fr 120px; gap: 10px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: 11.5px; color: var(--muted); }
.field input, .field select, textarea, .rule-add select {
  height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line-2); background: rgba(0, 0, 0, 0.3); color: var(--text); font: inherit; outline: 0; transition: border-color 0.2s, box-shadow 0.2s;
}
.field input:focus, .field select:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(200, 170, 110, 0.15); }
.tag-input { display: flex; align-items: center; border-radius: 10px; border: 1px solid var(--line-2); background: rgba(0, 0, 0, 0.3); transition: border-color 0.2s, box-shadow 0.2s; }
.tag-input:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(200, 170, 110, 0.15); }
.tag-input i { padding-left: 12px; color: var(--muted); font-style: normal; }
.tag-input input { border: 0 !important; box-shadow: none !important; background: none; padding-left: 4px; width: 100%; }
textarea { height: auto; padding: 12px; resize: vertical; line-height: 1.6; width: 100%; }
select option { background: #0d1421; }

.tier-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.tier-grid button { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 9px 2px 7px; border-radius: 10px; font-size: 11px; color: var(--muted); border: 1px solid var(--line); background: rgba(255, 255, 255, 0.02); transition: all 0.2s; }
.tier-grid button i { width: 14px; height: 14px; transform: rotate(45deg); border-radius: 3px; background: var(--tc); opacity: 0.55; transition: all 0.25s var(--spring); }
.tier-grid button:hover { color: var(--text); border-color: color-mix(in srgb, var(--tc) 50%, transparent); }
.tier-grid button:hover i { opacity: 1; transform: rotate(45deg) scale(1.15); }
.tier-grid button.is-active { color: white; border-color: var(--tc); background: color-mix(in srgb, var(--tc) 16%, transparent); box-shadow: 0 0 18px color-mix(in srgb, var(--tc) 25%, transparent); }
.tier-grid button.is-active i { opacity: 1; box-shadow: 0 0 12px var(--tc); transform: rotate(225deg) scale(1.2); }
.div-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; transition: opacity 0.2s; }
.div-row.is-hidden { display: none; }
.div-row button { height: 32px; border-radius: 8px; border: 1px solid var(--line); color: var(--muted); font-weight: 700; transition: all 0.2s; }
.div-row button:hover { color: var(--text); border-color: var(--line-2); }
.div-row button.is-active { border-color: var(--gold); color: var(--gold-hi); background: rgba(200, 170, 110, 0.1); }
.pos-pick { display: flex; align-items: center; gap: 10px; }
.pick-label { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 6px; font-size: 11px; font-weight: 700; background: rgba(255, 255, 255, 0.06); color: var(--text-2); flex: none; }
.pos-row { flex: 1; display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; }
.pos-row button { min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 7px 2px 5px; border-radius: 10px; font-size: 10.5px; color: var(--muted); border: 1px solid var(--line); transition: all 0.2s; }
.pos-row button .pos { width: 22px; height: 22px; transition: transform 0.3s var(--spring); }
.pos-row button:hover:not(:disabled) { color: var(--text); border-color: var(--line-2); }
.pos-row button:hover:not(:disabled) .pos { transform: scale(1.12); }
.pos-row button.is-active { color: var(--gold-hi); border-color: var(--gold); background: rgba(200, 170, 110, 0.12); }
#f-sub button.is-active { color: var(--text); border-color: rgba(255, 255, 255, 0.35); background: rgba(255, 255, 255, 0.07); }
.pos-row button:disabled { opacity: 0.25; }
.switch { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.switch input { display: none; }
.switch-ui { width: 36px; height: 20px; border-radius: 999px; background: rgba(255, 255, 255, 0.12); position: relative; transition: background 0.25s; flex: none; }
.switch-ui::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: white; transition: transform 0.3s var(--spring); }
.switch input:checked + .switch-ui { background: var(--gold); }
.switch input:checked + .switch-ui::after { transform: translateX(16px); }
.switch input:disabled + .switch-ui { opacity: 0.35; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-row button { height: 32px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--muted); font-size: 12.5px; transition: all 0.2s; }
.chip-row button em { color: var(--gold); }
.chip-row button:hover { color: var(--text); }
.chip-row button.is-active { color: #1b1307; border-color: var(--gold); background: var(--gold); }
.chip-row button.is-active em { color: #1b1307; }
.slider-row { display: flex; align-items: center; gap: 14px; }
.slider-row output { min-width: 140px; text-align: right; font-size: 12.5px; color: var(--gold-hi); font-weight: 600; }
input[type="range"] { --p: 50%; flex: 1; -webkit-appearance: none; appearance: none; height: 6px; border-radius: 6px; outline: 0; background: linear-gradient(90deg, rgba(255, 255, 255, 0.1) 0 50%, transparent 50%), rgba(255, 255, 255, 0.1); }
input[type="range"] { background: linear-gradient(90deg, rgba(255, 255, 255, 0.1) 0, rgba(255, 255, 255, 0.1) min(var(--p), 50%), var(--gold) min(var(--p), 50%), var(--gold) max(var(--p), 50%), rgba(255, 255, 255, 0.1) max(var(--p), 50%)); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: var(--gold-hi); border: 3px solid #0f1828; box-shadow: 0 0 0 1px var(--gold), 0 0 14px rgba(240, 217, 164, 0.6); cursor: grab; transition: transform 0.2s var(--spring); }
input[type="range"]::-webkit-slider-thumb:active { transform: scale(1.25); cursor: grabbing; }
.slider-scale { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--muted); margin-right: 154px; }
.breakdown { border-radius: 12px; border: 1px solid var(--line); overflow: hidden; }
.bd-row { display: flex; justify-content: space-between; gap: 10px; padding: 9px 12px; font-size: 13px; border-bottom: 1px solid var(--line); }
.bd-row b { font-variant-numeric: tabular-nums; }
.bd-form b, .bd-manual b, .bd-inhouse b { color: var(--text-2); }
.bd-total { background: rgba(200, 170, 110, 0.08); border-bottom: 0; }
.bd-total b { color: var(--gold-hi); font-size: 15px; }
.note { font-size: 11.5px; color: var(--warn); }
.note::before { content: "• "; }
.notice { padding: 12px; border-radius: 10px; background: rgba(255, 181, 71, 0.07); border: 1px solid rgba(255, 181, 71, 0.2); color: #ffd394; font-size: 12.5px; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat-ring { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); }
.stat-ring b { display: block; font-size: 14px; }
.stat-ring small { color: var(--muted); font-size: 11px; }
.ring-chart { flex: none; transform: rotate(-90deg); }
.ring-chart text { transform: rotate(90deg); transform-origin: center; fill: var(--text); font-size: 13px; font-weight: 700; }
.rc-bg { fill: none; stroke: rgba(255, 255, 255, 0.08); stroke-width: 6; }
.rc-fg { fill: none; stroke-width: 6; stroke-linecap: round; animation: ring-draw 1s var(--ease) both; }
@keyframes ring-draw { from { stroke-dashoffset: 1000; } }
.kpis { display: grid; grid-template-columns: 0.8fr 1.4fr 1fr; gap: 8px; }
.kpis div { padding: 8px 10px; border-radius: 10px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); }
.kpis small { display: block; font-size: 10.5px; color: var(--muted); }
.kpis b { font-size: 15px; font-variant-numeric: tabular-nums; }
.kpis .d { color: var(--lose); }
.champ-list, .pos-dist { display: flex; flex-direction: column; gap: 6px; }
.champ-row, .pd-row { display: grid; grid-template-columns: 30px 1fr 90px 74px; align-items: center; gap: 10px; animation: rise 0.4s var(--ease) both; }
.champ-row img, .champ-row .ci { width: 30px; height: 30px; border-radius: 8px; background: #1b2638; }
.cn { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.cn b { font-size: 13px; }
.cn small { font-size: 10.5px; color: var(--muted); }
.cbar { height: 6px; border-radius: 6px; background: rgba(255, 255, 255, 0.07); overflow: hidden; }
.cbar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--gold), var(--gold-hi)); animation: grow 0.9s var(--ease) both; transform-origin: left; }
@keyframes grow { from { transform: scaleX(0); } }
.cg { font-size: 11.5px; color: var(--text-2); text-align: right; }
.cg .up { color: var(--win); } .cg .down { color: var(--lose); }
.pd-row { grid-template-columns: 22px 40px 1fr 40px; font-size: 12px; color: var(--text-2); }
.pd-row .pos { width: 20px; height: 20px; color: var(--gold-hi); }
.pd-row em { text-align: right; color: var(--muted); }
.match-strip { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.match { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 2px 4px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.02); animation: pop 0.35s var(--spring) both; }
.match img, .match .ci { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; font-size: 10px; background: #1b2638; }
.match small { font-size: 10px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.match.w { border-color: rgba(61, 220, 151, 0.35); background: rgba(61, 220, 151, 0.06); }
.match.w img { box-shadow: 0 0 0 2px rgba(61, 220, 151, 0.6); }
.match.l { border-color: rgba(255, 107, 122, 0.3); background: rgba(255, 107, 122, 0.05); }
.match.l img { box-shadow: 0 0 0 2px rgba(255, 107, 122, 0.5); }
.match.dim { opacity: 0.4; }
.drawer-foot { flex: none; display: flex; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); background: rgba(0, 0, 0, 0.2); }
.drawer-foot .btn-gold { margin-left: auto; }

/* ───────────── shuffle overlay ───────────── */
.shuffle { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; align-content: center; gap: 40px; background: radial-gradient(circle at 50% 50%, rgba(20, 30, 50, 0.85), rgba(3, 6, 12, 0.96)); animation: fade-in 0.25s ease both; }
.shuffle.out { animation: fade-out 0.45s ease forwards; }
.shuffle-cards { position: relative; width: 520px; height: 200px; }
.sc { --tc: #5b6b80; position: absolute; left: 50%; top: 50%; width: 92px; height: 120px; margin: -60px 0 0 -46px; border-radius: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; background: linear-gradient(180deg, #172236, #0c1320); border: 1px solid color-mix(in srgb, var(--tc) 60%, transparent); box-shadow: 0 0 24px color-mix(in srgb, var(--tc) 30%, transparent); font-size: 11.5px; font-weight: 600; animation: deal-blue 1.1s var(--ease) both; animation-delay: calc(var(--i) * 35ms); }
.sc span { max-width: 84px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shuffle .sc:nth-child(-n+5) { animation-name: deal-blue; }
.shuffle .sc:nth-child(n+6) { animation-name: deal-red; }
@keyframes deal-blue {
  0% { transform: scale(0.5); opacity: 0; }
  35% { opacity: 1; transform: translate(calc((var(--i) - 2) * 56px), -20px) rotate(calc((var(--i) - 2) * 10deg)); }
  65% { transform: translate(calc((2 - var(--i)) * 30px + 40px), 30px) rotate(calc((var(--i) - 2) * -14deg)); }
  100% { transform: translate(calc(-200px + (var(--i) * 18px)), 0) rotate(-6deg); }
}
@keyframes deal-red {
  0% { transform: scale(0.5); opacity: 0; }
  35% { opacity: 1; transform: translate(calc((var(--i) - 7) * 56px), 20px) rotate(calc((var(--i) - 7) * 10deg)); }
  65% { transform: translate(calc((7 - var(--i)) * 30px - 40px), -30px) rotate(calc((var(--i) - 7) * -14deg)); }
  100% { transform: translate(calc(200px - ((9 - var(--i)) * 18px)), 0) rotate(6deg); }
}
.shuffle-text { color: var(--gold-hi); font-weight: 600; letter-spacing: 0.04em; display: flex; align-items: center; gap: 6px; }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--gold-hi); animation: bounce 0.9s ease-in-out infinite; }
.dots i:nth-child(2) { animation-delay: 0.15s; } .dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounce { 50% { transform: translateY(-6px); opacity: 0.4; } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; transform: scale(1.04); } }

/* ───────────── result view ───────────── */
#view-result { grid-template-rows: auto auto auto minmax(0, 1fr); gap: 14px; }
.result-top { display: flex; align-items: center; gap: 14px; }
.alt-tabs { display: flex; gap: 6px; margin: 0 auto; }
.alt { display: flex; flex-direction: column; align-items: center; padding: 6px 14px; border-radius: 10px; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.25); color: var(--muted); line-height: 1.2; transition: all 0.2s; }
.alt b { font-size: 13px; }
.alt small { font-size: 10.5px; }
.alt:hover { color: var(--text); border-color: var(--line-2); transform: translateY(-1px); }
.alt.is-active { color: var(--gold-hi); border-color: var(--gold); background: rgba(200, 170, 110, 0.12); box-shadow: 0 0 18px rgba(200, 170, 110, 0.18); }
.alt-manual.is-active { color: #c9b6ff; border-color: #9a7dff; background: rgba(154, 125, 255, 0.12); }
.result-actions { display: flex; gap: 8px; }
.swap-hint { justify-self: center; padding: 8px 18px; border-radius: 999px; background: rgba(154, 125, 255, 0.14); border: 1px solid rgba(154, 125, 255, 0.4); color: #ddd2ff; font-size: 13px; animation: pop 0.3s var(--spring); }
#view-result .swap-hint ~ .versus { margin-top: -4px; }

.versus { position: relative; display: grid; grid-template-columns: 1fr 220px 1fr; align-items: center; padding: 16px 26px 14px; border-radius: 18px; background: linear-gradient(90deg, rgba(37, 99, 235, 0.22), rgba(10, 16, 28, 0.75) 35%, rgba(10, 16, 28, 0.75) 65%, rgba(225, 29, 72, 0.22)); border: 1px solid var(--line); backdrop-filter: blur(14px); overflow: hidden; }
.versus::before { content: ""; position: absolute; inset: 0; background: linear-gradient(105deg, transparent 40%, rgba(255, 255, 255, 0.06) 50%, transparent 60%); background-size: 300% 100%; animation: shimmer 6s linear infinite; pointer-events: none; }
.vs-team { display: flex; flex-direction: column; }
.vs-red { align-items: flex-end; text-align: right; }
.vs-label { font-size: 12px; font-weight: 800; letter-spacing: 0.3em; }
.vs-blue .vs-label { color: var(--blue-hi); }
.vs-red .vs-label { color: var(--red-hi); }
.vs-total { display: flex; align-items: baseline; gap: 4px; }
.vs-total b { font-size: 38px; font-weight: 900; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.vs-blue .vs-total b { color: #cfe2ff; text-shadow: 0 0 24px rgba(61, 139, 255, 0.6); }
.vs-red .vs-total b { color: #ffd5da; text-shadow: 0 0 24px rgba(255, 77, 94, 0.6); }
.vs-total small { color: var(--muted); }
.vs-avg { font-size: 12px; color: var(--muted); }
.vs-center { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.vs-emblem { position: relative; width: 64px; height: 64px; display: grid; place-items: center; }
.vs-emblem::before { content: ""; position: absolute; inset: 0; border: 2px solid var(--gold); transform: rotate(45deg); border-radius: 8px; box-shadow: 0 0 24px rgba(200, 170, 110, 0.45), inset 0 0 18px rgba(200, 170, 110, 0.25); animation: emblem 5s ease-in-out infinite; }
.vs-emblem::after { content: ""; position: absolute; inset: -8px; border: 1px solid rgba(200, 170, 110, 0.3); transform: rotate(45deg); border-radius: 10px; animation: spin 12s linear infinite reverse; }
.vs-emblem span { position: relative; font-weight: 900; font-size: 20px; font-style: italic; color: var(--gold-hi); letter-spacing: 0.05em; }
@keyframes emblem { 50% { transform: rotate(225deg); } }
.vs-verdict { font-size: 13px; font-weight: 700; padding: 3px 12px; border-radius: 999px; }
.v-great { color: #86f5c4; background: rgba(61, 220, 151, 0.12); }
.v-good { color: #bdf0d9; background: rgba(61, 220, 151, 0.08); }
.v-mid { color: #ffd394; background: rgba(255, 181, 71, 0.1); }
.v-bad { color: #ffb0b8; background: rgba(255, 107, 122, 0.12); }
.vs-meter { grid-column: 1 / -1; margin-top: 12px; }
.vm-track { position: relative; height: 10px; border-radius: 10px; overflow: hidden; display: flex; background: rgba(255, 255, 255, 0.06); }
.vm-blue, .vm-red { height: 100%; width: var(--w); transition: width 0.9s var(--ease); }
.vm-blue { background: linear-gradient(90deg, #1d4ed8, #5aa0ff); box-shadow: 0 0 14px rgba(61, 139, 255, 0.6); }
.vm-red { background: linear-gradient(90deg, #ff6f7d, #be123c); box-shadow: 0 0 14px rgba(255, 77, 94, 0.6); }
.vm-mid { position: absolute; left: 50%; top: -2px; bottom: -2px; width: 2px; background: rgba(255, 255, 255, 0.7); transform: translateX(-1px); }
.versus.animate .vm-blue, .versus.animate .vm-red { animation: meter 1.1s var(--ease) 0.3s both; }
@keyframes meter { from { width: 50%; } }
.vm-labels { display: flex; justify-content: space-between; margin-top: 6px; font-size: 12px; color: var(--muted); }
.vm-labels b { color: var(--text); }
.versus.animate .vs-blue { animation: from-left 0.6s var(--ease) both; }
.versus.animate .vs-red { animation: from-right 0.6s var(--ease) both; }
.versus.animate .vs-center { animation: clash 0.7s var(--spring) 0.15s both; }
@keyframes from-left { from { opacity: 0; transform: translateX(-40px); } }
@keyframes from-right { from { opacity: 0; transform: translateX(40px); } }
@keyframes clash { from { opacity: 0; transform: scale(2.2); filter: blur(6px); } }

.result-body { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 16px; min-height: 0; }
.lanes { display: grid; grid-template-rows: repeat(5, minmax(0, 1fr)); gap: 8px; min-height: 0; }
.lane-row { display: grid; grid-template-columns: minmax(0, 1fr) 150px minmax(0, 1fr); align-items: stretch; gap: 10px; min-height: 0; }
.lanes.animate .rp-blue { animation: from-left 0.55s var(--ease) both; animation-delay: calc(0.25s + var(--i) * 70ms); }
.lanes.animate .rp-red { animation: from-right 0.55s var(--ease) both; animation-delay: calc(0.25s + var(--i) * 70ms); }
.lanes.animate .lane-mid { animation: fade-in 0.5s ease both; animation-delay: calc(0.45s + var(--i) * 70ms); }
.lane-row { --i: 0; }
.lane-row .rp, .lane-row .lane-mid { --i: inherit; }
.rp {
  --tc: #5b6b80; position: relative; display: flex; align-items: center; gap: 12px; padding: 8px 16px; border-radius: 14px; cursor: pointer; min-height: 0; overflow: hidden;
  border: 1px solid var(--line); transition: transform 0.25s var(--ease), border-color 0.25s, box-shadow 0.25s, background 0.25s;
}
.rp-blue { background: linear-gradient(90deg, rgba(37, 99, 235, 0.28), rgba(13, 20, 33, 0.8) 60%); border-left: 3px solid #4c8dff; }
.rp-red { flex-direction: row-reverse; text-align: right; background: linear-gradient(270deg, rgba(225, 29, 72, 0.28), rgba(13, 20, 33, 0.8) 60%); border-right: 3px solid #ff5a6a; }
.rp:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35); }
.rp-blue:hover { box-shadow: 0 10px 28px rgba(37, 99, 235, 0.25); }
.rp-red:hover { box-shadow: 0 10px 28px rgba(225, 29, 72, 0.25); }
.rp .avatar { box-shadow: 0 0 0 2px color-mix(in srgb, var(--tc) 70%, transparent); }
.rp-text { flex: 1; min-width: 0; }
.rp-name { font-size: 15px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-name small { font-size: 11px; color: var(--muted); font-weight: 500; margin-left: 3px; }
.rp-sub { display: flex; align-items: center; gap: 8px; margin-top: 2px; flex-wrap: wrap; }
.rp-red .rp-sub { justify-content: flex-end; }
.rp-score { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; }
.rp-red .rp-score { align-items: flex-start; }
.rp-score b { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.rp-score small { font-size: 10.5px; color: var(--muted); }
.fit { font-size: 10.5px; padding: 1px 7px; border-radius: 999px; font-weight: 600; }
.fit-main { color: #9ff3cf; background: rgba(61, 220, 151, 0.12); }
.fit-sub { color: #cfe3ff; background: rgba(140, 180, 255, 0.12); }
.fit-fill { color: #e0d3ff; background: rgba(154, 125, 255, 0.14); }
.fit-unknown { color: var(--muted); background: rgba(255, 255, 255, 0.06); }
.fit-off { color: #ffc28a; background: rgba(255, 150, 60, 0.15); }
.rp.is-swappable { animation: none !important; }
.rp.is-swappable:hover { border-color: #9a7dff; }
.rp.is-picked { border-color: #9a7dff; box-shadow: 0 0 0 2px rgba(154, 125, 255, 0.5), 0 0 30px rgba(154, 125, 255, 0.35); animation: jiggle 0.9s ease-in-out infinite !important; }
@keyframes jiggle { 25% { transform: rotate(-0.6deg) translateY(-1px); } 75% { transform: rotate(0.6deg) translateY(-1px); } }
.lane-mid { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; }
.lane-icon { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--gold-hi); }
.lane-icon .pos { width: 22px; height: 22px; }
.lane-diff { position: relative; width: 100%; height: 6px; border-radius: 6px; background: rgba(255, 255, 255, 0.07); }
.lane-diff::after { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 2px; background: rgba(255, 255, 255, 0.4); transform: translateX(-1px); }
.ld-bar { position: absolute; top: 0; bottom: 0; width: var(--w); border-radius: 6px; animation: grow 0.8s var(--ease) 0.5s both; }
.ld-bar.to-blue { right: 50%; background: linear-gradient(270deg, #5aa0ff, #1d4ed8); transform-origin: right; }
.ld-bar.to-red { left: 50%; background: linear-gradient(90deg, #ff6f7d, #be123c); transform-origin: left; }
.lane-num { font-size: 11px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.lane-num.blue { color: var(--blue-hi); } .lane-num.red { color: var(--red-hi); } .lane-num.even { color: #9ff3cf; }

.analysis { padding: 0; overflow: hidden; display: flex; flex-direction: column; min-height: 0; }
.an-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 18px 10px; display: flex; flex-direction: column; gap: 8px; }
.analysis .record { flex: none; margin: 0; padding: 12px 18px 16px; background: rgba(6, 10, 18, 0.55); }
.lanes.animate + .analysis { animation: from-right 0.6s var(--ease) 0.2s both; }
.analysis h3 { margin: 0; font-size: 15px; }
.an-lead { margin: 0; font-size: 12.5px; color: var(--text-2); }
.an-lead b { color: var(--gold-hi); }
.an-lead small { color: var(--muted); }
.cost-list { display: flex; flex-direction: column; gap: 6px; }
.cost-head { display: flex; justify-content: space-between; font-size: 12.5px; }
.cost-head b { font-variant-numeric: tabular-nums; color: var(--text); }
.cost-bar { height: 5px; border-radius: 5px; background: rgba(255, 255, 255, 0.06); margin: 4px 0 2px; overflow: hidden; }
.cost-bar i { display: block; height: 100%; width: var(--w); border-radius: inherit; background: linear-gradient(90deg, var(--gold), var(--gold-hi)); animation: grow 0.9s var(--ease) 0.4s both; transform-origin: left; }
.cost-row small { font-size: 11px; color: var(--muted); }
.an-sub { font-size: 11.5px; font-weight: 700; color: var(--gold); margin-top: 6px; letter-spacing: 0.04em; }
.an-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; }
.an-list li { display: flex; align-items: center; gap: 8px; }
.an-list small { color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; }
.dot-blue { background: var(--blue); } .dot-red { background: var(--red); }
.comp { display: flex; flex-direction: column; gap: 5px; }
.comp-row { display: grid; grid-template-columns: 1fr 52px 1fr; align-items: center; gap: 8px; font-size: 12px; }
.comp-row .ck { text-align: center; color: var(--text-2); }
.comp-row .cb { display: flex; justify-content: flex-end; gap: 3px; }
.comp-row .cr { display: flex; gap: 3px; }
.comp-row i { width: 14px; height: 14px; border-radius: 4px; animation: pop 0.4s var(--spring) both; }
.comp-row .cb i { background: linear-gradient(135deg, #5aa0ff, #1d4ed8); }
.comp-row .cr i { background: linear-gradient(135deg, #ff6f7d, #be123c); }
.record { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.record-btns { display: flex; gap: 8px; }
.record small { font-size: 11px; }
.record-done { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 14px; border-radius: 12px; background: rgba(200, 170, 110, 0.1); color: var(--gold-hi); font-weight: 700; animation: pop 0.4s var(--spring); }
.record-done b { font-size: 18px; font-variant-numeric: tabular-nums; margin-right: 4px; }
.record-done.rd-blue { background: rgba(37, 99, 235, 0.16); color: var(--blue-hi); }
.record-done.rd-red { background: rgba(225, 29, 72, 0.16); color: var(--red-hi); }
.record.is-done .btn-sm { align-self: center; }
.record-go { width: 100%; height: 44px; font-size: 14px; }
.record-go:disabled { opacity: 0.55; }

/* series score picker (2:1 etc.) */
.series { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
.series-side { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 6px; border-radius: 12px; border: 1px solid var(--line); transition: background 0.25s, border-color 0.25s, box-shadow 0.25s; }
.s-blue { background: rgba(37, 99, 235, 0.08); }
.s-red { background: rgba(225, 29, 72, 0.08); }
.s-blue.is-lead { background: rgba(37, 99, 235, 0.22); border-color: rgba(90, 160, 255, 0.55); box-shadow: 0 0 18px rgba(61, 139, 255, 0.25); }
.s-red.is-lead { background: rgba(225, 29, 72, 0.22); border-color: rgba(255, 111, 125, 0.55); box-shadow: 0 0 18px rgba(255, 77, 94, 0.25); }
.ss-label { font-size: 11px; font-weight: 800; letter-spacing: 0.12em; }
.s-blue .ss-label { color: var(--blue-hi); }
.s-red .ss-label { color: var(--red-hi); }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper b { min-width: 26px; text-align: center; font-size: 26px; font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1; }
.is-lead .stepper b { animation: pop 0.3s var(--spring); }
.stepper button { width: 26px; height: 26px; border-radius: 8px; border: 1px solid var(--line-2); color: var(--text-2); font-size: 16px; line-height: 1; transition: background 0.15s, color 0.15s, transform 0.15s; }
.stepper button:hover:not(:disabled) { background: rgba(255, 255, 255, 0.08); color: var(--text); }
.stepper button:active:not(:disabled) { transform: scale(0.88); }
.stepper button:disabled { opacity: 0.3; }
.series-colon { font-size: 22px; font-weight: 900; color: var(--muted); }
.series-quick { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.series-quick button { height: 26px; border-radius: 7px; font-size: 11.5px; font-weight: 700; color: var(--muted); border: 1px solid var(--line); font-variant-numeric: tabular-nums; transition: all 0.15s; }
.series-quick button.q-blue:hover, .series-quick button.q-blue.is-active { color: var(--blue-hi); border-color: rgba(90, 160, 255, 0.5); background: rgba(37, 99, 235, 0.15); }
.series-quick button.q-red:hover, .series-quick button.q-red.is-active { color: var(--red-hi); border-color: rgba(255, 111, 125, 0.5); background: rgba(225, 29, 72, 0.15); }
.edit-series { display: flex; flex-direction: column; gap: 8px; }
.t-blue { color: var(--blue-hi); font-weight: 700; }
.t-red { color: var(--red-hi); font-weight: 700; }

/* history score column */
.hm-score { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 4px; border-radius: 10px; border: 1px solid transparent; transition: background 0.2s, border-color 0.2s; }
.hm-score:hover { background: rgba(200, 170, 110, 0.08); border-color: var(--gold-line); }
.hm-score span { display: flex; align-items: baseline; gap: 5px; }
.hm-score b { font-size: 20px; font-weight: 900; color: var(--muted); font-variant-numeric: tabular-nums; }
.hm-score b.win { color: var(--gold-hi); text-shadow: 0 0 12px rgba(240, 217, 164, 0.45); }
.hm-score i { font-style: normal; color: var(--muted); font-weight: 700; }
.hm-score small { font-size: 10px; color: var(--muted); }

/* ───────────── history view ───────────── */
#view-history { grid-template-columns: 380px minmax(0, 1fr); gap: 20px; }
.hist-board, .hist-list { display: flex; flex-direction: column; min-height: 0; animation: rise 0.5s var(--ease) both; }
.hist-list { animation-delay: 0.08s; }
.board, .matches { flex: 1; overflow-y: auto; padding: 0 12px 12px; display: flex; flex-direction: column; gap: 6px; }
.board-row { display: grid; grid-template-columns: 28px 34px 1fr auto 56px; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: rgba(255, 255, 255, 0.025); border: 1px solid var(--line); animation: rise 0.4s var(--ease) both; animation-delay: calc(var(--i) * 40ms); }
.rank { font-weight: 900; text-align: center; color: var(--muted); }
.rank.r1 { color: #ffd76a; text-shadow: 0 0 12px rgba(255, 215, 106, 0.6); } .rank.r2 { color: #d8e2ee; } .rank.r3 { color: #e3a170; }
.bn { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.bn small { font-size: 11px; color: var(--muted); }
.bw { font-size: 12px; color: var(--text-2); }
.bw em { color: var(--muted); margin-left: 4px; }
.badj { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }
.badj.up { color: var(--win); } .badj.down { color: var(--lose); }
.hm { display: grid; grid-template-columns: 90px 1fr 76px 1fr 36px; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, 0.025); border: 1px solid var(--line); animation: rise 0.4s var(--ease) both; animation-delay: calc(var(--i) * 30ms); }
.hm-date { font-size: 12.5px; font-weight: 600; display: flex; flex-direction: column; }
.hm-date small { color: var(--muted); font-weight: 400; }
.hm-team { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; padding: 6px 8px; border-radius: 10px; font-size: 12px; color: var(--text-2); }
.hm-team span { padding: 1px 6px; border-radius: 6px; background: rgba(255, 255, 255, 0.05); }
.hm-blue { background: rgba(37, 99, 235, 0.08); }
.hm-red { background: rgba(225, 29, 72, 0.08); }
.hm-blue.won { background: rgba(37, 99, 235, 0.22); box-shadow: inset 0 0 0 1px rgba(90, 160, 255, 0.4); color: white; }
.hm-red.won { background: rgba(225, 29, 72, 0.22); box-shadow: inset 0 0 0 1px rgba(255, 111, 125, 0.4); color: white; }
.wtag { font-size: 11px; padding: 1px 7px; border-radius: 6px; background: var(--gold); color: #1b1307; }
.empty-hist { padding: 40px 20px; text-align: center; }

/* ───────────── modal / toasts / misc ───────────── */
.modal-wrap { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px; background: rgba(3, 6, 12, 0.6); backdrop-filter: blur(5px); opacity: 0; transition: opacity 0.22s; }
.modal-wrap.in { opacity: 1; }
.modal-wrap.out { opacity: 0; }
.modal { width: min(480px, 100%); max-height: 88vh; overflow-y: auto; padding: 24px; border-radius: 18px; background: linear-gradient(180deg, #121c2d, #0c1320); border: 1px solid var(--gold-line); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6); display: flex; flex-direction: column; gap: 14px; transform: translateY(16px) scale(0.97); transition: transform 0.35s var(--spring); }
.modal-wrap.in .modal { transform: none; }
.modal-wide { width: min(720px, 100%); }
.modal h3 { margin: 0; font-size: 18px; }
.modal p { margin: 0; line-height: 1.6; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.set-mode { display: flex; gap: 12px; padding: 12px 14px; border-radius: 12px; background: rgba(200, 170, 110, 0.07); border: 1px solid var(--gold-line); }
.set-mode i { width: 10px; height: 10px; margin-top: 5px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 10px var(--gold); flex: none; }
.set-mode.is-riot { background: rgba(61, 220, 151, 0.07); border-color: rgba(61, 220, 151, 0.3); }
.set-mode.is-riot i { background: var(--win); box-shadow: 0 0 10px var(--win); }
.set-mode small { display: block; color: var(--muted); margin-top: 2px; }
.rules { display: flex; flex-direction: column; gap: 6px; }
.rule { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 10px; border-radius: 10px; background: rgba(255, 255, 255, 0.03); border: 1px solid var(--line); animation: rise 0.3s var(--ease); }
.rule .icon-btn { margin-left: auto; width: 30px; height: 30px; }
.rule-type { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.rule-type.together { color: #9ff3cf; background: rgba(61, 220, 151, 0.12); }
.rule-type.apart { color: #ffb0b8; background: rgba(255, 107, 122, 0.12); }
.rule-add { display: grid; grid-template-columns: 1fr 96px 1fr auto; gap: 6px; }
.rule-add select { height: 34px; }
.how { display: flex; flex-direction: column; gap: 14px; }
.how-step { display: flex; gap: 14px; }
.how-step > span { width: 28px; height: 28px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #1b1307; background: linear-gradient(135deg, var(--gold-hi), var(--gold)); }
.how-step b { font-size: 14px; }
.how-step p { margin: 4px 0 0; font-size: 13px; color: var(--text-2); }
.how-step p.muted { color: var(--muted); }
.formula { margin: 8px 0; padding: 12px 14px; border-radius: 10px; background: rgba(0, 0, 0, 0.35); border: 1px solid var(--line); font-family: Consolas, "D2Coding", monospace; font-size: 12.5px; line-height: 1.8; color: var(--gold-hi); }

.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; max-width: 420px; padding: 11px 16px; border-radius: 12px; background: rgba(16, 24, 38, 0.95); border: 1px solid var(--line-2); box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45); font-size: 13px; animation: toast-in 0.4s var(--spring) both; backdrop-filter: blur(10px); }
.toast.out { animation: toast-out 0.35s ease forwards; }
.toast { pointer-events: auto; }
.toast-act { margin-left: 6px; padding: 4px 10px; border-radius: 8px; font-size: 12.5px; font-weight: 700; color: var(--gold-hi); border: 1px solid var(--gold-line); transition: background 0.15s; white-space: nowrap; }
.toast-act:hover { background: rgba(200, 170, 110, 0.15); }
.help-btn { font-weight: 800; font-size: 15px; border: 1px solid var(--line-2); border-radius: 50%; width: 30px; height: 30px; }
.next-game { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.next-game .btn { flex: 1 1 auto; }
.set-backup { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.set-backup code { font-size: 11.5px; color: var(--text-2); }
.set-backup-btns { display: flex; gap: 8px; }
.set-backup-btns a { text-decoration: none; }
.toast-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); flex: none; }
.toast-ok .toast-dot { background: var(--win); box-shadow: 0 0 8px var(--win); }
.toast-err { border-color: rgba(255, 107, 122, 0.4); }
.toast-err .toast-dot { background: var(--lose); box-shadow: 0 0 8px var(--lose); }
.toast-warn .toast-dot { background: var(--warn); }
@keyframes toast-in { from { opacity: 0; transform: translateX(40px) scale(0.95); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(30px); } }

.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 90; overflow: hidden; }
.confetti i { position: absolute; top: -20px; left: var(--x); width: 8px; height: 14px; border-radius: 2px; animation: fall var(--d) cubic-bezier(.25, .6, .4, 1) forwards; }
@keyframes fall { to { transform: translate(var(--dx), 110vh) rotate(var(--r)); opacity: 0.8; } }

.offline { position: fixed; inset: 0; z-index: 100; display: none; place-items: center; background: rgba(3, 6, 12, 0.85); backdrop-filter: blur(6px); }
.offline.is-on { display: grid; }
.offline-card { text-align: center; padding: 32px 40px; border-radius: 18px; background: #0f1828; border: 1px solid var(--gold-line); }
.offline-card h3 { margin: 0 0 10px; }
.offline-card p { margin: 0; color: var(--muted); line-height: 1.7; }

/* ───────────── roles (server mode) ───────────── */
.member-only { display: none !important; }
.role-member .admin-only { display: none !important; }
.role-member .me-bar.member-only { display: flex !important; }
.role-member .icon-btn.member-only { display: grid !important; }
.role-member #view-roster { grid-template-columns: 1fr; }
.drawer.read-only [data-perm="edit"], .drawer.read-only [data-perm="admin"], .drawer.no-admin [data-perm="admin"] { display: none !important; }
.card.is-me { border-color: rgba(240, 217, 164, 0.55); box-shadow: 0 0 0 1px rgba(240, 217, 164, 0.25), 0 0 26px rgba(200, 170, 110, 0.18); }
.card.is-me::before { content: "나"; position: absolute; top: 8px; left: 8px; z-index: 2; font-size: 10.5px; font-weight: 800; padding: 1px 7px; border-radius: 999px; background: var(--gold); color: #1b1307; }
.card-empty.is-open { cursor: default; }
.card-empty.is-open:hover { transform: none; border-color: rgba(255, 255, 255, 0.1); color: var(--muted); background: rgba(255, 255, 255, 0.015); }
.card-pos:disabled { cursor: default; }
.card-pos:disabled:hover { border-color: transparent; background: none; }

.me-bar { align-items: center; gap: 12px; padding: 10px 14px; border-radius: 14px; background: linear-gradient(90deg, rgba(200, 170, 110, 0.16), rgba(13, 20, 33, 0.7)); border: 1px solid var(--gold-line); animation: rise 0.4s var(--ease) both; }
.me-bar:empty { display: none !important; }
.me-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.me-text b { font-size: 15px; }
.me-text b small { font-weight: 500; color: var(--muted); font-size: 12px; }
.me-text span { font-size: 12.5px; color: var(--text-2); }
.me-text .ok { color: var(--win); }
.me-text .wait { color: var(--warn); }
.waitlist { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.waitlist:empty { display: none; }
.wl-label { font-size: 12px; font-weight: 700; color: var(--warn); margin-right: 2px; }
.wl-chip { font-size: 12px; padding: 4px 10px; border-radius: 999px; background: rgba(255, 181, 71, 0.08); border: 1px solid rgba(255, 181, 71, 0.3); color: #ffd394; }
button.wl-chip:hover { background: rgba(255, 181, 71, 0.18); }
.wl-chip em { font-weight: 800; margin-left: 2px; }
.wl-badge { font-size: 10px; padding: 0 6px; border-radius: 999px; background: rgba(255, 181, 71, 0.18); color: #ffd394; font-weight: 700; }
.invite-row { display: flex; gap: 6px; }
.invite-row input { flex: 1; height: 34px; padding: 0 10px; border-radius: 9px; border: 1px solid var(--line-2); background: rgba(0, 0, 0, 0.3); color: var(--text-2); font: inherit; font-size: 12px; }

/* sign-in gate */
.gate { position: fixed; inset: 0; z-index: 70; display: none; place-items: center; padding: 20px; background: radial-gradient(circle at 50% 30%, rgba(20, 30, 50, 0.9), rgba(3, 6, 12, 0.97)); backdrop-filter: blur(6px); }
.gate.is-on { display: grid; animation: fade-in 0.3s ease both; }
.gate-card { width: min(420px, 100%); padding: 28px; border-radius: 20px; background: linear-gradient(180deg, #121c2d, #0c1320); border: 1px solid var(--gold-line); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6); display: flex; flex-direction: column; gap: 12px; text-align: center; animation: pop 0.45s var(--spring) both; }
.gate-card h2 { margin: 4px 0 0; }
.gate-card p { margin: 0; line-height: 1.6; font-size: 13.5px; }
.gate-card input { height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line-2); background: rgba(0, 0, 0, 0.35); color: var(--text); font: inherit; outline: 0; }
.gate-card input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(200, 170, 110, 0.15); }
.gate-card .btn { height: 44px; }
.gate-err { color: var(--lose) !important; font-size: 13px; }
.brand-mark.big { width: 54px; height: 54px; margin: 0 auto; }
.gate-who { width: min(460px, 100%); text-align: left; }
.who-list { max-height: 46vh; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.who-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; border: 1px solid var(--line); text-align: left; transition: background 0.15s, border-color 0.15s; }
.who-row:hover { background: rgba(200, 170, 110, 0.08); border-color: var(--gold-line); }
.who-row span { display: flex; flex-direction: column; line-height: 1.2; }
.who-row small { color: var(--muted); font-size: 11px; }
.who-new { display: flex; gap: 6px; }
.who-new input { flex: 1; height: 38px; }

/* ───────────── responsive ───────────── */
@media (max-width: 1240px) {
  .slots { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
  .card-champs { display: none; }
  .balance-bar { grid-template-columns: 1fr 220px; }
  .balance-mid { grid-column: 1 / -1; grid-row: 2; }
  .result-body { grid-template-columns: minmax(0, 1fr) 290px; }
}
@media (max-width: 980px) {
  body { overflow: auto; }
  .view { position: static; min-height: calc(100vh - 68px); }
  #view-roster, #view-history, .result-body { grid-template-columns: 1fr; }
  .pool { max-height: 320px; }
  .slots { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: none; }
  .card { min-height: 250px; }
  .tabs .tab { padding: 8px 10px; }
  .brand { min-width: 0; } .brand-sub { display: none; }
  .top-actions { min-width: 0; } .provider-chip { display: none; }
  .lane-row { grid-template-columns: 1fr 90px 1fr; }
  .result-top { flex-wrap: wrap; }
  .versus { grid-template-columns: 1fr auto 1fr; padding: 14px; }
  .vs-total b { font-size: 28px; }
}

/* phones */
@media (max-width: 640px) {
  body { font-size: 13.5px; }
  .topbar { height: 56px; padding: 0 12px; gap: 8px; position: sticky; top: 0; }
  .brand { gap: 8px; }
  .brand-mark { width: 26px; height: 26px; }
  .brand-title { font-size: 12px; letter-spacing: 0.14em; }
  .tabs { padding: 3px; gap: 0; }
  .tabs .tab { padding: 7px 9px; font-size: 12px; gap: 4px; white-space: nowrap; }
  .tab em { display: none; }
  .brand-title { white-space: nowrap; }
  .brand > div:last-child { display: none; }
  .tab-num { display: none; }
  .top-actions { gap: 4px; }
  .icon-btn { width: 32px; height: 32px; }
  .view { min-height: calc(100vh - 56px); padding: 12px 12px 90px; }

  .lineup { gap: 10px; }
  .lineup-head { flex-direction: column; align-items: stretch; gap: 8px; }
  .lineup-head h1 { font-size: 20px; }
  .ready-bar { width: 120px; }
  .lineup-head .head-actions { overflow-x: auto; padding-bottom: 2px; }
  .lineup-head .head-actions .btn { flex: none; height: 34px; padding: 0 12px; font-size: 12.5px; }
  .slots { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .card { min-height: 0; padding: 10px 8px 8px; }
  .card-avatar { width: 50px; height: 50px; }
  .card-avatar .avatar { width: 44px; height: 44px; }
  .card-avatar .ring { -webkit-mask: radial-gradient(circle, transparent 23px, #000 24px); mask: radial-gradient(circle, transparent 23px, #000 24px); }
  .card-name { font-size: 13.5px; margin-top: 6px; }
  .card-score b { font-size: 17px; }
  .card-form small { display: none; }
  .card-empty { min-height: 120px; }
  .card-x { opacity: 1; transform: none; }
  .me-bar { flex-wrap: wrap; }
  .me-bar .me-text { flex-basis: calc(100% - 60px); }
  .me-bar .btn { flex: 1; }
  .balance-bar { grid-template-columns: 1fr; gap: 12px; padding: 12px; }
  .balance-mid { grid-column: auto; grid-row: auto; }
  .segmented button { padding: 7px 10px; font-size: 12.5px; }
  .cta { height: 56px; }
  .pool { max-height: 280px; }

  .result-top { flex-wrap: wrap; gap: 8px; }
  .alt-tabs { order: 3; width: 100%; overflow-x: auto; margin: 0; padding-bottom: 2px; }
  .alt { flex: none; padding: 5px 11px; }
  .result-actions { margin-left: auto; }
  .result-actions .btn { height: 34px; padding: 0 10px; font-size: 12.5px; }
  .versus { grid-template-columns: 1fr auto 1fr; padding: 12px; border-radius: 14px; }
  .vs-total b { font-size: 24px; }
  .vs-label { font-size: 10px; letter-spacing: 0.18em; }
  .vs-emblem { width: 42px; height: 42px; }
  .vs-emblem span { font-size: 14px; }
  .vs-verdict { font-size: 11px; padding: 2px 8px; text-align: center; }
  .vm-labels { font-size: 11px; }
  .vm-labels small { display: none; }
  .result-body { grid-template-columns: 1fr; }
  .lanes { grid-template-rows: none; }
  .lane-row { grid-template-columns: minmax(0, 1fr) 52px minmax(0, 1fr); gap: 5px; }
  .rp { padding: 7px 8px; gap: 7px; border-radius: 11px; }
  .rp .avatar { width: 30px; height: 30px; font-size: 10px; }
  .rp-name { font-size: 12.5px; }
  .rp-name small { display: none; }
  .rp-sub { gap: 4px; }
  .rp-sub .chip, .rp-sub .fit { display: none; }
  .rp-sub .tier-badge { font-size: 10.5px; }
  .rp-score b { font-size: 14px; }
  .rp-score small { display: none; }
  .lane-icon span { display: none; }
  .lane-num { font-size: 10px; }
  .analysis { overflow: visible; }
  .an-scroll { overflow: visible; }

  #view-history { grid-template-columns: 1fr; }
  .hm { grid-template-columns: 1fr 64px 1fr 32px; }
  .hm-date { grid-column: 1 / -1; flex-direction: row; gap: 8px; }

  .drawer { width: 100vw; border-left: 0; }
  .modal { padding: 18px; border-radius: 16px; }
  .modal-wrap { padding: 10px; align-items: end; }
  .bulk-row { grid-template-columns: 1fr; gap: 6px; }
  .pos-pop { width: calc(100vw - 16px); }
  .rule-add { grid-template-columns: 1fr 1fr; }
  .toasts { left: 10px; right: 10px; bottom: 12px; align-items: stretch; }
  .toast { max-width: none; }
  .shuffle-cards { transform: scale(0.6); }
}

@media (min-width: 981px) and (max-height: 780px) {
  .card { padding-top: 10px; }
  .card-avatar { width: 54px; height: 54px; }
  .card-avatar .avatar { width: 48px; height: 48px; }
  .card-avatar .ring { -webkit-mask: radial-gradient(circle, transparent 25px, #000 26px); mask: radial-gradient(circle, transparent 25px, #000 26px); }
  .card-name { margin-top: 6px; font-size: 14px; }
  .card-score b { font-size: 18px; }
  .card-form small, .card-champs { display: none; }
  .card-form { min-height: 0; }
  .balance-bar { padding-top: 10px; padding-bottom: 10px; }
  .cta { height: 56px; }
  .vs-total b { font-size: 30px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}
