/* ====================
   Базові стилі / Reset
   ==================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    max-width: 100%;
    overflow-x: hidden;
    overflow-y: auto;
}

body {
    background-color: #1e1e1e;
    color: #fff;
    font-family: "Open Sans", sans-serif;
    line-height: 1.5;
}

.pageShell {
    width: 100%;
    margin: 0 auto;
    position: relative;
}

/* ====================
   Верхня панель (header)
   ==================== */
.header {
    background-color: #1f1f1f;
    padding: 10px 15px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.gameStats {
    font-size: 0.9em;
    color: #bbb;
}

/* ====================
   Основний контейнер
   ==================== */
.container {
    max-width: 530px;
    width: 100%;
    margin: 0 auto;
    padding: 15px;
    text-align: center;
    position: relative;
    flex-direction: column;
}

h1 {
    margin-bottom: 10px;
    font-size: 1.4em;
    margin-top: 25px;
    letter-spacing: -0.02em;
    text-shadow: 0 2px 18px rgba(33, 150, 243, 0.12);
}

/* ====================
   Панель інфи про гру
   ==================== */
.game-info {
    font-family: "Inter", "Roboto", "Segoe UI", sans-serif;
    font-weight: 600;
    letter-spacing: 0.3px;
    font-variant-numeric: tabular-nums;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 10px;
    margin-top: 10px;
    padding: 2px 0 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    text-align: left;
    font-size: 0.88em;
    position: relative;
}

.gameInfoLeft {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    min-width: 0;
    flex: 1 1 auto;
}

#gameDateLabel {
    margin: 0;
    padding: 0;
    border-radius: 0;
    background-color: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.95);
    font-size: 1em;
    font-weight: 680;
    letter-spacing: -0.01em;
    flex-shrink: 0;
}

.gameStats {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 1em;
    color: rgba(255, 255, 255, 0.72);
    align-items: center;
}

.twitchHeaderControls {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex: 0 0 auto;
    min-width: 0;
}

.twitchHeaderIconButton {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease, color 0.2s ease;
    flex-shrink: 0;
}

.twitchHeaderIconButton:hover {
    background: rgba(25, 118, 210, 0.14);
    border-color: rgba(25, 118, 210, 0.36);
    color: #d7ebff;
    transform: translateY(-1px);
}

.twitchHeaderIconButton:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.18);
}

.guess-counter, .hint-counter {
    padding: 0;
    font-weight: 560;
    border-radius: 0;
    background-color: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1em;
    white-space: nowrap;
}

.gameStats > span + span {
    position: relative;
    padding-left: 12px;
}

.gameStats > span + span::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    width: 1px;
    height: 0.95em;
    background-color: rgba(255, 255, 255, 0.18);
    transform: translateY(-50%);
}

#guessCount,
#hintCount {
    color: rgba(255, 255, 255, 0.96);
    font-weight: 700;
}

.twitchInlineControls {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 28px;
    color: rgba(255, 255, 255, 0.72);
    white-space: nowrap;
    align-self: center;
    line-height: 1;
}

.gameStats > .twitchInlineControls {
    position: relative;
    padding-left: 12px;
}

.gameStats > .twitchInlineControls::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    width: 1px;
    height: 0.95em;
    background-color: rgba(255, 255, 255, 0.18);
    transform: translateY(-50%);
}

.twitchInlineStreamer {
    font-weight: 620;
    color: rgba(255, 255, 255, 0.72);
    letter-spacing: 0.01em;
    display: inline-flex;
    align-items: center;
    align-self: center;
    line-height: 1;
    margin-top: -1px;
}

.twitchInlineControls.connected .twitchInlineStreamer {
    color: rgba(255, 255, 255, 0.72);
}

.twitchInlineControls.live .twitchInlineStreamer {
    color: rgba(255, 255, 255, 0.95);
}

.twitchInlineControls.error .twitchInlineStreamer {
    color: #ffb3ad;
}

.twitchChatSwitch {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    cursor: pointer;
    align-self: center;
    margin-top: 2px;
}

.twitchChatSwitch input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.twitchChatSwitchTrack {
    width: 42px;
    height: 24px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.26);
    transition: background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    position: relative;
}

.twitchChatSwitchTrack::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 999px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
    transition: transform 0.2s ease;
}

.twitchChatSwitch input:checked + .twitchChatSwitchTrack {
    background: linear-gradient(135deg, #1565c0, #1976d2);
    border-color: rgba(25, 118, 210, 0.55);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.18), 0 0 0 4px rgba(25, 118, 210, 0.10);
}

.twitchChatSwitch input:checked + .twitchChatSwitchTrack::after {
    transform: translateX(18px);
}

.twitchChatSwitch input:focus-visible + .twitchChatSwitchTrack {
    outline: none;
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.16);
}

