:root {
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #18212b;
  background: #1d1e20;
  --line: #a18458;
  --male: #c9dced;
  --male-line: #426d9b;
  --female: #ead4e8;
  --female-line: #875783;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; display: grid; grid-template-rows: 58px 1fr 78px; overflow: hidden; }
button { font: inherit; letter-spacing: 0; cursor: pointer; }
.topbar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 18px; padding: 0 18px; color: #241b10; background: #d6bd8d; border-bottom: 2px solid #8c6d3e; }
.brand { display: flex; align-items: baseline; gap: 8px; }
.brand strong { font-size: 17px; }
.brand span, .progress { font-size: 12px; color: #635137; }
.level-nav { display: flex; align-items: center; gap: 10px; }
.level-nav strong { min-width: 86px; text-align: center; font-size: 20px; }
.icon { width: 34px; height: 34px; border: 1px solid #8c6d3e; background: #f5e7c9; font-size: 24px; line-height: 1; }
.level-jump { display: flex; align-items: center; gap: 4px; margin-left: 4px; font-size: 11px; }
.level-jump input { width: 58px; height: 30px; border: 1px solid #8c6d3e; background: #fffaf0; padding: 0 5px; font: inherit; }
.level-jump button { height: 30px; border: 1px solid #8c6d3e; background: #f5e7c9; color: #4e3c23; font-size: 11px; font-weight: 800; }
.tools { justify-self: end; display: flex; align-items: center; gap: 8px; }
.analysis-link { height: 32px; display:flex; align-items:center; padding:0 10px; border:1px solid #8c6d3e; background:#f5e7c9; color:#4e3c23; text-decoration:none; font-size:12px; font-weight:800; }
.mode-switch { display: flex; border: 1px solid #8c6d3e; }
.mode-switch button, .answer-toggle { height: 32px; padding: 0 10px; border: 0; background: #f5e7c9; color: #4e3c23; font-size: 12px; font-weight: 800; }
.mode-switch button + button { border-left: 1px solid #8c6d3e; }
.mode-switch button.active, .answer-toggle.active { background: #3c5062; color: #fff; }
.answer-toggle { border: 1px solid #8c6d3e; }
.progress { display: flex; gap: 10px; margin-left: 4px; }
#remainingBadText { color:#8f2139; font-weight:900; }
main { overflow: auto; display: grid; place-items: center; padding: 24px; background: #262629 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='48'%3E%3Cpath d='M0 0h88v48H0z' fill='%2328282b'/%3E%3Cpath d='M0 23h88M44 0v23M22 23v25M66 23v25' stroke='%23303235' stroke-width='2'/%3E%3C/svg%3E"); }
.attention-notice { position: fixed; z-index: 10; left: 14px; top: 70px; max-width: min(420px,calc(100vw - 28px)); padding: 9px 12px; border: 2px solid #c73546; background: #fff0f1; color: #6f1723; box-shadow: 0 3px 12px rgba(0,0,0,.28); }
.attention-notice strong { display:block;font-size:12px;text-transform:uppercase; }
.attention-notice span { display:block;margin-top:2px;font-size:12px; }
.attention-notice[hidden] { display:none; }
.queue-notice { width: min(620px, calc(100vw - 32px)); padding: 22px 24px; border: 2px solid #d0a34d; background: #fff5dc; color: #402f18; box-shadow: 0 5px 24px rgba(0,0,0,.4); }
.queue-notice strong { display: block; margin-bottom: 7px; color: #8f2139; font-size: 20px; }
.queue-notice > span { font-size: 12px; color: #68583e; }
.queue-notice ul { max-height: 180px; overflow: auto; margin: 12px 0; padding-left: 22px; font-size: 13px; line-height: 1.55; }
.queue-notice button { height: 36px; border: 0; padding: 0 14px; background: #3c5062; color: #fff; font-weight: 800; }
.board[hidden], .queue-notice[hidden] { display: none; }
.board { --cols: 4; --card-w: 128px; --card-h: 158px; --portrait-h: 118px; display: grid; grid-template-columns: repeat(var(--cols), var(--card-w)); gap: 6px; align-content: center; justify-content: center; }
.card { position: relative; width: var(--card-w); min-height: var(--card-h); height: var(--card-h); padding: 0; overflow: hidden; border: 2px solid var(--male-line); background: var(--male); color: #17212b; box-shadow: 0 2px 7px rgba(0,0,0,.36); }
.card.female { border-color: var(--female-line); background: var(--female); }
.card.blank { border-color: #68717a; background: #313943; }
.card.selected { outline: 3px solid #f2bf45; outline-offset: 2px; }
.card.resolved { opacity: .62; filter: saturate(.65); }
.coord { position: absolute; left: 5px; top: 3px; z-index: 2; color: #fff; font-weight: 800; font-size: 13px; text-shadow: 0 1px 3px #000; }
.portrait { height: var(--portrait-h); display: grid; place-items: end center; overflow: hidden; background: rgba(255,255,255,.18); }
.portrait img { width: 100%; height: 100%; object-fit: contain; }
.name { min-height: 32px; display: flex; align-items: center; justify-content: center; gap: 4px; padding: 3px 5px; background: rgba(255,255,255,.72); border-top: 1px solid rgba(0,0,0,.14); }
.name strong { font-weight: 800; }
.job { display: inline-block; padding: 1px 3px; border: 1px solid rgba(0,0,0,.25); background: rgba(255,255,255,.75); font-size: 8px; line-height: 1.1; white-space: nowrap; }
.clue { min-height: var(--card-h); height: var(--card-h); display: flex; flex-direction: column; justify-content: center; align-items: stretch; gap: 4px; padding: 5px 7px 7px; background: #fff; font-size: clamp(10px, calc(var(--card-w) / 10), 13px); line-height: 1.35; text-align: center; }
.clue-identity { height: 38%; min-height: 30px; display: grid; grid-template-columns: 44% 1fr; align-items: center; gap: 3px; overflow: hidden; border-bottom: 1px solid #d5d9dc; }
.clue-identity img { width: 100%; height: 100%; object-fit: contain; align-self: end; }
.clue-identity > div { min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.clue strong { display: block; max-width: 100%; overflow: hidden; font-size: 11px; line-height: 1.1; text-overflow: ellipsis; white-space: nowrap; }
.clue > span:last-child { font-weight: 700; }
.blank .portrait { height: var(--card-h); place-items: center; }
.blank .portrait::after { content: ""; width: 48px; height: 65px; border: 3px solid #8f9aa5; border-radius: 24px 24px 4px 4px; opacity: .55; }
.blank .name { display: none; }
.result { position: absolute; right: 5px; top: 4px; z-index: 3; padding: 3px 6px; color:#fff; font-size: 10px; font-weight: 900; border: 1px solid rgba(255,255,255,.85); }
.result.good-role { background:#237354; }
.result.bad-role { background:#a8354b; }
.mistake-mark { position:absolute;right:5px;top:31px;z-index:3;padding:2px 5px;background:#221f20;color:#fff;font-size:9px;font-weight:800; }
.answer-badge { position: absolute; right: 5px; bottom: 36px; z-index: 4; padding: 3px 7px; color: #fff; border: 1px solid rgba(255,255,255,.75); font-size: 11px; font-weight: 900; box-shadow: 0 1px 4px rgba(0,0,0,.4); }
.answer-good { outline: 3px solid #38a779; outline-offset: -3px; }
.answer-bad { outline: 3px solid #d54c62; outline-offset: -3px; }
.answer-good .answer-badge { background: #237354; }
.answer-bad .answer-badge { background: #a8354b; }
.actions { display: flex; justify-content: center; align-items: center; gap: 14px; background: #171719; border-top: 1px solid #444; }
.actions button { width: 150px; height: 48px; border: 0; color: #fff; font-size: 18px; font-weight: 800; }
.actions button:disabled { opacity: .35; cursor: default; }
.actions .undo { width:48px;background:#55585d;font-size:27px;line-height:1; }
.open { background: #2f76b7; }
.expel { background: #bd3f5e; }
.toast { position: fixed; left: 50%; bottom: 90px; transform: translate(-50%, 12px); opacity: 0; padding: 9px 14px; color: #fff; background: #111; transition: .16s; pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 720px) {
  body { grid-template-rows: auto 1fr 70px; }
  .topbar { grid-template-columns: 1fr auto; padding: 7px 10px; }
  .brand span { display: none; }
  .tools { grid-column: 1 / -1; justify-self: center; flex-wrap: wrap; justify-content: center; }
  .level-nav { flex-wrap: wrap; justify-content: center; }
  .level-jump { flex-basis: 100%; justify-content: center; }
  main { padding: 14px 8px; place-items: start center; }
  .board { --card-w: min(var(--card-w), 104px); }
}
