:root {
    color-scheme: light;
    --paper: #f4f1e9;
    --ink: #20392f;
    --muted: #6d756a;
    --felt: #143f35;
    --gold: #ebcc83;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
}
button, select { font: inherit; touch-action: manipulation; }
button, a, select { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, a:focus-visible, select:focus-visible { outline: 3px solid #b3742d; outline-offset: 5px; }
[hidden] { display: none !important; }
.game-shell { max-width: 1240px; margin: auto; padding: 25px 40px 32px; }
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.back-link { color: var(--ink); font-size: 14px; text-decoration: none; padding: 12px 0; }
.back-link:hover { text-decoration: underline; }
.classroom-tag { font-size: 12px; letter-spacing: 3px; color: var(--muted); }
.quiet-button { padding: 10px 14px; border: 1px solid #d4d9ce; border-radius: 8px; color: var(--ink); background: transparent; min-height: 44px; }
.quiet-button:hover { background: #e8e9df; }
.intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin: 35px 0 26px; }
.eyebrow { color: #8a6535; font-size: 12px; letter-spacing: 2px; margin: 0 0 8px; }
.eyebrow span { margin-right: 8px; }
h1 { font-size: 46px; letter-spacing: -2px; line-height: 1.15; margin: 0 0 12px; font-weight: 800; }
.title-dot { color: #ba794a; }
.intro-copy { margin: 0; font-size: 14px; color: var(--muted); line-height: 1.7; }
.steps { list-style: none; display: flex; gap: 22px; margin: 0 0 5px; padding: 0; }
.steps li { font-size: 12px; color: #758074; white-space: nowrap; padding-bottom: 10px; border-bottom: 2px solid #dadfd3; }
.steps span { display: block; font-family: Georgia, serif; font-size: 23px; margin-bottom: 6px; }
.steps li.active { color: var(--ink); border-color: #ab7c3b; }
.table {
    position: relative;
    overflow: hidden;
    padding: 24px 36px 20px;
    border-radius: 22px;
    background: radial-gradient(ellipse at 50% 10%, #2b6050 0%, var(--felt) 75%);
    color: #fcf8e9;
    box-shadow: 0 18px 38px -24px #18392fc0, inset 0 0 0 1px #ffffff18;
}
.table::before { content: ""; position: absolute; inset: 10px; border: 1px solid #e8d9ab22; border-radius: 14px; pointer-events: none; }
.table-status { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.phase-label { color: var(--gold); font-size: 11px; letter-spacing: 3px; margin: 0 0 6px; }
h2 { font-size: 24px; margin: 0; font-weight: 600; line-height: 1.5; }
.counter { display: flex; align-items: baseline; gap: 9px; flex-shrink: 0; }
.counter strong { font-family: Georgia, serif; font-size: 42px; font-weight: 400; font-variant-numeric: tabular-nums; }
.counter span { color: #bccfc0; font-size: 12px; }
.progress-track { height: 2px; background: #ffffff15; margin-top: 18px; }
#progress { height: 100%; width: 0; background: var(--gold); }
.board { position: relative; width: 100%; height: 400px; margin: 0 auto 8px; }
.positions { position: absolute; inset: 0; pointer-events: none; }
.positions span { position: absolute; text-align: center; font: 20px Georgia, serif; color: #e8d6a1; }
.playing-card {
    position: absolute; top: 18%; width: 17%; height: 62%; padding: 0;
    border: 0; background: transparent; border-radius: 10px;
    perspective: 900px; color: #20282b;
}
.playing-card:disabled { opacity: 1; }
.playing-card:not(:disabled):hover .card-front { box-shadow: 0 0 0 3px var(--gold), 0 12px 22px #001a1640; }
.playing-card:not(:disabled):hover .card-back { border-color: var(--gold); }
.card-inner { position: absolute; inset: 0; transform-style: preserve-3d; }
.card-face {
    position: absolute; inset: 0; border-radius: 10px;
    backface-visibility: hidden; -webkit-backface-visibility: hidden;
    box-shadow: 0 10px 20px #001a1640;
    overflow: hidden;
}
.card-front { background: #fffdf6; transform: rotateY(180deg); border: 1px solid #fff; }
.card-front.red { color: #b63f43; }
.card-back { background: #294f61; border: 6px solid #fbf6e6; }
.card-back::before {
    content: ""; position: absolute; inset: 5px; border: 1px solid #f1dfad99; border-radius: 3px;
    background: repeating-linear-gradient(45deg, transparent, transparent 7px, #d7dec51e 7px, #d7dec51e 8px),
        repeating-linear-gradient(-45deg, transparent, transparent 7px, #d7dec51e 7px, #d7dec51e 8px);
}
.card-back::after {
    content: "✧"; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    color: #f3dfab; font: 66px Georgia, serif; background: #294f61; border-radius: 50%; line-height: .8;
}
.corner { position: absolute; left: 9%; top: 5%; display: flex; flex-direction: column; align-items: center; font: bold 25px/1.05 Georgia, serif; }
.corner.bottom { left: auto; top: auto; right: 9%; bottom: 5%; transform: rotate(180deg); }
.corner .suit { font-size: .8em; }
.card-center { position: absolute; inset: 22% 0; display: flex; flex-direction: column; align-items: center; justify-content: center; font: 58px/1 Georgia, serif; }
.card-center .suit { font-size: .85em; margin-top: 5%; }
.table-hint { position: relative; text-align: center; color: #c1d3c6; font-size: 13px; line-height: 1.7; margin: 10px 0 0; min-height: 23px; }
.pause-notice { position: absolute; inset: 45% 8% auto; text-align: center; background: #fff9e8; color: var(--ink); padding: 20px; border-radius: 10px; z-index: 10; }
.controls { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 24px; padding: 24px 0; border-bottom: 1px solid #dce0d4; }
.settings, .actions { display: flex; align-items: center; gap: 12px; }
.settings label { display: flex; align-items: center; gap: 10px; font-size: 13px; color: #5c695b; }
select { min-height: 46px; border: 1px solid #d3d9cb; border-radius: 8px; padding: 8px 28px 8px 12px; color: var(--ink); background: #fcfaf4; }
select:disabled { opacity: .5; }
.primary-button, .secondary-button { border-radius: 9px; min-height: 48px; padding: 12px 24px; font-size: 15px; font-weight: 600; }
.primary-button { background: var(--ink); color: #fffcef; border: 1px solid var(--ink); min-width: 160px; }
.primary-button span { margin-left: 18px; }
.primary-button:hover { background: #305342; }
.secondary-button { background: transparent; color: var(--ink); border: 1px solid #bdc9b8; }
.secondary-button:disabled { opacity: .35; }
.secondary-button:not(:disabled):hover { background: #e5eadf; }
.teacher-note { color: var(--muted); font-size: 12px; line-height: 1.9; margin-top: 18px; text-align: center; }
.teacher-note span { color: #4b5b48; font-weight: 600; margin-right: 10px; }
.noscript { text-align: center; color: #a32d32; }
@media (min-width: 1500px) {
    .game-shell { padding-top: 32px; }
    .intro { margin-top: 45px; margin-bottom: 32px; }
}
@media (max-width: 900px) {
    .game-shell { padding: 18px 24px 26px; }
    .intro { margin-top: 28px; }
    h1 { font-size: 38px; }
    .steps { gap: 12px; }
    .table { padding: 22px 24px 18px; }
    .corner { font-size: 20px; }
    .card-center { font-size: 44px; }
    .controls { flex-wrap: wrap; justify-content: center; gap: 18px; }
    .settings { margin-right: auto; }
    .actions { margin-left: auto; }
}
@media (max-width: 600px) {
    .game-shell { padding: 12px 14px 20px; }
    .classroom-tag { display: none; }
    .intro { display: block; margin: 24px 0 18px; }
    h1 { font-size: 36px; }
    .intro-copy { font-size: 13px; }
    .steps { margin: 20px 0 0; gap: 0; justify-content: space-between; }
    .steps li { display: flex; align-items: baseline; gap: 8px; font-size: 11px; }
    .steps span { font-size: 16px; margin: 0; }
    .table { padding: 22px 12px 20px; border-radius: 16px; }
    .table::before { inset: 6px; border-radius: 11px; }
    .table-status { padding: 0 6px; }
    h2 { font-size: 18px; }
    .counter { gap: 4px; }
    .counter strong { font-size: 32px; }
    .counter span { font-size: 10px; }
    .board { margin-top: 16px; }
    .playing-card { height: 55%; top: 20%; border-radius: 5px; }
    .card-face { border-radius: 5px; }
    .card-back { border-width: 3px; }
    .card-back::before { inset: 3px; }
    .card-back::after { font-size: 32px; }
    .corner { font-size: 12px; }
    .corner .suit { display: none; }
    .corner.bottom { display: none; }
    .card-center { font-size: 28px; inset: 27% 0 6%; }
    .card-center .suit { font-size: .75em; margin-top: 2%; }
    .positions span { font-size: 16px; }
    .table-hint { font-size: 11px; padding: 0 4px; }
    .controls { padding: 20px 0; }
    .settings, .actions { width: 100%; margin: 0; justify-content: space-between; gap: 10px; }
    .settings label { flex: 1; flex-direction: column; align-items: stretch; gap: 6px; font-size: 12px; }
    select { min-width: 78px; padding-right: 18px; }
    .primary-button { flex: 1.25; min-width: 0; }
    .secondary-button { flex: 1; }
    .primary-button, .secondary-button { padding: 12px; font-size: 14px; }
    .teacher-note { text-align: left; font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) {
    /* 换位轨迹是题目本身，保留；取消翻面旋转。 */
    .card-inner { transform-style: flat; }
}
@media (max-width: 360px) {
    .card-center { font-size: 24px; }
}

/* 牌面字号随当前牌宽变化，5–10 张共用同一套布局。 */
.board .card-center { font-size: min(58px, calc(var(--card-width) * .42)); }
.board .corner { font-size: min(25px, calc(var(--card-width) * .18)); }
.board .card-back::after { font-size: min(66px, calc(var(--card-width) * .5)); }
.board .card-back { border-width: min(6px, calc(var(--card-width) * .055)); }