.twitchChatSwitch input:disabled + .twitchChatSwitchTrack {
    opacity: 0.5;
    cursor: not-allowed;
}

.twitchWinnersList {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px;
}

.twitchWinnerRow {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.twitchWinnerPlace {
    color: rgba(255, 255, 255, 0.5);
    font-weight: 700;
    min-width: 1.8em;
}

.twitchWinnerName {
    color: rgba(255, 255, 255, 0.94);
    font-weight: 620;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.twitchWinnerCount {
    color: #8fc0ff;
    font-weight: 700;
    white-space: nowrap;
}

.twitchWinnersEmpty,
.twitchWinnersLoading {
    margin: 6px 0 0;
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
}

.twitchLeaderboardSidebar {
    display: none;
    width: 100%;
}

.twitchLeaderboardPanel {
    position: relative;
    background: linear-gradient(180deg, rgba(38, 38, 38, 0.98), rgba(29, 29, 29, 0.97));
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 15px;
    margin-bottom: 20px;
    text-align: left;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.18);
    backdrop-filter: blur(8px);
}

.twitchLeaderboardPanel::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

.twitchLeaderboardInline {
    display: none !important;
}

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

.twitchLeaderboardPanelCopy {
    min-width: 0;
    width: 100%;
    text-align: center;
}

.twitchLeaderboardEyebrow {
    margin: 0 0 4px 0;
    color: rgba(143, 192, 255, 0.72);
    font-size: 0.7em;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.twitchLeaderboardPanelTitle {
    margin: 0;
    color: rgba(255, 255, 255, 0.96);
    font-size: 1.04em;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

.twitchLeaderboardPanel .twitchWinnersList {
    margin-top: 0;
    gap: 8px;
    scrollbar-gutter: stable;
}

.twitchWinnersListCompact {
    max-height: min(40vh, 320px);
    overflow: auto;
    padding-right: 2px;
}

.twitchWinnersListSidebar {
    max-height: calc(100vh - 176px);
    overflow: auto;
    padding-right: 0;
    width: 100%;
}

.twitchLeaderboardPanel .twitchWinnersListSidebar {
    scrollbar-gutter: auto;
}

.twitchLeaderboardPanel .twitchWinnerRow {
    grid-template-columns: 2.4em minmax(0, 1fr) auto;
    padding: 11px 12px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.035);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.twitchLeaderboardPanel .twitchWinnerRow:nth-child(1) {
    background:
        linear-gradient(135deg, rgba(255, 196, 77, 0.16), rgba(255, 255, 255, 0.045)),
        rgba(255, 255, 255, 0.035);
    border-color: rgba(255, 196, 77, 0.28);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.055),
        0 8px 22px rgba(255, 196, 77, 0.06);
}

.twitchLeaderboardPanel .twitchWinnerRow:nth-child(2),
.twitchLeaderboardPanel .twitchWinnerRow:nth-child(3) {
    background: linear-gradient(135deg, rgba(143, 192, 255, 0.1), rgba(255, 255, 255, 0.035));
}

.twitchLeaderboardPanel .twitchWinnerRow:nth-child(1) .twitchWinnerPlace {
    color: #ffd166;
}

.twitchLeaderboardPanel .twitchWinnerRow:nth-child(2) .twitchWinnerPlace,
.twitchLeaderboardPanel .twitchWinnerRow:nth-child(3) .twitchWinnerPlace {
    color: rgba(143, 192, 255, 0.82);
}


/* ====================
   Секція вводу
   ==================== */
.input-section {
    display: flex;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 20px;
    width: 100%;
}

#guessInput {
    flex-grow: 1;
    flex-basis: 0;
    flex-shrink: 1;
    min-width: 100px;
    padding: 10px;
    border-radius: 5px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background-color: #2a2a2a;
    color: #fff;
    font-size: 1em;
    min-height: 44px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}
#guessInput::placeholder {
    color: #bbb;
}
#guessInput:focus {
    outline: none;
    border-color: rgba(33, 150, 243, 0.85);
    background-color: #303030;
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.18);
}

/* Кнопка-меню біля інпуту */
.menu-container {
    position: relative;
    flex-shrink: 0;
    display: flex;
    align-self: stretch;
}
.menu-button {
    background-color: #262626;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.76);
    font-size: 1.38em;
    font-weight: 700;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    width: 44px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.menu-button:hover {
    background-color: #2e2e2e;
    border-color: rgba(255, 255, 255, 0.16);
    color: rgba(255, 255, 255, 0.92);
}
.menu-button:focus-visible {
    outline: none;
    background-color: #2e2e2e;
    border-color: rgba(33, 150, 243, 0.85);
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.2);
}

/* ====================
   Кнопки (загальні)
   ==================== */
