:root {
  color-scheme: dark;
  --bg: #0c0f13;
  --panel: #151a21;
  --panel-2: #1c222b;
  --line: #303846;
  --text: #f5f7fa;
  --muted: #9ca7b5;
  --accent: #e61b50;
  --good: #9fe3aa;
  --bad: #ff9a9a;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 1180px; min-height: 100vh; background: radial-gradient(circle at top, #18202a 0, var(--bg) 42%); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input { font: inherit; }
button { color: inherit; }
button:disabled { opacity: .38; cursor: not-allowed; }
.back-link { color: var(--muted); text-decoration: none; }
.back-link:hover { color: var(--text); }
.start-screen { min-height: 100vh; display: grid; place-items: center; padding: 32px; }
.start-screen > .back-link { position: fixed; top: 24px; left: 28px; }
.start-card { width: min(680px, calc(100vw - 64px)); padding: 38px; border: 1px solid var(--line); border-radius: 22px; background: rgba(21, 26, 33, .97); box-shadow: 0 24px 80px #0008; }
.eyebrow { color: var(--muted); text-transform: uppercase; letter-spacing: .12em; font-size: .76rem; }
h1 { margin: 10px 0; font-size: 3.5rem; line-height: .95; }
h1 span { font-size: .9rem; color: var(--muted); vertical-align: middle; }
h2 { margin: 0 0 10px; font-size: 1rem; }
p { color: var(--muted); }
.name-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 28px 0; }
label { display: grid; gap: 8px; color: var(--muted); font-size: .85rem; }
input { width: 100%; border: 1px solid var(--line); border-radius: 10px; background: #0e1217; color: var(--text); padding: 12px 14px; }
.primary { background: var(--accent); border-color: transparent !important; }
.large { min-height: 48px; padding: 12px 20px; border-radius: 12px; border: 0; font-weight: 800; cursor: pointer; }
#game-screen { padding: 18px 22px 44px; }
#game-root { max-width: 1500px; margin: 0 auto; }
.topbar { display: flex; align-items: end; justify-content: space-between; margin-bottom: 14px; }
.topbar h1 { font-size: 2.1rem; margin: 5px 0 0; }
.turn-summary { text-align: right; display: grid; gap: 2px; }
.turn-summary span { color: var(--muted); }
.status-grid { display: grid; grid-template-columns: 1fr .7fr 1fr; gap: 10px; margin-bottom: 12px; }
.status-card { padding: 10px 13px; border: 1px solid var(--line); border-radius: 12px; background: #12171d; display: grid; gap: 2px; }
.status-card > span, .status-card small { color: var(--muted); font-size: .73rem; }
.status-card strong { font-size: .95rem; }
.deck-card { text-align: center; }
.battle-area, .hand-panel, .insight-panel, .log-panel, .center-controls { border: 1px solid var(--line); border-radius: 15px; background: rgba(18, 23, 29, .92); padding: 12px; }
.battle-area { margin: 9px 0; }
.active-area { border-color: #59677a; }
.small-note { color: var(--muted); font-weight: 400; font-size: .72rem; margin-left: 8px; }
.effects { display: flex; gap: 7px; margin-bottom: 9px; }
.effects span { border: 1px solid var(--line); background: var(--panel-2); border-radius: 999px; padding: 5px 9px; font-size: .72rem; color: var(--muted); }
.effects strong { color: var(--text); }
.board-grid { display: grid; grid-template-columns: repeat(3, minmax(220px, 1fr)) minmax(220px, .9fr); gap: 7px; }
.column-head { text-align: center; color: var(--muted); font-size: .69rem; text-transform: uppercase; letter-spacing: .08em; padding-bottom: 1px; }
.slot { position: relative; min-height: 102px; text-align: left; padding: 8px 9px; border-radius: 10px; border: 1px solid var(--line); background: #1a2028; overflow: hidden; }
.active-area .slot { cursor: pointer; }
.slot.empty { display: grid; place-items: center; color: #617082; background: #11161c; border-style: dashed; }
.slot.selected, .hand-card.selected { outline: 2px solid #fff; outline-offset: 1px; }
.slot.front { border-color: #8c9aad; }
.destiny-slot { background: #201a28; }
.destiny-slot.fate-active { border-color: #c994ff; box-shadow: inset 0 0 0 1px #c994ff55; }
.front-badge, .fate-badge { position: absolute; top: 6px; right: 7px; font-size: .58rem; letter-spacing: .08em; background: #fff; color: #101318; border-radius: 999px; padding: 3px 5px; font-weight: 900; }
.fate-badge { background: #d6b2ff; }
.breach-marker { position: absolute; inset: auto 5px 4px 5px; z-index: 0; opacity: .45; font-size: .62rem; border: 1px dashed #e5c26b; color: #e5c26b; padding: 3px 5px; border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-name, .card-hp, .element-list, .destiny-tag { position: relative; z-index: 1; }
.card-name { font-weight: 850; font-size: .8rem; padding-right: 48px; }
.card-hp { color: var(--muted); font-size: .67rem; margin: 2px 0 5px; }
.element-list { display: flex; gap: 4px; flex-wrap: wrap; }
.element-list span, .destiny-tag { padding: 2px 5px; border-radius: 5px; background: #0f1419; border: 1px solid #303846; color: #cbd2dc; font-size: .61rem; }
.destiny-tag { display: inline-block; margin-top: 5px; background: #251d31; }
.center-controls { margin: 9px 0; padding: 9px 12px; }
.action-row { display: flex; gap: 8px; align-items: center; }
.action-row button, .attack-panel button, .game-over button { border: 1px solid var(--line); background: #202730; border-radius: 9px; padding: 8px 12px; cursor: pointer; font-size: .78rem; }
.action-row .primary { margin-left: auto; }
.message { margin-bottom: 7px; font-size: .76rem; color: var(--muted); }
.message.success { color: var(--good); }
.message.error { color: var(--bad); }
.attack-panel { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.attack-panel button small { color: var(--muted); }
.attack-panel.muted { color: var(--muted); font-size: .74rem; }
.hand-panel { margin-top: 9px; }
.panel-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 20px; }
.panel-heading span { color: var(--muted); font-size: .7rem; }
.hand-cards { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; }
.hand-card { min-height: 108px; text-align: left; border: 1px solid var(--line); border-radius: 10px; background: #1a2028; padding: 9px; cursor: pointer; }
.insight-panel, .log-panel { margin-top: 9px; }
.peek-list { display: flex; gap: 7px; flex-wrap: wrap; }
.peek-card { display: grid; gap: 2px; min-width: 150px; border: 1px solid var(--line); border-radius: 8px; background: #11161c; padding: 8px; font-size: .72rem; }
.peek-card span { color: var(--muted); }
.log-panel summary { cursor: pointer; font-weight: 700; }
.log-panel p { margin: 7px 0 0; font-size: .72rem; }
.log-panel p span { color: #fff; margin-right: 8px; }
.game-over { border: 1px solid #e5c26b; background: #2b2415; border-radius: 14px; padding: 14px 18px; margin-bottom: 10px; display: flex; align-items: center; gap: 18px; }
.game-over h2, .game-over p { margin: 0; }
.game-over button { margin-left: auto; }
.pass-overlay { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: #080a0deF; }
.pass-overlay[hidden] { display: none; }
.pass-card { width: 460px; padding: 32px; border: 1px solid var(--line); border-radius: 18px; background: #171c23; text-align: center; }
.pass-card > span { color: var(--muted); text-transform: uppercase; letter-spacing: .1em; font-size: .72rem; }
.pass-card h2 { font-size: 1.7rem; margin: 10px 0; }
.empty-note { grid-column: 1 / -1; margin: 8px; }
@media (max-width: 1250px) {
  body { min-width: 1000px; }
  .board-grid { grid-template-columns: repeat(3, minmax(180px, 1fr)) minmax(180px, .9fr); }
  .slot { min-height: 96px; }
}

.start-error{margin:14px 0 0;color:#ff9d9d;line-height:1.45;}
