:root {
    --bg: #111;
    --panel: #1a1b1e;
    --ink: #e6edf3;
    --muted: #a8b6c6;
    --accent: #ff8a1f;

    --tile: 30px;
    --timer: #ffb24d;
    --count: #60d394;
    --cell-hover-color: rgb(0, 0, 0);
}

/* Фон с мягкой подсветкой контента */
html, body {
    height: 100%
}

html, body {
    margin: 0;
    color: var(--ink);
    font: 16px/1.5 ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
    background: radial-gradient(700px 360px at 50% 120px, rgba(255, 138, 31, .12) 0%, rgba(0, 0, 0, 0) 70%), #111;
}

* {
    box-sizing: border-box
}

img {
    display: block;
    max-width: 100%
}

/* Хедер */
.topbar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: linear-gradient(to bottom, rgba(0, 0, 0, .35), rgba(0, 0, 0, 0));
    backdrop-filter: saturate(1.3) blur(6px)
}

.brand {
    display: flex;
    gap: 10px;
    align-items: center;
    color: var(--ink);
    text-decoration: none;
    font-weight: 700
}

.brand img {
    width: 28px;
    height: 28px;
    filter: drop-shadow(0 0 8px rgba(255, 138, 31, .22))
}

.brand span {
    opacity: .9
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px
}

.lang-switch {
    display: flex;
    gap: 6px
}

.lang,
.tap-toggle {
    appearance: none;
    border: 1px solid #30333a;
    background: #1f2227;
    color: var(--ink);
    padding: 6px 10px;
    border-radius: 10px;
    cursor: pointer;
}

.lang.active,
.tap-toggle[aria-pressed="true"] {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(255, 138, 31, .25) inset
}

/* tap-toggle по умолчанию скрыт на десктопе */
.tap-toggle {
    display: none
}

/* Новая аккуратная иконка «настройки» (слайдеры) */
.settings-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid #30333a;
    background: #1f2227;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    appearance: none;
    outline: none;
    transition: border-color .2s ease, box-shadow .2s ease, filter .2s ease;
    background-image: url("data:image/svg+xml;utf8,\
<svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'>\
<g fill='none' stroke='%23e6edf3' stroke-width='1.6' stroke-linecap='round'>\
<path d='M4 6h8'/><path d='M18 6h2'/><circle cx='14' cy='6' r='2' fill='%23ff8a1f'/>\
<path d='M4 12h2'/><path d='M10 12h10'/><circle cx='8' cy='12' r='2' fill='%2360d394'/>\
<path d='M4 18h12'/><path d='M20 18h0'/><circle cx='18' cy='18' r='2' fill='%234da3ff'/>\
</g></svg>");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 22px 22px;
}

.settings-btn:hover {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(255, 138, 31, .22) inset;
    filter: brightness(1.05)
}

/* Контент */
.wrapper {
    /*max-width: 1100px;*/
    /*margin: 0 auto;*/
    padding: 18px 16px
}

/* Поле по центру */
.field {
    padding: 12px 0;
    display: flex;
    justify-content: center
}

/* Обёртка вокруг поля (для HUD) */
.play {
    position: relative;
    display: inline-block;
    padding-top: 64px;
    min-width: 350px;
}

/* Сетка поля */
.board {
    display: grid;
    grid-template-rows: repeat(var(--rows), var(--tile));
    grid-template-columns: repeat(var(--cols), var(--tile));
    width: fit-content;
    border: 1px solid #272a30;
    background: #0f1114;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
    user-select: none;
    -webkit-user-select: none;
    margin: 0 auto;
}

/* HUD, привязанный к углам */
.hud-timer, .hud-mines, .hud-center {
    position: absolute;
    top: 8px
}

.hud-timer {
    left: 8px
}

.hud-mines {
    right: 8px
}

@media screen and (max-width: 600px) {
    .lang-switch {
        display: none
    }

    /* прячем языки на мобиле */
    .tap-toggle {
        display: inline-flex
    }

    /* показываем кнопку режима тапа */
    body .play {
        display: flex;
        justify-content: space-between;
        min-width: 240px;
    }

    body .hud-center {
        left: auto;
        transform: none;
        right: 8px;
    }

    body .hud-mines {
        display: none;
    }
}

.hud-center {
    left: 50%;
    transform: translateX(-50%)
}

/* Аккуратная светлая кнопка по центру */
.btn-cta {
    appearance: none;
    border: 1px solid #d5d9df;
    background: linear-gradient(#f6f7f9, #e8ebf0);
    color: #111;
    padding: 10px 22px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 800;
    letter-spacing: .2px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, .25), inset 0 1px 0 rgba(255, 255, 255, .6);
    transition: transform .06s ease, filter .2s ease, box-shadow .2s ease;
}

.btn-cta:hover {
    filter: brightness(1.03)
}

.btn-cta:active {
    transform: translateY(1px)
}

/* Таймер — бэйдж */
.timer-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 12px;
    background: linear-gradient(180deg, #1a1d22, #14171b);
    border: 1px solid #2c313a;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05), 0 8px 18px rgba(0, 0, 0, .35);
    font-variant-numeric: tabular-nums;
    font-weight: 900;
    letter-spacing: .4px;
    color: var(--timer);
}

.timer-badge .ico {
    opacity: .9
}

.timer-badge .val {
    min-width: 70px;
    text-align: center
}

/* Счётчик мин — бэйдж */
.mines-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 12px;
    background: linear-gradient(180deg, #1a1d22, #14171b);
    border: 1px solid #2c313a;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05), 0 8px 18px rgba(0, 0, 0, .35);
    font-weight: 900;
}

.mines-badge .ico {
    opacity: .9
}

.mines-badge .val {
    color: var(--count);
    min-width: 38px;
    text-align: center
}

/* Панель настроек */
.options {
    position: fixed;
    top: 56px;
    right: 16px;
    z-index: 6;
    background: var(--panel);
    border: 1px solid #2a2f37;
    border-radius: 14px;
    box-shadow: 0 14px 40px rgba(0, 0, 0, .45);
    padding: 12px;
    min-width: 320px;
    opacity: 0;
    transform: translateY(-8px) scale(.98);
    pointer-events: none;
    transition: opacity .15s ease, transform .15s ease;
}

.options.open {
    opacity: 1;
    transform: none;
    pointer-events: auto
}

.settings_header {
    padding: 6px 8px 10px
}

.settings_header h2 {
    margin: 0 0 2px;
    font-size: 16px
}

.settings_header p {
    margin: 0;
    color: var(--muted);
    font-size: 13px
}

.settings_grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding: 8px;
}

/* 4-й инпут просто уедет на следующую строку — ок */

.settings_form .field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: #15181d;
    padding: 10px;
    border: 1px solid #2a2f37;
    border-radius: 12px;
}

.settings_form .field .label {
    font-size: 12px;
    color: var(--muted)
}

.settings_form input {
    width: 100%;
    background: #0f1216;
    border: 1px solid #2a2f37;
    color: var(--ink);
    padding: 8px 10px;
    border-radius: 10px;
    outline: 0;
    font-weight: 700;
    text-align: center;
}

.settings_form input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(255, 138, 31, .22)
}

.settings_footer {
    display: flex;
    justify-content: flex-end;
    padding: 6px 8px
}

.btn-secondary {
    appearance: none;
    border: 1px solid #2a2f37;
    background: #1f2227;
    color: var(--ink);
    padding: 8px 14px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 800;
    letter-spacing: .2px;
    transition: filter .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.btn-secondary:hover {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(255, 138, 31, .18) inset
}
