/* BAHH Duel. Duel Disk / Neuron inspired: deep navy, holo cyan, gold LP. */
:root {
  --bg0: #04070f;
  --bg1: #0a1324;
  --panel: rgba(8, 17, 34, 0.82);
  --panel2: rgba(14, 28, 52, 0.9);
  --line: rgba(255, 255, 255, 0.26);
  --line2: rgba(255, 255, 255, 0.5);
  --cyan: #f2852a;
  --cyan2: #d96a12;
  --gold: #ffc940;
  --red: #ff3b5c;
  --green: #36f0a0;
  --purple: #a86bff;
  --txt: #e7f4ff;
  --mute: #8aa3c2;
  --mz: #ff9d3c;
  --st: #22e3b0;
  --fz: #6be36b;
  --emz: #b67cff;
  --pile: #45c8ff;
  --team-a: #39a0ff;
  --team-b: #ff4d6d;
  --font-d: 'Orbitron', 'Rajdhani', system-ui, sans-serif;
  --font: 'Rajdhani', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --r: 12px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg0);
  color: var(--txt);
  font: 500 16px/1.35 var(--font);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--cyan); }
img { -webkit-user-drag: none; user-select: none; }
.ic { flex: none; }
.spacer { flex: 1; }
.muted { color: var(--mute); }
.center { text-align: center; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 520px) { .grid2 { grid-template-columns: 1fr; } }

/* ---- Background (per duelist) ---- */
.bg-layer {
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(ellipse at 50% 120%, rgba(242, 133, 42, 0.16), transparent 60%),
    linear-gradient(rgba(4, 7, 15, 0.45), rgba(4, 7, 15, 0.75)),
    var(--bg-url, none) center / cover no-repeat,
    linear-gradient(180deg, #071226, #04070f);
}
.bg-layer::after {
  content: ''; position: absolute; inset: 0;
  background-image: linear-gradient(rgba(242, 133, 42, 0.05) 1px, transparent 1px), linear-gradient(90deg, rgba(242, 133, 42, 0.05) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at center, #000 30%, transparent 85%);
}
body:not(.in-duel) .bg-layer { filter: brightness(0.7) saturate(0.9); }

/* ---- Buttons and inputs ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 16px; border-radius: 10px;
  border: 1px solid var(--line2); background: rgba(15, 40, 70, 0.6); color: var(--txt);
  font: 700 15px var(--font); letter-spacing: 0.04em; text-transform: uppercase; text-decoration: none;
  transition: background 0.15s, box-shadow 0.15s, transform 0.08s;
}
.btn:hover { background: rgba(25, 64, 105, 0.75); box-shadow: 0 0 14px rgba(242, 133, 42, 0.25); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: default; box-shadow: none; }
.btn.primary { background: linear-gradient(180deg, #19c6ff, #0a7fd6); border-color: #7fe6ff; color: #02101d; box-shadow: 0 0 18px rgba(242, 133, 42, 0.35); }
.btn.primary:hover { background: linear-gradient(180deg, #4dd8ff, #1590e8); }
.btn.danger { border-color: rgba(255, 59, 92, 0.6); color: #ff8da1; }
.btn.ghost { background: transparent; }
.btn.big { min-height: 48px; padding: 0 22px; font-size: 16px; }
.btn.small { min-height: 32px; padding: 0 12px; font-size: 13px; }
.btn.tiny { min-height: 26px; padding: 0 10px; font-size: 12px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px;
  border: 1px solid transparent; background: transparent; color: var(--txt); flex: none; text-decoration: none;
}
.icon-btn:hover { border-color: var(--line); background: rgba(242, 133, 42, 0.08); }
.input {
  width: 100%; min-height: 42px; padding: 8px 12px; border-radius: 10px;
  background: #0b0d12; border: 1px solid var(--line2); color: var(--txt); outline: none; font-size: 16px;
}
.input:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(242, 133, 42, 0.15); }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--cyan) 50%), linear-gradient(135deg, var(--cyan) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
textarea.input { resize: vertical; font-family: ui-monospace, monospace; font-size: 13px; }
.check { display: flex; gap: 10px; align-items: center; margin: 8px 0; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--cyan); }
.chip, .chips button { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); background: rgba(242, 133, 42, 0.08); font-size: 13px; font-weight: 700; }
.chips { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.warn { margin-top: 8px; padding: 8px 12px; border-radius: 8px; background: rgba(255, 201, 64, 0.1); border: 1px solid rgba(255, 201, 64, 0.35); color: var(--gold); }
.err { color: #ff8da1; min-height: 20px; font-weight: 600; }
.empty { padding: 22px; text-align: center; color: var(--mute); border: 1px dashed var(--line); border-radius: var(--r); }
.avatar {
  display: inline-grid; place-items: center; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--uc) 60%, white), var(--uc) 60%, color-mix(in srgb, var(--uc) 50%, black));
  color: #06101c; font: 900 14px var(--font-d); box-shadow: 0 0 10px color-mix(in srgb, var(--uc) 50%, transparent);
}

/* ---- Logo ---- */
.logo { font-family: var(--font-d); font-weight: 900; letter-spacing: 0.14em; display: flex; flex-direction: column; align-items: center; line-height: 1; }
.logo-a { font-size: 18px; color: var(--cyan); text-shadow: 0 0 12px rgba(242, 133, 42, 0.7); letter-spacing: 0.5em; margin-right: -0.5em; }
.logo-b { font-size: 54px; background: linear-gradient(180deg, #fff3c4, var(--gold) 45%, #c47b0a); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 14px rgba(255, 201, 64, 0.45)); }
.logo.small { flex-direction: row; gap: 6px; align-items: baseline; }
.logo.small .logo-a { font-size: 11px; letter-spacing: 0.3em; margin: 0; }
.logo.small .logo-b { font-size: 20px; }

/* ---- Login ---- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.login-card {
  width: min(400px, 100%); padding: 34px 28px; border-radius: 20px; text-align: center;
  background: var(--panel); border: 1px solid var(--line2);
  box-shadow: 0 0 40px rgba(242, 133, 42, 0.15), inset 0 0 30px rgba(242, 133, 42, 0.05);
  backdrop-filter: blur(10px);
}
.login-card .tag { font: 600 14px var(--font-d); letter-spacing: 0.25em; text-transform: uppercase; color: var(--mute); margin: 14px 0 22px; }
.login-card form { display: grid; gap: 12px; }

/* ---- Top bar + pages ---- */
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 10px; padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top)); background: rgba(4, 9, 20, 0.82); border-bottom: 1px solid var(--line); backdrop-filter: blur(10px); }
.topbar h1 { margin: 0; font: 700 17px var(--font-d); letter-spacing: 0.12em; text-transform: uppercase; }
.user-chip { display: flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border-radius: 999px; border: 1px solid var(--line); background: rgba(10, 25, 45, 0.7); font-weight: 700; }
@media (max-width: 480px) { .user-chip > span:not(.avatar) { display: none; } .user-chip { padding: 4px; } }
.user-chip { flex: none; }
.home, .form-page { width: min(920px, 100%); margin: 0 auto; padding: 22px 16px 120px; display: grid; gap: 18px; }
.hero { padding: 26px; border-radius: 18px; background: linear-gradient(135deg, rgba(10, 40, 80, 0.75), rgba(8, 16, 34, 0.85)); border: 1px solid var(--line2); box-shadow: 0 0 30px rgba(242, 133, 42, 0.12); display: grid; gap: 18px; }
.hero h2 { margin: 0; font: 900 26px var(--font-d); letter-spacing: 0.04em; }
.hero p { margin: 4px 0 0; color: var(--mute); font-size: 17px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.panel { padding: 18px; border-radius: 16px; background: var(--panel); border: 1px solid var(--line); backdrop-filter: blur(8px); display: grid; gap: 12px; }
.sec-title { margin: 0; font: 700 14px var(--font-d); letter-spacing: 0.18em; text-transform: uppercase; color: var(--cyan); }
.lobby-list { display: grid; gap: 10px; }
.lobby-row { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: rgba(6, 16, 32, 0.7); text-align: left; }
.lobby-row:hover { border-color: var(--cyan); box-shadow: 0 0 14px rgba(242, 133, 42, 0.18); }
.lr-main { flex: 1; display: grid; gap: 4px; min-width: 0; }
.lr-seats { display: flex; gap: 10px; flex-wrap: wrap; }
.seat-mini { display: inline-flex; align-items: center; gap: 5px; font-weight: 700; }
.seat-mini.team-A { color: #8cc6ff; } .seat-mini.team-B { color: #ff9aac; }
.status { font: 700 11px var(--font-d); letter-spacing: 0.12em; padding: 5px 9px; border-radius: 6px; text-transform: uppercase; border: 1px solid; flex: none; }
.status.lobby { color: var(--gold); border-color: rgba(255, 201, 64, 0.5); }
.status.live { color: var(--green); border-color: rgba(54, 240, 160, 0.5); box-shadow: 0 0 10px rgba(54, 240, 160, 0.25); }
.status.ended { color: var(--mute); border-color: var(--line); }

/* Host form */
.field { display: grid; gap: 7px; }
.field > label { font: 700 12px var(--font-d); letter-spacing: 0.16em; text-transform: uppercase; color: var(--mute); }
.note { padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line); background: rgba(6, 16, 32, 0.6); font-weight: 700; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; }
.seg-opt { display: grid; gap: 2px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: rgba(6, 16, 32, 0.7); text-align: left; transition: all 0.15s; }
.seg-opt b { font: 700 15px var(--font-d); letter-spacing: 0.06em; }
.seg-opt small { color: var(--mute); font-size: 14px; }
.seg-opt.on { border-color: var(--cyan); background: linear-gradient(180deg, rgba(242, 133, 42, 0.18), rgba(242, 133, 42, 0.05)); box-shadow: 0 0 16px rgba(242, 133, 42, 0.25), inset 0 0 0 1px rgba(242, 133, 42, 0.4); }
.seg.small .seg-opt { padding: 8px 10px; text-align: center; }
@media (max-width: 560px) { .seg:not(.small) { grid-auto-flow: row; } }
.seats-edit { display: grid; gap: 8px; }
.seat-edit { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 12px; border: 1px solid var(--line); background: rgba(6, 16, 32, 0.6); flex-wrap: wrap; }
.seat-edit select { flex: 1; min-width: 150px; }
.seat-n { font: 900 15px var(--font-d); color: var(--cyan); width: 22px; text-align: center; }
.seat-host { flex: 1; display: flex; align-items: center; gap: 8px; }
.seat-host small { color: var(--gold); font: 700 11px var(--font-d); letter-spacing: 0.12em; }
.team-pick { display: flex; gap: 6px; }
.team-btn { padding: 7px 12px; border-radius: 8px; border: 1px solid var(--line); background: transparent; font-weight: 700; }
.team-btn.team-A.on { background: rgba(57, 160, 255, 0.25); border-color: var(--team-a); color: #bfe0ff; }
.team-btn.team-B.on { background: rgba(255, 77, 109, 0.22); border-color: var(--team-b); color: #ffc6d0; }

/* Room */
.room-tags { display: flex; gap: 8px; flex-wrap: wrap; }
.tag-pill { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line2); background: rgba(242, 133, 42, 0.08); font: 700 12px var(--font-d); letter-spacing: 0.08em; text-transform: uppercase; }
.room-seats { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.room-seat { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel); }
.room-seat > div { flex: 1; display: grid; min-width: 0; }
.room-seat small { color: var(--mute); }
.room-seat.ready { border-color: rgba(54, 240, 160, 0.55); box-shadow: 0 0 16px rgba(54, 240, 160, 0.15); }
.room-seat.team-A { border-left: 4px solid var(--team-a); } .room-seat.team-B { border-left: 4px solid var(--team-b); }
.host { color: var(--gold); font: 700 10px var(--font-d); letter-spacing: 0.15em; }
.ready-mark { display: flex; align-items: center; gap: 4px; color: var(--green); font: 700 11px var(--font-d); letter-spacing: 0.1em; }
.wait-mark { color: var(--mute); font: 700 11px var(--font-d); letter-spacing: 0.1em; animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: 0.4; } }

/* Decks */
.deck-list { display: grid; gap: 10px; }
.deck-row { display: flex; align-items: center; gap: 14px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); color: var(--txt); text-decoration: none; }
.deck-row:hover { border-color: var(--cyan); }
.deck-row > div:nth-child(2) { flex: 1; display: grid; }
.deck-row small { color: var(--mute); }
.deck-thumb img { width: 42px; border-radius: 4px; display: block; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5); }
.deck-name { flex: 1; font: 700 20px var(--font-d); min-width: 200px; }
.deck-add { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 16px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); }
@media (max-width: 600px) { .deck-add { grid-template-columns: 1fr; } }
.deck-sec { padding: 14px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); }
.deck-sec-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.deck-sec-head h3 { margin: 0; font: 700 15px var(--font-d); letter-spacing: 0.12em; text-transform: uppercase; }
.count { font: 900 15px var(--font-d); color: var(--cyan); padding: 2px 9px; border-radius: 6px; background: rgba(242, 133, 42, 0.12); }
.count.bad { color: var(--gold); background: rgba(255, 201, 64, 0.12); }
.deck-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; }
.deck-card { padding: 0; border: 0; background: none; border-radius: 4px; overflow: hidden; aspect-ratio: 59 / 86; transition: transform 0.12s; }
.deck-card:hover { transform: translateY(-3px); box-shadow: 0 0 12px rgba(242, 133, 42, 0.5); }
.deck-card img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---- Overlays ---- */
.overlay { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; background: rgba(1, 4, 10, 0.66); backdrop-filter: blur(4px); animation: fadein 0.15s; }
.overlay.out { opacity: 0; transition: opacity 0.15s; }
@keyframes fadein { from { opacity: 0; } }
.modal { width: min(440px, 100%); max-height: calc(100dvh - 32px); overflow: auto; padding: 20px; border-radius: 18px; background: linear-gradient(180deg, rgba(14, 30, 56, 0.97), rgba(7, 15, 30, 0.98)); border: 1px solid var(--line2); box-shadow: 0 0 40px rgba(242, 133, 42, 0.18), 0 20px 60px rgba(0, 0, 0, 0.6); animation: pop 0.18s cubic-bezier(0.2, 1.4, 0.5, 1); }
.modal.wide { width: min(760px, 100%); }
@keyframes pop { from { transform: scale(0.94); opacity: 0; } }
.modal h3 { margin: 0 0 10px; font: 700 16px var(--font-d); letter-spacing: 0.1em; text-transform: uppercase; }
.confirm { display: grid; gap: 12px; }
.confirm p { margin: 0; font-size: 17px; }
.pick-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.pick-top h3 { flex: 1; margin: 0; }

