*,*:before,*:after{margin:0;padding:0;box-sizing:border-box}:root{--board-size: min(80vh, 80vw, 560px);--square-size: calc(var(--board-size) / 8);--light-square: #f0d9b5;--dark-square: #b58863;--selected-light: #f7ec5d;--selected-dark: #dbc934;--last-move-light: #cdd26a;--last-move-dark: #aaa23a;--check-color: #ff4444;--move-dot: rgba(0, 0, 0, .25);--capture-ring: rgba(0, 0, 0, .25);--bg-color: #312e2b;--panel-bg: #272522;--panel-border: #3d3a37;--text-color: #bbb;--text-bright: #fff;--accent: #81b64c}html,body{height:100%;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif;background:var(--bg-color);color:var(--text-color);overflow:hidden}#app{display:flex;flex-direction:column;height:100vh}header{display:flex;align-items:center;justify-content:center;padding:8px 16px;background:var(--panel-bg);border-bottom:1px solid var(--panel-border)}header h1{font-size:20px;font-weight:700;color:var(--text-bright);letter-spacing:1px}main{flex:1;display:flex;align-items:center;justify-content:center;padding:12px;overflow:hidden}#game-container{display:flex;align-items:flex-start;gap:12px;max-height:100%}#game-info-panel{display:flex;flex-direction:column;align-items:center;justify-content:space-between;height:var(--board-size);width:140px;background:var(--panel-bg);border:1px solid var(--panel-border);border-radius:4px;padding:8px}.captured-pieces{display:flex;flex-wrap:wrap;gap:1px;min-height:30px;width:100%;align-content:flex-start}.captured-pieces svg{width:22px;height:22px}#game-status{text-align:center;font-size:13px;font-weight:600;color:var(--text-bright);padding:8px 4px}#board-container{position:relative;flex-shrink:0}#board{display:grid;grid-template-columns:repeat(8,var(--square-size));grid-template-rows:repeat(8,var(--square-size));border:2px solid var(--panel-border);border-radius:2px;overflow:hidden;user-select:none;-webkit-user-select:none}.square{position:relative;width:var(--square-size);height:var(--square-size);display:flex;align-items:center;justify-content:center;cursor:pointer}.square.light{background:var(--light-square)}.square.dark{background:var(--dark-square)}.square .file-label,.square .rank-label{position:absolute;font-size:10px;font-weight:700;pointer-events:none;-webkit-user-select:none;user-select:none}.square .file-label{bottom:1px;right:3px}.square .rank-label{top:1px;left:3px}.square.light .file-label,.square.light .rank-label{color:var(--dark-square)}.square.dark .file-label,.square.dark .rank-label{color:var(--light-square)}.square.selected.light{background:var(--selected-light)}.square.selected.dark{background:var(--selected-dark)}.square.last-move.light{background:var(--last-move-light)}.square.last-move.dark{background:var(--last-move-dark)}.square.check{background:radial-gradient(ellipse at center,var(--check-color) 0%,var(--check-color) 25%,transparent 90%)}.move-dot{position:absolute;width:28%;height:28%;border-radius:50%;background:var(--move-dot);pointer-events:none;z-index:2}.capture-ring{position:absolute;width:100%;height:100%;border-radius:50%;border:none;pointer-events:none;z-index:2;background:radial-gradient(transparent 52%,var(--capture-ring) 52%,var(--capture-ring) 100%)}.piece{width:85%;height:85%;z-index:1;pointer-events:none;transition:none}#side-panel{display:flex;flex-direction:column;gap:8px;height:var(--board-size);width:200px}#controls{background:var(--panel-bg);border:1px solid var(--panel-border);border-radius:4px;padding:10px;display:flex;flex-direction:column;gap:8px}#controls .btn-row{display:flex;gap:6px}#controls button{flex:1;padding:7px 10px;background:#444;color:var(--text-bright);border:none;border-radius:3px;font-size:12px;font-weight:600;cursor:pointer;transition:background .15s}#controls button:hover{background:#555}#controls button:active{background:#333}#controls button.primary{background:var(--accent);color:#fff}#controls button.primary:hover{background:#6fa33d}#controls .mode-select,#controls .depth-control{display:flex;align-items:center;gap:6px;font-size:12px}#controls .mode-select select{flex:1;padding:4px 6px;background:#444;color:var(--text-bright);border:1px solid var(--panel-border);border-radius:3px;font-size:12px}#controls .depth-control input[type=range]{flex:1;accent-color:var(--accent)}#controls .depth-control .depth-value{width:16px;text-align:center;font-weight:600;color:var(--text-bright)}#move-history{flex:1;background:var(--panel-bg);border:1px solid var(--panel-border);border-radius:4px;padding:8px;overflow-y:auto;font-family:Courier New,monospace;font-size:12px}#move-history .history-header{font-size:12px;font-weight:700;color:var(--text-bright);margin-bottom:6px;padding-bottom:4px;border-bottom:1px solid var(--panel-border)}.move-row{display:flex;align-items:center;padding:1px 0}.move-number{width:28px;color:#777;text-align:right;padding-right:4px;flex-shrink:0}.move-san{flex:1;padding:2px 4px;border-radius:2px;cursor:default;color:var(--text-color)}.move-san.white-move{margin-right:2px}.move-san.current{background:#ffffff1a;color:var(--text-bright);font-weight:600}#promotion-dialog{position:fixed;top:0;left:0;width:100vw;height:100vh;background:#0009;display:flex;align-items:center;justify-content:center;z-index:100}#promotion-dialog.hidden{display:none}.promotion-choices{display:flex;gap:4px;background:var(--panel-bg);border:2px solid var(--panel-border);border-radius:6px;padding:8px;box-shadow:0 8px 32px #00000080}.promotion-choice{width:64px;height:64px;display:flex;align-items:center;justify-content:center;cursor:pointer;border-radius:4px;border:2px solid transparent;transition:background .15s,border-color .15s}.promotion-choice:hover{background:#ffffff1a;border-color:var(--accent)}.promotion-choice svg{width:52px;height:52px}.thinking-indicator{display:flex;align-items:center;gap:6px;font-size:12px;color:var(--accent);font-weight:600;padding:4px 0}.thinking-spinner{width:14px;height:14px;border:2px solid var(--panel-border);border-top-color:var(--accent);border-radius:50%;animation:spin .8s linear infinite}@keyframes spin{to{transform:rotate(360deg)}}#move-history::-webkit-scrollbar{width:6px}#move-history::-webkit-scrollbar-track{background:transparent}#move-history::-webkit-scrollbar-thumb{background:#555;border-radius:3px}@media(max-width:900px){#game-container{flex-direction:column;align-items:center}#game-info-panel{flex-direction:row;width:var(--board-size);height:auto;padding:6px 8px}.captured-pieces{min-height:22px}#side-panel{width:var(--board-size);height:200px;flex-direction:row}#controls,#move-history{width:50%}}@media(max-width:600px){:root{--board-size: 96vw}#game-info-panel{width:var(--board-size)}#side-panel{width:var(--board-size);flex-direction:column;height:auto}#controls{width:100%}#move-history{width:100%;max-height:150px}}
