:root { --bg-color: #ffffff; --text-color: #1e293b; --btn-bg: #e2e8f0; --btn-hover: #cbd5e1; --primary: #3b82f6; --light-square: #f0d9b5; --dark-square: #b58863; --highlight: rgba(255, 255, 51, 0.5); --board-bg: #f8fafc; --cell-border: #cbd5e1; }
body.dark-mode { --bg-color: #0f172a; --text-color: #f8fafc; --btn-bg: #334155; --btn-hover: #475569; --light-square: #c0c0c0; --dark-square: #5c626b; --board-bg: #1e293b; --cell-border: #334155; }
* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }
body { background-color: var(--bg-color); color: var(--text-color); transition: background-color 0.3s, color 0.3s; display: flex; flex-direction: column; min-height: 100vh; }
.top-bar { display: flex; justify-content: space-between; align-items: center; padding: max(20px, env(safe-area-inset-top)) 20px 20px 20px; width: 100%; }
.icon-btn { background: none; border: none; font-size: 1.5rem; color: var(--text-color); cursor: pointer; transition: 0.2s; padding: 10px; display: flex; align-items: center; justify-content: center; text-decoration: none; }
.icon-btn:hover { color: var(--primary); transform: scale(1.1); }
.lang-btn { font-size: 1rem; font-weight: bold; border: 2px solid var(--text-color); border-radius: 50%; width: 38px; height: 38px; padding: 0; }
.lang-btn:hover { border-color: var(--primary); }
.right-icons { display: flex; gap: 15px; align-items: center; }
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.7); display: none; justify-content: center; align-items: center; z-index: 2000; padding: 20px; }
.modal-overlay.open { display: flex; }
.modal-content { background-color: var(--board-bg); color: var(--text-color); padding: 30px; border-radius: 12px; width: 100%; max-width: 500px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); border: 2px solid var(--cell-border); }
.modal-content h2 { margin-bottom: 20px; color: var(--primary); text-align: center; font-size: 1.8rem; }
.modal-content p { white-space: pre-line; text-align: left; line-height: 1.6; margin-bottom: 25px; font-size: 1rem; }
.close-btn { background-color: var(--primary); color: white; border: none; padding: 12px; font-size: 1.1rem; font-weight: bold; border-radius: 8px; cursor: pointer; width: 100%; transition: 0.2s; }
.close-btn:hover { filter: brightness(1.1); }
.fb-input { width: 100%; padding: 12px; margin-bottom: 15px; border-radius: 8px; border: 1px solid var(--cell-border); background-color: var(--bg-color); color: var(--text-color); font-family: inherit; font-size: 1rem; }
.fb-file-label { display: block; margin-bottom: 5px; font-size: 0.9rem; color: var(--text-color); }
.fb-input-file { margin-bottom: 20px; width: 100%; color: var(--text-color); }
.primary-btn { background-color: #22c55e; color: white; border: none; padding: 12px; font-size: 1.1rem; font-weight: bold; border-radius: 8px; cursor: pointer; width: 100%; transition: 0.2s; }
.primary-btn:hover { background-color: #16a34a; }
.mt-2 { margin-top: 10px; }
.status-msg { text-align: center; margin-top: 10px; font-weight: bold; }
.menu-divider { border: 1px solid var(--cell-border); margin: 15px 0; opacity: 0.5; }
.container { display: flex; flex-direction: column; align-items: center; justify-content: center; flex-grow: 1; padding: 20px; }
h1 { margin-bottom: 20px; font-size: 2.5rem; display: flex; align-items: center; gap: 10px; }
.diff-selector { display: flex; background-color: var(--btn-bg); border-radius: 8px; overflow: hidden; margin-bottom: 20px; box-shadow: 0 4px 6px rgba(0,0,0,0.1); width: 100%; max-width: 320px; }
.diff-btn { flex: 1; padding: 10px 15px; border: none; background: transparent; color: var(--text-color); font-weight: bold; cursor: pointer; transition: 0.3s; font-size: 1rem; }
.diff-btn:hover { background-color: var(--btn-hover); }
.diff-btn.active[data-diff="easy"] { background-color: #22c55e; color: white; }
.diff-btn.active[data-diff="medium"] { background-color: #eab308; color: white; }
.diff-btn.active[data-diff="hard"] { background-color: #ef4444; color: white; }
.timer-box { font-family: 'Orbitron', 'Courier New', monospace; font-variant-numeric: tabular-nums; font-size: 1.8rem; font-weight: bold; background-color: var(--cell-border); color: var(--text-color); padding: 6px 0; border-radius: 8px; margin: 0 auto 20px auto; width: 140px; display: flex; justify-content: center; align-items: center; text-align: center; box-shadow: inset 0 2px 4px rgba(0,0,0,0.15); }
.blink-yellow { animation: flashYellow 2s 3; }
.blink-red-fast { animation: flashRed 1s infinite; }
.flash-red-once { animation: flashRed 1s 1; }
.rapid-blink { animation: flashRed 0.2s 5; }
.timeout-red { background-color: #9B111E !important; color: white !important; }
.timeout-green { background-color: #22c55e !important; color: white !important; }
@keyframes flashYellow { 0%, 100% { background-color: var(--cell-border); color: var(--text-color); } 50% { background-color: #eab308; color: white; } }
@keyframes flashRed { 0%, 100% { background-color: var(--cell-border); color: var(--text-color); } 50% { background-color: #9B111E; color: white; } }
@keyframes softKingPulse { 0%, 100% { box-shadow: inset 0 0 15px rgba(155, 17, 30, 0.4); background-color: rgba(155, 17, 30, 0.25); } 50% { box-shadow: inset 0 0 5px rgba(155, 17, 30, 0.1); background-color: transparent; } }
.square.king-pulse { animation: softKingPulse 1.5s infinite ease-in-out; }
.board-container { margin-bottom: 20px; border: 4px solid var(--text-color); border-radius: 4px; box-shadow: 0 10px 20px rgba(0,0,0,0.2); background-color: var(--cell-border); }
.chessboard { display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr); width: min(90vw, 360px); height: min(90vw, 360px); }
.square { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: min(2.2rem, 8vw); line-height: 1; cursor: pointer; user-select: none; position: relative; overflow: hidden; }
.square.light { background-color: var(--light-square); color: #000; }
.square.dark { background-color: var(--dark-square); color: #000; }
.square.selected { background-color: var(--highlight) !important; }
.status-area { text-align: center; }
#status { margin-bottom: 15px; font-size: 1.5rem; height: 30px; transition: 0.3s; }
.status-green { text-decoration: underline; text-decoration-color: #22c55e; text-decoration-thickness: 4px; }
.status-red { text-decoration: underline; text-decoration-color: #9B111E; text-decoration-thickness: 4px; }
.status-gray { text-decoration: underline; text-decoration-color: #94a3b8; text-decoration-thickness: 4px; }
#restart { padding: 12px 24px; font-size: 1.1rem; font-weight: bold; background-color: var(--primary); color: white; border: none; border-radius: 8px; cursor: pointer; transition: 0.2s; }
#restart:hover { background-color: #2563eb; transform: translateY(-2px); }
.ad-container { margin-top: 40px; display: flex; justify-content: center; align-items: center; width: 100%; min-height: 90px; overflow: hidden; }
.side-menu { position: fixed; top: 0; left: -250px; width: 250px; height: 100%; background-color: var(--board-bg); box-shadow: 2px 0 10px rgba(0,0,0,0.2); transition: 0.3s; z-index: 1000; padding: 20px; display: flex; flex-direction: column; justify-content: space-between; }
.side-menu.open { left: 0; }
.side-menu h2 { margin-bottom: 30px; color: var(--primary); border-bottom: 2px solid var(--cell-border); padding-bottom: 10px; font-size: 1.5rem;}
.side-menu ul { list-style: none; }
.side-menu li { margin-bottom: 15px; }
.side-menu a, .menu-bottom a { text-decoration: none; color: var(--text-color); font-size: 1.1rem; display: flex; align-items: center; gap: 10px; }
.side-menu a.active { color: var(--primary); font-weight: bold; }
.menu-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); display: none; z-index: 999; }
.menu-overlay.open { display: block; }

.menu-category { font-size: 0.85rem; font-weight: bold; color: var(--primary); opacity: 0.7; margin-bottom: 8px; letter-spacing: 1px; pointer-events: none; }
.mt-3 { margin-top: 25px; }