html, body {
    width: 100%;
    height: 100%;
    margin: 0;
    overflow: hidden;
    background: #080a0d;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #f2f2f2;
}

#game,
#game canvas {
    display: block;
    width: 100%;
    height: 100%;
}

#hud {
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 20;
    min-width: 220px;
    padding: 12px 14px;
    border: 1px solid rgba(255,255,255,.18);
    border-radius: 10px;
    background: rgba(8,10,13,.72);
    backdrop-filter: blur(7px);
    box-shadow: 0 8px 28px rgba(0,0,0,.3);
    pointer-events: none;
    line-height: 1.5;
}

.hud-title {
    font-weight: 800;
    letter-spacing: .08em;
    margin-bottom: 5px;
}

.hud-title span {
    font-weight: 500;
    opacity: .65;
    letter-spacing: normal;
}

#status {
    opacity: .82;
}

#selection {
    opacity: .82;
}

#help {
    position: fixed;
    right: 16px;
    top: 16px;
    z-index: 20;
    padding: 12px 14px;
    border: 1px solid rgba(255,255,255,.18);
    border-radius: 10px;
    background: rgba(8,10,13,.72);
    backdrop-filter: blur(7px);
    line-height: 1.55;
    pointer-events: none;
}

#help.hidden {
    display: none;
}

#crosshair {
    position: fixed;
    left: 50%;
    top: 50%;
    width: 24px;
    height: 24px;
    transform: translate(-50%, -50%);
    z-index: 25;
    pointer-events: none;
    opacity: .92;
}

#crosshair span {
    position: absolute;
    background: rgba(255,255,255,.9);
    box-shadow: 0 0 3px rgba(0,0,0,.8);
}

#crosshair span:first-child {
    left: 11px;
    top: 3px;
    width: 2px;
    height: 18px;
}

#crosshair span:last-child {
    left: 3px;
    top: 11px;
    width: 18px;
    height: 2px;
}

/* ============================================================
   CROSSHAIR TARGET FEEDBACK
   ============================================================ */

#crosshair span {
    transition:
        background-color 0.12s ease,
        box-shadow 0.12s ease,
        transform 0.12s ease;
}

/* Friendly selectable piece */
#crosshair.target-piece span {
    background: #ffdc61;
    box-shadow:
        0 0 4px #000,
        0 0 9px rgba(255, 220, 97, 0.9);
}

/* Legal empty destination */
#crosshair.target-move span {
    background: #4ee26b;
    box-shadow:
        0 0 4px #000,
        0 0 9px rgba(78, 226, 107, 0.95);
}

/* Legal capture */
#crosshair.target-capture span {
    background: #ff5f58;
    box-shadow:
        0 0 4px #000,
        0 0 10px rgba(255, 95, 88, 0.95);
}

/* Enemy / unavailable piece */
#crosshair.target-blocked span {
    background: #90959c;
    box-shadow:
        0 0 4px #000;
}

/* Slight enlargement when something useful is targeted */
#crosshair.target-piece,
#crosshair.target-move,
#crosshair.target-capture {
    transform: translate(-50%, -50%) scale(1.18);
}

#start-screen {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    background: radial-gradient(circle at center, rgba(35,40,47,.76), rgba(3,4,6,.94));
}

#start-screen.hidden {
    display: none;
}

.start-card {
    width: min(440px, calc(100vw - 48px));
    padding: 32px;
    box-sizing: border-box;
    text-align: center;
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 16px;
    background: rgba(10,12,16,.9);
    box-shadow: 0 24px 80px rgba(0,0,0,.45);
}

.start-card h1 {
    margin: 0 0 8px;
    font-size: 2rem;
}

.start-card p {
    opacity: .76;
    line-height: 1.55;
}

.start-card button {
    margin: 12px 0 15px;
    padding: 11px 22px;
    border: 0;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
}

.start-card small {
    display: block;
    opacity: .5;
}

/* ============================================================
   PAWN PROMOTION
   ============================================================ */

#promotion-screen {
    position: fixed;
    inset: 0;

    display: grid;
    place-items: center;

    z-index: 100;

    background:
        rgba(0, 0, 0, 0.62);

    backdrop-filter:
        blur(5px);
}

#promotion-screen.hidden {
    display: none;
}

.promotion-card {
    min-width: 340px;

    padding: 28px;

    text-align: center;

    border-radius: 14px;

    border:
        1px solid
        rgba(255, 255, 255, 0.18);

    background:
        rgba(10, 12, 16, 0.96);

    box-shadow:
        0 20px 70px
        rgba(0, 0, 0, 0.55);
}

.promotion-card h2 {
    margin:
        0 0 6px;
}

.promotion-card p {
    margin:
        0 0 20px;

    opacity: 0.7;
}

.promotion-options {
    display: grid;

    grid-template-columns:
        repeat(2, 1fr);

    gap: 10px;
}

.promotion-options button {
    padding:
        12px 18px;

    border: 0;

    border-radius: 8px;

    font-size: 1rem;
    font-weight: 700;

    cursor: pointer;
}

.promotion-options button:hover {
    transform:
        translateY(-1px);
}


/* ============================================================
   MOVE HISTORY
   ============================================================ */

#move-history-panel {
    position: fixed;

    top: 150px;
    right: 16px;

    width: 260px;
    max-height: 360px;

    z-index: 20;

    overflow: hidden;

    border: 1px solid rgba(255,255,255,.18);
    border-radius: 10px;

    background: rgba(8,10,13,.72);

    backdrop-filter: blur(7px);

    box-shadow: 0 8px 28px rgba(0,0,0,.3);

    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

.history-title {
    padding: 10px 12px;

    font-weight: 800;
    letter-spacing: .08em;

    border-bottom:
        1px solid rgba(255,255,255,.12);
}

.history-move,
.history-number {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

#move-history-list {
    max-height: 310px;

    overflow-y: auto;

    padding: 8px 10px;
}

.history-row {
    display: grid;

    grid-template-columns:
        32px 1fr 1fr;

    gap: 6px;

    padding: 4px 2px;

    border-bottom:
        1px solid rgba(255, 255, 255, 0.06);
}

.history-number {
    opacity: 0.5;
}

.history-move {
    white-space: nowrap;
}

.history-empty {
    padding: 8px 2px;

    opacity: 0.5;
    font-style: italic;
}

.game-mode-picker {
    margin: 20px 0;

    display: grid;
    gap: 10px;

    text-align: left;
}

.game-mode-picker label {
    font-size: 0.85rem;
    font-weight: 700;

    opacity: 0.75;
}

.game-mode-picker select {
    width: 100%;

    padding: 10px 12px;

    border-radius: 8px;

    border:
        1px solid
        rgba(255,255,255,.18);

    background:
        rgba(255,255,255,.08);

    color: #f2f2f2;

    font-size: 1rem;
}

#human-color-picker {
    display: grid;
    gap: 10px;
}

#human-color-picker.hidden {
    display: none;
}
