:root{--bg:#1a1a2e;--bg-surface:#16213e;--bg-card:#1e2a47;--text:#e0e0e0;--text-muted:#8892a4;--accent:#4fc3f7;--success:#66bb6a;--error:#ef5350;--warning:#ffa726;--board-light:#f0d9b5;--board-dark:#b58863;--highlight:#4caf5080;--selected:#ffeb3b80;--mistake-color:#ef5350b3;--last-move:#ff03;--border:#2a3a5c}*{box-sizing:border-box;margin:0;padding:0}body{background:var(--bg);color:var(--text);min-height:100vh;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,sans-serif}#root{min-height:100vh}button{cursor:pointer;font-family:inherit;font-size:inherit;border:none}h1,h2,h3{font-weight:600}.app{flex-direction:column;min-height:100vh;display:flex}.app-header{background:var(--bg-surface);border-bottom:1px solid var(--border);justify-content:space-between;align-items:center;padding:10px 16px;display:flex}.header-logo{vertical-align:middle;width:24px;height:24px;margin-right:8px}.app-header h1{color:var(--accent);align-items:center;font-size:1.1rem;display:flex}.header-actions{gap:4px;display:flex}.icon-btn{color:var(--text-muted);background:0 0;border-radius:6px;align-items:center;padding:6px;transition:color .2s,background .2s;display:flex}.icon-btn:hover{color:var(--text);background:#ffffff14}.game-layout{flex:1;justify-content:center;padding:16px;display:flex}.board-section{flex-direction:column;align-items:center;gap:10px;display:flex}.status-bar{background:var(--bg-card);color:var(--text-muted);text-align:center;border-radius:8px;justify-content:center;align-items:center;width:100%;max-width:504px;min-height:32px;padding:6px 12px;font-size:.85rem;transition:background .3s,color .3s;display:flex}.status-error{color:var(--error);background:#ef535026}.status-success{color:var(--success);background:#66bb6a26}.board-container{-webkit-user-select:none;user-select:none;flex-direction:column;display:flex}.board-with-coords{display:flex}.rank-labels{flex-direction:column;justify-content:space-around;padding-right:4px;display:flex}.file-labels{padding-top:4px;display:flex}.rank-spacer{width:20px}.coord-label{color:var(--text-muted);justify-content:center;align-items:center;font-size:.75rem;display:flex}.rank-label{width:16px;height:60px}.file-label{width:60px;height:16px}.board-grid{border:2px solid var(--border);border-radius:4px;grid-template-rows:repeat(8,60px);grid-template-columns:repeat(8,60px);display:grid;overflow:hidden}.square{cursor:pointer;justify-content:center;align-items:center;width:60px;height:60px;transition:background-color .15s;display:flex;position:relative}.square.light{background-color:var(--board-light)}.square.dark{background-color:var(--board-dark)}.square.selected{background-color:var(--selected)!important}.square.light.last-move{background-color:#f5f5a0}.square.dark.last-move{background-color:#d8d560}.square.opening-hint:after{content:"";background:var(--highlight);pointer-events:none;z-index:1;position:absolute;inset:0}.square-tier{z-index:2;pointer-events:none;border-radius:3px;padding:1px 3px;font-size:.7rem;font-weight:700;line-height:1;position:absolute;top:2px;right:2px}.square-tier.tier-S{color:#2e7d32;background:#4caf5040}.square-tier.tier-A{color:#00796b;background:#26a69a40}.square-tier.tier-B{color:#1565c0;background:#42a5f540}.square-tier.tier-C{color:#5e35b1;background:#7e57c240}.square.mistake{animation:.4s ease-in-out 3 mistake-flash}.square.correct-hint:after{content:"";background:var(--highlight);pointer-events:none;z-index:1;animation:.6s ease-in-out infinite alternate pulse-hint;position:absolute;inset:0}@keyframes pulse-hint{0%{opacity:.5}to{opacity:1}}@keyframes mistake-flash{0%,to{background-color:inherit}50%{background-color:var(--mistake-color)}}.chess-piece{pointer-events:none;object-fit:contain;width:90%;height:90%}.legal-dot{z-index:2;background:#0003;border-radius:50%;width:16px;height:16px}.legal-capture{z-index:2;pointer-events:none;border:4px solid #0003;border-radius:50%;position:absolute;inset:0}.drawer-overlay{z-index:50;opacity:0;pointer-events:none;background:#00000080;transition:opacity .25s;position:fixed;inset:0}.drawer-overlay.open{opacity:1;pointer-events:auto}.drawer{background:var(--bg-surface);border-left:1px solid var(--border);z-index:60;flex-direction:column;width:340px;max-width:85vw;transition:transform .25s;display:flex;position:fixed;top:0;bottom:0;right:0;transform:translate(100%)}.drawer.open{transform:translate(0)}.drawer-header{border-bottom:1px solid var(--border);justify-content:space-between;align-items:center;padding:14px 16px;display:flex}.drawer-header h2{font-size:1.1rem}.progress-panel{flex-direction:column;flex:1;gap:10px;padding:0 16px 12px;display:flex;overflow:hidden}.panel-tabs{border-bottom:1px solid var(--border);gap:0;display:flex}.panel-tab{color:var(--text-muted);background:0 0;border-bottom:2px solid #0000;flex:1;justify-content:center;align-items:center;gap:6px;padding:10px 8px;font-size:.85rem;font-weight:500;transition:color .2s,border-color .2s;display:flex}.panel-tab:hover{color:var(--text)}.panel-tab.active{color:var(--text);border-bottom-color:var(--accent)}.tab-dot{border:1px solid var(--text-muted);border-radius:50%;width:10px;height:10px;display:inline-block}.tab-dot.white-dot{background:#fff}.tab-dot.black-dot{background:#1a1a1a}.tab-current{color:var(--accent);margin-left:2px;font-size:.65rem}.mastery-summary{color:var(--accent);font-size:.85rem;font-weight:500}.completed-banner{color:var(--success);text-align:center;background:#66bb6a26;border-radius:8px;padding:8px 12px;font-size:.85rem;font-weight:500;animation:.3s fade-in}@keyframes fade-in{0%{opacity:0;transform:translateY(-8px)}to{opacity:1;transform:translateY(0)}}.opening-list{flex-direction:column;flex:1;gap:4px;padding-right:4px;display:flex;overflow-y:auto}.opening-list::-webkit-scrollbar{width:6px}.opening-list::-webkit-scrollbar-track{background:0 0}.opening-list::-webkit-scrollbar-thumb{background:var(--border);border-radius:3px}.tier-group{flex-direction:column;gap:3px;display:flex}.tier-header{color:var(--text);cursor:pointer;background:0 0;border-radius:6px;justify-content:space-between;align-items:center;padding:6px 10px;font-size:.8rem;transition:background .15s;display:flex}.tier-header:hover{background:#ffffff0a}.tier-header-left{align-items:center;gap:6px;display:flex}.tier-label{color:var(--text-muted);font-weight:500}.tier-header-right{align-items:center;gap:6px;display:flex}.tier-count{color:var(--text-muted);font-size:.72rem}.tier-chevron{color:var(--text-muted);font-size:.7rem;transition:transform .2s}.tier-chevron.collapsed{transform:rotate(-90deg)}.opening-item{background:var(--bg-card);cursor:pointer;border:1px solid #0000;border-radius:8px;flex-direction:column;padding:8px 10px;transition:border-color .2s,background .2s;display:flex}.opening-row{justify-content:space-between;align-items:center;gap:8px;display:flex}.opening-detail{border-top:1px solid var(--border);margin-top:6px;padding-top:6px}.opening-moves{color:var(--text-muted);word-break:break-word;font-family:ui-monospace,Consolas,monospace;font-size:.78rem;line-height:1.5}.opening-item.active{border-color:var(--accent);background:#4fc3f714}.opening-item.mastered{border-color:var(--success);background:#66bb6a14}.opening-info{flex-direction:column;flex:1;gap:2px;min-width:0;display:flex}.opening-name{white-space:nowrap;text-overflow:ellipsis;align-items:center;gap:5px;font-size:.85rem;font-weight:500;display:flex;overflow:hidden}.tier-badge{border-radius:3px;flex-shrink:0;padding:1px 4px;font-size:.6rem;font-weight:700;line-height:1.2}.tier-S{color:#66bb6a;background:#4caf5040}.tier-A{color:#4db6ac;background:#26a69a40}.tier-B{color:#42a5f5;background:#42a5f540}.tier-C{color:#9575cd;background:#7e57c240}.opening-eco{color:var(--text-muted);font-size:.7rem}.opening-meta{flex-shrink:0;align-items:center;gap:8px;display:flex}.move-count{color:var(--text-muted);white-space:nowrap;font-size:.7rem}.score-bar{gap:3px;display:flex}.score-pip{background:var(--border);border-radius:50%;width:8px;height:8px;transition:background .3s}.score-pip.filled{background:var(--success)}.score-text{color:var(--text-muted);text-align:right;min-width:24px;font-size:.75rem}.game-actions{gap:12px;margin-top:8px;display:flex}.primary-btn{background:var(--accent);color:#000;border-radius:8px;padding:10px 24px;font-weight:600;transition:opacity .2s}.primary-btn:hover{opacity:.85}.secondary-btn{background:var(--bg-card);color:var(--text);border:1px solid var(--border);border-radius:8px;padding:10px 24px;transition:border-color .2s}.secondary-btn:hover{border-color:var(--text-muted)}.modal-overlay{z-index:100;background:#0009;justify-content:center;align-items:center;animation:.2s fade-in;display:flex;position:fixed;inset:0}.modal{background:var(--bg-surface);border:1px solid var(--border);border-radius:16px;flex-direction:column;width:90%;max-width:480px;max-height:80vh;display:flex}.modal-header{border-bottom:1px solid var(--border);justify-content:space-between;align-items:center;padding:16px 20px;display:flex}.modal-header h2{font-size:1.2rem}.close-btn{color:var(--text-muted);background:0 0;border-radius:4px;align-items:center;padding:4px;display:flex}.close-btn:hover{color:var(--text)}.modal-body{flex-direction:column;gap:24px;padding:20px;display:flex;overflow-y:auto}.settings-section h3{margin-bottom:8px;font-size:.95rem}.settings-desc{color:var(--text-muted);font-size:.85rem}.settings-phases{flex-direction:column;gap:6px;display:flex}.phase-row{color:var(--text-muted);align-items:center;gap:8px;font-size:.82rem;display:flex}.phase-badge{text-align:center;border-radius:4px;min-width:28px;padding:2px 6px;font-size:.7rem;font-weight:700}.phase-learn{color:#66bb6a;background:#4caf5033}.phase-practice{color:#4fc3f7;background:#4fc3f733}.phase-mastered{color:#ffd740;background:#ffd70033}.reset-list{flex-direction:column;gap:6px;max-height:240px;display:flex;overflow-y:auto}.reset-item{background:var(--bg-card);border-radius:6px;justify-content:space-between;align-items:center;gap:8px;padding:8px 10px;display:flex}.reset-info{flex-direction:column;flex:1;gap:2px;min-width:0;display:flex}.reset-name{white-space:nowrap;text-overflow:ellipsis;font-size:.82rem;font-weight:500;overflow:hidden}.reset-scores{color:var(--text-muted);align-items:center;gap:6px;font-size:.75rem;display:flex}.reset-color-dot{border:1px solid var(--text-muted);border-radius:50%;width:8px;height:8px;display:inline-block}.reset-color-dot.white-dot{background:#fff}.reset-color-dot.black-dot{background:#1a1a1a}.reset-actions{flex-shrink:0;gap:4px;display:flex}.reset-btn{color:var(--error);background:#ef535026;border-radius:4px;padding:3px 8px;font-size:.75rem;font-weight:600}.reset-btn:hover{background:#ef53504d}.danger-btn{color:var(--error);background:#ef535026;border-radius:8px;width:100%;padding:10px 20px;font-weight:500;transition:background .2s}.danger-btn:hover{background:#ef535040}.danger-btn.confirming{background:var(--error);color:#fff}@media (width<=520px){.board-grid{grid-template-rows:repeat(8,44px);grid-template-columns:repeat(8,44px)}.square{width:44px;height:44px}.rank-label{height:44px}.file-label{width:44px}.app-header h1{font-size:.95rem}}
