/* 拼图桌面：主题仍决定画布；控件采用统一、高对比的暖白界面。 */
@font-face { font-family: Roboto; src: url(../fonts/Roboto.woff) format('woff'); font-weight: 100 900; font-display: swap; }
:root { --background: #2e284f; --paper: #fffefa; --ink: #283c33; --green: #31594a; --line: #dce1d6; --toolbar-height: 56px; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; height: 100%; overflow: hidden; }
body { background: var(--background); color: var(--ink); font: 16px/1.5 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; touch-action: none; user-select: none; -webkit-user-select: none; overscroll-behavior: none; -webkit-tap-highlight-color: transparent; }
button, input { font: inherit; }
button { color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:disabled, .disabled { opacity: .45; cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible, [role='menuitem']:focus-visible { outline: 3px solid #ad653e; outline-offset: -3px; }
a { color: var(--green); text-underline-offset: 3px; }
.bar { display: flex; }
#toolbar { position: absolute; z-index: 1; top: 0; left: 0; width: 100%; height: var(--toolbar-height); background: var(--paper); border-bottom: 1px solid #213e2526; box-shadow: 0 2px 12px #20352912; align-items: center; justify-content: space-between; }
.bar-left, .bar-center, .bar-right { display: flex; align-items: center; }
.bar-left { padding-left: 10px; flex: 1; }
.bar-center { justify-content: center; }
.bar-right { padding-right: 10px; justify-content: flex-end; flex: 1; }
.icon-btn { width: 44px; height: 44px; padding: 10px; color: var(--ink); flex: none; border-radius: 7px; display: flex; align-items: center; justify-content: center; }
.icon-btn:hover, .text-btn:hover, #clock:hover { background: #eef1e8; }
.icon-btn.on { background: #dce8d7; color: #224a36; box-shadow: inset 0 0 0 1px #b6cbb0; }
.icon { display: block; width: 24px; height: 24px; fill: currentColor; pointer-events: none; flex: none; }
#clock { min-width: 85px; height: 44px; padding: 0 10px; font-size: 17px; color: var(--ink); font-variant-numeric: tabular-nums; border-radius: 7px; }
.text-btn { padding: 0 8px; height: 44px; font-size: 11px; font-weight: 600; border-radius: 7px; }
#canvas { display: block; position: absolute; top: var(--toolbar-height); left: 0; outline: none; touch-action: none; }
.dialog-panel { position: absolute; top: 0; right: 0; bottom: 0; left: 0; margin: auto; display: none; background: var(--paper); box-shadow: 0 18px 65px #192d3338; border: 1px solid #ffffff80; border-radius: 14px; z-index: 20; max-width: calc(100% - 32px); max-height: calc(100vh - 80px); max-height: calc(100dvh - 80px); overflow: auto; }
.dialog-panel.open { display: block; }
.dialog-bar { display: flex; justify-content: flex-end; gap: 10px; padding: 18px 22px; border-top: 1px solid var(--line); background: #f3f5ee; }
.dialog-button { min-width: 100px; min-height: 44px; padding: 9px 18px; border-radius: 7px; border: 1px solid #becabb; background: var(--paper); }
.dialog-button:hover { background: #e9efe3; }
.dialog-button.default { background: var(--green); border-color: var(--green); color: white; }
#start, #start.wide { width: 450px; height: fit-content; padding: 28px; text-align: center; overflow: auto; }
.start-eyebrow { margin: 0 0 10px; font-size: 10px; letter-spacing: .13em; font-weight: 600; color: #66775d; }
#start-title { font: 400 31px/1.2 Georgia, serif; letter-spacing: -.03em; margin: 0 0 10px; }
#start-summary { font-size: 13px; color: #586758; margin: 0 0 24px; }
#start-bar { display: flex; flex-direction: column; gap: 24px; }
#start-bar .bar-center { gap: 8px; flex-wrap: wrap; }
.start-btn { width: 65px; height: 70px; flex-direction: column; gap: 7px; padding: 9px 4px; background: #eff2e9; border: 1px solid #dce3d5; }
.start-label { font-size: 11px; line-height: 1.3; }
.start-btn:hover:not(:disabled) { background: #e2eadb; }
#ok-btn { min-height: 46px; width: 100%; border-radius: 8px; background: var(--green); color: #fff; font-size: 15px; font-weight: 600; }
#ok-btn:hover { background: #254536; }
.slide-panel { position: absolute; top: 0; left: 0; height: 100%; width: 310px; max-width: calc(100% - 24px); z-index: 30; background: var(--paper); box-shadow: 10px 0 40px #20352926; transform: translateX(-110%); transition: transform .2s; overflow: auto; visibility: hidden; padding: 28px 20px; touch-action: pan-y; }
.slide-panel.open { transform: none; visibility: visible; }
.slide-title { font: 400 27px/1.2 Georgia, serif; margin: 0 0 28px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.slide-text { font-size: 15px; line-height: 1.65; margin: 0; overflow-wrap: anywhere; }
.slide-input { width: 100%; margin: 12px 0 20px; padding: 11px 12px; border: 1px solid #b4c1af; background: white; color: var(--ink); border-radius: 7px; font-size: 16px; }
.slide-button { width: 100%; margin: 12px 0; padding: 12px 16px; min-height: 44px; background: var(--green); color: #fff; border-radius: 7px; }
.back-btn { display: block; width: 100%; min-height: 44px; margin: 24px 0 0; padding: 10px; border: 1px solid var(--line); border-radius: 7px; font-size: 14px; }
.back-btn:hover { background: #edf1e7; }
.choice-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.choice { min-height: 47px; padding: 11px 3px; background: #f1f3eb; border: 1px solid #dce3d5; border-radius: 7px; font-size: 15px; }
.choice:hover { background: #e5eddd; }
.choice.sel { color: white; background: var(--green); border-color: var(--green); }
.swatch { width: 100%; height: 38px; border-radius: 4px; background-size: 128px; }
#theme-list .choice { padding: 5px; font-size: 11px; text-transform: capitalize; }
.copy-button { display: inline-flex; padding: 10px 15px; min-height: 44px; border-radius: 7px; background: var(--green); color: #fff; cursor: pointer; }
#copy-done { display: block; margin-top: 12px; visibility: hidden; }
#copy-done.open { visibility: visible; }
#player-list { line-height: 1.8; }
/* Android 浏览器打开多人链接时的底部横条（player.js appBanner）。 */
#app-banner { position: absolute; z-index: 35; left: 50%; bottom: 16px; transform: translateX(-50%); width: max-content; max-width: calc(100% - 24px); display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 16px; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 30px #20352933; font-size: 14px; }
#app-banner .copy-button { flex: none; text-decoration: none; align-items: center; }
.banner-close { flex: none; width: 36px; height: 36px; font-size: 22px; color: var(--ink); }
.menu { position: absolute; top: calc(var(--toolbar-height) + 6px); left: 8px; display: none; flex-direction: column; width: min(315px, calc(100% - 16px)); max-height: calc(100vh - 76px); max-height: calc(100dvh - 76px); overflow: auto; padding: 7px; border-radius: 10px; border: 1px solid var(--line); background: var(--paper); box-shadow: 0 12px 40px #20352935; z-index: 40; touch-action: pan-y; }
.menu.open { display: flex; }
.menu-item { display: block; width: 100%; padding: 11px 13px; min-height: 44px; cursor: pointer; text-align: left; border-radius: 6px; font-size: 14px; color: var(--ink); text-decoration: none; }
.menu-item:hover:not(.disabled) { background: #eaf0e3; }
#home-link { border-top: 1px solid var(--line); margin-top: 6px; border-radius: 0 0 6px 6px; }
#open-file { display: none; }
#help-panel { width: 750px; height: 78%; z-index: 25; padding-top: 48px; }
.panel-close { position: absolute; right: 8px; top: 5px; width: 40px; height: 40px; font-size: 28px; border-radius: 7px; }
.panel-close:hover { background: #eaf0e3; }
#help-tabs { border-bottom: 1px solid var(--line); }
.tab { width: 50%; padding: 12px; font-size: 16px; border-bottom: 3px solid transparent; }
.tab.sel { color: var(--green); border-bottom-color: var(--green); background: #edf2e7; }
.help-sub { padding: 24px 30px; height: calc(100% - 52px); overflow: auto; display: none; user-select: text; -webkit-user-select: text; touch-action: pan-y; font-size: 15px; }
.help-sub.open { display: block; }
.help-sub p { margin: 0 0 20px; }
table.keys { border-collapse: collapse; margin: 14px 0 24px; width: 100%; font-size: 13px; }
table.keys td { padding: 8px 10px; border-bottom: 1px solid var(--line); }
.tag-line { font-size: 13px; color: #62735a; margin-top: 20px; }
.credit { font-size: 14px; text-align: center; }
#pause-screen { position: absolute; top: 0; right: 0; bottom: 0; left: 0; background: #172c27c7; z-index: 10; display: none; }
#pause-screen.open { display: block; }
#pause-dlg { width: 450px; height: fit-content; z-index: 11; text-align: center; }
#pause-title { font: 32px Georgia, serif; margin: 32px 24px 15px; }
#status-line { font-size: 15px; margin: 0 24px 28px; }
#pause-mp { font-size: 14px; margin: 0 24px 20px; overflow-wrap: anywhere; }
#msgbox { width: 450px; height: fit-content; z-index: 100; }
#msgbox-content { font-size: 16px; margin: 28px; overflow-wrap: anywhere; }
#toast { display: none; position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 32px); padding: 13px 22px; background: #263d32; color: #fff; border-radius: 9px; box-shadow: 0 8px 35px #0003; z-index: 90; font-size: 14px; text-align: center; }
#toast.open { display: block; }
#toast a { color: inherit; }
#tooltip { position: absolute; visibility: hidden; opacity: 0; z-index: 999; pointer-events: none; padding: 8px 12px; font-size: 13px; border-radius: 6px; background: #263d32; color: #fff; transition: opacity .15s; max-width: calc(100% - 16px); }
#tooltip.open { visibility: visible; opacity: 1; }
@keyframes spin { to { transform: rotate(360deg); } }
#spinner { position: absolute; top: 0; right: 0; bottom: 0; left: 0; margin: auto; width: 60px; height: 60px; z-index: 999; display: none; pointer-events: none; }
#spinner.open { display: block; }
.spinner, .small-spinner { width: 48px; height: 48px; border: 4px solid #ffffff55; border-left-color: #fff; border-radius: 50%; animation: spin 1s linear infinite; }
.small-spinner { display: none; margin: 24px auto; border-color: #dce3d5; border-left-color: var(--green); width: 32px; height: 32px; }
.small-spinner.open { display: block; }
#dbg-panel { position: absolute; top: 64px; right: 12px; display: none; gap: 5px; z-index: 50; }
#dbg-panel.open { display: flex; }
#dbg-panel button { padding: 8px 12px; background: var(--paper); color: var(--ink); border: 1px solid var(--line); border-radius: 6px; font-size: 12px; min-height: 36px; }
#dbg-panel button.on { background: #dce8d7; }
.photo-editor { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 200; background: #1a1a1a; touch-action: none; }
.photo-editor canvas { display: block; width: 100%; height: 100%; }
@media (max-width: 600px) { #start, #start.wide { width: 350px; padding: 24px 18px; } #start-title { font-size: 27px; } #start-summary { font-size: 12px; margin-bottom: 20px; } .start-btn { width: 50px; height: 66px; } #start-bar .bar-center { gap: 5px; } .start-label { font-size: 10px; } .bar-left { padding-left: 4px; } .bar-right { padding-right: 4px; } #clock { min-width: 72px; padding: 0 6px; font-size: 15px; } .text-btn { padding: 0 5px; } .help-sub { padding: 20px; } }
@media (max-height: 500px) { #start, #start.wide { padding: 16px 24px; } .start-eyebrow { display: none; } #start-title { font-size: 24px; } #start-summary { margin-bottom: 12px; } #start-bar { gap: 12px; } .start-btn { height: 54px; gap: 2px; } #help-panel { height: calc(100% - 32px); max-height: calc(100% - 32px); } }
@media (prefers-reduced-motion: reduce) { .slide-panel, #tooltip { transition: none; } .spinner, .small-spinner { animation-duration: 2s; } }

@media (max-width: 600px) { #start-bar .bar-center { display: grid; width: 100%; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; } #start:not(.wide) #start-bar .bar-center { grid-template-columns: repeat(4, minmax(0, 1fr)); } .start-btn { width: 100%; min-width: 0; } }
