/* 관리자페이지에서 보기 */
#admin { height:100vh; min-height:0; padding:0; overflow:hidden; }
#admin > .content { min-height:0; margin:0; overflow:hidden; }

/* 사용자페이지에서 보기 */
#pHelpButton, #jwTopBtn { display:none; }

body:has(#jw-chess) { overflow:hidden; }
main#sub03:has(#jw-chess) { background:transparent; }

/* ##### .three-scene */
.three-scene { --chess-ink:#f1e7d6; --chess-muted:#a69786; --chess-brass:#d9a568; --chess-line:rgba(214,183,137,.22); --chess-panel:rgba(19,15,12,.76); --chess-panel-w:252px; --chess-panel-right:24px; --chess-canvas-gap:24px; position:fixed; inset:0; z-index:95; height:100dvh; overflow:hidden; background:#0b0907; color:var(--chess-ink); isolation:isolate; }
.three-scene * { box-sizing:border-box; }
.three-scene [hidden] { display:none !important; }
.three-scene p, .three-scene dl, .three-scene dd, .three-scene dt { margin:0; }
.three-scene canvas { display:block; width:calc(100% - var(--chess-panel-w) - var(--chess-panel-right) - var(--chess-canvas-gap)); height:100%; touch-action:none; outline:none; }
.three-scene canvas:focus-visible { outline:2px solid var(--chess-brass); outline-offset:-4px; }
.three-scene .jw-button { --jwbutton-height:38px; --jwbutton-bg:rgba(18,14,11,.52); --jwbutton-color:var(--chess-ink); padding:0 14px; border:1px solid var(--chess-line); border-radius:4px; background:var(--jwbutton-bg); color:var(--jwbutton-color); font-size:12px; }
.three-scene .jw-button:hover { border-color:rgba(224,185,126,.55); background:rgba(48,37,27,.78); }
.three-scene .jw-button:focus-visible { outline:2px solid var(--chess-brass); outline-offset:3px; }
.three-scene .jw-button:active { transform:translateY(1px); }

.three-scene .chess-top { position:absolute; z-index:3; top:22px; right:24px; left:24px; display:flex; align-items:flex-start; justify-content:space-between; gap:16px; pointer-events:none; }
.three-scene .chess-brand { text-shadow:0 2px 14px rgba(0,0,0,.75); }
.three-scene .chess-brand > span { display:block; color:var(--chess-muted); font-size:12px; }
.three-scene .chess-brand > strong { display:block; margin-top:4px; color:var(--chess-ink); font-size:24px; font-weight:500; }
.three-scene .chess-brand em { color:var(--chess-brass); font-style:normal; font-weight:400; }
.three-scene .chess-tools { display:flex; gap:8px; pointer-events:auto; }

.three-scene .chess-panel { position:absolute; z-index:3; top:50%; right:24px; width:252px; padding:18px; transform:translateY(-50%); border:1px solid var(--chess-line); border-radius:6px; background:var(--chess-panel); -webkit-backdrop-filter:blur(16px); backdrop-filter:blur(16px); box-shadow:0 24px 60px rgba(0,0,0,.36); }
.three-scene .chess-label { display:block; color:var(--chess-muted); font-size:12px; }
.three-scene .chess-turn { padding-bottom:16px; border-bottom:1px solid var(--chess-line); }
.three-scene .chess-turn strong { display:flex; align-items:baseline; gap:8px; margin-top:6px; font-size:24px; font-weight:500; }
.three-scene .chess-turn strong i { color:var(--chess-brass); font-size:24px; font-style:normal; }
.three-scene .chess-turn[data-turn="b"] strong i { color:#c4b39a; }
.three-scene .chess-turn p { display:flex; align-items:center; gap:6px; margin-top:8px; color:var(--chess-muted); font-size:12px; }
.three-scene .chess-turn p::before { content:""; width:5px; height:5px; flex:none; border-radius:50%; background:var(--chess-brass); opacity:.5; }
.three-scene.is-thinking .chess-turn p::before { opacity:1; animation:chess-pulse 1.1s ease-in-out infinite; }
.three-scene.is-over .chess-turn p::before { background:#e07862; opacity:1; }
.three-scene .chess-facts { display:grid; grid-template-columns:1fr 1fr; gap:10px; padding:14px 0; border-bottom:1px solid var(--chess-line); }
.three-scene .chess-facts dt { color:var(--chess-muted); font-size:12px; }
.three-scene .chess-facts dd { margin-top:4px; font-size:14px; font-variant-numeric:tabular-nums; }
.three-scene .chess-captured { display:grid; gap:8px; padding:14px 0; border-bottom:1px solid var(--chess-line); }
.three-scene .chess-captured > div { display:flex; align-items:baseline; justify-content:space-between; gap:10px; }
.three-scene .chess-captured span { flex:none; color:var(--chess-muted); font-size:12px; }
.three-scene .chess-captured p { color:#d8c7b0; font-size:18px; text-align:right; word-break:break-all; }
.three-scene .chess-log-wrap { padding:14px 0; border-bottom:1px solid var(--chess-line); }
.three-scene .chess-log { display:grid; gap:4px; max-height:168px; margin-top:10px; overflow-y:auto; scrollbar-color:rgba(217,165,104,.35) transparent; scrollbar-width:thin; }
.three-scene .chess-log p { display:grid; grid-template-columns:28px 1fr 1fr; gap:6px; color:var(--chess-muted); font-size:12px; font-variant-numeric:tabular-nums; }
.three-scene .chess-log .chess-log-empty { display:block; grid-column:1 / -1; color:var(--chess-muted); }
.three-scene .chess-log b { color:var(--chess-ink); font-weight:400; }
.three-scene .chess-log b.is-black { color:#c7b29a; }
.three-scene .chess-log::-webkit-scrollbar { width:4px; }
.three-scene .chess-log::-webkit-scrollbar-thumb { border-radius:2px; background:rgba(217,165,104,.35); }
.three-scene .chess-actions { display:grid; grid-template-columns:1fr 1fr; gap:6px; padding-top:14px; }
.three-scene .chess-actions .jw-button { --jwbutton-height:40px; padding:0 8px; }
.three-scene #btn-reset { --jwbutton-bg:var(--chess-brass); --jwbutton-color:#1b120a; border-color:var(--chess-brass); font-weight:600; }
.three-scene #btn-reset:hover { background:#e8bb82; border-color:#e8bb82; }
.three-scene .chess-hint { position:absolute; z-index:2; bottom:20px; left:24px; color:rgba(241,231,214,.55); font-size:12px; pointer-events:none; text-shadow:0 1px 8px #000; }

.three-scene .chess-loading { position:absolute; z-index:5; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:14px; background:radial-gradient(circle at 50% 42%,#2a1f17 0,#120e0b 46%,#080706 100%); text-align:center; }
.three-scene .chess-loading-mark { color:var(--chess-brass); font-size:24px; }
.three-scene .chess-loading strong { color:var(--chess-ink); font-size:18px; font-weight:500; }
.three-scene .chess-loading p { max-width:360px; padding:0 24px; color:var(--chess-muted); font-size:12px; }
.three-scene .chess-loading-bar { width:180px; height:2px; margin-top:6px; overflow:hidden; background:rgba(217,165,104,.16); }
.three-scene .chess-loading-bar::after { content:""; display:block; width:40%; height:100%; background:var(--chess-brass); animation:chess-loading 1.2s ease-in-out infinite; }
.three-scene .chess-noscript { position:absolute; z-index:6; inset:0; display:grid; place-items:center; padding:24px; background:#0b0907; color:var(--chess-ink); font-size:14px; text-align:center; }

@keyframes chess-pulse {
	50% { opacity:.25; }
}
@keyframes chess-loading {
	0% { transform:translateX(-110%); }
	100% { transform:translateX(360%); }
}

@media (max-width:1100px) {
	.three-scene { --chess-panel-w:232px; --chess-panel-right:16px; }
	.three-scene .chess-panel { right:16px; width:232px; padding:16px; }
	.three-scene .chess-log { max-height:132px; }
}
@media (max-width:860px) {
	.three-scene { --chess-panel-w:0px; --chess-panel-right:0px; --chess-canvas-gap:0px; }
	.three-scene canvas { width:100%; }
	.three-scene .chess-top { top:16px; right:16px; left:16px; }
	.three-scene .chess-brand > span { display:none; }
	.three-scene .chess-brand > strong { font-size:18px; }
	.three-scene .chess-panel { top:auto; right:12px; bottom:12px; left:12px; display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; gap:10px 14px; width:auto; padding:12px; transform:none; }
	.three-scene .chess-turn { padding-bottom:0; border-bottom:0; }
	.three-scene .chess-turn .chess-label { display:none; }
	.three-scene .chess-turn strong { margin-top:0; font-size:18px; }
	.three-scene .chess-turn strong i { font-size:18px; }
	.three-scene .chess-facts, .three-scene .chess-captured, .three-scene .chess-log-wrap { display:none; }
	.three-scene .chess-actions { display:flex; gap:6px; padding-top:0; }
	.three-scene .chess-actions .jw-button { --jwbutton-height:36px; }
	.three-scene .chess-hint { display:none; }
}
@media (max-width:420px) {
	.three-scene .chess-panel { gap:8px; padding:10px; }
	.three-scene .chess-turn p { margin-top:4px; }
	.three-scene .chess-actions .jw-button { padding:0 7px; }
}
@media (max-width:360px) {
	.three-scene .chess-brand > strong { font-size:14px; }
	.three-scene .chess-tools .jw-button { padding:0 8px; }
}
@media (max-height:520px) and (min-width:600px) {
	.three-scene { --chess-panel-w:220px; --chess-panel-right:12px; --chess-canvas-gap:12px; }
	.three-scene .chess-panel { top:50%; right:12px; bottom:auto; left:auto; display:block; width:220px; transform:translateY(-50%); }
	.three-scene .chess-facts, .three-scene .chess-captured, .three-scene .chess-log-wrap, .three-scene .chess-hint { display:none; }
	.three-scene .chess-actions { padding-top:12px; }
}
@media (min-width:600px) and (max-width:860px) and (max-height:520px) {
	.three-scene canvas { width:calc(100% - var(--chess-panel-w) - var(--chess-panel-right) - var(--chess-canvas-gap)); }
}
@media (prefers-reduced-motion:reduce) {
	.three-scene .jw-button, .three-scene .chess-loading-bar::after, .three-scene.is-thinking .chess-turn p::before { transition:none; animation:none; }
}
