@font-face { font-family: "DeyiHei"; src: url("./DeyiHei.ttf") format("truetype"); }
@font-face { font-family: "XimaiTi"; src: url("./XimaiTi.ttf") format("truetype"); }

:root {
  --ink: #17384a;
  --cream: #fff8e8;
  --gold: #f4b63c;
  --affirmative: #e96862;
  --negative: #377f9e;
  --panel: rgba(9, 37, 54, 0.86);
}
* { box-sizing: border-box; }
html { min-width: 960px; min-height: 100%; overflow: auto; }
body { width: 100%; min-width: 960px; min-height: max(620px, 100dvh); margin: 0; overflow: visible; }
body {
  color: var(--cream);
  font-family: "DeyiHei", "Microsoft YaHei", sans-serif;
  background: linear-gradient(120deg, rgba(2, 22, 38, 0.48), rgba(4, 38, 54, 0.12)), url("./background-jiaxiang-timer.jpg") center / cover no-repeat fixed;
}
button, input { font: inherit; }
button { cursor: pointer; transition: transform .16s ease, filter .16s ease, box-shadow .16s ease, background-color .16s ease, border-color .16s ease; }
button:disabled { cursor: not-allowed; opacity: 0.45; }
@media (hover: hover) {
  button:not(:disabled):hover { transform: translateY(-1px); filter: brightness(1.07); box-shadow: 0 5px 12px rgba(0, 0, 0, .18); }
  .opinion-card:hover:not(:disabled) { box-shadow: 0 8px 16px rgba(0, 0, 0, .2); }
}
.app-shell { min-height: max(620px, 100dvh); padding: clamp(18px, 3vh, 42px) clamp(32px, 5vw, 92px); background: radial-gradient(circle at 50% 24%, rgba(255, 229, 160, 0.16), transparent 31%), rgba(1, 17, 31, 0.32); }
.topbar { display: grid; grid-template-columns: 180px 1fr 180px; align-items: center; gap: 18px; max-width: 1680px; margin: 0 auto 20px; }
.title-panel { text-align: center; text-shadow: 0 2px 0 rgba(0,0,0,.25); }
.title-panel p { margin: 0 0 4px; color: #f7d67c; font-size: 16px; letter-spacing: .18em; }
.title-panel h1 { margin: 0; color: #fff8e8; font-family: "XimaiTi", "DeyiHei", sans-serif; font-size: var(--topic-size, 44px); line-height: 1.1; letter-spacing: .03em; overflow-wrap: anywhere; }
.score-panel { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 12px 16px; border: 1px solid rgba(255,255,255,.25); border-radius: 20px; background: var(--panel); box-shadow: 0 10px 24px rgba(0,0,0,.25); }
.score-panel span { font-size: 15px; }
.score-panel strong { min-width: 40px; color: var(--gold); font-size: 36px; line-height: 1; text-align: center; }
.score-panel.affirmative { border-color: rgba(233,104,98,.8); }
.score-panel.negative { border-color: rgba(81,171,200,.8); }
.screen { display: none; max-width: 1600px; margin: 0 auto; }
.screen.active { display: block; }
.panel { border: 1px solid rgba(255, 223, 139, .45); border-radius: 24px; background: rgba(3, 31, 46, .81); box-shadow: 0 14px 36px rgba(0,0,0,.28); backdrop-filter: blur(4px); }
.lobby-grid { display: grid; grid-template-columns: minmax(350px, 1.3fr) minmax(220px, .54fr) minmax(350px, 1.3fr); gap: 18px; align-items: start; }
.fortress-column { min-height: 340px; padding: 18px; border: 1px solid rgba(255,255,255,.2); border-radius: 28px; background: rgba(5, 34, 50, .74); }
.fortress-column.affirmative { box-shadow: inset 0 4px 0 var(--affirmative); }
.fortress-column.negative { box-shadow: inset 0 4px 0 #62b9ce; }
.fortress-heading { display: flex; justify-content: space-between; align-items: baseline; margin: 2px 4px 14px; }
.fortress-heading span { font-size: 23px; color: #fff; }
.fortress-heading small { color: #d7e8e3; font-size: 13px; }
.cards-stack { display: grid; gap: 10px; }
.opinion-card { position: relative; display: flex; width: 100%; min-height: 94px; align-items: center; padding: 16px 20px 16px 67px; border: 1px solid rgba(255,255,255,.2); border-radius: 17px; color: #fdf8ea; text-align: left; background: rgba(255,255,255,.08); transition: .18s ease; }
.opinion-card:hover:not(:disabled) { transform: translateY(-2px); background: rgba(255,255,255,.17); }
.opinion-card.selected { outline: 3px solid var(--gold); background: rgba(244,182,60,.22); }
.opinion-card.dead { color: rgba(255,255,255,.45); background: rgba(0,0,0,.38); filter: grayscale(.85); }
.opinion-card.dead::after { content: "攻破"; position: absolute; right: 14px; bottom: 10px; color: #ff9d91; font-size: 13px; }
.opinion-card > span { position: absolute; top: 18px; left: 16px; display: grid; width: 30px; height: 30px; place-items: center; border-radius: 50%; color: var(--ink); font-weight: 700; background: var(--gold); }
.opinion-card.negative > span { background: #8bd8e4; }
.opinion-card p { margin: 0; font-size: var(--viewpoint-size, 24px); line-height: 1.38; overflow-wrap: anywhere; }
.command-center { display: flex; min-height: 340px; align-items: center; justify-content: center; flex-direction: column; gap: 15px; padding: 10px 4px; }
.attacker-switch { width: 100%; padding: 14px 10px; text-align: center; }
.attacker-switch > span { display: block; margin-bottom: 12px; font-size: 17px; color: #fce8a7; }
.attacker-switch > div { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.attacker-switch button, .lobby-actions button { padding: 9px 5px; border: 1px solid rgba(255,255,255,.28); border-radius: 12px; color: var(--cream); background: rgba(255,255,255,.1); font-size: 14px; }
.attacker-switch button.active { color: var(--ink); border-color: var(--gold); background: var(--gold); font-weight: 700; }
.selection-summary { min-height: 44px; margin: 0; color: #dcece7; line-height: 1.5; text-align: center; }
.primary-btn { min-width: 164px; padding: 14px 18px; border: 0; border-radius: 16px; color: #17384a; background: var(--gold); box-shadow: inset 0 -4px rgba(146,85,8,.22), 0 8px 16px rgba(0,0,0,.18); font-size: 20px; font-weight: 700; }
.lobby-actions { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; gap: 8px; margin-top: 8px; }
.lobby-actions button:nth-child(2) { color: #ffd8ce; }
.lobby-actions button:nth-child(3) { color: #fee098; }

.battle-header { display: flex; justify-content: space-between; align-items: center; padding: 14px 22px; margin-bottom: 18px; }
.battle-header div { display: flex; align-items: baseline; gap: 14px; }
.battle-header span { color: var(--gold); font-size: 20px; }
.battle-header strong { color: #fff; font-size: 24px; }
.battle-header button, .stage-switch button { padding: 9px 14px; border: 1px solid rgba(255,255,255,.25); border-radius: 11px; color: #fff; background: rgba(255,255,255,.1); }
.battle-cards-row { display: grid; grid-template-columns: 1fr 90px 1fr; align-items: center; gap: 20px; margin-bottom: 18px; }
.battle-card-panel { min-height: 210px; padding: 20px 26px; border: 2px solid var(--affirmative); border-radius: 28px; background: rgba(69, 27, 30, .72); box-shadow: 0 12px 30px rgba(0,0,0,.22); }
.battle-card-panel.negative { border-color: #63bdd1; background: rgba(12, 55, 72, .74); }
.battle-card-panel h2 { margin: 0 0 14px; color: #ffdcd6; font-size: 19px; }
.battle-card-panel.negative h2 { color: #c9f4f5; }
.battle-card-panel span { color: var(--gold); font-size: 14px; }
.battle-card-panel p { margin: 12px 0 0; color: #fff; font-size: var(--battle-viewpoint-size, 32px); line-height: 1.35; overflow-wrap: anywhere; }
.versus { display: grid; width: 76px; height: 76px; place-items: center; border: 4px solid var(--gold); border-radius: 50%; color: var(--gold); background: var(--ink); font-family: "XimaiTi"; font-size: 30px; transform: rotate(-7deg); }
.timer-zone { padding: 16px 24px; }
.timers-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.timer-panel { padding: 16px; border: 1px solid rgba(255,255,255,.22); border-radius: 16px; text-align: center; background: rgba(0,0,0,.15); }
.timer-panel > span { display: block; color: #dcece7; }
.timer-panel strong { display: block; margin: 4px 0 9px; color: #fff7dc; font-family: "XimaiTi", sans-serif; font-size: var(--timer-size, 54px); line-height: 1; }
.timer-panel strong.warning { color: #ff9284; }
.timer-panel > div { display: flex; justify-content: center; gap: 7px; flex-wrap: wrap; }
.timer-panel button { padding: 6px 10px; border: 1px solid rgba(255,255,255,.34); border-radius: 9px; color: #fff; background: rgba(255,255,255,.1); }
.stage-switch { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 12px; color: #f6dfa1; }
.debate-controls { display: none; justify-content: center; gap: 9px; margin-top: 12px; }
.debate-controls.visible { display: flex; }
.debate-controls button { min-width: 84px; padding: 8px 13px; border: 1px solid rgba(255,255,255,.35); border-radius: 10px; color: #fff; background: rgba(255,255,255,.12); font-weight: 700; }
.judge-row { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 10px; margin-top: 18px; }
.judge { padding: 14px 10px; border: 0; border-radius: 14px; font-size: 16px; font-weight: 700; }
.judge.attacker { color: #fff; background: #c95253; }
.judge.draw { color: var(--ink); background: #f0d172; }
.judge.defender { color: #fff; background: #2f839c; }
.judge.end { color: #fff; background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.28); }

.modal-backdrop { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 24px; overflow: auto; background: rgba(0,16,28,.72); backdrop-filter: blur(5px); }
.modal { position: relative; width: min(920px, 96vw); max-height: 90vh; overflow: auto; padding: 28px; border: 1px solid rgba(240,194,89,.55); border-radius: 26px; color: var(--ink); background: #fff8e9; box-shadow: 0 30px 70px rgba(0,0,0,.45); }
.modal h2 { margin: 0 0 12px; color: #17384a; font-family: "XimaiTi", "DeyiHei"; font-size: 32px; }
.modal h3 { margin: 0; }
.modal-close { position: absolute; top: 14px; right: 16px; width: 34px; height: 34px; border: 0; border-radius: 50%; color: var(--ink); background: #e4ece6; font-size: 26px; line-height: 1; }
.modal-lead, .muted { color: #526e78; line-height: 1.55; }
.fortress-setup-grid, .endgame-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.setup-side { padding: 16px; border: 1px solid #d4dee0; border-radius: 18px; background: #fffdf7; }
.setup-side.affirmative { border-top: 6px solid var(--affirmative); }
.setup-side.negative { border-top: 6px solid var(--negative); }
.setup-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.setup-heading button { width: 30px; height: 30px; border: 0; border-radius: 50%; color: #fff; background: var(--ink); font-size: 20px; }
.setup-heading strong { display: inline-block; width: 28px; text-align: center; }
.setup-side label, .settings-grid label, .field-label { display: block; margin: 9px 0; color: #31505d; font-size: 14px; }
.setup-side input, .settings-grid input, .field-label input { display: block; width: 100%; margin-top: 5px; padding: 10px 11px; border: 1px solid #b7c8ca; border-radius: 10px; color: #17384a; background: #fff; }
.form-error { min-height: 22px; color: #b63e38; font-weight: 700; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.modal-actions button { padding: 10px 16px; border-radius: 11px; font-weight: 700; }
.modal-actions .primary-btn { min-width: auto; color: var(--ink); font-size: 16px; }
.ghost-btn, .secondary-btn, .danger-btn { border: 1px solid #b6c7c9; color: #31505d; background: #edf2ef; }
.secondary-btn { color: #734d00; border-color: #e6bd53; background: #ffe9ac; }
.danger-btn { color: #fff; border-color: #b94f4e; background: #c95c56; }
.settings-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.settings-section-title { margin: 20px 0 8px; color: #17384a; font-size: 18px; }
.display-settings-grid { display: grid; gap: 10px; }
.range-setting { display: grid; grid-template-columns: 108px minmax(0, 1fr); align-items: center; gap: 14px; color: #31505d; font-size: 14px; }
.range-setting > div { display: grid; grid-template-columns: minmax(0, 1fr) 56px; align-items: center; gap: 12px; }
.range-setting input[type="range"] { width: 100%; height: 7px; margin: 0; padding: 0; border: 0; border-radius: 999px; accent-color: #d8795b; background: #d7e4e2; cursor: pointer; }
.range-setting output { display: grid; min-height: 30px; place-items: center; border-radius: 9px; color: #17384a; background: #e6efeb; font-weight: 700; }
.settlement-modal { width: min(760px, 96vw); max-height: min(84vh, 700px); }
.settlement-lead { margin: 0 0 16px; color: #526e78; line-height: 1.55; text-align: center; }
.endgame-grid section { padding: 17px; border-radius: 16px; color: #fff; text-align: center; background: #d5635d; }
.endgame-grid section.negative { background: #398aa1; }
.endgame-grid span, .endgame-grid small { display: block; }
.endgame-grid strong { display: block; margin: 4px 0; color: #fff6cf; font-family: "XimaiTi"; font-size: 54px; }
.detailed-endgame { gap: 14px; }
.detailed-endgame section { display: flex; min-height: 304px; flex-direction: column; padding: 16px; text-align: left; }
.settlement-side { margin-bottom: 10px; color: #fff6cf; font-size: 23px; font-weight: 700; text-align: center; }
.settlement-row, .settlement-total { padding: 10px 12px; border-radius: 12px; opacity: 0; transform: translateY(10px); transition: opacity .28s ease, transform .28s ease; }
.settlement-row { margin-bottom: 9px; background: rgba(255,255,255,.14); }
.settlement-row > span, .settlement-total > span { color: rgba(255,255,255,.92); font-size: 14px; }
.settlement-row small { margin-top: 3px; color: rgba(255,255,255,.82); font-size: 12px; }
.settlement-row strong { margin-top: 2px; font-size: 39px; line-height: 1; }
.settlement-total { margin-top: auto; border: 1px solid rgba(255,246,207,.68); background: rgba(4,37,54,.2); }
.settlement-total strong { margin-top: 2px; font-size: 48px; line-height: 1; }
.settlement-row.show, .settlement-total.show, .winner-banner.show { opacity: 1; transform: translateY(0); }
.winner-banner[data-reveal] { opacity: 0; transform: translateY(10px); transition: opacity .28s ease, transform .28s ease; }
.winner-banner { margin-top: 18px; padding: 14px; border-radius: 14px; color: #714b00; background: #ffe9aa; text-align: center; font-size: 20px; font-weight: 700; }
.round-result-overlay { position: fixed; inset: 0; z-index: 15; display: grid; place-items: center; padding: 24px; overflow: auto; background: rgba(1,20,32,.46); }
.round-result-overlay.hidden { display: none; }
.round-result-overlay > div { padding: 28px 48px; border: 2px solid #ffe19a; border-radius: 24px; color: #fff7dc; text-align: center; background: rgba(5,35,52,.94); box-shadow: 0 20px 50px rgba(0,0,0,.42); }
.round-result-overlay span { display: block; color: #f7d67c; font-size: 16px; }
.round-result-overlay strong { display: block; margin-top: 6px; font-family: "XimaiTi"; font-size: 34px; }
.vs-overlay { position: fixed; inset: 0; z-index: 14; display: grid; place-items: center; padding: 24px; overflow: auto; background: rgba(1,20,32,.7); backdrop-filter: blur(4px); }
.vs-overlay.hidden { display: none; }
.vs-stage { display: grid; grid-template-columns: minmax(260px,400px) 112px minmax(260px,400px); align-items: center; gap: 24px; width: min(1100px,90vw); }
.vs-stage > strong { display: grid; place-items: center; width: 112px; height: 112px; border: 5px solid var(--gold); border-radius: 50%; color: var(--gold); background: var(--ink); font-family: "XimaiTi"; font-size: 44px; animation: vsPulse .8s ease-in-out infinite alternate; }
.vs-card { min-height: 180px; padding: 26px; border: 2px solid var(--affirmative); border-radius: 26px; color: #fff; background: rgba(74,28,31,.92); box-shadow: 0 22px 48px rgba(0,0,0,.38); animation: cardEnterLeft .55s ease-out both; }
.vs-card.negative { border-color: #63bdd1; background: rgba(11,54,72,.92); animation-name: cardEnterRight; }
.vs-card span { color: #ffd8cf; font-size: 16px; }
.vs-card.negative span { color: #c9f4f5; }
.vs-card p { margin: 14px 0 0; font-size: var(--battle-viewpoint-size, 31px); line-height: 1.38; overflow-wrap: anywhere; }
.topic-input-label { display: block; margin: 12px 0 16px; color: #31505d; font-size: 14px; }
.clearable-input { display: flex; gap: 8px; margin-top: 5px; }
.clearable-input input { min-width: 0; flex: 1; padding: 11px; border: 1px solid #b7c8ca; border-radius: 10px; color: #17384a; }
.clearable-input button { width: 42px; border: 0; border-radius: 10px; color: #fff; background: #718990; font-size: 24px; }
@keyframes cardEnterLeft { from { opacity: 0; transform: translateX(-80px) rotate(-5deg); } to { opacity: 1; transform: translateX(0) rotate(0); } }
@keyframes cardEnterRight { from { opacity: 0; transform: translateX(80px) rotate(5deg); } to { opacity: 1; transform: translateX(0) rotate(0); } }
@keyframes vsPulse { from { transform: scale(.93) rotate(-4deg); } to { transform: scale(1.06) rotate(4deg); } }

@media (max-width: 1180px) {
  .app-shell { padding: 18px 28px; }
  .topbar { grid-template-columns: 170px 1fr 170px; }
  .lobby-grid { gap: 16px; }
  .fortress-column { padding: 13px; }
  .opinion-card { padding-left: 53px; }
}