.btn-wide,
#shareButton,
#closestWordsBtn,
#giveUpYesBtn,
#giveUpNoBtn,
#randomGameBtn {
    padding: 10px 15px;
    min-height: 44px;
    cursor: pointer;
    background-color: #2196f3;
    border: none;
    border-radius: 5px;
    color: #fff;
    font-weight: bold;
    font-size: 0.95em;
    transition: background-color 0.2s ease-in-out, transform 0.15s ease, box-shadow 0.2s ease-in-out;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1.2;
    box-shadow: 0 8px 22px rgba(33, 150, 243, 0.18);
}

/* Hover-стани основних кнопок */
.btn-wide:hover,
#shareButton:hover,
#closestWordsBtn:hover,
#giveUpYesBtn:hover,
#giveUpNoBtn:hover,
#randomGameBtn:hover {
    background-color: #1976d2;
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(33, 150, 243, 0.24);
}

.btn-wide:active,
#shareButton:active,
#closestWordsBtn:active,
#giveUpYesBtn:active,
#giveUpNoBtn:active,
#randomGameBtn:active {
    transform: translateY(0);
}

.btn-wide:focus-visible,
#shareButton:focus-visible,
#closestWordsBtn:focus-visible,
#giveUpYesBtn:focus-visible,
#giveUpNoBtn:focus-visible,
#randomGameBtn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.22), 0 8px 22px rgba(33, 150, 243, 0.18);
}

/* ====================
   Випадаюче меню
   ==================== */
.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background-color: #3a3a3a;
    border-radius: 8px;
    padding: 8px;
    min-width: 200px;
    max-width: min(280px, calc(100vw - 24px));
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.08);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.dropdown-menu.hidden {
    display: none !important;
}
.dropdown-menu .menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: transparent;
    border: none;
    color: #fff;
    text-align: left;
    padding: 12px 16px;
    width: 100%;
    cursor: pointer;
    font-size: 1em;
    border-radius: 5px;
    transition: background-color 0.1s ease-in-out;
    font-weight: normal;
    min-height: 44px;
}
.dropdown-menu .menu-item .menu-icon {
    font-size: 1.1em;
    line-height: 1;
}
.dropdown-menu .menu-item:hover {
    background-color: #4a4a4a !important;
    color: #fff !important;
}

/* Скидання зайвих стилів для елементів меню */
.dropdown-menu button#hintButton,
.dropdown-menu button#settingsBtn,
.dropdown-menu button#previousGamesBtn,
.dropdown-menu button#giveUpBtn,
.dropdown-menu button#createGameBtn,
.dropdown-menu #twitchConnectButton,
.dropdown-menu #twitchDisconnectButton,
.dropdown-menu button#authorshipBtn {
    justify-content: flex-start;
    box-shadow: none;
}

.dropdown-menu #twitchConnectButton,
.dropdown-menu #twitchDisconnectButton {
    text-decoration: none;
}

.dropdown-menu #twitchConnectButton .menu-icon,
.dropdown-menu #twitchDisconnectButton .menu-icon {
    color: #c6a7ff !important;
    opacity: 1 !important;
}

.twitchMenuIcon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.15em;
    height: 1.15em;
    flex-shrink: 0;
}

.twitchMenuIcon svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* Іконка "Авторство" світліша */
#authorshipBtn .menu-icon {
    color: #cccccc !important;
    opacity: 1 !important;
}

/* ====================
   Список спроб / близьких слів
   ==================== */
#guessesContainer,
#closestWordsList {
    margin-top: 16px;
    text-align: left;
}

/* Елемент спроби з вбудованою смугою прогресу */
.guessItem {
    position: relative;       /* для .fillBar */
    display: block;
    margin: 8px 0;
    min-height: 44px;
    border-radius: 5px;
    background-color: #2a2a2a;
    overflow: hidden;         /* обрізання смуги прогресу по краях */
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.16);
}

.guessItemHint {
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14), 0 6px 16px rgba(0, 0, 0, 0.16);
}

/* Смуга прогресу; ширина та колір задаються класами рангу */
.fillBar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    height: 100%;
    width: 0%;
    border-radius: 5px;
    transition: width 0.4s ease-in-out, background-color 0.4s ease-in-out;
    background-color: #4CAF50;
}

/* Контейнер тексту поверх .fillBar (z-index) */
.guessText {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    min-height: 44px;
    padding: 8px 12px;
    gap: 10px;
    font-weight: bold;
}

.guessWordInfo {
    min-width: 0;
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
}

.guessText .word {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    flex-grow: 1;
    min-width: 0;
}

