* { box-sizing: border-box; }
:root { color-scheme: light; font-family: "Microsoft YaHei", "PingFang SC", sans-serif; color: #514b40; background: #eee8dc; }
body { display: flow-root; margin: 0; min-height: 100vh; background: radial-gradient(ellipse at 50% 5%, #faf7ef 0, #eee8dc 66%, #e5ddcf 100%); }
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:focus-visible { outline: 2px solid #8c743f; outline-offset: 4px; }
[hidden] { display: none !important; }
.game { width: min(1240px, calc(100% - 40px), max(1030px, calc((100svh - 325px) * 1.5515 + 212px))); margin: 20px auto; display: grid; grid-template-columns: 168px minmax(0, 1fr); gap: 16px 22px; align-items: start; }
.lab-status { grid-column: 1 / -1; display: flex; align-items: center; flex-wrap: wrap; gap: 12px 24px; padding: 12px 16px; background: #fffcf4; border: 1px solid #cbbfa8; border-radius: 10px; font-size: 13px; }
.lab-status small { margin-left: 8px; color: #99886e; font-size: 11px; }
.battle-controls { display: flex; gap: 8px; margin-left: auto; }
.battle-controls button { padding: 7px 13px; border: 1px solid #d1c3a8; border-radius: 6px; background: #f5eddd; font-size: 12px; }
#action { background: #607f72; border-color: #567566; color: #fffdf4; min-width: 90px; }
button:disabled { opacity: .5; cursor: default; }
.role-type { font-size: 10px; color: #93836e; }
.round-note { color: #93836e; font-size: 11px; font-weight: 400; }
.lab-feed { grid-column: 1; grid-row: 2; margin-top: 445px; font-size: 11px; color: #857760; }
.lab-feed ol { list-style: none; padding: 0; margin: 0; }
.lab-feed li { padding: 9px 0; border-bottom: 1px solid #d7cebc; line-height: 1.65; }
.lab-feed p { line-height: 1.8; color: #a0927b; }
.seat-status { font-size: 12px; color: #81755f; white-space: nowrap; }
.seat-status b { font-variant-numeric: tabular-nums; }
#roster { grid-column: 1; grid-row: 2; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 10px; margin: 47px 0 0; }
.role { --tone: #9c7658; position: relative; display: flex; align-items: center; flex-direction: column; min-width: 0; padding: 6px 6px 10px; border: 1px solid #c9bda5; border-radius: 13px; background: linear-gradient(160deg, #fffdf6, #f1eadb); box-shadow: inset 0 1px 0 #fff, inset 0 -2px 0 #e0d5c1, 0 3px 0 #d7ccb7, 0 7px 13px #66503412; }
.role::before { content: ""; position: absolute; inset: 5px; border: 1px solid #ffffffa3; border-radius: 9px; pointer-events: none; }
.portrait { position: relative; width: 100%; aspect-ratio: 1; border-radius: 9px; background: radial-gradient(ellipse at 50% 70%, color-mix(in srgb, var(--tone) 13%, transparent), transparent 70%); }
.portrait img { display: block; width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 3px 2px #594a3625); }
.role-name { position: relative; font-size: 13px; font-weight: 600; letter-spacing: .04em; line-height: 22px; }
@media (hover: hover) {
  .role:hover { border-color: #a5916a; }
}
.role[aria-pressed="true"] { border-color: #ac8947; background: linear-gradient(160deg, #fffdf3, #efe1be); box-shadow: 0 0 0 2px #d1b67880, inset 0 1px 0 #fff, inset 0 -2px 0 #d6bc81, 0 3px 0 #bda571, 0 9px 18px #7f633529; }
.role[aria-pressed="true"]::after { content: "✓"; position: absolute; top: 8px; right: 8px; width: 18px; height: 18px; display: grid; place-items: center; background: #9e7c3d; border-radius: 50%; color: #fffdf3; font-size: 11px; box-shadow: 0 1px 3px #7f633530; }
.paper { grid-column: 2; grid-row: 2; position: relative; padding: 0 10px; min-width: 0; width: 100%; border: 1px solid #cbbfa8; border-radius: 12px; background: #fffcf4; box-shadow: inset 0 0 0 3px #fffef9, 0 3px 0 -1px #e5dcc9, 0 4px 0 #c9bda6, 0 14px 34px #65513a14; }
.map-toolbar { min-height: 47px; padding: 6px 2px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; font-weight: 600; }
.map-tools { display: flex; align-items: center; gap: 6px; }
.map-tools button { padding: 5px 8px; border: 1px solid #d7ccb8; border-radius: 5px; background: #f7f1e5; font-size: 11px; font-weight: 400; }
.map-tools button:disabled { opacity: .45; cursor: default; }
.board-scroll { overflow-x: auto; scrollbar-width: thin; scrollbar-color: #d5c9b3 transparent; }
#board { position: relative; width: 100%; min-width: 720px; aspect-ratio: 1536 / 990; isolation: isolate; }
.map-image { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; user-select: none; -webkit-user-drag: none; }
#room-background { z-index: 0; }
#chair-backs, #chair-fronts { position: absolute; inset: 0; pointer-events: none; }
#chair-backs { z-index: 1; }
#chair-fronts { z-index: 4; }
.chair { position: absolute; display: block; pointer-events: none; user-select: none; }
.chair.occupied { transform: translateY(var(--occupied-offset)); }
#papers { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 7; pointer-events: none; overflow: visible; }
.paper-piece { filter: drop-shadow(0 3px 2px #6c583526); pointer-events: auto; cursor: pointer; }
.paper-piece.selected, .paper-piece:focus-visible { filter: drop-shadow(0 0 5px #bd9345); outline: none; }
.paper-difficulty { font-size: 17px; fill: #716753; font-weight: 600; }
#range, #effects { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#range { z-index: 6; overflow: hidden; }
#range circle { fill: #7faaa00c; stroke: #71988b75; stroke-width: 2; stroke-dasharray: 8 12; }
#effects { z-index: 9; }
#effects text { font-family: inherit; text-anchor: middle; paint-order: stroke; stroke: #fff8e8; stroke-width: 3px; stroke-linejoin: round; }
.damage-number { font-size: 20px; fill: #657d74; }
.boost-number { font-size: 22px; font-weight: 700; fill: #a17227; }
.san-number { font-size: 20px; fill: #448f97; }
#san-bars { position: absolute; inset: 0; z-index: 8; pointer-events: none; }
.san-bar { position: absolute; border-radius: 5px; background: #b5b9a5aa; overflow: hidden; box-shadow: 0 0 0 1px #faf4e1b0; }
.san-bar i { display: block; height: 100%; background: #6fadb2; border-radius: inherit; }
.san-bar.charged i { background: #d1ac4f; box-shadow: 0 0 5px #e2bc63; }
#cells { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
#towers { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
#room-foreground { z-index: 5; }
.cell { position: absolute; border: 0; padding: 0; border-radius: 8px; background: transparent; cursor: default; pointer-events: auto; }
.cell::after { content: "+"; position: absolute; top: 44%; left: 50%; transform: translateX(-50%); display: grid; place-items: center; width: 23px; height: 23px; border: 1px dashed #907646; border-radius: 50%; color: #796239; background: #fff9e8cf; font-size: 16px; opacity: 0; pointer-events: none; }
#board.placing .cell:not(.occupied)::after { opacity: .75; }
#board.placing .cell { cursor: crosshair; }
#board.placing .cell:hover, .cell:focus-visible { background: #c6b58715; }
.cell:focus-visible { outline: 1px solid #a78c53; outline-offset: -5px; border-radius: 4px; }
.cell.invalid { background: #ba756c20 !important; }
.tower { --tone: #9c7658; position: absolute; display: grid; place-items: center; border: 0; padding: 0; background: transparent; overflow: visible; pointer-events: auto; }
.tower img { display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; user-select: none; -webkit-user-drag: none; }
.tower[aria-pressed="true"] img, .tower:focus-visible img { filter: drop-shadow(0 0 1px #fff3ba) drop-shadow(0 0 3px #c39938) drop-shadow(0 0 7px #d6b86099); }
.tower[aria-pressed="true"] { z-index: 2; }
.tower:focus-visible { outline: none; }
.ghost { opacity: .55; pointer-events: none; z-index: 4; }
.ghost img { width: 100%; height: 100%; }
.board-footer { min-height: 52px; display: flex; align-items: center; justify-content: center; gap: 14px; font-size: 12px; color: #9a8d76; }
.board-footer button { padding: 4px 12px; border: 1px solid #d3c6ad; border-radius: 6px; background: linear-gradient(#fffef8, #f0e8d9); box-shadow: inset 0 1px 0 #fff, 0 1px 1px #65513a10; color: #7d6554; font-size: 12px; white-space: nowrap; }
.board-footer button:hover { border-color: #ae9774; }
.board-footer button:disabled { opacity: .45; cursor: default; }
#details { border-top: 1px solid #e4dac8; padding: 12px 10px 16px; min-height: 105px; font-size: 12px; }
#details strong { display: block; font-size: 13px; }
#details strong small { font-weight: 400; margin-left: 12px; }
#details small { font-size: 11px; color: #93826b; line-height: 1.8; }
.detail-stats { display: flex; flex-wrap: wrap; gap: 7px 18px; margin: 8px 0; color: #88765c; }
.detail-stats b { color: #5c584a; font-variant-numeric: tabular-nums; }
#result { padding: 13px; margin: 0 0 12px; border-radius: 8px; background: #e9eee2; color: #5b7560; line-height: 1.8; font-size: 13px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
@media (max-width: 760px) {
  .game { width: calc(100% - 20px); margin: 16px auto; display: block; }
  .lab-status { padding: 10px; gap: 9px 14px; font-size: 11px; margin-bottom: 14px; }
  .lab-status small { font-size: 10px; margin-left: 4px; }
  .battle-controls { width: 100%; margin: 0; }
  .battle-controls button { padding: 7px 12px; }
  .lab-feed { margin-top: 15px; }
  .round-note { display: none; }
  #roster { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; margin: 0 0 17px; }
  .role { padding: 3px 2px 6px; border-radius: 9px; }
  .role::before { inset: 3px; border-radius: 6px; }
  .role-name { font-size: clamp(10px, 2.5vw, 13px); letter-spacing: 0; line-height: 20px; }
  .role[aria-pressed="true"]::after { top: 4px; right: 4px; width: 14px; height: 14px; font-size: 9px; }
  .paper { width: 100%; padding: 0 5px; }
  .map-toolbar { padding: 8px 3px; font-size: 11px; }
  .map-tools { gap: 4px; }
  .map-tools button { font-size: 10px; padding: 5px 6px; }
  .board-footer { min-height: 48px; font-size: 11px; flex-wrap: wrap; gap: 8px 10px; padding: 10px 0; }
  .board-footer button { font-size: 11px; padding: 4px 8px; }
}
