:root {
  --ink: #17212b;
  --muted: #6c7883;
  --paper: #f4f1e9;
  --panel: rgba(255, 255, 255, .78);
  --line: #d8d3c8;
  --red: #b93b2e;
  --red-dark: #8f2a20;
  --shadow: 0 16px 45px rgba(40, 43, 46, .10);
}
* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 8%, rgba(185,59,46,.11), transparent 31rem),
    linear-gradient(135deg, #f8f6f0 0%, var(--paper) 55%, #ece8df 100%);
  font-family: "Microsoft YaHei UI", "Noto Sans SC", system-ui, sans-serif;
  min-height: 100vh;
}
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; opacity: .16;
  background-image: repeating-linear-gradient(0deg, transparent, transparent 3px, rgba(20,25,30,.035) 4px);
}
.shell { width: min(960px, calc(100% - 40px)); margin: 0 auto; padding: 48px 0 32px; }
.hero { display: flex; align-items: center; gap: 18px; margin-bottom: 28px; position: relative; }
.mark { width: 64px; height: 64px; display: grid; place-items: center; color: #fff; background: var(--red); font: 700 35px/1 Georgia, serif; box-shadow: 8px 8px 0 #252e36; }
.eyebrow { margin: 0 0 4px; color: var(--red); font-size: 11px; font-weight: 800; letter-spacing: .2em; text-transform: uppercase; }
h1 { margin: 0; font: 800 clamp(28px, 4vw, 42px)/1.1 "Microsoft YaHei UI", sans-serif; letter-spacing: -.04em; }
.subtitle { margin: 7px 0 0; color: var(--muted); }
.companion-link { margin: 7px 0 0; font-size: 13px; }
.companion-link a { color: #245c87; text-underline-offset: 4px; }
.format { margin-left: auto; align-self: flex-start; border: 1px solid var(--line); border-radius: 99px; padding: 7px 12px; font: 700 11px/1 ui-monospace, monospace; color: var(--muted); background: rgba(255,255,255,.5); }
.build-info { margin-left: auto; align-self: flex-start; display: grid; justify-items: end; gap: 3px; padding: 9px 12px; border: 1px solid var(--line); background: rgba(255,255,255,.58); }
.build-info strong { color: var(--red); font: 900 14px/1 ui-monospace, monospace; }.build-info span { font-size: 11px; font-weight: 800; }.build-info small { color: var(--muted); font: 10px/1.2 ui-monospace, monospace; }
.panel { position: relative; background: var(--panel); border: 1px solid rgba(199,192,181,.8); box-shadow: var(--shadow); padding: 26px; margin-top: 18px; backdrop-filter: blur(10px); }
.section-title { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 20px; }
.section-title > span { font: 800 13px/1 ui-monospace, monospace; color: var(--red); padding-top: 5px; }
.section-title h2 { font-size: 18px; margin: 0 0 4px; }
.section-title p { margin: 0; font-size: 13px; color: var(--muted); }
.section-title.compact { margin: 0; }
.path-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.browse-stack { width: 190px; display: flex; flex-direction: column; align-items: stretch; }.browse-stack .secondary { width: 100%; }.browse-stack .status { margin: 6px 0 0; text-align: center; }
input[type=text] { width: 100%; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 12px 14px; font: 13px/1.4 ui-monospace, "Microsoft YaHei UI", monospace; outline: 0; }
input[type=text]:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(185,59,46,.1); }
button { border: 0; font: 700 13px/1 "Microsoft YaHei UI", sans-serif; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .46; }
.secondary { padding: 12px 17px; border: 1px solid var(--line); background: #fff; color: var(--ink); }
.secondary:hover { border-color: #a9a39a; }
.status { margin: 10px 0 0; font-size: 12px; }
.status.ok { color: #327154; }
.status.bad { color: var(--red); }
.muted { color: var(--muted); }
.drop-zone { width: 100%; min-height: 184px; border: 1.5px dashed #aca59a; background: rgba(255,255,255,.45); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--ink); transition: .18s ease; }
.drop-zone:hover, .drop-zone.dragging { border-color: var(--red); background: rgba(185,59,46,.045); transform: translateY(-1px); }
.upload-icon { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-size: 25px; color: var(--red); border: 1px solid rgba(185,59,46,.35); }
.drop-zone strong { font-size: 16px; }.drop-zone small { color: var(--muted); font-weight: 400; }
.file-card { display: flex; align-items: center; gap: 12px; margin-top: 12px; padding: 12px; border: 1px solid var(--line); background: #fff; }
.file-glyph { width: 38px; height: 42px; display: grid; place-items: center; background: var(--ink); color: #fff; font: 800 16px/1 Georgia, serif; }
.file-copy { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.file-copy strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }.file-copy span { color: var(--muted); font-size: 11px; }
.icon-button { background: none; color: var(--muted); font-size: 24px; padding: 8px; }
.primary { margin-top: 16px; width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 15px 18px; color: #fff; background: var(--red); box-shadow: 5px 5px 0 var(--red-dark); }
.primary:not(:disabled):hover { background: #a83227; }.primary:not(:disabled):active { transform: translate(3px,3px); box-shadow: 2px 2px 0 var(--red-dark); }
.primary.small { width: auto; margin: 0; padding: 12px 16px; box-shadow: none; }
.arrow { font-size: 20px; }.error { padding: 12px; margin: 14px 0 0; color: #8f281e; background: #fff0ed; border-left: 3px solid var(--red); font-size: 13px; }
.result-head { display: flex; justify-content: space-between; gap: 20px; align-items: center; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.actions { display: flex; gap: 8px; }.actions .secondary { white-space: nowrap; }
.legend { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.legend-item { display: inline-flex; padding: 4px 8px; border-left: 3px solid; border-radius: 3px; font: 700 11px/1.3 "Microsoft YaHei UI", sans-serif; }
.report-text { margin: 20px 0 0; max-height: 620px; overflow: auto; padding: 16px 12px; background: #1d252c; color: #e9e5dc; font: 13px/1.78 "Cascadia Mono", Consolas, "Microsoft YaHei UI", monospace; }
.report-line { min-height: 1.78em; padding: 0 8px; display: flex; align-items: flex-start; gap: 8px; white-space: pre-wrap; word-break: break-word; border-left: 3px solid transparent; }
.report-copy { min-width: 0; flex: 1; }
.card-link { display: inline; padding: 0; color: #ffe29c; background: none; border: 0; font: inherit; text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 3px; cursor: pointer; }.card-link:hover { color: #fff3c9; }
.scene-button { flex: 0 0 auto; margin-top: 2px; padding: 4px 7px; color: #cbd6de; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.18); font-size: 10px; }.scene-button:hover { color: #fff; border-color: rgba(255,255,255,.45); }
.report-line.player-0, .legend-item.player-0 { background: rgba(39, 143, 190, .24); border-left-color: #4fc3f0; }
.report-line.player-1, .legend-item.player-1 { background: rgba(212, 126, 40, .25); border-left-color: #f0a44f; }
.legend-item.player-0 { color: #125f81; background: rgba(39, 143, 190, .14); }
.legend-item.player-1 { color: #8a4c0d; background: rgba(212, 126, 40, .15); }
.deck-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 20px 0; }
.deck-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
.deck-panel.collapsed .deck-tabs, .deck-panel.collapsed .deck-view, .deck-panel.collapsed #downloadDeckButton, .deck-panel.collapsed .deck-code-action { display: none; }
.deck-tab { padding: 13px 16px; text-align: left; color: var(--ink); background: #fff; border: 1px solid var(--line); border-left: 5px solid transparent; transition: .16s ease; }
.deck-tab.player-0 { border-left-color: #2a9ac9; }.deck-tab.player-1 { border-left-color: #df8b37; }
.deck-tab.active { background: var(--ink); color: #fff; box-shadow: 4px 4px 0 rgba(23,33,43,.16); }
.deck-view { display: grid; gap: 24px; }
.deck-group { min-width: 0; }
.deck-group-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.deck-group-title h3 { margin: 0; font-size: 15px; }.deck-group-title span { color: var(--muted); font-size: 11px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 12px 9px; }
.card-item { min-width: 0; cursor: pointer; outline: 0; }.card-item:hover .card-art, .card-item:focus .card-art { transform: translateY(-2px); box-shadow: 0 7px 15px rgba(21,27,32,.28); }.card-item:focus .card-name { color: var(--red); }
.card-art { position: relative; overflow: hidden; aspect-ratio: 59 / 86; background: linear-gradient(145deg, #2c3740, #11181e); box-shadow: 0 3px 9px rgba(21,27,32,.20); transition: .16s ease; }
.card-art img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: cover; }
.card-fallback { position: absolute; inset: 0; display: grid; place-items: center; padding: 8px; text-align: center; white-space: pre-line; color: #9ba8b1; font: 700 10px/1.5 ui-monospace, monospace; }
.card-count { position: absolute; right: 5px; bottom: 5px; z-index: 2; min-width: 28px; padding: 4px 6px; color: #fff; background: rgba(15,20,24,.88); border: 1px solid rgba(255,255,255,.3); text-align: center; font: 800 12px/1 ui-monospace, monospace; }
.card-name { margin-top: 5px; height: 2.8em; overflow: hidden; color: #35414b; font-size: 11px; line-height: 1.4; }
.modal-open { overflow: hidden; }.modal-backdrop { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; padding: 24px; background: rgba(10,16,21,.72); backdrop-filter: blur(5px); }
.modal-card { position: relative; width: min(760px, 100%); max-height: calc(100vh - 48px); overflow: auto; padding: 28px; background: #f7f4ed; border: 1px solid #d7d0c4; box-shadow: 0 25px 80px rgba(0,0,0,.34); }.modal-card.wide { width: min(1240px, 100%); }
.modal-backdrop.scene-mode { place-items: start center; padding: 16px 20px; background: transparent; backdrop-filter: none; pointer-events: auto; }
.modal-backdrop.scene-mode .modal-card { width: min(720px, 100%); max-height: calc(100vh - 32px); overflow-x: hidden; overflow-y: auto; padding: 12px; pointer-events: auto; border-color: #a8a095; box-shadow: 0 12px 38px rgba(0,0,0,.34); }
.modal-close { position: sticky; z-index: 5; top: 0; float: right; width: 34px; height: 34px; margin: -14px -14px 0 12px; color: #fff; background: var(--ink); font-size: 22px; }
.card-detail { display: grid; grid-template-columns: minmax(190px, 270px) 1fr; gap: 28px; align-items: start; }.detail-art { width: 100%; box-shadow: 0 10px 24px rgba(20,26,31,.22); }.detail-info h2 { margin: 4px 0 10px; font-size: 24px; }.detail-info h3 { margin: 24px 0 8px; font-size: 14px; }.detail-meta { margin: 0; padding: 10px 12px; color: #fff; background: var(--ink); font-size: 12px; line-height: 1.7; }.detail-id { color: var(--muted); font: 11px/1.5 ui-monospace, monospace; }.detail-desc { margin: 0; white-space: pre-wrap; font-size: 13px; line-height: 1.8; }
.scene-title { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 0 0 7px; padding: 0 2px; }.scene-title h2 { margin: 0; font-size: 17px; }.scene-title > span { color: var(--muted); font: 11px/1 ui-monospace, monospace; }.swap-position-button { padding: 7px 9px; color: #fff; background: var(--ink); border: 1px solid #43505a; font-size: 10px; }.swap-position-button:hover { background: var(--red); }
.scene-detail { position: relative; clear: both; overflow-x: auto; }.duel-board { min-width: 630px; display: grid; gap: 3px; padding: 7px; color: #fff; background: linear-gradient(rgba(8,23,34,.42), rgba(5,18,26,.54)), var(--duel-bg, url('/asset/background.webp')) center / cover; border: 2px solid #334a58; box-shadow: inset 0 0 45px rgba(0,0,0,.45); }
.duelist-bar { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 14px; min-height: 34px; padding: 5px 11px; background: rgba(10,18,25,.86); border: 1px solid rgba(255,255,255,.38); }.duelist-bar.player-0 { border-left: 5px solid #4fc3f0; }.duelist-bar.player-1 { border-left: 5px solid #f0a44f; }.duelist-bar strong { font-size: 12px; }.duelist-bar span { color: #c9d5dc; font-size: 10px; }.duelist-bar b { min-width: 108px; padding: 3px 11px; color: #fff36b; background: linear-gradient(#a20c0c,#450000); border: 1px solid #e44236; text-align: center; font: 900 17px/1 ui-monospace, monospace; }
.duel-half { display: grid; grid-template-columns: 82px minmax(0, 430px) 82px; justify-content: center; gap: 7px; align-items: stretch; }.duel-core { display: grid; grid-template-rows: repeat(2, 76px); gap: 5px; }.duel-zone-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
.scene-side-stack { display: grid; gap: 5px; }.own-side { grid-template-rows: 1fr 1fr; }.public-side { grid-template-rows: repeat(3, 1fr); }.scene-pile { position: relative; min-height: 0; width: 100%; overflow: hidden; display: grid; align-content: end; padding: 4px; color: #fff; text-align: left; background: rgba(12,25,34,.72); border: 1px solid rgba(255,255,255,.55); }.scene-pile:hover { border-color: #fff36b; outline: 1px solid #fff36b; }.scene-pile.empty { opacity: .72; }.scene-pile span, .scene-pile strong { position: relative; z-index: 2; text-shadow: 0 1px 3px #000; }.scene-pile span { font-size: 8px; }.scene-pile strong { color: #fff36b; font: 900 14px/1 ui-monospace, monospace; }.pile-cover { position: absolute; inset: 4px; width: calc(100% - 8px); height: calc(100% - 8px); object-fit: cover; opacity: .72; }
.shared-extra-zones { width: 190px; height: 76px; margin: 0 auto; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.scene-slot { position: relative; min-width: 0; height: 76px; overflow: visible; display: grid; place-items: center; background: rgba(12,25,34,.68); border: 1px solid rgba(255,255,255,.64); box-shadow: inset 0 0 12px rgba(0,0,0,.28); }.scene-slot.empty { border-style: dashed; }.scene-slot.clickable { cursor: pointer; }.scene-slot.clickable:hover { outline: 2px solid #fff36b; outline-offset: -3px; }
.scene-card-art { position: absolute; z-index: 1; left: 50%; top: 50%; width: auto; height: 110%; object-fit: cover; transform: translate(-50%,-50%); filter: drop-shadow(0 2px 3px rgba(0,0,0,.5)); transition: transform .18s ease; }.scene-slot.defense .scene-card-art { height: 78%; transform: translate(-50%,-50%) rotate(90deg); }.scene-slot small { position: absolute; z-index: 3; left: 2px; top: 2px; padding: 2px 3px; color: #dce7ed; background: rgba(12,17,21,.66); font-size: 7px; }.scene-slot.empty small { position: static; color: rgba(220,231,237,.68); background: none; }
.scene-position { position: absolute; z-index: 3; left: 2px; right: 2px; bottom: 2px; padding: 2px; color: #fff; background: rgba(12,17,21,.80); text-align: center; font: 8px/1.2 ui-monospace, monospace; }
.scene-hand { position: relative; width: 608px; min-height: 68px; margin: 0 auto; display: grid; grid-template-columns: 170px 1fr; align-items: center; gap: 7px; padding: 0; }.scene-player-summary { min-width: 0; display: grid; gap: 5px; padding: 7px 9px; color: #fff; text-shadow: 0 1px 3px #000; background: rgba(10,18,25,.76); border-left: 4px solid; }.scene-player-summary.player-0 { border-left-color: #4fc3f0; }.scene-player-summary.player-1 { border-left-color: #f0a44f; }.scene-player-summary strong { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 11px; }.scene-player-summary span { color: #fff36b; font: 800 11px/1.2 ui-monospace, monospace; }.scene-hand-cards { height: 66px; display: flex; align-items: center; justify-content: flex-start; gap: 4px; }.scene-hand-cards small { color: rgba(255,255,255,.72); }.scene-hand-card { height: 64px; width: 44px; padding: 0; background: none; filter: drop-shadow(0 2px 3px rgba(0,0,0,.52)); transition: transform .15s ease; }.scene-hand-card:hover { z-index: 3; transform: translateY(-4px) scale(1.08); }.scene-hand-card img { width: 100%; height: 100%; object-fit: cover; }
.scene-step-row { width: 608px; height: 76px; margin: 0 auto; display: grid; grid-template-columns: 122px 190px 122px; align-items: center; justify-content: space-between; }.scene-step-navigation { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }.scene-step-navigation button { padding: 8px 3px; color: #fff; background: rgba(10,18,25,.84); border: 1px solid rgba(255,255,255,.52); font-size: 10px; }.scene-step-navigation button:not(:disabled):hover { color: #fff36b; border-color: #fff36b; }.scene-step-actions { display: grid; justify-items: stretch; gap: 5px; }.scene-step-actions span { color: #fff36b; text-align: center; text-shadow: 0 1px 3px #000; font: 800 10px/1.2 ui-monospace, monospace; }.scene-operation { width: 608px; min-height: 30px; margin: 1px auto 0; display: grid; grid-template-columns: auto 1fr; align-items: start; gap: 9px; padding: 7px 9px; color: #e8eef2; background: rgba(10,18,25,.86); border-left: 4px solid var(--red); font-size: 10px; line-height: 1.5; }.scene-operation strong { color: #fff36b; white-space: nowrap; }.scene-operation span { word-break: break-word; }
.scene-zone-inspector { position: absolute; z-index: 12; top: 51px; right: 10px; width: min(540px, calc(100% - 20px)); max-height: 440px; overflow: auto; padding: 12px; color: var(--ink); background: rgba(247,244,237,.98); border: 1px solid #bfb6a7; box-shadow: 0 15px 40px rgba(0,0,0,.38); }.scene-zone-inspector header { position: sticky; z-index: 2; top: -12px; display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 10px; margin: -12px -12px 10px; padding: 9px 12px; background: #f7f4ed; border-bottom: 1px solid var(--line); }.scene-zone-inspector header span { color: var(--muted); font-size: 11px; }.inspector-close { width: 28px; height: 28px; color: #fff; background: var(--ink); font-size: 18px; }.scene-collection-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(65px, 1fr)); gap: 9px 6px; }.scene-collection-card { min-width: 0; padding: 0; color: var(--ink); background: none; text-align: left; }.scene-collection-card img { width: 100%; aspect-ratio: 59 / 86; display: block; object-fit: cover; box-shadow: 0 2px 7px rgba(0,0,0,.24); }.scene-collection-card span { display: block; height: 2.7em; overflow: hidden; margin-top: 3px; font-size: 9px; line-height: 1.35; }.scene-collection-card:hover span { color: var(--red); }.scene-collection-empty { grid-column: 1 / -1; color: var(--muted); font-size: 12px; }
.scene-card-inspector { position: absolute; z-index: 14; top: 51px; left: 10px; width: min(500px, calc(100% - 20px)); max-height: 570px; overflow: auto; padding: 14px; color: var(--ink); background: rgba(247,244,237,.99); border: 1px solid #bfb6a7; box-shadow: 0 15px 40px rgba(0,0,0,.42); }.card-inspector-close { position: sticky; z-index: 3; top: 0; float: right; margin: -5px -5px 6px 10px; }.scene-card-inspector .card-detail { grid-template-columns: 145px 1fr; gap: 16px; }.scene-card-inspector .detail-info h2 { margin-top: 0; font-size: 19px; }.scene-card-inspector .detail-info h3 { margin-top: 14px; }.scene-card-inspector .detail-desc { font-size: 12px; line-height: 1.65; }
.hidden { display: none !important; }
.static-report .config, .static-report .upload { display: none; }
.static-report .hero { margin-bottom: 6px; }
.static-report .result { margin-top: 22px; }
.static-report .export-button { display: none; }
.static-report .result-head .section-title h2 { max-width: 590px; word-break: break-word; }
footer { text-align: center; padding: 26px 0 0; color: var(--muted); font-size: 11px; }
footer a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
footer a:hover { color: var(--red); }
@media (max-width: 680px) {
  .shell { width: min(100% - 24px, 960px); padding-top: 24px; }.hero { align-items: flex-start; }.mark { width: 50px; height: 50px; }.format, .build-info small { display: none; }.build-info { padding: 7px 9px; }
  .panel { padding: 20px; }.result-head { align-items: flex-start; flex-direction: column; }.actions { width: 100%; }.actions > button { flex: 1; }.path-row { grid-template-columns: 1fr; }
  .browse-stack { width: 100%; }.deck-tabs { grid-template-columns: 1fr; }.card-grid { grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 10px 7px; }.deck-panel .primary.small { width: 100%; }
  .modal-backdrop { padding: 10px; }.modal-card { padding: 20px; max-height: calc(100vh - 20px); }.card-detail { grid-template-columns: 1fr; }.detail-art { width: min(230px, 75%); margin: 0 auto; }.scene-slot small { display: none; }.scene-position { font-size: 7px; }.report-line { gap: 5px; }.scene-button { padding: 3px 5px; }.deck-actions { width: 100%; }.deck-actions > button { flex: 1; }
}
.scene-keyboard-hint { font: 400 11px/1.5 "Microsoft YaHei UI",sans-serif; color:#65717b; margin-left:6px; }
.build-info { min-width: 205px; }
.build-info small { display:block; color:#65717b; font-size:11px; }
@media(max-width:680px) { .hero { flex-wrap:wrap; } .hero > div:nth-child(2) { flex:1; } .build-info { width:100%; display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:6px 16px; } .build-info small { display:block; } .scene-keyboard-hint { display:block; margin-left:0; } }

#runtimeStatus { color: var(--red); line-height: 1.6; }
button:disabled { cursor: wait; opacity: .6; }
@media(max-width:680px){.scene-detail::before{content:"左右滑动牌桌查看完整场面";display:block;font-size:12px;margin-bottom:8px;color:#6c7883}.mark{flex-shrink:0}.build-info{min-width:74px}}

.generator-help{margin:-12px 0 24px;text-align:right;font-size:14px}.generator-help a,.example-link{color:#245c87;text-underline-offset:4px}.example-link{font-size:12px;font-weight:400;margin-left:12px;white-space:nowrap}.static-report .generator-help{display:none}