.guessSubmittedBy {
    flex: 0 1 auto;
    color: rgba(255, 255, 255, 0.62);
    font-size: 0.68em;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-align: right;
    line-height: 1.1;
    max-width: 9ch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.guessMeta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    flex-shrink: 0;
    min-width: 4.9em;
    gap: 1px;
    font-variant-numeric: tabular-nums;
}

.guessText .rank {
    font-size: 0.9em;
    color: rgba(255, 255, 255, 0.98);
    font-weight: 800;
    letter-spacing: -0.01em;
    text-align: right;
    line-height: 1.05;
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.3);
}

.guessText .similarity {
    font-size: 0.69em;
    line-height: 1.05;
    color: rgba(255, 255, 255, 0.76);
    font-weight: 650;
    letter-spacing: 0.01em;
}

/* Підсвітка останньої спроби */
.highlightGuess {
    border-color: rgba(255, 255, 255, 0.46);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.72), 0 8px 18px rgba(0, 0, 0, 0.18);
}

/* ================================================================
   Кольори для категорій рангу (насичені, читабельні на білому тексті)
   ================================================================ */
.rank-exact .fillBar { background-color: #1565C0; }
.rank-very-close .fillBar { background-color: #2E7D32; }
.rank-close .fillBar { background-color: #689F38; }
.rank-medium .fillBar { background-color: #FFA000; }
.rank-far .fillBar { background-color: #F57C00; }
.rank-very-far .fillBar { background-color: #C62828; }

/* Текст/помилки */
.guessText { color: #fff; }
.guessText .rank { color: rgba(255, 255, 255, 0.95); }
.rank-error .guessText { color: #EF9A9A; }
.rank-error .fillBar { display: none; }

/* ====================
   Відображення останньої спроби
   ==================== */
.lastGuessWrapper {
    margin-bottom: 20px;
    text-align: left;
}
#lastGuessDisplay {
    margin: 10px 0;
}

/* ====================
   Блок "Як грати?"
   ==================== */
.howToPlayBlock {
    background-color: #272727;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 20px;
    text-align: left;
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.12);
}
.howToPlayBlock h2 {
    margin-top: 0;
    margin-bottom: 8px;
    font-size: 1.08em;
    color: #2196f3;
}
.howToPlayBlock p {
    margin-bottom: 12px;
    font-size: 0.93em;
    line-height: 1.58;
    color: rgba(255, 255, 255, 0.92);
}
.howToPlayBlock details {
    margin-bottom: 10px;
    padding: 9px 12px;
    background-color: #1f1f1f;
    border-radius: 6px;
    border: 1px solid #333;
}
.howToPlayBlock details summary {
    cursor: pointer;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.96);
    margin-bottom: 4px;
    font-size: 0.94em;
}
.howToPlayBlock details p {
    margin: 6px 0 0 0;
    font-size: 0.84em;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.48;
}

/* ====================
   Блок завершення гри
   ==================== */
.congratsBlock {
    background-color: #2a2a2a;
    border: 2px solid #2196f3;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    text-align: center;
    box-shadow: 0 14px 32px rgba(33, 150, 243, 0.12);
}
.congratsBlock h2 {
    font-size: 1.3em;
    margin-bottom: 10px;
}
.congratsBlock p {
    margin-bottom: 15px;
    white-space: pre-wrap; /* для коректних \n у тексті */
}
#closestWordsBtn {
    margin-top: 15px;
}
.hidden {
    display: none !important;
}

/* ====================
   Модальні вікна
   ==================== */
.modal {
    position: fixed;
    z-index: 1050;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 15px;
}
.modal-content {
    position: relative;
    background-color: #2a2a2a;
    border-radius: 10px;
    padding: 20px;
    width: 100%;
    max-width: 500px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 5px 20px rgba(0,0,0,0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
}
#closestWordsModal .modal-content {
    background-color: #333333;
}

/* Список найближчих слів у модалці */
#closestWordsList {
    padding-bottom: 10px;
    font-size: 0.95em;
}

.close {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 28px;
    font-weight: bold;
    line-height: 1;
    cursor: pointer;
    color: #aaa;
    transition: color 0.2s;
    padding: 5px;
}
.close:hover {
    color: #fff;
}
.modal-content h2 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #2196f3;
    text-align: center;
    font-size: 1.2em;
}

/* ====================
   Сторінка "Створити гру"
   ==================== */
.create-game-shell {
    width: 100%;
    max-width: 660px;
    margin: 0 auto;
    padding: 18px 15px 42px;
    text-align: left;
}

.create-game-panel {
    background-color: #272727;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.12);
}

.create-game-back {
    color: #2196f3;
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 14px;
    transition: color 0.2s ease, transform 0.2s ease;
}

.create-game-back:hover {
    text-decoration: underline;
    color: #64b5f6;
    transform: translateX(-1px);
}

.create-game-title {
    margin: 0 0 10px 0;
    text-align: center;
    font-size: 1.4em;
    letter-spacing: -0.02em;
    text-shadow: 0 2px 18px rgba(33, 150, 243, 0.12);
}

.create-game-subtitle {
    margin: 0 0 18px 0;
    color: rgba(255, 255, 255, 0.76);
    font-size: 0.97em;
    line-height: 1.58;
    text-align: center;
}

.dev-archive-toolbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.dev-archive-note {
    margin: 0 0 18px 0;
    padding: 10px 12px;
    border-radius: 8px;
    background-color: rgba(33, 150, 243, 0.1);
    border: 1px solid rgba(33, 150, 243, 0.18);
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.92em;
    line-height: 1.55;
}

.create-game-form-page {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.create-game-label {
    font-family: "Inter", "Roboto", "Segoe UI", sans-serif;
    font-size: 0.9em;
    font-weight: 680;
    letter-spacing: 0.2px;
    color: rgba(255, 255, 255, 0.94);
}

.create-game-input {
    min-height: 44px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 5px;
    background-color: #2a2a2a;
    color: #fff;
    font-size: 1em;
    padding: 10px 12px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.create-game-input::placeholder {
    color: #bbb;
}

.create-game-input:focus {
    outline: none;
    border-color: rgba(33, 150, 243, 0.85);
    background-color: #303030;
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.18);
}

.create-game-submit {
    width: fit-content;
    min-width: 170px;
}

.create-game-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.create-game-error {
    color: #ffb4b4;
    font-style: italic;
    margin-top: 2px;
}

.create-game-result {
    margin-top: 24px;
    padding: 16px;
    background-color: #272727;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.12);
    text-align: left;
}

.create-game-result-title {
    margin: 0 0 6px 0;
    font-size: 1.2em;
    color: #2196f3;
}

.create-game-result-subtitle {
    margin: 0 0 12px 0;
    color: rgba(255, 255, 255, 0.84);
    font-size: 0.94em;
}

.create-game-link-row {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.create-game-link-input {
    flex: 1;
    min-height: 44px;
    border-radius: 5px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background-color: #2a2a2a;
    color: #f5f5f5;
    padding: 10px 12px;
    font-size: 0.95em;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.create-game-copy-btn {
    white-space: nowrap;
}

.create-game-copy-status {
    margin-top: 8px;
    color: #a7f3c0;
    font-size: 0.92em;
}

.create-game-copy-status-error {
    color: #ffb4b4;
}

.create-game-open-link {
    display: inline-block;
    margin-top: 8px;
    color: #64b5f6;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease, text-decoration 0.2s ease;
}

.create-game-open-link:hover {
    color: #90caf9;
    text-decoration: underline;
}

.dev-archive-logout,
.dev-archive-save {
    flex-shrink: 0;
}

.dev-archive-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    margin: 14px 0 0 0;
}

.dev-archive-meta-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-height: 76px;
    padding: 10px 12px;
    border-radius: 8px;
    background-color: #232323;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.dev-archive-meta-label {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.8em;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.dev-archive-meta-value {
    color: rgba(255, 255, 255, 0.96);
    font-size: 0.98em;
    font-weight: 600;
    line-height: 1.35;
    word-break: break-word;
}

.create-game-table-title {
    margin: 18px 0 10px 0;
    font-size: 1.02em;
    color: rgba(255, 255, 255, 0.96);
}

.create-game-table-wrap {
    max-height: 520px;
    overflow: auto;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    background-color: #232323;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.create-game-table {
    width: 100%;
    border-collapse: collapse;
}

.create-game-table thead th {
    position: sticky;
    top: 0;
    background-color: #1f1f1f;
    color: rgba(255, 255, 255, 0.9);
    text-align: left;
    font-weight: 700;
    font-size: 0.86em;
    letter-spacing: 0.02em;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.create-game-table tbody td {
    padding: 8px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.92);
    font-variant-numeric: tabular-nums;
}

.create-game-table tbody td:first-child,
.create-game-table tbody td:last-child {
    color: rgba(255, 255, 255, 0.76);
    font-weight: 650;
    white-space: nowrap;
}

.create-game-table tbody td:nth-child(2) {
    color: rgba(255, 255, 255, 0.97);
    font-weight: 600;
}

.create-game-table tbody tr:nth-child(even) {
    background-color: #262626;
}

.create-game-table tbody tr:nth-child(odd) {
    background-color: #222222;
}

/* Уніфікуємо зовнішній вигляд елементів у модалці "Найближчі слова" */
/* (спеціальних перевизначень не потрібно) */

/* Модалка "Попередні ігри" */
#randomGameContainer {
    text-align: center;
    margin-bottom: 1rem;
}
#previousGamesList button {
    width: 100%;
    background-color: #2196f3;
    color: #fff;
    border: none;
    padding: 12px 15px;
    margin: 6px 0;
    border-radius: 8px;
    font-size: 1em;
    display: flex;
    justify-content: space-between; /* ліва і права частина */
    align-items: center;
    transition: background-color 0.2s ease;
    min-height: 44px;
    text-align: left; /* для лівого тексту */
}

#previousGamesList button:hover {
    background-color: #1976d2;
    cursor: pointer;
}

