/* ============================================================
   chess.css - ШАХМАТЫ С ДРАКОНАМИ
   Версия: 5.6 - FINAL SYNCED VERSION
   ============================================================ */

* {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    background: #1a1a1a;
    min-height: 100vh;
}

.game-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 100vh;
    padding: 16px;
    background: #1a1a1a;
    transition: padding 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.game-container {
    background: #2a2a2a;
    padding: 16px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.7);
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    max-width: 100%;
    margin: 0 auto;
    position: relative;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.board-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.board-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 10px;
    gap: 10px;
    flex-wrap: wrap;
    padding: 0 2px;
}

.board-controls .game-title {
    color: #eee;
    font-weight: 300;
    letter-spacing: 2px;
    font-size: 18px;
    margin: 0;
    flex: 1;
    white-space: nowrap;
}

.board-controls .btn-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-fullscreen, .btn-reset {
    padding: 6px 14px;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    display: flex;
    align-items: center;
    gap: 4px;
    touch-action: manipulation;
}

.btn-fullscreen { background: #2a4a6a; font-size: 16px; }
.btn-fullscreen:hover { background: #3a6a8a; }
.btn-fullscreen.fullscreen-active { background: #6a2a2a; }
.btn-reset { background: #4a3728; font-size: 12px; }
.btn-reset:hover { background: #5c4a3a; }

.table-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    overflow: auto;
}

table {
    border-collapse: collapse;
    border: 3px solid #4a3728;
    table-layout: fixed;
    margin: 0 auto;
}

td {
    width: 46px;
    height: 46px;
    text-align: center;
    vertical-align: middle;
    border: 1px solid #3a3a3a;
    position: relative;
    cursor: pointer;
    font-size: 28px;
    line-height: 46px;
    transition: background 0.1s ease, transform 0.05s;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

td:active { transform: scale(0.94); }

td span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* Cell Colors */
.light { background: #f0d9b5 !important; }
.dark { background: #b58863 !important; }
.hidden { background: #1a1a1a !important; border: 1px solid #2a2a2a; cursor: default; }
.hidden span { color: #444; font-size: 14px !important; }
.revealed { background: #4a7a4a !important; border: 2px solid #7aff7a !important; }
.revealed.light { background: #5a8a5a !important; }
.revealed.dark { background: #3a6a3a !important; }

td.coord {
    background: #2c2c2c !important;
    color: #aaa;
    cursor: default;
    width: 18px;
    font-size: 10px;
    pointer-events: none;
}
td.coord-left { text-align: right; padding-right: 3px; width: 16px; }
td.coord-right { text-align: left; padding-left: 3px; width: 16px; }
td.coord-top, td.coord-bottom { height: 18px; font-size: 9px; width: 46px; }

/* Highlights */
.selected { background: #ffd700 !important; box-shadow: inset 0 0 15px rgba(255,215,0,0.5); }
.legal-move::after { content: "●"; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 12px; color: rgba(0,255,0,0.6); }
.legal-capture { background: rgba(255,0,0,0.25) !important; }
.legal-reveal { background: rgba(0,255,0,0.25) !important; }
.check-king { background: rgba(255,0,0,0.45) !important; }

/* Pieces */
.piece-white { color: #fff !important; text-shadow: 0 0 3px #000; }
.piece-black { color: #000 !important; text-shadow: 0 0 3px #fff; }
.dragon-white { color: #fff !important; text-shadow: 0 0 5px #ffd700, 0 0 3px #000; }
.dragon-black { color: #000 !important; text-shadow: 0 0 5px #ff4500, 0 0 3px #fff; }

/* Notifications */
.chess-notification {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 20px;
    border-radius: 12px;
    z-index: 10000;
    text-align: center;
    backdrop-filter: blur(8px);
    animation: chessFadeDown 0.3s ease;
    pointer-events: none;
}
@keyframes chessFadeDown { from { opacity: 0; transform: translateX(-50%) translateY(-20px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

.move-history {
    max-height: 120px;
    overflow-y: auto;
    font-family: monospace;
    margin-top: 10px;
    padding: 6px;
    background: #1a1a1a;
    border-radius: 4px;
    width: 100%;
    max-width: 500px;
    font-size: 10px;
}
.move-history div { padding: 2px 0; border-bottom: 1px solid #333; color: #aaa; }
.move-history .checkmate { color: #ffd700; font-weight: bold; }
.move-history .stalemate { color: #ff6b6b; font-weight: bold; }
.move-history .check { color: #ff6b6b; font-weight: bold; }

/* Fullscreen Mode */
.fullscreen-mode .game-wrapper {
    position: fixed !important;
    top: 0; left: 0; width: 100vw; height: 100vh;
    padding: 12px !important;
    z-index: 9999 !important;
    background: #0a0a0a !important;
}
.fullscreen-mode .game-container {
    border-radius: 0 !important;
    background: #1a1a1a !important;
    width: 100% !important; height: 100% !important;
}
.fullscreen-mode td { width: 54px; height: 54px; font-size: 34px; line-height: 54px; }
.fullscreen-mode td.coord { height: 54px; width: 20px; }
.fullscreen-mode td.coord-top, .fullscreen-mode td.coord-bottom { height: 22px; width: 54px; }

@media (max-width: 768px) {
    td { width: 34px; height: 34px; font-size: 20px; line-height: 34px; }
    td.coord { height: 34px; width: 12px; }
    td.coord-top, td.coord-bottom { height: 14px; width: 34px; }
}

@media (max-width: 480px) {
    td { width: 28px; height: 28px; font-size: 17px; line-height: 28px; }
    td.coord { height: 28px; width: 10px; }
    td.coord-top, td.coord-bottom { height: 12px; width: 28px; }
}
