@charset "UTF-8";
:root { color-scheme: light; font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif; color: #51452e; background: #fff; }
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; overscroll-behavior: none; }
body { background: #fff; }
body.game-page { background-color: #fff7df; }
button, input { font: inherit; color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button { cursor: pointer; }
button:disabled { cursor: default; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible { outline: 2px solid #54713a; outline-offset: 2px; }
h1, p { margin: 0; }
[hidden] { display: none !important; }
.app-frame { position: fixed; top: var(--view-top, 0px); left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; height: 100vh; height: var(--view-height, 100dvh); display: flex; flex-direction: column; padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); overflow: hidden; }
.topbar { position: relative; z-index: 3; flex: 0 0 42px; min-height: 42px; display: flex; align-items: center; gap: 6px; padding: 4px 10px; background: #fff7df; border-bottom: 1px solid #d4c299; color: #342817; }
.toolbar-actions { display: flex; gap: 6px; margin-left: auto; }
.game-menu { width: 100%; padding: 56px 24px 24px; overflow-y: auto; }
.game-menu h1 { margin: 8px 0 28px; font-size: 28px; font-weight: 600; }
.menu-caption { font-size: 12px; color: #776748; }
.menu-card { position: relative; display: block; margin: 12px 0; padding: 15px 22px 15px 12px; border: 1px solid #b9a272; border-radius: 8px; background: #fff9e8ed; text-align: left; line-height: 1.5; }
.menu-card strong { display: block; font-size: 18px; font-weight: 600; }
.menu-card span { display: block; margin-top: 5px; font-size: 11px; }
.menu-card b { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); font-size: 18px; }
@media (max-height: 550px) { .game-menu h1 { margin: 4px 0; font-size: 22px; } .menu-card { margin: 6px 0; padding: 8px 22px 8px 10px; } .menu-caption { display: none; } }
.toolbar-actions button, .close-button { min-height: 32px; min-width: 42px; padding: 0 9px; border: 1px solid #b8a578; border-radius: 5px; background: #fffdf5; font-size: 12px; font-weight: 600; }
#main { position: relative; flex: 1; min-height: 0; width: 100%; display: flex; flex-direction: column; }
.art-space { position: absolute; inset: 0; overflow: hidden; }
.wordmark { font-size: 13px; font-weight: 700; white-space: nowrap; }
.close-button { display: flex; gap: 4px; align-items: center; white-space: nowrap; }
.close-button span { font-size: 16px; }
.illustration { position: absolute; inset: 0; background-color: #cba45e; background-image: var(--artwork); background-size: cover; background-position: center; background-repeat: no-repeat; }
.illustration::before { content: ''; position: absolute; left: 11%; right: 10.5%; top: 14.5%; bottom: 29.6%; border: 1px solid #9c8558; background: #fff9df; z-index: 0; }
.artwork-loaded .illustration::before { display: none; }
.board-region { position: absolute; top: 8.8%; left: 16%; width: 68%; height: 65.5%; display: flex; justify-content: center; align-items: flex-start; }
.board { container-type: inline-size; display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); grid-template-rows: repeat(var(--rows), minmax(0, 1fr)); width: 100%; max-height: 100%; position: relative; }
.cell { min-width: 0; min-height: 0; width: 100%; height: 100%; padding: 0; border: 1px solid #806c48; border-radius: 0; appearance: none; -webkit-appearance: none; background: #fffbedb8; font-family: "Songti SC", STSong, serif; font-size: var(--cell-font, 16px); line-height: 1; display: flex; align-items: center; justify-content: center; position: relative; }
.cell.given { color: #51452e; }
.cell.active-word { background: #fff1c4d9; }
.cell.selected { background: #edf0ba; }
.cell:focus-visible { outline: none; filter: brightness(.92); }
.cell.correct { color: #41602c; background: #dce9acd9; }
.cell.incorrect { color: #a32727; background: #ffebeb; }
.cell.correct.selected { background: #bfd78b; }
.cell.incorrect.selected { background: #ffcaca; }
.error-mark { position: absolute; top: 1px; right: 1px; width: 8px; height: 8px; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: #fff; color: #c42525; font: 700 11px/1 sans-serif; pointer-events: none; }
#cell-input { width: 100%; min-width: 0; height: 100%; min-height: 0; padding: 0; border: 0; outline: none; border-radius: 0; background: transparent; color: #466232; caret-color: #466232; text-align: center; font-size: 16px; z-index: 2; pointer-events: none; }
#cell-input:disabled { visibility: hidden; }
.game-tools { position: absolute; z-index: 2; left: 0; right: 0; bottom: 0; padding: 6px 12px max(10px, env(safe-area-inset-bottom)); text-align: center; }
.selection-label { display: inline-block; max-width: 100%; padding: 5px 10px; border-radius: 5px; background: #fff7df; color: #342817; font-size: 13px; font-weight: 600; line-height: 1.4; margin: 0 0 6px; }
.tool-buttons { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px; }
.tool-buttons button { border: 1px solid #aa9569; border-radius: 5px; background: #fff4d9; padding: 8px 15px; min-height: 40px; font-size: 12px; }
.home-content { position: absolute; top: var(--home-top, 40%); transform: translateY(-50%); left: 17%; right: 17%; text-align: center; font-size: max(8px, calc(12px * var(--art-scale, 1))); line-height: 1.9; }
.home-content h1 { font-family: "Songti SC", STSong, serif; font-size: max(18px, calc(34px * var(--art-scale, 1))); font-weight: 500; letter-spacing: calc(5px * var(--art-scale, 1)); margin: calc(15px * var(--art-scale, 1)) 0; }
.loading-state, .error-state { padding: 80px 20px; text-align: center; }
.loading-note { font-size: 30px; }
.toast { position: fixed; bottom: max(24px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100vw - 32px); padding: 11px 16px; background: #4d5634f0; color: #fff9df; border-radius: 7px; font-size: 12px; opacity: 0; pointer-events: none; z-index: 20; }
.toast.visible { opacity: 1; }
dialog { padding: 0; width: calc(100% - 48px); max-width: 340px; border: 1px solid #b5a173; border-radius: 9px; background: #fff7df; color: #51452e; }
dialog::backdrop { background: #39352266; }
.modal-inner { padding: 24px 21px 18px; text-align: center; }
#modal-eyebrow { display: none; }
#modal-title { font-family: "Songti SC", STSong, serif; font-size: 22px; font-weight: 500; margin: 0 0 14px; }
#modal-body { line-height: 1.9; font-size: 14px; overflow-wrap: anywhere; }
#modal-actions { display: grid; gap: 8px; margin-top: 20px; }
#modal-actions button { min-height: 44px; border: 1px solid #b5a173; border-radius: 4px; background: #fff9e8; font-size: 13px; }
#modal-actions button.primary { background: #687a45; border-color: #687a45; color: #fff9df; }
.pop { animation: correct-pop .5s ease-out; }
@keyframes correct-pop { 0% { box-shadow: 0 0 0 0 #8aaa57a0; } 45% { box-shadow: 0 0 0 5px #8aaa5745; background-color: #b8d685; } 100% { box-shadow: 0 0 0 9px #8aaa5700; } }
@media (prefers-reduced-motion: reduce) { .pop { animation: none; } }