#previousGamesList .archive-left {
    flex: 1;
}

#previousGamesList .archive-right {
    font-style: italic;
    font-weight: 600;          /* напівжирний */
    font-size: 0.95em;         /* трохи менший */
    opacity: 0.95;
    margin-left: 10px;
    font-family: "Inter", "Roboto", "Segoe UI", sans-serif; /* сучасний вигляд */
}

.game-status-label {
    font-weight: normal;
    font-size: 0.9em;
    opacity: 0.8;
    margin-left: 10px;
}

/* Модалка "Здатися" */
#giveUpModal .modal-content {
    text-align: center;
}
#giveUpModal h2 {
    margin-bottom: 25px;
}
#giveUpModal .btn-wide {
    margin: 0 5px;
}

/* Модалка "Налаштування" */
#settingsModal .modal-content {
    max-width: 680px;
    padding: clamp(22px, 2vw, 30px);
}

.settings-section {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 14px 18px;
    align-items: start;
    margin-bottom: 26px;
}

.settings-section:last-child {
    margin-bottom: 4px;
}

.settings-section-title {
    margin: 4px 0 0 0;
    text-align: left;
    color: #ffffff;
    font-size: clamp(1.06rem, 1rem + 0.12vw, 1.15rem);
}

.settings-options {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.settings-option {
    display: grid;
    grid-template-columns: 20px 1fr;
    gap: 12px;
    align-items: start;
    cursor: pointer;
    text-align: left;
}

.settings-option input[type="radio"] {
    margin-top: 6px;
    accent-color: #2196f3;
}

.settings-option-label {
    display: block;
    color: #ffffff;
    font-weight: 700;
    font-size: clamp(1.02rem, 0.98rem + 0.12vw, 1.1rem);
}

.settings-option-description {
    display: block;
    margin-top: 2px;
    color: #cfd7df;
    font-size: clamp(0.95rem, 0.92rem + 0.08vw, 1rem);
    line-height: 1.45;
}

/* Модалка "Авторство" */
#authorshipModal .modal-content {
    padding: 20px 25px;
}
#authorshipContent {
    color: #e0e0e0;
    font-size: 1em;
    line-height: 1.7;
    text-align: left;
    margin-top: 20px;
}
#authorshipContent p {
    margin-bottom: 15px;
}
#authorshipContent p:last-child {
    margin-bottom: 0;
}
#authorshipContent a {
    color: #64b5f6;
    text-decoration: none;
    transition: color 0.2s ease, text-decoration 0.2s ease;
}
#authorshipContent a:hover,
#authorshipContent a:focus {
    color: #90caf9;
    text-decoration: underline;
}
#authorshipContent strong {
    font-weight: 600;
    color: #ffffff;
}
#authorshipContent code {
    background-color: #3a3a3a;
    color: #f0f0f0;
    padding: 2px 5px;
    border-radius: 4px;
    font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
    font-size: 0.9em;
}