/* Card details */
.card-detail { display: grid; grid-template-columns: minmax(180px, 300px) 1fr; gap: 20px; }
@media (max-width: 620px) { .card-detail { grid-template-columns: 1fr; } .cd-img { max-width: 260px; margin: 0 auto; } }
.cd-img img { width: 100%; border-radius: 10px; box-shadow: 0 0 30px rgba(242, 133, 42, 0.25); display: block; }
.cd-info h2 { margin: 0 0 4px; font: 900 22px var(--font-d); letter-spacing: 0.03em; }
.cd-type { color: var(--cyan); font-weight: 700; }
.cd-stars { color: var(--gold); font-weight: 700; margin-top: 4px; }
.cd-stats { font: 700 15px var(--font-d); margin: 8px 0; letter-spacing: 0.05em; white-space: pre-wrap; }
.cd-sec h4 { margin: 12px 0 4px; font: 700 12px var(--font-d); letter-spacing: 0.15em; color: var(--mute); text-transform: uppercase; }
.cd-text p { margin: 0 0 8px; font-size: 16.5px; line-height: 1.45; }
.cd-ban { display: flex; gap: 8px; margin: 10px 0; }
.ban { padding: 3px 8px; border-radius: 6px; background: rgba(255, 59, 92, 0.15); border: 1px solid rgba(255, 59, 92, 0.5); color: #ff9aac; font-weight: 700; font-size: 13px; }
.ban.goat { background: rgba(255, 201, 64, 0.12); border-color: rgba(255, 201, 64, 0.45); color: var(--gold); }
.cd-pass { color: var(--mute); font: 600 13px var(--font-d); letter-spacing: 0.08em; margin-top: 10px; }

/* Picker */
.modal.picker-modal { width: min(520px, 100%); }
.picker { display: grid; gap: 10px; }
.pick-list { display: grid; gap: 4px; max-height: min(52dvh, 460px); overflow: auto; }
.pick-row { display: flex; align-items: center; gap: 12px; padding: 6px 8px; border-radius: 10px; border: 1px solid transparent; background: rgba(6, 16, 32, 0.5); text-align: left; }
.pick-row:hover, .pick-row:focus { border-color: var(--line2); background: rgba(242, 133, 42, 0.08); outline: none; }
.pick-row img { width: 38px; border-radius: 3px; }
.pick-row > div { flex: 1; display: grid; min-width: 0; }
.pick-row b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pick-row small { color: var(--mute); }
.pick-plus { color: var(--cyan); }
.pick-head { font: 700 11px var(--font-d); letter-spacing: 0.15em; color: var(--mute); text-transform: uppercase; padding: 4px 2px; }
.pick-empty { padding: 18px; text-align: center; color: var(--mute); }
.pick-added { display: flex; gap: 6px; flex-wrap: wrap; }
.pick-added:empty { display: none; }
.pick-added .chip { color: var(--green); border-color: rgba(54, 240, 160, 0.4); }

/* Menus */
.menu-root { position: fixed; inset: 0; z-index: 120; }
.menu-veil { position: absolute; inset: 0; }
.menu { position: absolute; min-width: 230px; max-width: 320px; padding: 6px; border-radius: 14px; background: rgba(9, 20, 40, 0.97); border: 1px solid var(--line2); box-shadow: 0 0 26px rgba(242, 133, 42, 0.2), 0 14px 40px rgba(0, 0, 0, 0.6); animation: pop 0.12s ease-out; }
.menu.sheet { left: 8px; right: 8px; bottom: calc(8px + var(--safe-b)); max-width: none; max-height: 72dvh; overflow: auto; animation: sheet 0.18s ease-out; }
@keyframes sheet { from { transform: translateY(30px); opacity: 0; } }
.menu-list { display: grid; }
.menu-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 0; background: none; border-radius: 9px; text-align: left; font-weight: 600; font-size: 16px; }
.menu-item span { flex: 1; }
.menu-item:hover:not(:disabled) { background: rgba(242, 133, 42, 0.12); }
.menu-item:disabled { opacity: 0.55; cursor: default; }
.menu-item.danger { color: #ff8da1; }
.menu-item .ic { color: var(--cyan); }
.menu-item.danger .ic { color: #ff8da1; }
.ic-space { width: 17px; }
.menu-sep { height: 1px; margin: 5px 8px; background: var(--line); }
.menu-head, .menu-title { padding: 6px 10px 4px; font: 700 11px var(--font-d); letter-spacing: 0.14em; text-transform: uppercase; color: var(--mute); }
.menu-card { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 8px 10px; margin-bottom: 4px; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; }
.menu-card img { width: 44px; border-radius: 3px; }
.menu-card > div { display: grid; min-width: 0; }
.menu-card b { font: 700 14px var(--font-d); line-height: 1.2; }
.menu-card small { color: var(--mute); }
.menu-more { color: var(--cyan); font-size: 12px; }

/* Toasts */
.toasts { position: fixed; left: 50%; top: max(14px, env(safe-area-inset-top)); transform: translateX(-50%); z-index: 200; display: grid; gap: 8px; pointer-events: none; width: min(92vw, 440px); }
.toast { padding: 10px 16px; border-radius: 12px; background: rgba(9, 22, 44, 0.96); border: 1px solid var(--line2); box-shadow: 0 0 20px rgba(242, 133, 42, 0.2); font-weight: 700; text-align: center; animation: pop 0.2s; transition: opacity 0.3s, transform 0.3s; }
.toast.bad { border-color: rgba(255, 59, 92, 0.6); color: #ffb3c1; }
.toast.out { opacity: 0; transform: translateY(-8px); }

/* Arena settings */
.bg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 12px 0; }
.bg-opt { display: grid; gap: 6px; padding: 6px; border-radius: 12px; border: 1px solid var(--line); background: rgba(6, 16, 32, 0.6); font-weight: 700; text-align: center; cursor: pointer; }
.bg-opt.on { border-color: var(--cyan); box-shadow: 0 0 16px rgba(242, 133, 42, 0.35); }
.bg-thumb { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; display: block; }
.grid-thumb { background: linear-gradient(rgba(242, 133, 42, 0.15) 1px, transparent 1px) 0 0 / 14px 14px, linear-gradient(90deg, rgba(242, 133, 42, 0.15) 1px, transparent 1px) 0 0 / 14px 14px, radial-gradient(#0b2346, #04070f); }
.up-thumb { display: grid; place-items: center; background: rgba(242, 133, 42, 0.06); border: 1px dashed var(--line2); color: var(--cyan); }

/* ---- Kaiba ---- */
.kaiba-fab {
  position: fixed; right: 16px; bottom: calc(18px + var(--safe-b)); z-index: 90;
  width: 58px; height: 58px; padding: 0; border-radius: 50%; overflow: hidden;
  border: 2px solid #7fe6ff; background: #000; box-shadow: 0 0 0 4px rgba(242, 133, 42, 0.15), 0 0 24px rgba(242, 133, 42, 0.5);
  transition: transform 0.15s;
}
.kaiba-fab img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 15%; }
.kaiba-fab:hover { transform: scale(1.06); }
body[data-screen="login"] .kaiba-fab, body:not([data-screen]) .kaiba-fab { display: none; }
body.in-duel .kaiba-fab { bottom: calc(88px + var(--safe-b)); width: 48px; height: 48px; }
@media (max-width: 760px) { body.in-duel .kaiba-fab { bottom: calc(118px + var(--safe-b)); right: 10px; width: 44px; height: 44px; } }
.kaiba-panel {
  position: fixed; right: 16px; bottom: 16px; z-index: 110; width: min(420px, calc(100vw - 32px)); height: min(620px, calc(100dvh - 32px));
  display: flex; flex-direction: column; border-radius: 18px; overflow: hidden;
  background: linear-gradient(180deg, rgba(10, 22, 44, 0.98), rgba(5, 11, 24, 0.98)); border: 1px solid var(--line2);
  box-shadow: 0 0 40px rgba(242, 133, 42, 0.25), 0 20px 60px rgba(0, 0, 0, 0.6); animation: pop 0.18s;
}
@media (max-width: 600px) { .kaiba-panel { inset: 0; width: auto; height: auto; border-radius: 0; padding-top: env(safe-area-inset-top); padding-bottom: var(--safe-b); } }
.k-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); background: linear-gradient(90deg, rgba(242, 133, 42, 0.12), transparent); }
.k-head img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; object-position: 50% 15%; border: 2px solid #7fe6ff; }
.k-head > div { display: grid; }
.k-head b { font: 900 15px var(--font-d); letter-spacing: 0.1em; text-transform: uppercase; }
.k-head small { color: var(--mute); }
.k-list { flex: 1; overflow: auto; padding: 14px 12px; display: flex; flex-direction: column; gap: 10px; }
.k-msg { display: flex; gap: 8px; align-items: flex-end; max-width: 90%; }
.k-msg.me { align-self: flex-end; }
.k-av { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; object-position: 50% 15%; flex: none; }
.k-bubble { padding: 9px 13px; border-radius: 14px; white-space: pre-wrap; font-size: 16px; line-height: 1.4; }
.k-msg.kaiba .k-bubble { background: rgba(20, 44, 80, 0.85); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.k-msg.me .k-bubble { background: linear-gradient(180deg, #19c6ff, #0a7fd6); color: #021120; font-weight: 600; border-bottom-right-radius: 4px; }
.k-msg.err { color: #ff9aac; font-weight: 600; align-self: center; }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--cyan); animation: dot 1s infinite; }
.dots i:nth-child(2) { animation-delay: 0.15s; } .dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes dot { 50% { opacity: 0.2; transform: translateY(-3px); } }
.k-share { display: flex; align-items: center; gap: 8px; padding: 6px 14px; color: var(--mute); font-size: 14px; }
.k-share input { accent-color: var(--cyan); }
.k-compose { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); }
.k-input { flex: 1; resize: none; min-height: 42px; max-height: 120px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: rgba(3, 10, 22, 0.8); outline: none; font-size: 16px; }
.k-input:focus { border-color: var(--cyan); }
.k-send { width: 42px; height: 42px; border-radius: 12px; border: 0; background: linear-gradient(180deg, #19c6ff, #0a7fd6); color: #021120; display: grid; place-items: center; }

/* ================= DUEL ================= */
.duel { position: fixed; inset: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr); user-select: none; -webkit-user-select: none; }
.duel-top { display: flex; align-items: center; gap: 8px; padding: 6px 10px; padding-top: max(6px, env(safe-area-inset-top)); background: linear-gradient(180deg, rgba(4, 9, 20, 0.92), rgba(4, 9, 20, 0.6)); border-bottom: 1px solid var(--line); z-index: 5; }
.opps { flex: 1; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.opp-chip { display: flex; align-items: center; gap: 8px; padding: 4px 6px 4px 5px; border-radius: 12px; border: 1px solid var(--line); background: rgba(10, 22, 42, 0.75); flex: none; cursor: pointer; }
.opp-chip.on { border-color: var(--red); box-shadow: 0 0 14px rgba(255, 59, 92, 0.3); }
.opp-chip.team-A { border-left: 3px solid var(--team-a); } .opp-chip.team-B { border-left: 3px solid var(--team-b); }
.opp-chip.turn .avatar { animation: turnglow 1.4s infinite; }
@keyframes turnglow { 50% { box-shadow: 0 0 0 3px rgba(255, 201, 64, 0.6), 0 0 18px var(--gold); } }
.opp-chip.out { opacity: 0.45; }
.oc-name { display: grid; line-height: 1.1; }
.oc-name b { font: 700 13px var(--font-d); letter-spacing: 0.04em; }
.oc-name small { color: var(--mute); font-size: 12.5px; white-space: nowrap; }
.top-tools { display: flex; align-items: center; gap: 2px; }
@media (max-width: 640px) { .oc-name small { display: none; } .top-tools .icon-btn { width: 34px; height: 34px; } .top-tools .wide-only { display: none; } }
.lp { display: grid; justify-items: end; padding: 2px 9px; border-radius: 9px; border: 1px solid rgba(255, 201, 64, 0.4); background: rgba(30, 22, 4, 0.55); line-height: 1; transition: transform 0.1s; }
.lp small { font: 700 9px var(--font-d); color: var(--gold); letter-spacing: 0.2em; }
.lp b { font: 900 17px var(--font-d); color: #fff1c2; text-shadow: 0 0 10px rgba(255, 201, 64, 0.6); letter-spacing: 0.04em; font-variant-numeric: tabular-nums; }
.lp.big b { font-size: 24px; }
.lp.dead b { color: var(--red); text-shadow: 0 0 10px rgba(255, 59, 92, 0.6); }
.lp:hover { border-color: var(--gold); box-shadow: 0 0 14px rgba(255, 201, 64, 0.3); }
.lp.hit { animation: lphit 0.5s; }
@keyframes lphit { 30% { transform: scale(1.15); box-shadow: 0 0 22px rgba(255, 59, 92, 0.7); } }
.lp-float { position: fixed; z-index: 150; transform: translate(-50%, -100%); font: 900 26px var(--font-d); pointer-events: none; animation: lpf 1.4s ease-out forwards; }
.lp-float.dmg { color: var(--red); text-shadow: 0 0 12px rgba(255, 59, 92, 0.8); }
.lp-float.gain { color: var(--green); text-shadow: 0 0 12px rgba(54, 240, 160, 0.8); }
@keyframes lpf { to { transform: translate(-50%, -220%); opacity: 0; } }

.duel-mid { display: flex; min-height: 0; min-width: 0; }
.duel-side { display: none; width: 290px; flex: none; flex-direction: column; gap: 10px; padding: 10px; border-right: 1px solid var(--line); background: rgba(4, 9, 20, 0.7); backdrop-filter: blur(6px); min-height: 0; }
@media (min-width: 1100px) { .duel-side { display: flex; } .log-btn { display: none; } }
.preview { flex: none; max-height: 62%; overflow: auto; display: grid; gap: 6px; align-content: start; }
.pv-empty { color: var(--mute); padding: 20px 6px; text-align: center; border: 1px dashed var(--line); border-radius: 10px; }
.pv-img { width: 100%; max-width: 230px; margin: 0 auto; border-radius: 8px; display: block; box-shadow: 0 0 20px rgba(242, 133, 42, 0.2); }
.pv-name { font: 900 15px var(--font-d); letter-spacing: 0.03em; }
.pv-type { color: var(--cyan); font-weight: 700; font-size: 14px; }
.pv-stats { font: 700 13px var(--font-d); color: var(--gold); }
.pv-text p { margin: 0 0 6px; font-size: 15px; line-height: 1.35; }
.side-log { flex: 1; min-height: 120px; display: flex; flex-direction: column; border-top: 1px solid var(--line); padding-top: 8px; }
.side-log h4, .ld-head b { margin: 0 0 6px; font: 700 11px var(--font-d); letter-spacing: 0.16em; color: var(--mute); text-transform: uppercase; }
.log-list { flex: 1; overflow: auto; display: grid; align-content: start; gap: 5px; }
.log-line { font-size: 14.5px; line-height: 1.3; display: flex; gap: 6px; }
.log-line time { color: var(--mute); font-size: 11px; flex: none; padding-top: 2px; width: 50px; }
.log-line.sys { color: var(--gold); font-weight: 700; }
.cardref { padding: 0; border: 0; background: none; color: var(--cyan); font-weight: 700; text-decoration: underline dotted; text-underline-offset: 2px; }
.log-drawer { position: fixed; right: 0; top: 0; bottom: 0; z-index: 95; width: min(380px, 92vw); display: flex; flex-direction: column; padding: 12px; padding-top: max(12px, env(safe-area-inset-top)); background: rgba(6, 13, 28, 0.97); border-left: 1px solid var(--line2); box-shadow: -10px 0 40px rgba(0, 0, 0, 0.5); animation: slidein 0.18s; }
@keyframes slidein { from { transform: translateX(40px); opacity: 0; } }
.ld-head { display: flex; align-items: center; justify-content: space-between; }

.stage { position: relative; flex: 1; min-width: 0; overflow: hidden; touch-action: none; }
.mat, .layer { position: absolute; inset: 0; }
.layer { pointer-events: none; }
.layer .card { pointer-events: auto; }

/* Zones */
.zone { position: absolute; border-radius: calc(var(--c) * 0.08); --zc: var(--pile); border: 1.5px solid color-mix(in srgb, var(--zc) 55%, transparent); background: radial-gradient(ellipse at center, color-mix(in srgb, var(--zc) 10%, transparent), color-mix(in srgb, var(--zc) 4%, rgba(2, 6, 14, 0.35)) 70%); box-shadow: inset 0 0 calc(var(--c) * 0.18) color-mix(in srgb, var(--zc) 20%, transparent), 0 0 calc(var(--c) * 0.1) color-mix(in srgb, var(--zc) 25%, transparent); cursor: pointer; transition: box-shadow 0.15s, background 0.15s; }
.zone.z-mz { --zc: var(--mz); }
.zone.z-st { --zc: var(--st); }
.zone.z-fz { --zc: var(--fz); }
.zone.z-emz { --zc: var(--emz); }
.zone.opp { --zc2: var(--red); opacity: 0.92; }
.zone::before { content: ''; position: absolute; inset: 14%; border: 1px dashed color-mix(in srgb, var(--zc) 30%, transparent); border-radius: 4px; pointer-events: none; }
.zone.z-gy::before, .zone.z-ban::before, .zone.z-deck::before, .zone.z-extra::before { display: none; }
.zlabel { position: absolute; left: 0; right: 0; bottom: 3%; text-align: center; font: 700 calc(var(--c) * 0.12) var(--font-d); letter-spacing: 0.08em; text-transform: uppercase; color: color-mix(in srgb, var(--zc) 80%, white); opacity: 0.75; pointer-events: none; white-space: nowrap; overflow: hidden; }
.zone.opp .zlabel { bottom: auto; top: 3%; }
.zone.z-emz .zlabel { white-space: normal; line-height: 1.05; bottom: 6%; padding: 0 4%; }
.zone:hover { box-shadow: inset 0 0 calc(var(--c) * 0.25) color-mix(in srgb, var(--zc) 35%, transparent), 0 0 calc(var(--c) * 0.2) color-mix(in srgb, var(--zc) 45%, transparent); }
.zone.target { animation: target 1s infinite; border-style: solid; border-width: 2px; }
.zone.target.mine { border-color: var(--cyan); }
.zone.target.theirs { border-color: rgba(255, 120, 140, 0.7); }
.zone.hover { background: color-mix(in srgb, var(--zc) 30%, transparent); box-shadow: 0 0 calc(var(--c) * 0.35) var(--zc); }
@keyframes target { 50% { box-shadow: 0 0 calc(var(--c) * 0.35) var(--cyan), inset 0 0 calc(var(--c) * 0.3) rgba(242, 133, 42, 0.4); } }
.pile { position: absolute; left: 50%; top: 50%; translate: -50% -50%; pointer-events: none; }
.pile img { width: 100%; height: 100%; object-fit: cover; border-radius: calc(var(--c) * 0.04); display: block; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6); }
.pile-edge { position: absolute; inset: 0; transform: translate(2px, 2px); z-index: -1; border-radius: calc(var(--c) * 0.04); background: #3a2410; box-shadow: 2px 2px 0 #1d1208; }
.pile-count { position: absolute; right: -6%; bottom: -6%; min-width: calc(var(--c) * 0.3); padding: 1px 4px; border-radius: 6px; background: rgba(2, 8, 18, 0.92); border: 1px solid var(--line2); font: 900 calc(var(--c) * 0.17) var(--font-d); text-align: center; color: var(--txt); }
.pile-count.zero { display: none; }
.mid-info { position: absolute; left: 50%; translate: -50% -50%; display: grid; justify-items: center; pointer-events: none; text-align: center; }
.mid-info b { font: 900 calc(var(--c) * 0.24) var(--font-d); letter-spacing: 0.18em; color: var(--gold); text-shadow: 0 0 14px rgba(255, 201, 64, 0.6); }
.mid-info span { font: 600 calc(var(--c) * 0.17) var(--font); color: var(--mute); letter-spacing: 0.05em; }
.mid-info.live b { color: var(--green); text-shadow: 0 0 14px rgba(54, 240, 160, 0.6); }

/* Cards */
.card { position: absolute; left: 0; top: 0; transform-origin: 50% 50%; transition: transform 0.32s cubic-bezier(0.22, 0.9, 0.25, 1), width 0.32s, height 0.32s, opacity 0.25s; will-change: transform; cursor: pointer; touch-action: none; }
.reduce-motion .card { transition: none !important; }
.card .face { position: absolute; inset: 0; border-radius: calc(var(--c) * 0.04); overflow: hidden; background: #111; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.65); }
.card .face img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card.on-field.own .face { box-shadow: 0 0 0 1px rgba(242, 133, 42, 0.55), 0 0 calc(var(--c) * 0.12) rgba(242, 133, 42, 0.35), 0 2px 6px rgba(0, 0, 0, 0.6); }
.card.on-field.theirs .face { box-shadow: 0 0 0 1px rgba(255, 90, 115, 0.45), 0 2px 6px rgba(0, 0, 0, 0.6); }
.card.own-set .face img { filter: brightness(0.5) saturate(0.6); }
.card.own-set .face::after { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(45deg, rgba(242, 133, 42, 0.1) 0 4px, transparent 4px 9px); }
/* Hover lift only with a mouse (on touch screens :hover sticks after a tap); phones use .raised */
@media (hover: hover) { .card:hover .face { outline: 2px solid var(--cyan); } }
.card.raised .face { outline: 2px solid var(--cyan); }
.card.in-hand { transition: transform 0.3s cubic-bezier(0.22, 0.9, 0.25, 1), width 0.3s, height 0.3s, opacity 0.25s; }
@media (hover: hover) {
  .card.in-hand.own:hover { z-index: 50 !important; }
  .card.in-hand.own:hover .face { transform: translateY(-14%); box-shadow: 0 0 18px rgba(242, 133, 42, 0.6); transition: transform 0.15s; }
}
/* Touch: a tapped card is only outlined (tap it again to open it) */
.card.dragging { transition: none !important; z-index: 80 !important; opacity: 0.92; }
.card.dragging .face { box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7), 0 0 20px rgba(242, 133, 42, 0.6); }
.ov { position: absolute; pointer-events: none; }
.ov.stat { left: 50%; top: 50%; padding: 0 4px; border-radius: 4px; background: rgba(2, 8, 18, 0.88); border: 1px solid rgba(255, 201, 64, 0.5); font: 900 calc(var(--c) * 0.135) var(--font-d); color: #fff1c2; white-space: nowrap; letter-spacing: 0.02em; z-index: 2; }
.ov.stat.dim { opacity: 0.6; }
.ov.set-tag { left: 50%; top: 50%; font: 900 calc(var(--c) * 0.15) var(--font-d); letter-spacing: 0.2em; color: var(--cyan); text-shadow: 0 0 6px #000, 0 0 10px rgba(242, 133, 42, 0.8); }
.ov.ctr { right: -12%; top: -8%; min-width: calc(var(--c) * 0.26); height: calc(var(--c) * 0.26); border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 35% 35%, #c9a3ff, #7a3bea); border: 1px solid #e8d7ff; font: 900 calc(var(--c) * 0.14) var(--font-d); color: #fff; box-shadow: 0 0 10px rgba(168, 107, 255, 0.8); }
.ov.mats { left: -12%; bottom: -8%; min-width: calc(var(--c) * 0.26); height: calc(var(--c) * 0.26); border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 35% 35%, #ffe08a, #d18b00); border: 1px solid #fff2c2; font: 900 calc(var(--c) * 0.14) var(--font-d); color: #231500; box-shadow: 0 0 10px rgba(255, 201, 64, 0.8); }
.ov.mat-edge { inset: 0; transform: translate(-6%, 4%); z-index: -1; border-radius: calc(var(--c) * 0.04); background: linear-gradient(135deg, #a77a2a, #5a3c0c); box-shadow: -3px 3px 0 #3a2508; }
.token-art { width: 100%; height: 100%; display: grid; place-content: center; text-align: center; gap: 2px; padding: 4px; background: radial-gradient(circle at 50% 35%, #3a5d8a, #13233c 70%), #13233c; border: 2px solid #a9c7ef; border-radius: inherit; }
.token-art b { font: 900 calc(var(--c) * 0.12) var(--font-d); color: #fff; line-height: 1.05; word-break: break-word; }
.token-art span { font: 700 calc(var(--c) * 0.11) var(--font-d); color: var(--gold); }
.token-art.big { width: 220px; height: 320px; margin: 0 auto; border-radius: 12px; }
.token-art.big b { font-size: 22px; } .token-art.big span { font-size: 18px; }
.token-art.mini { width: 44px; height: 64px; border-radius: 4px; font: 900 18px var(--font-d); }

/* Placing banner */
.place-banner { position: absolute; left: 50%; top: 8px; transform: translate(-50%, -150%); z-index: 70; display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 16px; border-radius: 999px; background: rgba(6, 18, 36, 0.95); border: 1px solid var(--cyan); box-shadow: 0 0 20px rgba(242, 133, 42, 0.4); font-weight: 700; transition: transform 0.2s; max-width: 94%; }
.place-banner.on { transform: translate(-50%, 0); }

/* Bottom bar */
.duel-bottom { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 8px 10px; padding-bottom: max(8px, var(--safe-b)); background: linear-gradient(0deg, rgba(4, 9, 20, 0.95), rgba(4, 9, 20, 0.7)); border-top: 1px solid var(--line); z-index: 5; }
.me-box { display: flex; align-items: center; gap: 8px; }
.me-name { display: grid; line-height: 1.1; }
.me-name b { font: 700 13px var(--font-d); }
.me-name small { color: var(--mute); font-size: 12.5px; white-space: nowrap; }
.me-actions { display: flex; gap: 6px; margin-left: auto; }
.btn.draw { border-color: var(--gold); color: #ffe3a0; background: rgba(60, 40, 5, 0.6); }
.phases { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; justify-content: center; }
.turn-tag { display: grid; font: 900 12px var(--font-d); letter-spacing: 0.1em; text-transform: uppercase; color: var(--mute); text-align: center; white-space: nowrap; }
.turn-tag small { font-size: 10px; color: var(--mute); }
.phases.mine .turn-tag { color: var(--gold); text-shadow: 0 0 10px rgba(255, 201, 64, 0.6); }
.ph-row { display: flex; gap: 3px; }
.ph { display: grid; justify-items: center; min-width: 46px; padding: 4px 6px; border-radius: 8px; border: 1px solid var(--line); background: rgba(6, 16, 32, 0.7); line-height: 1.05; clip-path: polygon(8% 0, 100% 0, 92% 100%, 0 100%); }
.ph b { font: 900 14px var(--font-d); letter-spacing: 0.06em; }
.ph small { font-size: 10.5px; color: var(--mute); white-space: nowrap; }
.ph.done { opacity: 0.4; }
.ph.on { background: linear-gradient(180deg, #19c6ff, #0a7fd6); border-color: #7fe6ff; color: #02101d; box-shadow: 0 0 14px rgba(242, 133, 42, 0.5); }
.ph.on small { color: #02233b; }
.ph:disabled { cursor: default; }
.ph:not(:disabled):not(.on):hover { border-color: var(--cyan); background: rgba(242, 133, 42, 0.15); }
.ph.end { background: rgba(80, 10, 25, 0.75); border-color: var(--red); color: #ffc2cd; margin-left: 4px; }
.ph.end:hover { background: rgba(140, 20, 45, 0.85) !important; }
.live-tag { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; font: 900 14px var(--font-d); letter-spacing: 0.3em; color: var(--green); }
.live-tag .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px var(--green); animation: pulse 1.4s infinite; }
.ended-bar { flex: 1; display: flex; align-items: center; justify-content: center; gap: 10px; }
.ended-bar b { font: 900 16px var(--font-d); letter-spacing: 0.1em; color: var(--gold); }
@media (max-width: 760px) {
  .duel-bottom { flex-wrap: wrap; row-gap: 6px; }
  .phases { order: 3; flex-basis: 100%; }
  .ph { min-width: 0; flex: 1; padding: 4px 2px; }
  .ph small { display: none; }
  .ph-row { flex: 1; }
  .hide-sm { display: none; }
  .me-name small { display: none; }
}

/* Place-a-card modal */
.hand-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; }
.pile-card { position: relative; padding: 0; border: 0; background: none; border-radius: 5px; overflow: hidden; aspect-ratio: 59 / 86; transition: transform 0.12s, box-shadow 0.12s; }
.pile-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pile-card:hover { transform: translateY(-3px); box-shadow: 0 0 14px rgba(242, 133, 42, 0.6); }
.pile-card.dim { opacity: 0.45; }
.pile-card .fd { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, 0.75); font-size: 11px; font-weight: 700; text-align: center; }
.place-alt { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.pile-view .pile-grid, .pile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 8px; max-height: 62dvh; overflow: auto; padding: 2px; }
.modal.how-modal { width: min(520px, 100%); }
.how-head { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.how-head img { width: 54px; border-radius: 4px; }
.how-head > div { display: grid; }
.how-head b { font: 900 16px var(--font-d); }
.how-head small { color: var(--mute); }
.how-row { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 10px; }
.how-btn { display: grid; justify-items: center; gap: 4px; padding: 14px 8px 12px; border-radius: 14px; border: 1px solid var(--line2); background: rgba(6, 18, 36, 0.8); transition: all 0.15s; }
.how-btn:hover { border-color: var(--cyan); background: rgba(242, 133, 42, 0.12); box-shadow: 0 0 18px rgba(242, 133, 42, 0.3); transform: translateY(-2px); }
.how-btn b { font: 900 16px var(--font-d); letter-spacing: 0.1em; text-transform: uppercase; }
.how-btn small { color: var(--mute); font-size: 13px; }
.how-ic { height: 74px; display: grid; place-items: center; }
.how-card { display: block; width: 44px; height: 64px; border-radius: 3px; overflow: hidden; box-shadow: 0 0 10px rgba(242, 133, 42, 0.4); }
.how-card img { width: 100%; height: 100%; object-fit: cover; }
.token-dialog .token-pick { display: flex; align-items: center; gap: 10px; }
.token-pick img { width: 44px; border-radius: 4px; }

/* LP calculator */
.modal.calc-modal { width: min(360px, 100%); }
.calc { display: grid; gap: 10px; }
.calc-head { display: flex; align-items: center; gap: 10px; }
.calc-head b { flex: 1; font: 700 14px var(--font-d); letter-spacing: 0.06em; }
.calc-cur { font: 900 18px var(--font-d); color: var(--gold); }
.calc-disp { padding: 10px 14px; border-radius: 12px; background: #01060e; border: 1px solid rgba(255, 201, 64, 0.4); text-align: right; font: 900 38px var(--font-d); color: #fff1c2; text-shadow: 0 0 14px rgba(255, 201, 64, 0.5); font-variant-numeric: tabular-nums; }
.calc-res { text-align: right; color: var(--mute); font-weight: 700; font-size: 17px; }
.calc-res b { color: var(--txt); }
.calc-ops { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.calc-op { padding: 10px 4px; border-radius: 10px; border: 1px solid var(--line); background: rgba(6, 16, 32, 0.8); font: 700 13px var(--font-d); }
.calc-op.on { border-color: var(--gold); background: rgba(255, 201, 64, 0.15); color: var(--gold); }
.calc-op[data-op="-"].on { border-color: var(--red); background: rgba(255, 59, 92, 0.15); color: #ffb3c1; }
.calc-op[data-op="+"].on { border-color: var(--green); background: rgba(54, 240, 160, 0.12); color: var(--green); }
.calc-keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.calc-key { padding: 12px 0; border-radius: 10px; border: 1px solid var(--line); background: rgba(12, 28, 52, 0.85); font: 900 20px var(--font-d); }
.calc-key:active { background: rgba(242, 133, 42, 0.25); }
.calc-key.fn { font-size: 15px; color: var(--cyan); }

/* Shared moments */
.fx { position: fixed; inset: 0; z-index: 140; display: grid; place-items: center; background: rgba(1, 4, 10, 0.35); animation: fadein 0.2s; }
.fx.out { opacity: 0; transition: opacity 0.35s; }
.fx > div { display: grid; justify-items: center; gap: 10px; padding: 24px 34px; border-radius: 20px; background: rgba(6, 16, 34, 0.92); border: 1px solid var(--line2); box-shadow: 0 0 50px rgba(242, 133, 42, 0.35); animation: pop 0.25s cubic-bezier(0.2, 1.4, 0.5, 1); }
.fx-who { font: 700 13px var(--font-d); letter-spacing: 0.16em; text-transform: uppercase; color: var(--mute); }
.dice-row { display: flex; gap: 14px; }
.die { width: 76px; height: 76px; display: grid; place-items: center; border-radius: 16px; background: linear-gradient(145deg, #fff, #cfe6ff); color: #061428; font: 900 38px var(--font-d); box-shadow: 0 0 24px rgba(242, 133, 42, 0.6), inset 0 -4px 0 rgba(0, 0, 0, 0.15); animation: roll 0.7s ease-out; }
.die.done { animation: land 0.3s; }
@keyframes roll { from { transform: rotate(-360deg) scale(0.6); } }
@keyframes land { 50% { transform: scale(1.18); } }
.coin { width: 96px; height: 96px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 35% 30%, #fff3c4, #ffc940 50%, #a86a00); border: 3px solid #fff0b8; box-shadow: 0 0 30px rgba(255, 201, 64, 0.7); font: 900 40px var(--font-d); color: #4a2e00; animation: flip 1s ease-out; }
@keyframes flip { from { transform: rotateY(1440deg) scale(0.6); } }
.fx-coin b { font: 900 24px var(--font-d); color: var(--gold); letter-spacing: 0.15em; text-transform: uppercase; }
.fx-reveal img { width: 220px; border-radius: 10px; box-shadow: 0 0 30px rgba(242, 133, 42, 0.5); }
.fx-reveal b { font: 900 18px var(--font-d); }
.fx > .fx-turn { background: none; border: 0; box-shadow: none; }
.fx-turn b { font: 900 clamp(32px, 8vw, 64px) var(--font-d); letter-spacing: 0.18em; color: #ffb3c1; text-shadow: 0 0 30px rgba(255, 59, 92, 0.8); }
.fx-turn.mine b { color: #fff1c2; text-shadow: 0 0 30px rgba(255, 201, 64, 0.9); }
.fx-turn small { font: 700 14px var(--font-d); letter-spacing: 0.3em; color: var(--mute); text-transform: uppercase; }

/* Rulebooks */
.rule-list { display: grid; gap: 6px; }
.rule-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: rgba(6, 16, 32, 0.6); text-align: left; }
.rule-row:hover { border-color: var(--cyan); background: rgba(242, 133, 42, 0.08); }
.rule-row > div { flex: 1; display: grid; }
.rule-row small { color: var(--mute); }
.rule-row .ic:first-child { color: var(--cyan); }
.rule-row.current { border-color: var(--gold); box-shadow: 0 0 14px rgba(255, 201, 64, 0.2); }
.rule-row.current .ic:first-child { color: var(--gold); }
.rule-text pre { white-space: pre-wrap; font: 500 14px/1.4 var(--font); max-height: 70dvh; overflow: auto; margin: 0; }

/* Stat changes, notes, equips */
.ov.stat i { font-style: normal; }
.ov.stat i.up { color: #6dffb9; }
.ov.stat i.down { color: #ff8da1; }
.ov.note { left: 50%; top: 50%; max-width: calc(var(--c) * 1.1); padding: 0 4px; border-radius: 4px; background: rgba(60, 20, 90, 0.92); border: 1px solid #c9a3ff; font: 700 calc(var(--c) * 0.11) var(--font); color: #f1e6ff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; z-index: 3; }
.ov.eq, .ov.eqd { right: -10%; bottom: -6%; padding: 0 4px; border-radius: 5px; font: 900 calc(var(--c) * 0.12) var(--font-d); background: rgba(10, 60, 50, 0.95); border: 1px solid var(--st); color: #b8ffe9; }
.ov.eqd { right: auto; left: -10%; top: -8%; bottom: auto; }
.fx-declare b { font: 900 clamp(20px, 5vw, 34px) var(--font-d); color: var(--gold); text-align: center; max-width: 80vw; }
.fx-hand-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; max-width: 86vw; }
.fx-hand-row img { width: clamp(70px, 14vw, 130px); border-radius: 6px; }

/* Ink layer: equip arrows + drawings */
.ink { position: absolute; inset: 0; z-index: 45; pointer-events: none; overflow: visible; }
.inking .ink { pointer-events: auto; cursor: crosshair; touch-action: none; }
.ink .ink-shape { filter: drop-shadow(0 0 3px rgba(0, 0, 0, 0.8)) drop-shadow(0 0 6px currentColor); }
.ink .equip-link { filter: drop-shadow(0 0 6px rgba(61, 255, 200, 0.9)); }
.ink .flow { animation: flow 1.2s linear infinite; }
.reduce-motion .ink .flow { animation: none; }
@keyframes flow { to { stroke-dashoffset: -40; } }
.ink-bar { position: absolute; left: 50%; bottom: 8px; z-index: 75; transform: translate(-50%, 160%); display: flex; align-items: center; gap: 4px; padding: 6px; border-radius: 14px; background: rgba(6, 18, 36, 0.96); border: 1px solid var(--cyan); box-shadow: 0 0 20px rgba(242, 133, 42, 0.35); transition: transform 0.2s; max-width: calc(100% - 16px); overflow-x: auto; scrollbar-width: none; }
.ink-bar.on { transform: translate(-50%, 0); }
.ink-btn { flex: none; display: grid; place-items: center; min-width: 34px; height: 34px; padding: 0 6px; border-radius: 9px; border: 1px solid transparent; background: transparent; color: var(--txt); font: 700 12px var(--font-d); letter-spacing: 0.04em; }
.ink-btn:hover { background: rgba(242, 133, 42, 0.1); }
.ink-btn.on { border-color: var(--cyan); background: rgba(242, 133, 42, 0.18); color: var(--cyan); }
.ink-btn.txt { text-transform: uppercase; white-space: nowrap; }
.ink-btn.done { background: linear-gradient(180deg, #19c6ff, #0a7fd6); color: #02101d; text-transform: uppercase; padding: 0 12px; }
.ink-color { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.25); }
.ink-color.on { border-color: #fff; box-shadow: 0 0 0 2px rgba(242, 133, 42, 0.6); }
.ink-sep { flex: none; width: 1px; height: 24px; background: var(--line); margin: 0 3px; }
.icon-btn.on { border-color: var(--cyan); background: rgba(242, 133, 42, 0.15); color: var(--cyan); }
.ov.ctl { left: -10%; bottom: -6%; padding: 0 4px; border-radius: 5px; font: 900 calc(var(--c) * 0.12) var(--font-d); background: var(--uc); color: #06101c; box-shadow: 0 0 8px var(--uc); white-space: nowrap; }

/* ================= Minimal theme (BAHH Duel) ================= */
:root { --bg0: #0b0d12; --panel: #12151c; --panel2: #161a22; --line: rgba(255, 255, 255, 0.08); --line2: rgba(255, 255, 255, 0.14); --mute: #8b93a1; --txt: #e8eaee; }
.bg-layer { background: linear-gradient(rgba(11, 13, 18, 0.55), rgba(11, 13, 18, 0.8)), var(--bg-url, none) center / cover no-repeat, #0b0d12; }
.bg-layer::after { display: none; }
body:not(.in-duel) .bg-layer { filter: none; }
.plain-thumb { background: #0b0d12; border: 1px solid var(--line2); }
/* calm surfaces: no glows, no blur, flat fills */
.login-card, .hero, .panel, .modal, .menu, .kaiba-panel, .toast, .lobby-row, .room-seat, .deck-row, .deck-sec, .deck-add, .seg-opt, .note, .seat-edit, .opp-chip, .fx > div, .place-banner, .ink-bar, .log-drawer { box-shadow: none !important; backdrop-filter: none !important; background: var(--panel) !important; }
.modal, .menu, .kaiba-panel { border-color: var(--line2) !important; box-shadow: 0 16px 50px rgba(0, 0, 0, 0.55) !important; }
.seg-opt.on { background: rgba(242, 133, 42, 0.12) !important; border-color: var(--cyan) !important; box-shadow: none !important; }
.btn { background: transparent; border-color: var(--line2); letter-spacing: 0.02em; }
.btn:hover { background: rgba(255, 255, 255, 0.05); box-shadow: none; }
.btn.primary { background: var(--cyan); border-color: var(--cyan); color: #140a02; box-shadow: none; }
.btn.primary:hover { background: #ff9640; }
.btn.draw { background: transparent; border-color: var(--line2); color: var(--txt); }
.topbar, .duel-top, .duel-bottom { background: #0b0d12 !important; backdrop-filter: none; }
.duel-side { background: #0e1117; backdrop-filter: none; }
.hero h2, .cd-info h2 { font-weight: 700; }
.sec-title, .field > label { color: var(--mute); }
.status.live { box-shadow: none; }
.avatar { background: var(--uc); box-shadow: none; }
.kaiba-fab { border: 2px solid var(--line2); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5); }
.k-head { background: transparent; }
.k-msg.me .k-bubble { background: var(--cyan); color: #140a02; }
.k-msg.kaiba .k-bubble { background: #1b1f28 !important; }
/* Logo: picture in a circle, name underneath */
.logo { gap: 14px; }
.logo-img { width: 132px; height: 132px; border-radius: 50%; object-fit: cover; border: 3px solid var(--line2); display: block; }
.logo-name { font: 900 30px var(--font-d); letter-spacing: 0.12em; color: var(--txt); }
.logo.small { flex-direction: row; gap: 9px; align-items: center; }
.logo.small .logo-img { width: 30px; height: 30px; border-width: 1.5px; }
.logo.small .logo-name { font-size: 15px; letter-spacing: 0.1em; }
.login-card { padding: 36px 28px 30px; }
.login-card form { margin-top: 26px; }
/* LP: plain numbers */
.lp { background: transparent; border-color: var(--line2); }
.lp small { color: var(--mute); }
.lp b { color: var(--txt); text-shadow: none; }
.lp:hover { border-color: var(--cyan); box-shadow: none; }
.calc-disp { border-color: var(--line2); color: var(--txt); text-shadow: none; }
.calc-cur { color: var(--txt); }
/* Mat: thin quiet outlines, no glow */
.zone { background: rgba(255, 255, 255, 0.015); box-shadow: none; border: 1px solid color-mix(in srgb, var(--zc) 30%, rgba(255, 255, 255, 0.08)); }
.zone::before { display: none; }
.zone:hover { box-shadow: none; background: rgba(255, 255, 255, 0.05); }
.zone.z-mz, .zone.z-st, .zone.z-fz, .zone.z-emz { --zc: rgba(255, 255, 255, 0.5); }
.zone.z-emz { border-style: dashed; }
.zlabel { color: var(--mute); opacity: 0.6; }
.zone.target { animation: none; background: rgba(242, 133, 42, 0.1); }
.zone.target.mine { border-color: var(--cyan); }
.zone.hover { background: rgba(242, 133, 42, 0.18); box-shadow: none; }
.mid-info b { color: var(--txt); text-shadow: none; font-weight: 700; }
.mid-info.live b { color: var(--green); text-shadow: none; }
.card.on-field.own .face, .card.on-field.theirs .face { box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6); }
@media (hover: hover) { .card:hover .face { outline: 2px solid var(--cyan); } .card.in-hand.own:hover .face { box-shadow: 0 6px 16px rgba(0, 0, 0, 0.6); } }
.ov.stat { border-color: var(--line2); color: var(--txt); }
.ph { clip-path: none; border-radius: 8px; }
.ph.on { background: var(--cyan); border-color: var(--cyan); color: #140a02; box-shadow: none; }
.ph.on small { color: #3a1d04; }
.phases.mine .turn-tag { color: var(--cyan); text-shadow: none; }
.fx-turn b, .fx-turn.mine b { color: var(--txt); text-shadow: 0 2px 20px rgba(0, 0, 0, 0.8); }
.ink-btn.done { background: var(--cyan); }
.ph:disabled:not(.on):not(.end) { opacity: 0.38; }
.opp-chip.on { border-color: var(--line2) !important; background: #1a1e27 !important; }

/* Kaiba opponent */
.kaiba-av { border-radius: 50%; object-fit: cover; object-position: 50% 15%; flex: none; }
.kaiba-btn img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; object-position: 50% 15%; }
.ks-head { display: flex; gap: 14px; align-items: center; }
.ks-head img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; object-position: 50% 15%; border: 2px solid var(--line2); }
.ks-head h3 { margin: 0 0 4px; }
.ks-head p { margin: 0; font-style: italic; }
.thinking { color: var(--mute); font: 600 11px var(--font); letter-spacing: 0; }
.thinking .dots i { width: 4px; height: 4px; background: var(--mute); }
.btn.hold { border-color: #ff6b81; color: #ffb3c1; }
.btn.hold.on { background: #ff3b5c; color: #fff; border-color: #ff3b5c; }
.say-bubble { position: fixed; z-index: 130; display: flex; gap: 8px; align-items: flex-start; max-width: min(360px, calc(100vw - 24px)); padding: 9px 12px 9px 9px; border-radius: 4px 14px 14px 14px; background: #f3f5f9; color: #0b0d12; font-weight: 700; font-size: 15px; line-height: 1.3; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); animation: pop 0.2s; transition: opacity 0.4s; }
.say-bubble img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; object-position: 50% 15%; flex: none; }
.say-bubble.out { opacity: 0; }
.attack-panel { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); z-index: 72; width: min(520px, calc(100% - 20px)); padding: 12px 14px; border-radius: 12px; background: #161a22; border: 1px solid #ff3b5c; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6); display: grid; gap: 6px; animation: pop 0.18s; }
.attack-panel.incoming { border-width: 2px; }
.ap-title { font-size: 16px; }
.ap-title b { color: #fff; }
.ap-preview { color: #ffb3c1; font-weight: 700; }
.ap-hint { color: var(--mute); font-size: 14px; }
.ap-buttons { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.ink .attack-arrow { filter: drop-shadow(0 0 6px rgba(255, 59, 92, 0.9)); }

/* Begin Duel + countdown */
.btn.begin { width: 100%; min-height: 64px; font: 900 22px var(--font-d); letter-spacing: 0.18em; text-transform: uppercase; background: var(--cyan); border-color: var(--cyan); color: #140a02; border-radius: 14px; margin-top: 6px; }
.btn.begin:hover:not(:disabled) { background: #ff9640; }
.btn.begin:disabled { background: transparent; color: var(--mute); border-color: var(--line2); font-size: 15px; letter-spacing: 0.08em; }
.countdown { position: fixed; inset: 0; z-index: 160; display: grid; place-items: center; background: rgba(11, 13, 18, 0.82); transition: opacity 0.4s; pointer-events: none; }
.countdown.out { opacity: 0; }
.cd-num { font: 900 clamp(96px, 26vw, 220px) var(--font-d); color: var(--txt); line-height: 1; }
.cd-num.go { font-size: clamp(64px, 16vw, 150px); color: var(--cyan); letter-spacing: 0.08em; }
.cd-num.tick { animation: cdtick 0.9s ease-out; }
@keyframes cdtick { 0% { transform: scale(1.6); opacity: 0; } 25% { transform: scale(1); opacity: 1; } 80% { opacity: 1; } 100% { transform: scale(0.85); opacity: 0.2; } }
.cd-num.go.tick { animation: cdgo 0.8s ease-out; }
@keyframes cdgo { 0% { transform: scale(0.6); opacity: 0; } 30% { transform: scale(1.08); opacity: 1; } 100% { transform: scale(1); opacity: 1; } }

.begin-overlay { position: absolute; inset: 0; z-index: 90; display: grid; place-items: center; background: rgba(11, 13, 18, 0.55); }
.begin-box { display: grid; gap: 14px; justify-items: center; padding: 16px; }
.btn.begin.huge { width: min(420px, 82vw); min-height: 88px; font-size: clamp(24px, 6vw, 34px); box-shadow: 0 18px 50px rgba(0, 0, 0, 0.6); }
.begin-wait { font: 700 20px var(--font-d); letter-spacing: 0.08em; color: var(--txt); text-align: center; padding: 18px 26px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line2); }
.begin-who { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.begin-who span { display: flex; align-items: center; gap: 6px; font-weight: 700; color: var(--mute); }
.begin-who span.ok { color: var(--txt); }

.countdown.roll { pointer-events: auto; }
.roll-box { display: grid; gap: 22px; justify-items: center; padding: 26px 30px; border-radius: 18px; background: var(--panel); border: 1px solid var(--line2); }
.roll-title { font: 900 clamp(20px, 4.5vw, 28px) var(--font-d); letter-spacing: 0.06em; text-align: center; }
.roll-row { display: flex; gap: 22px; flex-wrap: wrap; justify-content: center; }
.roll-who { display: grid; justify-items: center; gap: 8px; padding: 10px; border-radius: 14px; border: 2px solid transparent; transition: border-color 0.2s, background 0.2s; }
.roll-who b { font-weight: 700; }
.roll-who .die { width: 64px; height: 64px; font-size: 32px; background: #f3f5f9; box-shadow: none; }
.roll-who.win { border-color: var(--cyan); background: rgba(242, 133, 42, 0.12); }
.roll-who.win .die { background: var(--cyan); color: #140a02; }

/* Deck choice + official decks */
.deck-choice { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line2); background: #0b0d12; text-align: left; }
.deck-choice:hover { border-color: var(--cyan); }
.deck-choice > div { flex: 1; display: grid; min-width: 0; }
.deck-choice b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deck-choice small { color: var(--mute); }
.dc-art { width: 46px; height: 46px; border-radius: 8px; object-fit: cover; flex: none; background: #1a1e27; }
.dc-art.empty { display: grid; place-items: center; color: var(--mute); }
.dc-change { color: var(--cyan); font-weight: 700; font-size: 14px; }
.deck-tabs { max-width: 420px; }
.pick-deck { display: grid; gap: 12px; }
.pick-deck-body { display: grid; gap: 12px; max-height: min(62dvh, 620px); overflow: auto; }
.precon-groups { display: grid; gap: 16px; }
.precon-group { display: grid; gap: 8px; }
.precon-list { display: grid; gap: 6px; }
.precon-row { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: #0f1218; cursor: pointer; }
.precon-row:hover { border-color: var(--cyan); background: rgba(242, 133, 42, 0.06); }
.precon-row > div { flex: 1; display: grid; min-width: 0; }
.precon-row b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.precon-row small { color: var(--mute); }
.precon-art { width: 52px; height: 52px; border-radius: 8px; object-fit: cover; flex: none; background: #1a1e27; }
.precon-art.none { display: grid; place-items: center; color: var(--mute); }
.precon-art.big { width: 72px; height: 72px; }
.precon-view { display: grid; gap: 10px; }
.precon-view .pick-top > div { flex: 1; display: grid; }

.surrender-btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 10px; border: 1px solid rgba(255, 59, 92, 0.45); background: transparent; color: #ff8da1; font: 700 13px var(--font); letter-spacing: 0.04em; text-transform: uppercase; margin-right: 4px; }
.surrender-btn:hover { background: rgba(255, 59, 92, 0.12); }
@media (max-width: 640px) { .surrender-btn span { display: none; } .surrender-btn { padding: 0 8px; } }
.surrender-box h3 { font-size: 20px; }

/* Step-by-step phases (Digital) */
.ph-row.track .ph { cursor: default; }
.next-row { display: flex; gap: 6px; }
.btn.next-ph { min-height: 38px; padding: 0 12px; font-size: 13px; }
.btn.next-ph.end:not(.primary) { border-color: rgba(255, 59, 92, 0.6); color: #ffb3c1; }
@media (max-width: 760px) { .phases { flex-wrap: wrap; } .next-row { width: 100%; justify-content: flex-end; } .ph-row.track .ph { padding: 3px 0; } }
/* Clock + pause */
.duel-clock { font: 700 15px var(--font-d); color: var(--txt); letter-spacing: 0.06em; padding: 0 8px; font-variant-numeric: tabular-nums; }
.duel-clock.paused { color: #ffb3c1; animation: pulse 1.4s infinite; }
.duel.paused .mat, .duel.paused .layer { filter: grayscale(0.6) brightness(0.6); }
.pause-banner { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 85; display: flex; align-items: center; gap: 14px; width: min(520px, calc(100% - 24px)); padding: 16px 18px; border-radius: 14px; background: #161a22; border: 1px solid var(--line2); box-shadow: 0 18px 50px rgba(0, 0, 0, 0.6); }
.pause-banner > div { flex: 1; display: grid; }
.pause-banner b { font: 900 17px var(--font-d); letter-spacing: 0.06em; }
.pause-banner small { color: var(--mute); }
.pile-card.picked { outline: 3px solid #ff3b5c; transform: translateY(-4px); }

/* Link Arrows on Link Monsters */
.ov.larrow { width: 0; height: 0; border: calc(var(--c) * 0.075) solid transparent; z-index: 4; filter: drop-shadow(0 0 3px rgba(255, 80, 60, 0.9)); }
.ov.larrow.top { left: 50%; top: -9%; transform: translateX(-50%); border-bottom-color: #ff4a3d; border-top: 0; }
.ov.larrow.bottom { left: 50%; bottom: -9%; transform: translateX(-50%); border-top-color: #ff4a3d; border-bottom: 0; }
.ov.larrow.left { top: 50%; left: -12%; transform: translateY(-50%); border-right-color: #ff4a3d; border-left: 0; }
.ov.larrow.right { top: 50%; right: -12%; transform: translateY(-50%); border-left-color: #ff4a3d; border-right: 0; }
.ov.larrow.top-left { left: -10%; top: -7%; transform: rotate(-45deg); border-bottom-color: #ff4a3d; border-top: 0; }
.ov.larrow.top-right { right: -10%; top: -7%; transform: rotate(45deg); border-bottom-color: #ff4a3d; border-top: 0; }
.ov.larrow.bottom-left { left: -10%; bottom: -7%; transform: rotate(45deg); border-top-color: #ff4a3d; border-bottom: 0; }
.ov.larrow.bottom-right { right: -10%; bottom: -7%; transform: rotate(-45deg); border-top-color: #ff4a3d; border-bottom: 0; }
.pile-card.chosen { outline: 3px solid var(--cyan); transform: translateY(-4px); }
/* Learn */
.learn-hero { display: flex; gap: 16px; align-items: center; }
.learn-hero img { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; object-position: 50% 15%; border: 2px solid var(--line2); }
.learn-hero h2 { margin: 0 0 4px; font: 900 24px var(--font-d); }
.learn-hero p { margin: 0; font-style: italic; }
.learn-head { display: flex; align-items: baseline; gap: 10px; justify-content: space-between; }
.lesson-list { display: grid; gap: 6px; }
.lesson-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: #0f1218; color: var(--txt); text-decoration: none; }
.lesson-row:hover { border-color: var(--cyan); }
.lesson-row > div { flex: 1; display: grid; }
.lesson-row small { color: var(--mute); }
.lesson-n { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line2); font: 700 13px var(--font-d); flex: none; }
.lesson-row.done .lesson-n { background: var(--green); border-color: var(--green); color: #052012; }
.lesson-body { display: grid; gap: 16px; }
.kaiba-says { display: flex; gap: 14px; align-items: flex-start; }
.ks-av { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; object-position: 50% 15%; border: 2px solid var(--line2); flex: none; }
.ks-bubble { padding: 14px 16px; border-radius: 4px 16px 16px 16px; background: #f3f5f9; color: #0b0d12; font-size: 18px; line-height: 1.45; font-weight: 600; }
.lesson-card { justify-self: center; padding: 0; border: 0; background: none; display: grid; gap: 4px; justify-items: center; }
.lesson-card img { width: min(240px, 60vw); border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); }
.lesson-card small { color: var(--mute); }
.lesson-nav { border-top: 1px solid var(--line); padding-top: 12px; }
.lesson-end { display: grid; }
.quiz { display: grid; gap: 10px; padding: 14px; border-radius: 12px; border: 1px solid var(--line2); background: var(--panel); }
.quiz b { font-size: 17px; }
.quiz-opts { display: flex; gap: 8px; flex-wrap: wrap; }
.quiz .btn { text-transform: none; letter-spacing: 0; font-size: 15px; }
.quiz .btn.right { border-color: var(--green); background: rgba(54, 240, 160, 0.15); color: var(--green); }
.quiz .btn.wrong { border-color: #ff3b5c; background: rgba(255, 59, 92, 0.12); color: #ffb3c1; }
.quiz-res { margin: 0; font-weight: 700; }
.mat-diagram { justify-self: center; display: grid; gap: 4px; padding: 12px; border-radius: 12px; background: #0f1218; border: 1px solid var(--line); }
.md-row { display: grid; grid-template-columns: repeat(7, minmax(34px, 52px)); gap: 4px; }
.md-cell { aspect-ratio: 1; border-radius: 5px; border: 1px solid rgba(255, 255, 255, 0.14); display: grid; place-items: center; font: 700 10px var(--font-d); color: var(--mute); text-transform: uppercase; }
.md-cell.blank { border-color: transparent; }
.md-cell.mdp { border-style: dashed; font-size: 8px; }
.md-cell.emz { border-style: dashed; border-color: rgba(182, 124, 255, 0.5); }
.md-cell.lit { background: rgba(242, 133, 42, 0.3); border-color: var(--cyan); color: var(--txt); }
.md-cell.arrow { background: rgba(255, 74, 61, 0.25); border-color: #ff4a3d; }
.md-label { text-align: center; color: var(--mute); font-size: 13px; padding-top: 4px; }
.practice-panel { position: absolute; left: 50%; top: 8px; transform: translateX(-50%); z-index: 74; display: flex; align-items: center; gap: 10px; width: min(560px, calc(100% - 20px)); padding: 8px 10px; border-radius: 12px; background: #161a22; border: 1px solid var(--cyan); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); }
.practice-panel img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; object-position: 50% 15%; }
.practice-panel > div { flex: 1; display: grid; min-width: 0; }
.practice-panel small { color: var(--mute); }
.practice-panel.done { border-color: var(--green); }

.zone.picked { background: rgba(242, 133, 42, 0.35) !important; border-color: var(--cyan) !important; }
/* Card carousel (GY / banished) */
.modal.carousel-modal { width: min(860px, 100%); }
.carousel .pick-top { gap: 12px; }
.cc-pos { color: var(--mute); font-weight: 700; }
.cc-stage { display: flex; align-items: center; gap: 8px; touch-action: pan-y; }
.cc-card { flex: 1; display: grid; grid-template-columns: minmax(160px, 300px) 1fr; gap: 18px; align-items: start; min-height: 320px; }
@media (max-width: 620px) { .cc-card { grid-template-columns: 1fr; } .cc-img { max-width: 220px; margin: 0 auto; } }
.cc-img { width: 100%; border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); display: block; user-select: none; }
.cc-info h2 { margin: 0 0 4px; font: 900 21px var(--font-d); }
.cc-note { margin: 8px 0; color: #ffb3c1; font-weight: 700; }
.cc-nav { flex: none; width: 44px; height: 88px; border-radius: 12px; border: 1px solid var(--line2); background: #0f1218; color: var(--txt); display: grid; place-items: center; }
.cc-nav:disabled { opacity: 0.25; }
.cc-nav:not(:disabled):hover { border-color: var(--cyan); color: var(--cyan); }

.how-label { font: 700 12px var(--font-d); letter-spacing: 0.12em; text-transform: uppercase; color: var(--mute); margin: 10px 0 6px; }
.how-row + .how-label { margin-top: 14px; }

.sug-list { display: grid; gap: 6px; }
.sug-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line2); background: rgba(242, 133, 42, 0.07); text-align: left; font-weight: 700; }
.sug-row:hover { border-color: var(--cyan); }
.sug-row .ic { color: var(--cyan); }
.other-fx { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.other-fx summary { cursor: pointer; color: var(--mute); font-weight: 700; }
.other-fx[open] summary { margin-bottom: 6px; }
.place-here { display: grid; gap: 12px; }

.mat-status { font-weight: 700; color: var(--cyan); margin-bottom: 6px; }
.card.picked-flash .face { outline: 3px solid #ffc940; box-shadow: 0 0 22px #ffc940; }

.ov.bol { right: -10%; top: -8%; padding: 0 4px; border-radius: 5px; font: 900 calc(var(--c) * 0.12) var(--font-d); background: #3a1d6e; border: 1px solid #b67cff; color: #ead9ff; }
.ap-fx { display: flex; gap: 6px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 6px; }
.alt-trib { justify-self: start; margin: -2px 0 6px; }

/* Card sheet: tap a card -> picture, text, actions */
.modal.sheet-modal { width: min(820px, 100%); }
.card-sheet { display: grid; gap: 14px; }
.cs-top { display: grid; grid-template-columns: minmax(150px, 260px) 1fr; gap: 18px; align-items: start; }
.cs-img { width: 100%; border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); display: block; }
.cs-info h2 { margin: 0 0 4px; font: 900 20px var(--font-d); }
.cs-acts { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px; border-top: 1px solid var(--line); padding-top: 12px; }
.cs-act { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line2); background: #0f1218; text-align: left; font-weight: 700; font-size: 15px; }
.cs-act:hover:not(:disabled) { border-color: var(--cyan); background: rgba(242, 133, 42, 0.08); }
.cs-act:disabled { opacity: 0.5; cursor: default; }
.cs-act .ic { color: var(--cyan); flex: none; }
.cs-act.danger, .cs-act.danger .ic { color: #ff8da1; }
.cs-sep { display: none; }
.cs-head { grid-column: 1 / -1; font: 700 11px var(--font-d); letter-spacing: 0.14em; text-transform: uppercase; color: var(--mute); padding: 4px 2px 0; }
.cs-sub { grid-column: 1 / -1; border: 1px solid var(--line); border-radius: 10px; background: #0d1015; }
.cs-sub summary { display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer; font-weight: 700; list-style: none; }
.cs-sub summary::-webkit-details-marker { display: none; }
.cs-sub summary .ic { color: var(--cyan); }
.cs-sub summary::after { content: '+'; margin-left: auto; color: var(--mute); font-weight: 900; }
.cs-sub[open] summary::after { content: '\2212'; }
.cs-subitems { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px; padding: 0 10px 10px; }
@media (max-width: 620px) {
  .cs-top { grid-template-columns: 110px 1fr; gap: 12px; }
  .cs-info h2 { font-size: 17px; }
  .cs-info .cd-text p { font-size: 15px; }
  .cs-acts, .cs-subitems { grid-template-columns: 1fr; }
}
/* Placing notice: full width, rounded rectangle */
.place-banner { left: 8px; right: 8px; top: 8px; transform: translateY(-160%); max-width: none; border-radius: 14px; padding: 10px 12px; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.place-banner.on { transform: translateY(0); }
.place-banner > span { flex: 1 1 200px; font-size: 15px; line-height: 1.3; }
/* Desktop: no left panel; the log is a button */
.duel-side { display: none !important; }
@media (min-width: 1100px) { .top-tools .log-btn { display: inline-grid; } }
/* Clock: top bar on wide screens, bottom bar on phones */
.phone-clock { display: none; align-items: center; gap: 2px; }
@media (max-width: 640px) {
  .top-tools .duel-clock, .top-tools .icon-btn[title="Pause Duel"] { display: none; }
  .phone-clock { display: flex; }
}

.carousel .cs-acts { margin-top: 10px; }

/* Deck shuffle */
.fx-shuffle { position: absolute; z-index: 30; pointer-events: none; }
.fx-shuffle img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 4px; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6); animation: riffle 0.9s ease-in-out both; }
@keyframes riffle {
  0%, 100% { transform: translate(0, 0) rotate(0); }
  25% { transform: translate(calc(var(--dir) * 70%), -8%) rotate(calc(var(--dir) * 10deg)); }
  50% { transform: translate(calc(var(--dir) * -20%), 4%) rotate(calc(var(--dir) * -4deg)); }
  75% { transform: translate(calc(var(--dir) * 40%), -4%) rotate(calc(var(--dir) * 6deg)); }
}
@media (prefers-reduced-motion: reduce) { .fx-shuffle img { animation-duration: 0.01s; } }

/* Sign-in: create an account */
.login-note { margin: 0; font-size: 13px; color: var(--mute); text-align: left; }
.login-card .link-btn { margin-top: 16px; background: none; border: 0; padding: 6px; color: var(--mute); font: inherit; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.login-card .link-btn:hover { color: var(--txt); }

/* Duel history rows: open + remove */
.lobby-item { display: flex; align-items: stretch; gap: 8px; }
.lobby-item .lobby-row { flex: 1; min-width: 0; }
.lobby-item .lr-del { align-self: center; flex: none; }
/* Profile */
img.avatar.photo { object-fit: cover; border-radius: 50%; display: inline-block; flex: none; background: var(--uc); }
.profile-set { display: grid; gap: 18px; min-width: min(380px, 100%); }
.prof-row { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.prof-btns { display: grid; gap: 8px; }
.prof-btns label.btn { cursor: pointer; }
.home > *, .lobby-list > * { min-width: 0; }
.home { grid-template-columns: minmax(0, 1fr); }
.lobby-item .lobby-row { overflow: hidden; }
@media (max-width: 640px) { .lobby-item .lobby-row > .status { display: none; } .lobby-item .lobby-row { gap: 10px; padding: 10px 12px; } }

/* Top bar: centered BAHH DUEL logo */
.topbar { min-height: 70px; }
.topbar-logo { position: absolute; left: 50%; bottom: 6px; translate: -50% 0; display: block; line-height: 0; }
.topbar-logo img { height: 58px; width: auto; display: block; }
@media (max-width: 640px) { .topbar h1 { display: none; } .topbar-logo img { height: 52px; } }

.logo-word { width: min(320px, 92%); height: auto; display: block; }

/* Home: wide enough for all six buttons on one row */
.home { width: min(1160px, 100%); }

/* Response window banner (Digital Duels) */
.resp-banner { position: absolute; left: 8px; right: 8px; top: 8px; z-index: 72; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 12px 14px; border-radius: 14px; background: #10141c; border: 1px solid var(--cyan); overflow: hidden; }
.resp-banner .rb-text { flex: 1 1 220px; font-size: 15px; line-height: 1.35; }
.resp-banner .rb-text b { color: var(--cyan); }
.resp-banner .rb-btns { display: flex; gap: 8px; flex: none; }
.resp-banner .rb-timer { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(255, 255, 255, 0.06); }
.resp-banner .rb-timer i { display: block; height: 100%; background: var(--cyan); transform-origin: left; animation: rb-shrink linear forwards; }
@keyframes rb-shrink { from { transform: scaleX(1); } to { transform: scaleX(0); } }
.resp-banner.wait { left: 50%; right: auto; transform: translateX(-50%); padding: 8px 14px; border-color: var(--line2); color: var(--mute); font-weight: 600; font-size: 14px; white-space: nowrap; max-width: calc(100% - 16px); }
.resp-banner.held { border-color: #7dff9b; }

/* Phones: duelists on top, every tool in a row at the bottom */
.bottom-tools { display: none; }
@media (max-width: 640px) {
  .duel-top .top-tools { display: none; }
  .duel-top .opps { flex: 1; min-width: 0; }
  .bottom-tools { display: flex; order: 4; flex-basis: 100%; align-items: center; justify-content: space-between; gap: 2px; padding-top: 4px; border-top: 1px solid var(--line); }
  .bottom-tools .icon-btn { width: 34px; height: 34px; }
  .bottom-tools .duel-clock { padding: 0 4px; }
  .bottom-tools .surrender-btn span { display: none; }
  .bottom-tools .surrender-btn { padding: 0 8px; height: 34px; }
}

/* AI usage report */
.usage-rep { display: grid; gap: 14px; }
.us-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.us-stat { display: grid; gap: 2px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
.us-stat small { color: var(--mute); font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; font-size: 11px; }
.us-stat b { font-size: 22px; }
.us-stat span { color: var(--mute); font-size: 12px; }
.us-sec h4 { margin: 4px 0 6px; }
.us-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.us-table th, .us-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.us-table th { color: var(--mute); font-weight: 700; }
.us-table td:not(:first-child), .us-table th:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }

/* Phones in a duel: Kaiba's button sits top right (it covered the End Phase button at the bottom) */
@media (max-width: 640px) {
  body.in-duel .kaiba-fab { top: calc(8px + env(safe-area-inset-top)); bottom: auto; right: 8px; width: 40px; height: 40px; }
  body.in-duel .duel-top { padding-right: 56px; }
}

/* Dragging a hand card: a small yellow arrow marks where it will go */
.hand-drop { position: absolute; z-index: 85; width: 0; height: 0; pointer-events: none; transform: translate(-50%, -100%); margin-top: -4px;
  border-left: 9px solid transparent; border-right: 9px solid transparent; border-top: 13px solid #ffd23f; filter: drop-shadow(0 0 6px rgba(255, 210, 63, 0.8)); animation: hand-drop-bob 0.8s ease-in-out infinite alternate; }
@keyframes hand-drop-bob { from { margin-top: -8px; } to { margin-top: -2px; } }

/* Turn log: button next to Kaiba's chat button; the log is grouped by turn */
.log-fab { position: fixed; z-index: 90; right: 74px; bottom: calc(88px + var(--safe-b)); width: 44px; height: 44px; margin-top: 2px; border-radius: 50%; display: grid; place-items: center; background: var(--panel); border: 2px solid var(--line2); color: var(--txt); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5); }
.log-fab:hover { border-color: var(--cyan); color: var(--cyan); }
@media (max-width: 760px) { .log-fab { bottom: calc(118px + var(--safe-b)); right: 62px; width: 40px; height: 40px; } }
@media (max-width: 640px) { .log-fab { top: calc(8px + env(safe-area-inset-top)); bottom: auto; right: 54px; } body.in-duel .duel-top { padding-right: 102px; } }
.log-turn { display: flex; align-items: baseline; gap: 8px; margin: 10px 0 2px; padding-top: 8px; border-top: 1px solid var(--line); font: 800 12px var(--font-d); letter-spacing: 0.1em; text-transform: uppercase; color: var(--cyan); }
.log-turn span { color: var(--txt); letter-spacing: 0.04em; text-transform: none; font-size: 14px; }
.log-turn:first-child { border-top: 0; margin-top: 0; padding-top: 0; }

/* Sign-in links, profile forms, admin panel (2026-11-02) */
.login-card .login-links { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 24px; margin-top: 16px; }
.login-card .login-links .link-btn { margin-top: 0; }
.profile-set form + form { margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--line); }
.profile-set .field .input + .input { margin-top: 4px; }
.admin-rep { display: grid; gap: 24px; }
.admin-scroll { overflow-x: auto; }
.admin-table td, .admin-table th { vertical-align: middle; white-space: nowrap; }
.admin-table td:not(:first-child), .admin-table th:not(:first-child) { text-align: left; }
.admin-table .admin-btns { text-align: right !important; }
.admin-btns .btn + .btn { margin-left: 8px; }
@media (max-width: 640px) {
  .admin-table, .admin-table tbody, .admin-table tr, .admin-table td { display: block; }
  .admin-table tr:first-child { display: none; }
  .admin-table tr { padding: 16px 0; border-bottom: 1px solid var(--line); }
  .admin-table td, .admin-table th { border: 0; padding: 2px 0; white-space: normal; }
  .admin-table td[data-l]::before { content: attr(data-l) ': '; color: var(--mute); }
  .admin-table .admin-btns { text-align: left !important; padding-top: 12px; }
  .admin-btns .btn { margin: 0 8px 8px 0 !important; }
}
.admin-pw { font: 700 22px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace; user-select: all; padding: 16px; border: 1px solid var(--line); border-radius: 10px; text-align: center; }
.admin-search { width: 100%; }
.admin-list { display: grid; gap: 24px; }

/* ---- How To Use, tour, chat, Random Duel (2026-11-02) ---- */
.howto-link { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line2); background: transparent; color: var(--txt); font: 600 14px var(--font-b, inherit); cursor: pointer; flex: none; white-space: nowrap; }
.howto-link:hover { border-color: var(--cyan); color: var(--cyan); }
.howto-link .ic { color: var(--cyan); }
@media (max-width: 640px) { .howto-link { padding: 0; width: 40px; justify-content: center; } .howto-link span { display: none; } }
.howto { display: grid; gap: 24px; max-width: 680px; }
.howto h3 { margin: 0; }
.howto .ht-lead { margin: 0; font-size: 17px; line-height: 1.6; text-wrap: pretty; }
.ht-item, .ht-honor { display: grid; grid-template-columns: 40px 1fr; gap: 16px; align-items: start; }
.ht-item h4, .ht-honor h4 { margin: 0 0 8px; font-size: 17px; text-wrap: balance; }
.ht-item p, .ht-honor p { margin: 0 0 8px; line-height: 1.6; color: var(--txt); text-wrap: pretty; max-width: 62ch; }
.ht-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--cyan); border: 1px solid var(--line2); }
.ht-honor { padding: 32px; border-radius: 16px; border: 1px solid var(--cyan); background: rgba(242, 133, 42, 0.08); }
.ht-honor .ht-ic { background: var(--cyan); color: #111; border-color: var(--cyan); }
.ht-btns { flex-wrap: wrap; gap: 8px; margin-top: 8px; }

.tour-modal { max-width: 860px; }
.tour { display: grid; grid-template-columns: 1.15fr 1fr; gap: 32px; align-items: center; }
@media (max-width: 760px) { .tour { grid-template-columns: 1fr; gap: 24px; } }
.tour-media { border-radius: 14px; overflow: hidden; border: 1px solid var(--line2); background: #07090d; aspect-ratio: 16 / 11; display: grid; place-items: center; }
.tour-media img { width: 100%; height: 100%; object-fit: contain; }
.tour-media.logo img { object-fit: contain; padding: 32px; }
.tour-media.honor { background: rgba(242, 133, 42, 0.08); border-color: var(--cyan); }
.tour-honor { display: grid; justify-items: center; gap: 16px; color: var(--cyan); }
.tour-honor b { font: 700 22px var(--font-d); letter-spacing: 0.1em; text-transform: uppercase; }
.tour-text h3 { margin: 8px 0 16px; text-wrap: balance; }
.tour-text p { margin: 0 0 12px; line-height: 1.6; text-wrap: pretty; }
.tour-dots { display: flex; gap: 8px; margin: 24px 0; }
.tour-dots span { width: 8px; height: 8px; border-radius: 50%; background: var(--line2); }
.tour-dots span.on { background: var(--cyan); width: 24px; border-radius: 4px; }
.tour .row.end { gap: 8px; flex-wrap: wrap; }

.chat-panel { display: grid; gap: 12px; }
.chat-head { display: flex; align-items: center; justify-content: space-between; }
.chat-head .sec-title { margin: 0; }
.chat-view { display: grid; grid-template-rows: 1fr auto; gap: 12px; min-height: 0; }
.chat-panel .chat-list { max-height: 320px; min-height: 120px; }
.chat-list { overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding-right: 4px; }
.chat-msg { display: flex; gap: 8px; align-items: flex-end; max-width: 88%; }
.chat-msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.chat-bubble { padding: 8px 12px; border-radius: 14px; background: var(--panel2); border: 1px solid var(--line); min-width: 0; }
.chat-msg.mine .chat-bubble { background: rgba(242, 133, 42, 0.14); border-color: rgba(242, 133, 42, 0.4); }
.chat-who { display: flex; gap: 8px; align-items: baseline; font-size: 12px; margin-bottom: 2px; }
.chat-who small { color: var(--mute); }
.chat-text { font-size: 15px; line-height: 1.45; overflow-wrap: anywhere; }
.chat-sys { align-self: center; text-align: center; font-size: 13px; color: var(--mute); max-width: 44ch; line-height: 1.5; }
.chat-form { display: flex; gap: 8px; }
.chat-form .input { flex: 1; min-width: 0; }
.chat-form .btn { flex: none; width: 48px; padding: 0; justify-content: center; }
.chat-drawer { position: fixed; right: 0; top: 0; bottom: 0; z-index: 96; width: min(380px, 92vw); display: flex; flex-direction: column; gap: 12px; padding: 16px; padding-top: max(16px, env(safe-area-inset-top)); padding-bottom: max(16px, var(--safe-b)); background: var(--panel) !important; border-left: 1px solid var(--line2); box-shadow: -10px 0 40px rgba(0, 0, 0, 0.5); animation: slidein 0.18s; }
.chat-drawer .ld-head { gap: 12px; }
.chat-drawer .ld-head .spacer { flex: 1; }
.chat-drawer .chat-view { flex: 1; }
.chat-fab { position: fixed; z-index: 90; right: 128px; bottom: calc(88px + var(--safe-b)); width: 44px; height: 44px; margin-top: 2px; border-radius: 50%; display: grid; place-items: center; background: var(--panel); border: 2px solid var(--line2); color: var(--txt); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5); }
.chat-fab:hover { border-color: var(--cyan); color: var(--cyan); }
.chat-badge { position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--cyan); color: #111; font: 700 11px/20px var(--font-b, inherit); text-align: center; }
@media (max-width: 760px) { .chat-fab { bottom: calc(118px + var(--safe-b)); right: 110px; width: 40px; height: 40px; } }
@media (max-width: 640px) { .chat-fab { top: calc(8px + env(safe-area-inset-top)); bottom: auto; right: 100px; } body.in-duel .duel-top { padding-right: 148px; } }

.lottery-bar { position: fixed; z-index: 97; left: 50%; transform: translateX(-50%); bottom: calc(24px + var(--safe-b)); display: flex; align-items: center; gap: 16px; padding: 12px 12px 12px 20px; border-radius: 999px; background: var(--panel2); border: 1px solid var(--cyan); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); font-weight: 600; white-space: nowrap; max-width: calc(100vw - 24px); }
.lottery-bar small { color: var(--mute); font-weight: 400; }
.lottery-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--cyan); animation: lotpulse 1.2s infinite; flex: none; }
@keyframes lotpulse { 50% { opacity: 0.25; transform: scale(0.7); } }
@media (max-width: 480px) { .lottery-bar small { display: none; } }
.chat-head .link-btn, .chat-drawer .link-btn { background: none; border: 0; padding: 8px; color: var(--mute); font: inherit; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.chat-head .link-btn:hover, .chat-drawer .link-btn:hover { color: var(--txt); }
.admin-notes { display: grid; gap: 12px; }
.admin-note { padding: 16px; border-radius: 12px; border: 1px solid var(--line2); display: grid; gap: 8px; }
.admin-note.report { border-color: rgba(255, 59, 92, 0.6); }
.admin-note p { margin: 0; }
.an-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.an-head .spacer { flex: 1; }
.an-kind { font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--line2); }
.admin-note.report .an-kind { color: #ff8da1; border-color: rgba(255, 59, 92, 0.6); }
.an-text { white-space: pre-wrap; line-height: 1.55; overflow-wrap: anywhere; }
.an-chat { display: grid; gap: 4px; padding: 8px 0 0; font-size: 14px; color: var(--mute); }
.an-chat b { color: var(--txt); }

.profile-set textarea.input { font: inherit; font-size: 16px; line-height: 1.5; }
/* Side-by-side fields line up at the top (labels level, boxes level), whatever is under them. */
.grid2 { align-items: start; }
.grid2 > .field { align-content: start; }
.grid2 > .field > .note { min-height: 42px; padding-top: 0; padding-bottom: 0; display: flex; align-items: center; box-sizing: border-box; }
.seg-opt { align-content: start; }
/* Footer: copyright, centered, 10px (Paul 2026-11-02). Hidden on the duel mat. */
.site-foot { padding: 24px 16px calc(24px + var(--safe-b, 0px)); text-align: center; font-size: 10px; line-height: 1.4; color: var(--mute); }
body.in-duel .site-foot { display: none; }
.login { min-height: calc(100dvh - 64px); }
/* Short pages: the footer sits at the bottom of the window, not halfway up. */
body:not(.in-duel) #app { min-height: calc(100dvh - 64px); }
.news-check { align-items: flex-start; font-size: 14px; line-height: 1.45; color: var(--txt); margin: 0; }
.news-check input { margin-top: 2px; flex: none; }
.news-check { text-align: left; justify-content: flex-start; } .news-check span { flex: 1; } .news-check input { width: 18px; height: 18px; }
