:root { color-scheme: light; --paper: #f6f4ee; --ink: #343b36; --muted: #777c72; --accent: #647b58; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif; -webkit-font-smoothing: antialiased; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--ink); outline-offset: 5px; }
.shell { min-height: 100svh; max-width: 1200px; margin: auto; padding: 0 48px; display: flex; flex-direction: column; }
.site-header { min-height: 100px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #dedfd5; }
.brand { display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; font-size: 17px; font-weight: 650; letter-spacing: 2px; }
.brand-mark { width: 23px; display: grid; grid-template-columns: 1fr 1fr; gap: 3px; }
.brand-mark i { height: 10px; background: #829371; border-radius: 2px; }
.brand-mark i:last-child { background: #b9c2a6; }
.header-note { font-size: 12px; color: var(--muted); letter-spacing: 2px; }
.header-actions { display: flex; align-items: center; gap: 20px; }
.sound-button { border: 1px solid #d5d9cd; border-radius: 20px; background: transparent; color: var(--ink); font-size: 12px; padding: 9px 13px; cursor: pointer; white-space: nowrap; }
.sound-button:hover { background: #e8ecdf; }
.sound-button:disabled { cursor: default; color: var(--muted); }
main { flex: 1; display: grid; place-items: center; padding: 48px 0; }
.screen { width: 100%; text-align: center; }
.eyebrow { color: var(--accent); font-size: 10px; font-weight: 600; letter-spacing: 4px; margin: 0 0 20px; }
.intro h1 { font-size: clamp(36px, 5vw, 58px); font-weight: 550; letter-spacing: -2px; line-height: 1.3; margin: 0; }
.intro h1 span { color: var(--accent); }
.intro-copy { color: var(--muted); line-height: 1.9; font-size: 14px; margin: 20px 0 26px; }
.preview-grid { width: 158px; height: 158px; margin: 0 auto 30px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; transform: rotate(-7deg); }
.preview-grid i { background: #99a78a; border-radius: 8px; }
.preview-grid i:nth-child(5) { background: #bdc9af; }
.rules { display: flex; justify-content: center; gap: 24px; font-size: 12px; color: #666e60; margin-bottom: 28px; }
.mode-picker { display: flex; justify-content: center; gap: 8px; border: 0; padding: 0; margin: 0 auto; }
.mode-picker legend { width: 100%; font-size: 11px; color: var(--muted); margin-bottom: 12px; }
.mode-picker label { position: relative; cursor: pointer; }
.mode-picker input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.mode-picker span { display: block; padding: 11px 20px; border: 1px solid #d5d9cd; border-radius: 9px; font-size: 13px; }
.mode-picker input:checked + span { background: #e8ecdf; border-color: #7c906b; color: #415437; font-weight: 600; }
.mode-picker input:focus-visible + span { outline: 3px solid var(--ink); outline-offset: 3px; }
.mode-description { font-size: 12px; color: var(--muted); margin: 14px 0 22px; line-height: 1.8; }
.difficulty-picker span { min-width: 74px; }
.classroom-settings { max-width: 440px; margin: 0 auto 24px; padding: 18px; border: 1px solid #dedfd5; border-radius: 12px; text-align: left; }
.classroom-settings legend { font-size: 12px; color: var(--muted); padding: 0 6px; }
.count-label { font-size: 12px; margin-right: 12px; }
.classroom-settings select, .nickname-fields input { font: inherit; font-size: 13px; color: var(--ink); background: #fffdf7; border: 1px solid #d5d9cd; border-radius: 7px; padding: 9px 10px; }
.classroom-settings select:focus-visible, .nickname-fields input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.nickname-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.nickname-fields label { min-width: 0; font-size: 11px; color: var(--muted); }
.nickname-fields input { display: block; width: 100%; margin-top: 6px; }
.ranking-table { width: 100%; max-width: 660px; margin: 0 auto 20px; border-collapse: collapse; text-align: left; font-size: 13px; font-variant-numeric: tabular-nums; }
.ranking-table th, .ranking-table td { padding: 14px 8px; border-bottom: 1px solid #dedfd5; }
.ranking-table th { font-size: 11px; color: var(--muted); font-weight: 400; }
.ranking-table th:nth-child(n+3), .ranking-table td:nth-child(n+3) { text-align: right; white-space: nowrap; }
.ranking-table .leader { background: #e8ecdf; }
.ranking-name { display: block; overflow-wrap: anywhere; }
.ranking-title { display: block; margin-top: 6px; font-size: 11px; color: #59694e; }
#handoff-title, #handoff-copy, #turn-label, #result-title, .review-card h3 { overflow-wrap: anywhere; }
.review-details { max-width: 760px; margin: 28px auto; text-align: left; border-top: 1px solid #dedfd5; border-bottom: 1px solid #dedfd5; padding: 17px 0; }
.review-details summary { cursor: pointer; font-size: 14px; font-weight: 550; }
.review-note { font-size: 11px; color: var(--muted); line-height: 1.8; margin: 14px 0 0; }
.review-grid { display: grid; gap: 20px; margin-top: 18px; }
.review-grid.multi { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.review-card { min-width: 0; }
.review-card h3 { font-size: 13px; font-weight: 550; margin: 0 0 12px; }
.review-table { width: 100%; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
.review-table th, .review-table td { text-align: right; padding: 10px 3px; border-bottom: 1px solid #e3e5dc; font-weight: 400; }
.review-table thead th { color: var(--muted); font-size: 11px; }
.review-table th:first-child { text-align: left; }
.review-swatch { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 7px; }
.review-highlights { font-size: 11px; color: #59694e; line-height: 1.9; margin: 12px 0 0; }
.turn-label { color: var(--accent); font-size: 12px; margin: 0 0 18px; }
.fun-title { display: inline-block; background: #e8ecdf; color: #415437; padding: 9px 17px; border-radius: 30px; font-size: 14px; margin: 0; }
.duel-rule { font-size: 12px; color: var(--muted); line-height: 1.8; margin: 0 0 28px; }
.text-button { display: block; margin: 16px auto 0; border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 12px; padding: 8px; text-decoration: underline; text-underline-offset: 4px; }
.primary-button { display: inline-flex; align-items: center; justify-content: space-between; gap: 48px; min-width: 232px; border: 0; border-radius: 12px; padding: 18px 24px; background: var(--ink); color: #fffef8; cursor: pointer; font-size: 15px; }
.primary-button:hover { background: #4b594b; }
.primary-button span { font-size: 21px; line-height: 1; }
.soft-note { color: var(--muted); font-size: 11px; margin: 18px 0 0; letter-spacing: 1px; }
.section-title { font-size: clamp(26px, 4vw, 36px); font-weight: 550; margin: 0; letter-spacing: -1px; }
.section-copy { font-size: 13px; color: var(--muted); margin: 14px 0 30px; line-height: 1.7; }
.game-panel { width: min(100%, 400px); margin: auto; }
.stats { display: flex; justify-content: space-between; align-items: center; font-size: 13px; font-weight: 550; }
.timer { font-variant-numeric: tabular-nums; }
.tiny-label { color: var(--muted); font-size: 11px; margin-right: 7px; font-weight: 400; }
.progress { display: flex; gap: 5px; margin: 13px 0 22px; }
.progress i { height: 3px; border-radius: 3px; flex: 1; background: #dfe2d7; }
.progress i.active { background: #7c906b; }
.color-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.board { position: relative; }
.celebration { position: absolute; inset: 0; z-index: 1; overflow: hidden; border-radius: 15px; pointer-events: none; }
.firework-trail, .firework-spark { position: absolute; left: 50%; top: 50%; border-radius: 100%; }
.firework-trail { width: 7px; height: 22px; background: #ffd166; box-shadow: 0 0 7px #ffd166; animation: firework-rise 300ms ease-out both; }
.firework-spark { width: 9px; height: 9px; background: var(--spark-color); box-shadow: 0 0 5px var(--spark-color); animation: firework-burst 900ms 300ms ease-out both; }
.final-fireworks { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 2; }
.final-burst { position: absolute; width: 0; height: 0; }
.final-burst .firework-trail, .final-burst .firework-spark { left: 0; top: 0; }
.final-burst .firework-trail { width: 8px; height: 26px; animation-duration: 400ms; animation-delay: var(--launch-delay); }
.final-burst .firework-spark { width: 10px; height: 10px; animation-duration: 1150ms; animation-delay: calc(var(--launch-delay) + 400ms); }
@keyframes firework-rise {
  0% { opacity: 0; transform: translate(-50%, 100px) scaleY(1.5); }
  25% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, 0) scaleY(0.4); }
}
@keyframes firework-burst {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
  10% { opacity: 1; }
  55% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--spark-x), var(--spark-y)) scale(0.3); }
}
@media (prefers-reduced-motion: reduce) {
  .celebration, .final-fireworks { display: none; }
}
.tile { display: block; padding: 0; width: 100%; aspect-ratio: 1; border: 0; border-radius: 15px; box-shadow: none; cursor: pointer; touch-action: manipulation; }
.tile:disabled { cursor: default; opacity: 1; }
.tile.tile-wrong { outline: 5px solid #a93a58; outline-offset: -5px; animation: wrong-shake 420ms ease-out; }
.error-pop { position: absolute; z-index: 2; pointer-events: none; padding: 8px 12px; background: #fff5ef; color: #9d3852; border: 1px solid #d99aa8; border-radius: 20px; font-size: 14px; font-weight: 600; white-space: nowrap; animation: error-rise 650ms ease-out both; }
@keyframes wrong-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  50% { transform: translateX(6px); }
  75% { transform: translateX(-4px); }
}
@keyframes error-rise {
  0% { opacity: 1; transform: translate(-50%, -50%); }
  60% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, calc(-50% - 25px)); }
}
.feedback-row { min-height: 140px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-content: start; align-items: start; gap: 12px; padding-top: 20px; }
.feedback-copy { min-width: 0; text-align: left; padding-left: 12px; border-left: 4px solid transparent; }
.feedback-copy.is-error { border-left-color: #a93a58; }
#feedback { font-size: 19px; font-weight: 600; margin: 0; color: #59694e; line-height: 1.6; }
.feedback-copy.is-error #feedback { color: #9d3852; }
.error-hint { font-size: 17px; color: #515b50; line-height: 1.8; margin: 8px 0 0; }
#error-label { font-size: 13px; color: var(--muted); margin-top: 6px; white-space: nowrap; }
@media (prefers-reduced-motion: reduce) {
  .tile.tile-wrong, .error-pop { animation: none; }
  .error-pop { transform: translate(-50%, -50%); }
}
.result-symbol { color: #869874; font-size: 70px; line-height: 1; margin-bottom: 28px; }
.result-stats { display: grid; grid-template-columns: 1fr 1fr; max-width: 380px; margin: 32px auto; padding: 25px 0; border-top: 1px solid #dedfd5; border-bottom: 1px solid #dedfd5; }
.result-stats > div + div { border-left: 1px solid #dedfd5; }
.result-stats span { color: var(--muted); display: block; font-size: 12px; margin-bottom: 12px; }
.result-stats strong { font-weight: 500; font-size: 32px; font-variant-numeric: tabular-nums; }
footer { text-align: center; color: var(--muted); font-size: 10px; padding: 22px 0 26px; letter-spacing: 1px; }
footer span { margin: 0 9px; }
@media (max-width: 600px) {
  .shell { padding: 0 24px; }
  .site-header { min-height: 76px; }
  .header-note { display: none; }
  .brand { font-size: 15px; gap: 8px; }
  main { padding: 32px 0; }
  .rules { gap: 9px; font-size: 10px; }
  .intro h1 { letter-spacing: -1px; }
  .color-grid { gap: 9px; }
  .tile { border-radius: 11px; }
  .section-copy { margin-bottom: 24px; }
  .play .eyebrow { margin-bottom: 12px; }
  .play .section-copy { margin: 10px 0 18px; }
  .play .turn-label { margin-bottom: 12px; }
  .result-stats strong { font-size: 28px; }
  .review-grid.multi { grid-template-columns: 1fr; }
  .ranking-table { font-size: 12px; }
  .ranking-table th, .ranking-table td { padding: 12px 4px; }
  .classroom-settings { padding: 14px; }
  .feedback-row { grid-template-columns: minmax(0, 1fr); min-height: 172px; gap: 8px; }
  #error-label { margin: 0; padding-left: 16px; text-align: left; }
}
