/* ================================
   RESET + FULLSCREEN
================================ */
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden; /* 🔥 никаких полос прокрутки */
}

/* ================================
   ТЕМЫ (переменные)
================================ */

body.light {
    --bg: #ffffff;
    --text: #000000;
    --border: #cccccc;
    --button-bg: #eaeaea;
    --button-bg-hover: #dcdcdc;
    --ui-bg: #f5f5f5;
    --ui-text: #000000;
}

body.dark {
    --bg: #1e1e1e;
    --text: #ffffff;
    --border: #444444;
    --button-bg: #2c2c2c;
    --button-bg-hover: #3a3a3a;
    --ui-bg: #2b2b2b;
    --ui-text: #ffffff;
}

/* ================================
   BASIC LAYOUT — FULLSCREEN
================================ */

body {
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, sans-serif;

    display: flex;
    justify-content: center;
    align-items: center;

    width: 100%;
    height: 100%;
}

.panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;

    width: 100%;
    max-width: 100%;
    height: 100%;
    box-sizing: border-box;

    /* Внутренний отступ безопасный */
    padding: 12px;
}

/* ================================
   CONTROLS
================================ */

.controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

select {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--button-bg);
    color: var(--text);
    cursor: pointer;
    min-width: 120px;
    transition: 0.15s;
    font-size: 14px;
}

select:hover {
    background: var(--button-bg-hover);
}

/* ================================
   CANVAS — адаптация в экран
================================ */

canvas {
    border: 3px solid var(--border);
    background: #111;
    image-rendering: pixelated;

    display: block;

    /* 🔥 Ключевой момент — canvas никогда не выходит за экран */
    max-width: 100%;
    max-height: calc(100vh - 200px);/* 200px под UI + селекты */
    height: auto;
    width: auto;
}

canvas.disabled {
    opacity: 0.4;
    filter: grayscale(0.6);
    pointer-events: none;
}

/* ================================
   UI PANEL (под канвасом)
================================ */

.ui {
    background: var(--ui-bg);
    color: var(--ui-text);

    border-radius: 10px;
    padding: 12px 16px;
    border: 1px solid var(--border);

    margin-top: 8px;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    min-width: 240px;
    font-size: 15px;

    max-width: 100%;
}

.hint {
    font-size: 14px;
    margin-top: 6px;
    opacity: 0.85;
}

.hint.win {
    color: #22c55e !important;
    font-weight: bold;
}

.hint.lose {
    color: #ef4444 !important;
    font-weight: bold;
}

/* ================================
   MOBILE ADAPTATION
================================ */

@media (max-width: 768px) {
    .panel {
        padding: 8px;
    }

    canvas {
        max-height: calc(100vh - 250px);
    }

    select {
        font-size: 16px;
        padding: 10px 14px;
    }

    .ui {
        width: 100%;
        max-width: 300px;
    }
}

@media (max-width: 480px) {
    .controls {
        flex-direction: column;
        gap: 6px;
    }

    select {
        width: 100%;
        font-size: 17px;
    }

    .ui {
        width: 100%;
        padding: 16px;
        font-size: 17px;
    }

    canvas {
        max-height: calc(100vh - 280px);
    }
}

/* Горизонтальные телефоны */
@media (max-height: 600px) and (orientation: landscape) {
    .panel {
        padding: 4px;
    }

    canvas {
        max-height: 60vh;
    }

    .ui {
        font-size: 14px;
        padding: 8px;
    }
}

html,
body{

    width:100%;
    height:100%;
    margin:0;
    overflow:hidden;

}


body.dark{

    background:
    radial-gradient(
        circle at center,
        #242424,
        #050505
    );

}


.panel{

    position:fixed;
    inset:0;

    display:flex;
    flex-direction:column;

}


canvas#game{

    flex:1;

    width:100vw;
    height:100vh;

    object-fit:contain;

    image-rendering:pixelated;

}