/* ====================
   Медіа-запити
   ==================== */
@media (min-width: 1440px) {
    .container {
        max-width: 35.8vw;
        padding: 1.04vw;
    }

    h1 {
        margin-top: 1.74vw;
        margin-bottom: 0.69vw;
        font-size: 1.56vw;
    }

    .game-info {
        gap: 0.83vw;
        margin-top: 0.69vw;
        margin-bottom: 0.69vw;
        padding: 0.14vw 0 0.83vw;
        font-size: 0.97vw;
    }

    .gameStats {
        gap: 0.83vw;
    }

    #gameDateLabel,
    .guess-counter,
    .hint-counter {
        padding: 0;
    }

    .gameStats > span + span {
        padding-left: 0.83vw;
    }

    .gameStats > span + span::before {
        height: 0.95vw;
    }

    .input-section {
        gap: 0.56vw;
        margin-bottom: 1.39vw;
    }

    #guessInput {
        padding: 0.69vw;
        font-size: 1.11vw;
        min-height: 3.06vw;
        border-radius: 0.35vw;
    }

    .menu-button {
        font-size: 1.56vw;
        padding: 0;
        width: 3.06vw;
        min-width: 3.06vw;
        min-height: 3.06vw;
        border-radius: 0.35vw;
    }

    .btn-wide,
    #shareButton,
    #closestWordsBtn,
    #giveUpYesBtn,
    #giveUpNoBtn,
    #randomGameBtn {
        padding: 0.69vw 1.04vw;
        min-height: 3.06vw;
        border-radius: 0.35vw;
        font-size: 1.06vw;
    }

    .dropdown-menu {
        min-width: 13.89vw;
        padding: 0.56vw;
        max-width: min(19.44vw, calc(100vw - 1.67vw));
    }

    .dropdown-menu .menu-item {
        padding: 0.83vw 1.11vw;
        font-size: 1vw;
        min-height: 3.06vw;
    }

    #guessesContainer,
    #closestWordsList {
        margin-top: 1.11vw;
    }

    .guessItem {
        margin: 0.56vw 0;
        min-height: 3.06vw;
        border-radius: 0.35vw;
    }

    .fillBar {
        border-radius: 0.35vw;
    }

    .guessText {
        min-height: 3.06vw;
        padding: 0.56vw 0.83vw;
        gap: 0.69vw;
        font-size: 1.11vw;
    }

    .guessText .rank {
        font-size: 1vw;
    }

    .guessMeta {
        min-width: 4.9em;
        gap: 0.07vw;
    }

    .guessText .similarity {
        font-size: 0.74vw;
    }

    .lastGuessWrapper {
        margin-bottom: 1.39vw;
    }

    #lastGuessDisplay {
        margin: 0.69vw 0;
    }

    .howToPlayBlock,
    .congratsBlock {
        padding: 1.25vw;
        margin-bottom: 1.39vw;
        border-radius: 0.56vw;
    }

    .howToPlayBlock h2,
    .congratsBlock h2,
    .modal-content h2 {
        font-size: 1.33vw;
    }

    .howToPlayBlock p,
    .congratsBlock p,
    #closestWordsList,
    #authorshipContent {
        font-size: 1.06vw;
    }

    .modal {
        padding: 1.04vw;
    }

    .modal-content {
        max-width: 34.72vw;
        padding: 1.39vw;
    }

    #settingsModal .modal-content {
        max-width: 47.22vw;
    }

    .create-game-shell {
        max-width: min(760px, 45vw);
        padding: 1.18vw 1.04vw 2.22vw;
    }

    .create-game-panel {
        padding: 1.11vw;
        border-radius: 0.69vw;
    }

    .create-game-back {
        margin-bottom: 0.97vw;
        font-size: 1vw;
    }

    .create-game-title {
        margin-bottom: 0.69vw;
        font-size: 1.56vw;
    }

    .create-game-subtitle {
        margin-bottom: 1.25vw;
        font-size: 1vw;
    }

    .create-game-label {
        font-size: 0.92vw;
    }

    .create-game-form-page {
        gap: 0.69vw;
    }

    .dev-archive-note {
        margin-bottom: 1.25vw;
        padding: 0.69vw 0.83vw;
        border-radius: 0.56vw;
        font-size: 0.92vw;
    }

    .create-game-input,
    .create-game-link-input {
        min-height: 3.06vw;
        padding: 0.69vw 0.83vw;
        font-size: 1vw;
        border-radius: 0.35vw;
    }

    .create-game-submit,
    .create-game-copy-btn {
        min-width: 12.5vw;
    }

    .create-game-actions {
        gap: 0.69vw;
    }

    .create-game-result {
        margin-top: 1.67vw;
        padding: 1.11vw;
        border-radius: 0.56vw;
    }

    .create-game-result-title {
        font-size: 1.22vw;
    }

    .create-game-result-subtitle,
    .create-game-copy-status,
    .create-game-open-link {
        font-size: 0.94vw;
    }

    .dev-archive-meta-grid {
        gap: 0.69vw;
        margin-top: 0.97vw;
    }

    .dev-archive-meta-item {
        min-height: 5.28vw;
        padding: 0.69vw 0.83vw;
        border-radius: 0.56vw;
    }

    .dev-archive-meta-label {
        font-size: 0.78vw;
    }

    .dev-archive-meta-value {
        font-size: 0.94vw;
    }

    .create-game-table-title {
        margin-top: 1.25vw;
        margin-bottom: 0.69vw;
        font-size: 1vw;
    }

    .create-game-table-wrap {
        border-radius: 0.56vw;
    }

    .create-game-table thead th,
    .create-game-table tbody td {
        padding: 0.69vw 0.83vw;
        font-size: 0.92vw;
    }

    .twitchLeaderboardPanel {
        padding: 1.04vw;
        border-radius: 0.97vw;
    }

    .twitchLeaderboardPanelHeader {
        margin-bottom: 0.83vw;
        gap: 0.83vw;
    }

    .twitchLeaderboardEyebrow {
        margin-bottom: 0.28vw;
        font-size: 0.69vw;
    }

    .twitchLeaderboardPanelTitle {
        font-size: 1vw;
    }

    .twitchLeaderboardPanel .twitchWinnerRow {
        padding: 0.76vw 0.83vw;
        border-radius: 0.69vw;
    }

    .close {
        font-size: 1.94vw;
    }
}

