:root {
  --bg: #05090f;
  --panel: #0b111a;
  --panel2: #111a26;
  --line: #283748;
  --soft-line: #1a2735;
  --text: #edf4fb;
  --muted: #8090a4;
  --cyan: #58d8e8;
  --orange: #ff7b42;
  --green: #56d6a3;
  --red: #ff5c71;
  --gold: #f3c969;
  --card-w: 74px;
  --card-h: 108px;
  --zone-w: 116px;
  --zone-h: 118px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: Inter, "Noto Sans KR", system-ui, sans-serif; }
button, select, input { font: inherit; }
button { color: inherit; }
.lobby-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 50% 42%, #193541 0, #09131d 38%, #04070c 76%); }.lobby-card { width: min(620px, calc(100vw - 32px)); padding: 42px; border: 1px solid #365267; border-radius: 14px; background: linear-gradient(145deg, #101c29f2, #080e16f7); box-shadow: 0 28px 80px #000b; text-align: center; }.lobby-card > small { color: var(--orange); font-size: 10px; letter-spacing: .22em; }.lobby-card h1 { margin: 9px 0 6px; font: 900 36px/1 Georgia, serif; letter-spacing: .06em; }.lobby-card h2 { margin: 9px 0 26px; }.lobby-card p { margin: 0 0 28px; color: var(--muted); }.lobby-emblem { width: 74px; height: 74px; margin: 0 auto 25px; display: grid; place-items: center; border: 2px solid var(--orange); color: var(--orange); font: 900 42px/1 Georgia, serif; transform: rotate(45deg); box-shadow: 0 0 30px #ff7b4233; }.lobby-primary { min-width: 210px; border: 1px solid var(--cyan); border-radius: 6px; background: #1d5263; padding: 13px 22px; font-weight: 900; cursor: pointer; }.lobby-primary:hover { background: #267086; }.lobby-back { display: block; margin: 20px auto 0; border: 0; background: transparent; color: var(--muted); cursor: pointer; }.role-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }.role-grid button { min-height: 88px; border: 1px solid #354d61; border-radius: 7px; background: #101b28; padding: 13px; text-align: left; cursor: pointer; }.role-grid button:hover { border-color: var(--cyan); background: #142737; }.role-grid b, .role-grid span { display: block; }.role-grid span { margin-top: 6px; color: var(--muted); font-size: 10px; }.deck-drop { display: grid; place-items: center; min-height: 150px; border: 1px dashed #506b80; border-radius: 8px; background: #09121c; cursor: pointer; }.deck-drop:hover { border-color: var(--gold); }.deck-drop strong, .deck-drop span { display: block; }.deck-drop span { margin-top: 7px; color: var(--muted); font-size: 11px; }.deck-drop input { display: none; }.deck-summary { margin: 14px 0 24px; color: #b9c8d5; font-size: 12px; }.lobby-message { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); padding: 10px 16px; border: 1px solid #b44d5c; background: #3b171f; border-radius: 6px; font-size: 12px; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 310px minmax(860px, 1fr) 290px; }
.console { height: 100vh; position: sticky; top: 0; display: grid; grid-template-rows: auto auto 1fr auto; background: linear-gradient(180deg, #0c131e 0%, #070c13 100%); border-right: 1px solid var(--line); box-shadow: 18px 0 50px #0007; z-index: 20; }
.brand { height: 74px; display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); letter-spacing: .08em; }
.brand-mark { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid var(--orange); color: var(--orange); font: 900 23px/1 Georgia, serif; transform: rotate(45deg); }
.brand-mark::first-letter { transform: rotate(-45deg); }
.brand strong, .brand small { display: block; }.brand small { color: var(--muted); font-size: 9px; margin-top: 4px; }
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--line); }
.tab { border: 0; background: #0b121c; color: var(--muted); padding: 13px 4px; cursor: pointer; border-bottom: 2px solid transparent; font-size: 12px; }
.tab:hover, .tab.active { color: var(--text); background: #111b28; }.tab.active { border-color: var(--orange); }
.panel { display: none; min-height: 0; overflow: auto; padding: 14px; }.panel.active { display: block; }
.empty-panel { color: var(--muted); min-height: 260px; display: grid; place-items: center; text-align: center; line-height: 1.8; }
.card-preview { width: 180px; aspect-ratio: 59/86; display: block; object-fit: cover; margin: 4px auto 16px; border-radius: 9px; box-shadow: 0 12px 35px #000a; }
.card-info-name { margin: 0 0 8px; font-size: 17px; }.card-info-meta { color: var(--muted); font: 11px ui-monospace, monospace; }
.card-description { margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--line); color: #c8d4df; font-size: 12px; line-height: 1.65; white-space: pre-wrap; }
.log-list { display: flex; flex-direction: column; gap: 7px; }.log-entry { border-left: 2px solid #33465c; background: #0f1824; padding: 8px 9px; font-size: 12px; }.log-entry.p1 { border-color: var(--cyan); }.log-entry.p2 { border-color: var(--orange); }.log-entry small { color: var(--muted); margin-right: 6px; }
.notice[hidden] { display: none; }.edit-button, .next-turn, .notice button { background: #142234; border: 1px solid #36506b; padding: 8px 10px; border-radius: 5px; cursor: pointer; }.notice button:hover { background: #1b3049; }
.deck-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }.deck-card { position: relative; aspect-ratio: 59/86; background: #172331; border: 1px solid #34485e; border-radius: 4px; overflow: hidden; cursor: pointer; }.deck-card img { width: 100%; height: 100%; object-fit: cover; }.deck-card .mini-back { position: absolute; inset: 0; }.deck-count { grid-column: 1/-1; color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.connection { padding: 11px 15px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; }.connection i { width: 8px; height: 8px; border-radius: 50%; background: #d99c45; }.connection.online i { background: var(--green); box-shadow: 0 0 9px var(--green); }.connection.offline i { background: var(--red); }
.table-wrap { min-width: 0; background: radial-gradient(circle at 50% 44%, #172c37 0, #0b171f 42%, #05090f 78%); position: relative; overflow: hidden; }
.zone-console { height: 100vh; position: sticky; top: 0; display: grid; grid-template-rows: auto auto 1fr; background: linear-gradient(180deg, #0c131e 0%, #070c13 100%); border-left: 1px solid var(--line); box-shadow: -18px 0 50px #0007; z-index: 20; }
.zone-console-head { min-height: 74px; display: flex; align-items: center; gap: 8px; padding: 12px 15px; border-bottom: 1px solid var(--line); }.zone-console-head div { flex: 1; min-width: 0; }.zone-console-head small, .zone-console-head strong { display: block; }.zone-console-head small { color: var(--orange); font-size: 9px; letter-spacing: .14em; }.zone-console-head strong { margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }.zone-console-head button { border: 1px solid #3a4e63; background: #101b28; color: var(--muted); width: 30px; height: 30px; border-radius: 5px; cursor: pointer; }
.zone-viewer-help { color: var(--muted); padding: 12px 14px; border-bottom: 1px solid var(--soft-line); font-size: 11px; line-height: 1.6; }.zone-card-list { min-height: 0; overflow: auto; display: grid; grid-template-columns: repeat(2, 1fr); align-content: start; gap: 7px; padding: 12px; }.zone-view-card { min-width: 0; }.zone-view-card .card-shell { width: 100%; height: auto; aspect-ratio: 59/86; }.zone-view-empty { grid-column: 1/-1; color: var(--muted); text-align: center; padding: 40px 10px; font-size: 12px; line-height: 1.7; }
.topbar { height: 74px; display: flex; align-items: center; gap: 10px; padding: 10px 18px; background: #070d14ed; border-bottom: 1px solid #263847; position: sticky; top: 0; z-index: 15; backdrop-filter: blur(12px); }
.match-title { min-width: 180px; }.match-title small, .match-title strong { display: block; }.match-title small { color: var(--orange); font-size: 9px; letter-spacing: .15em; }.match-title strong { margin-top: 3px; }
.turn-info { display: flex; align-items: center; height: 36px; border: 1px solid #35495e; background: #101a27; }.turn-info span { padding: 0 10px; font-size: 11px; }.turn-info span + span { align-self: stretch; display: grid; place-items: center; background: var(--cyan); color: #061016; font-weight: 900; }
.phase-bar { display: flex; height: 34px; flex: 1; min-width: 300px; }.phase { flex: 1; display: grid; place-items: center; border: 1px solid #293b4d; color: #6f8297; font-size: 10px; margin-left: -1px; cursor: default; }.phase.active { color: #0a141a; background: var(--gold); border-color: var(--gold); font-weight: 900; }
.view-select { color: var(--muted); font-size: 10px; display: flex; align-items: center; gap: 6px; }.view-select select { background: #121e2c; color: var(--text); border: 1px solid #35495e; padding: 8px; border-radius: 4px; }
.perspective-switch { display: flex; height: 34px; border: 1px solid #35495e; border-radius: 4px; overflow: hidden; }.perspective-switch[hidden] { display: none; }.perspective-switch button { min-width: 48px; border: 0; border-left: 1px solid #35495e; background: #101a27; color: var(--muted); padding: 0 7px; font-size: 10px; cursor: pointer; }.perspective-switch button:first-child { border-left: 0; }.perspective-switch button.active { background: var(--cyan); color: #061016; font-weight: 900; }
.edit-button.active { color: #07130f; background: var(--green); border-color: var(--green); font-weight: 900; }.next-turn { border-color: #714027; background: #3b2119; }
.notice { margin: 10px 18px -4px; padding: 9px 12px; background: #2d2312; border: 1px solid #81652a; display: flex; align-items: center; gap: 8px; position: relative; z-index: 12; }.notice span { flex: 1; font-size: 12px; }
.engine-prompt-bar { width: fit-content; max-width: calc(100% - 36px); margin: 10px auto -4px; padding: 7px; display: flex; gap: 6px; align-items: center; justify-content: center; border: 1px solid #506980; border-radius: 7px; background: #0e1925ed; position: relative; z-index: 13; }.engine-prompt-bar button { border: 1px solid #3f5b73; border-radius: 5px; background: #182a3c; padding: 8px 12px; font-size: 11px; cursor: pointer; }.engine-prompt-bar button:hover { border-color: var(--gold); color: var(--gold); }
.duel-mat { width: min(1100px, calc(100vw - 340px)); min-width: 850px; margin: 12px auto 30px; padding: 8px 14px 16px; position: relative; }
.duel-mat::before { content: ""; position: absolute; inset: 138px 70px; border: 1px solid #4e6c7b50; background: linear-gradient(90deg, transparent 49.9%, #8cb1bd18 50%, transparent 50.1%), linear-gradient(0deg, transparent 49.9%, #8cb1bd18 50%, transparent 50.1%); pointer-events: none; }
.player-summary { height: 42px; display: flex; align-items: center; gap: 10px; padding: 0 8px; font-size: 12px; }.player-summary .name { font-weight: 900; }.player-summary .lp { margin-left: auto; font: 900 24px/1 ui-monospace, monospace; }.player-summary.opponent .name { color: var(--orange); }.player-summary.self .name { color: var(--cyan); }
.hand { height: 116px; display: flex; align-items: center; justify-content: center; gap: 4px; position: relative; z-index: 3; }.opponent-hand { align-items: flex-start; }.own-hand { align-items: flex-end; }
.field-grid { display: grid; grid-template-columns: var(--zone-w) minmax(590px, 1fr) var(--zone-w); gap: 10px; align-items: stretch; position: relative; z-index: 2; }
.core-field { display: grid; grid-template-rows: repeat(5, var(--zone-h)); gap: 5px; }
.field-row { display: grid; grid-template-columns: repeat(5, var(--zone-w)); gap: 5px; justify-content: center; }.field-row.inverted { direction: rtl; }.field-row.inverted > * { direction: ltr; }
.shared-emz { display: grid; grid-template-columns: repeat(5, var(--zone-w)); justify-content: center; align-items: center; gap: 5px; position: relative; }.shared-line { position: absolute; left: 0; right: 0; height: 1px; background: linear-gradient(90deg, transparent, #7199a7aa, transparent); }.shared-emz .zone[data-index="0"] { grid-column: 2; }.shared-emz .zone[data-index="1"] { grid-column: 4; }.duel-mat.perspective-p2 .shared-emz .zone[data-index="0"] { grid-column: 4; }.duel-mat.perspective-p2 .shared-emz .zone[data-index="1"] { grid-column: 2; }.center-mark { grid-column: 3; text-align: center; color: #5e7781; font-size: 9px; letter-spacing: .2em; }.center-mark span, .center-mark b { display: block; }.center-mark b { font-size: 15px; color: #89a7af; }
.flow-controls { grid-column: 5; display: grid; grid-template-columns: 1fr; grid-template-rows: repeat(2, 34px); align-content: center; gap: 6px; position: relative; z-index: 5; }.flow-controls button { width: 100%; min-width: 0; padding: 7px 4px; border: 1px solid #466177; border-radius: 5px; background: #132334; color: var(--text); font: 800 9px/1.1 ui-monospace, monospace; cursor: pointer; }.flow-controls #chainButton[data-mode="ALL"] { color: var(--gold); border-color: #8a7135; }.flow-controls #chainButton[data-mode="OFF"] { color: var(--muted); }.flow-controls #nextActionButton { background: #244b5b; border-color: var(--cyan); color: #dffcff; }.flow-controls button:disabled { opacity: .38; cursor: not-allowed; }
.zone { width: var(--zone-w); height: var(--zone-h); border: 1px solid #385464; background: linear-gradient(145deg, #132731aa, #0d1d25aa); display: flex; align-items: center; justify-content: center; position: relative; overflow: visible; }.zone::after { content: attr(data-label); position: absolute; left: 5px; bottom: 3px; font-size: 8px; color: #6b8794; letter-spacing: .08em; }.zone > span { color: #54707c; font-size: 9px; text-align: center; letter-spacing: .08em; }.zone.monster { border-color: #346071; }.zone.spell { border-color: #3c6658; }.zone.emz { border-color: #765a7c; background: #27182aaa; }.zone.drag-over { border-color: var(--gold); box-shadow: inset 0 0 16px #f3c96955; }
.zone.engine-selectable { border-color: var(--gold); box-shadow: inset 0 0 18px #f3c96955, 0 0 13px #f3c96944; cursor: pointer; animation: selectable-zone 1.2s ease-in-out infinite alternate; }.zone.engine-selectable::before { content: "SELECT"; position: absolute; top: 4px; right: 5px; color: var(--gold); font: 800 8px/1 ui-monospace, monospace; }
@keyframes selectable-zone { from { filter: brightness(.9); } to { filter: brightness(1.25); } }
.side-column { display: grid; grid-template-rows: repeat(5, var(--zone-h)); gap: 5px; align-items: center; padding: 0; }.side-zone { position: relative; width: var(--zone-w); height: var(--zone-h); display: grid; place-items: center; }.side-zone .zone { background: #0b151dcc; }.side-zone.inspectable-zone .zone { cursor: pointer; }.side-zone.inspectable-zone:hover .zone { border-color: var(--gold); box-shadow: inset 0 0 14px #f3c96933; }.pile-count { position: absolute; right: -4px; top: -5px; min-width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: #dfeaf2; color: #0a1118; font: 900 10px/1 ui-monospace, monospace; z-index: 5; }
.card-shell { width: var(--card-w); height: var(--card-h); position: relative; flex: 0 0 auto; perspective: 750px; cursor: pointer; z-index: 2; }.card-shell.defense { transform: rotate(90deg); }.card-shell.dragging { opacity: .35; }.card-shell.engine-actionable .card-face { box-shadow: 0 0 0 2px var(--cyan), 0 0 17px #58d8e866; }.card-shell.engine-actionable::before { content: "ACTION"; position: absolute; left: 50%; top: -13px; transform: translateX(-50%); color: var(--cyan); font: 900 8px/1 ui-monospace, monospace; z-index: 8; }.card-shell.engine-selected .card-face { box-shadow: 0 0 0 3px var(--gold), 0 0 24px #f3c969aa; filter: brightness(1.2); }
.card-face { position: absolute; inset: 0; border: 1px solid #c9d5dd; border-radius: 5px; overflow: hidden; background: #182532; box-shadow: 0 5px 12px #000a; backface-visibility: hidden; transition: transform .22s ease, filter .2s; }.card-front { transform: rotateY(0deg); }.card-back { transform: rotateY(180deg); background: radial-gradient(ellipse at center, #dd782e 0 4%, #6b2c16 18%, #151017 61%, #b7682d 64%, #1c1118 70%); border: 3px solid #b8804d; }.card-shell.facedown .card-front { transform: rotateY(180deg); }.card-shell.facedown .card-back { transform: rotateY(0deg); }.card-shell.facedown.inspectable:hover .card-front { transform: rotateY(0deg); }.card-shell.facedown.inspectable:hover .card-back { transform: rotateY(-180deg); }.card-shell:hover { z-index: 9; }.card-shell:hover .card-face { filter: brightness(1.14); box-shadow: 0 8px 20px #000c, 0 0 0 1px var(--gold); }
.card-front img { width: 100%; height: 100%; object-fit: cover; display: block; }.card-fallback { position: absolute; inset: 0; padding: 7px; display: grid; place-items: center; text-align: center; background: linear-gradient(145deg, #30465d, #132132); font-size: 9px; }.card-front img + .card-fallback { display: none; }.card-front img[hidden] + .card-fallback { display: grid; }.card-shell.negated::after { content: "×"; position: absolute; inset: 18px 0 auto; text-align: center; color: #ff4058; text-shadow: 0 2px 4px #000; font: 900 64px/1 sans-serif; z-index: 6; pointer-events: none; }.card-shell .owner-mark { position: absolute; top: 2px; right: 2px; background: #05090dcc; color: white; border-radius: 3px; padding: 1px 3px; font-size: 7px; z-index: 7; }
.hand .card-shell { margin-left: -22px; transform-origin: bottom center; }.hand .card-shell:first-child { margin-left: 0; }.hand .card-shell:hover { transform: translateY(-14px) scale(1.08); }.opponent-hand .card-shell:hover { transform: translateY(14px) scale(1.08); }.hand .card-shell.defense { transform: none; }
.context-menu { position: fixed; min-width: 190px; max-height: min(520px, calc(100vh - 20px)); overflow: auto; padding: 5px; background: #111a26f5; border: 1px solid #40536a; box-shadow: 0 14px 38px #000c; z-index: 100; }.context-menu button { width: 100%; display: flex; justify-content: space-between; border: 0; background: transparent; color: #e7eef5; padding: 8px 9px; cursor: pointer; text-align: left; font-size: 12px; }.context-menu button:hover { background: #25364a; }.menu-separator { height: 1px; background: #314256; margin: 4px; }.menu-label { color: var(--muted); padding: 5px 9px 3px; font-size: 9px; letter-spacing: .12em; }
.card-action-menu { position: fixed; min-width: 156px; max-width: 230px; padding: 5px; border: 1px solid var(--gold); border-radius: 7px; background: #111a26f5; box-shadow: 0 10px 30px #000d, 0 0 18px #f3c96933; z-index: 110; }.card-action-menu[hidden] { display: none; }.card-action-menu::after { content: ""; position: absolute; left: calc(50% - 6px); bottom: -7px; width: 11px; height: 11px; border-right: 1px solid var(--gold); border-bottom: 1px solid var(--gold); background: #111a26; transform: rotate(45deg); }.card-action-menu button { width: 100%; border: 0; border-radius: 4px; background: transparent; color: var(--text); padding: 8px 9px; text-align: left; font-size: 11px; cursor: pointer; }.card-action-menu button:hover { background: #293b4d; color: var(--gold); }
.chain-overlay { position: sticky; top: 84px; width: fit-content; max-width: min(680px, calc(100% - 30px)); margin: 0 auto -42px; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 6px 8px; border: 1px solid #72568c; border-radius: 7px; background: #160e20e8; box-shadow: 0 8px 28px #000b; z-index: 12; }.chain-overlay[hidden] { display: none; }.chain-link { min-width: 116px; padding: 6px 8px; border-left: 3px solid var(--orange); background: #291a35; font-size: 10px; }.chain-link.p1 { border-color: var(--cyan); }.chain-link strong, .chain-link span { display: block; }.chain-link span { margin-top: 3px; color: #bba9c9; font-size: 9px; }.chain-link.resolving { outline: 2px solid var(--gold); }.chain-link.resolved { opacity: .55; }.chain-link.new-link { animation: chain-pulse .7s ease-out; }
@keyframes chain-pulse { 0% { transform: scale(.78); filter: brightness(2); box-shadow: 0 0 30px var(--gold); } 100% { transform: scale(1); filter: none; box-shadow: none; } }
.status-toast { position: fixed; right: 18px; bottom: 18px; z-index: 120; padding: 10px 14px; background: #172436; border: 1px solid #4b647e; box-shadow: 0 8px 25px #000b; font-size: 12px; }.status-toast.error { border-color: #b44d5c; background: #3b171f; }
@media (max-width: 1500px) { .app-shell { grid-template-columns: 270px minmax(760px, 1fr) 250px; }.duel-mat { width: 850px; }.zone-card-list { grid-template-columns: 1fr; } }
@media (max-width: 1180px) { :root { --zone-w: 101px; --zone-h: 114px; }.app-shell { grid-template-columns: 250px minmax(760px, 1fr) 220px; }.field-row { grid-template-columns: repeat(5, var(--zone-w)); }.phase-bar { display: none; } }