@media (min-width: 1024px) {
    .twitchLeaderboardSidebar {
        display: block;
        position: fixed;
        top: 78px;
        left: calc(50% + 283px);
        width: min(340px, calc(50vw - 301px));
        z-index: 35;
    }

    .twitchLeaderboardPanelDesktop {
        width: 100%;
        max-height: calc(100vh - 128px);
        padding: 16px;
        border-radius: 18px;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    .twitchLeaderboardSidebar .twitchLeaderboardPanelHeader {
        margin-bottom: 14px;
        gap: 10px;
    }

    .twitchLeaderboardSidebar .twitchLeaderboardEyebrow {
        font-size: 0.72em;
        margin-bottom: 4px;
    }

    .twitchLeaderboardSidebar .twitchLeaderboardPanelTitle {
        font-size: 1.1em;
    }

    .twitchLeaderboardSidebar .twitchWinnersListSidebar {
        flex: 1 1 auto;
        min-height: 0;
        max-height: none;
        width: 100%;
    }

    .twitchLeaderboardSidebar .twitchWinnerRow {
        padding: 12px 14px;
        border-radius: 12px;
        gap: 10px;
        width: 100%;
    }

    .twitchLeaderboardSidebar .twitchWinnerPlace,
    .twitchLeaderboardSidebar .twitchWinnerCount,
    .twitchLeaderboardSidebar .twitchWinnerName {
        font-size: 0.96em;
    }
}

@media (max-width: 1023px) {
    .twitchLeaderboardSidebar {
        display: none !important;
    }
}

@media (min-width: 1440px) {
    .twitchLeaderboardSidebar {
        top: 5.42vw;
        left: calc(50% + 17.9vw + 1.25vw);
        width: calc(29.6vw - 2.5vw);
    }

    .twitchLeaderboardPanelDesktop {
        max-height: calc(100vh - 9.72vw);
        padding: 1.25vw;
        border-radius: 1.39vw;
    }

    .twitchLeaderboardSidebar .twitchLeaderboardPanelHeader {
        margin-bottom: 1.04vw;
        gap: 0.83vw;
    }

    .twitchLeaderboardSidebar .twitchLeaderboardEyebrow {
        font-size: 0.74vw;
    }

    .twitchLeaderboardSidebar .twitchLeaderboardPanelTitle {
        font-size: 1.14vw;
    }

    .twitchLeaderboardSidebar .twitchWinnersListSidebar {
        max-height: none;
    }

    .twitchLeaderboardSidebar .twitchWinnerRow {
        padding: 0.9vw 1.04vw;
        border-radius: 0.9vw;
        gap: 0.69vw;
        width: 100%;
    }

    .twitchLeaderboardSidebar .twitchWinnerPlace,
    .twitchLeaderboardSidebar .twitchWinnerCount,
    .twitchLeaderboardSidebar .twitchWinnerName {
        font-size: 0.98vw;
    }
}

@media (max-width: 360px) {
    .container { padding: 10px; }
    h1 { font-size: 1.3em; }
    #guessInput { font-size: 0.95em; }

    /* Компактніші кнопки на дуже малих екранах */
    #giveUpModal .btn-wide {
        padding: 8px 10px;
        font-size: 0.9em;
        min-width: 60px;
    }

    .menu-button {
        font-size: 1.5em;
        padding: 0 8px;
    }

    /* Компактніші елементи списку */
    .guessItem {
        min-height: 40px;
        margin: 6px 0;
    }
    .guessText {
        min-height: 40px;
        padding: 6px 10px;
    }

    .modal-content { padding: 15px; }
    .modal-content h2 { font-size: 1.1em; }
    .create-game-shell { padding: 12px 10px 28px; }
    .create-game-panel { padding: 14px; }
    .dev-archive-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .create-game-link-row {
        flex-direction: column;
    }
    .create-game-actions {
        flex-direction: column;
        align-items: stretch;
    }
    .create-game-submit {
        width: 100%;
    }
    .create-game-copy-btn {
        width: 100%;
    }
    .dev-archive-logout,
    .dev-archive-save {
        width: 100%;
    }
    .twitchLeaderboardPanel {
        padding: 12px;
        border-radius: 12px;
    }
    .twitchLeaderboardPanelHeader {
        gap: 10px;
    }
    .twitchLeaderboardPanelTitle {
        font-size: 0.98em;
    }
    #authorshipContent {
        font-size: 0.95em;
        line-height: 1.6;
    }
}
