/* ========================================
   Reversi – CSS Styles
   Green Board with Glossy Stones
   ======================================== */

/* ---- Landscape Blocker ---- */
.landscape-blocker {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: linear-gradient(180deg, #5b8c3e, #3d6b28);
    justify-content: center;
    align-items: center;
}
.landscape-blocker-content {
    text-align: center;
    color: white;
    font-family: 'Outfit', sans-serif;
}
.landscape-blocker-content p {
    font-size: 1.2rem;
    font-weight: 700;
    margin-top: 16px;
}
.rotate-icon {
    font-size: 4rem;
    animation: rotate-phone 2s ease-in-out infinite;
}
@keyframes rotate-phone {
    0%, 100% { transform: rotate(90deg); }
    50% { transform: rotate(0deg); }
}
@media (orientation: landscape) and (max-height: 500px) {
    .landscape-blocker { display: flex; }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Outfit', sans-serif;
    background: url('../img/background.png') center center / cover no-repeat fixed;
    min-height: 100vh;
    overflow: auto;
    color: #333;
    overscroll-behavior: none;
}

/* ---- Screens ---- */
.screen {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
}
.screen.visible {
    display: flex;
}
.overlay {
    background: rgba(0, 0, 0, 0.5);
    z-index: 100;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
}

/* ---- Title Logo ---- */
.title-logo {
    display: block;
    max-width: 340px;
    margin: 8px auto 0;
}

/* ---- Setup Screen ---- */
#setup-screen {
    justify-content: center;
    align-items: center;
    overflow-y: auto;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
    padding: 20px;
    background: url('../img/background.png') center center / cover no-repeat fixed;
}
#setup-screen::-webkit-scrollbar { display: none; /* Chrome/Safari */ }

/* Menu outer frame (dark wood border) */
.menu {
    width: min(92vw, 640px);
    border-radius: 42px;
    padding: 18px;
    background:
        linear-gradient(180deg, #d49a58 0%, #b87739 55%, #8e5526 100%);
    box-shadow:
        0 18px 36px rgba(84, 49, 19, 0.35),
        inset 0 2px 0 rgba(255,255,255,0.3),
        inset 0 -3px 0 rgba(80, 42, 18, 0.5);
}

/* Menu inner panel (light wood grain) */
.menu-inner {
    position: relative;
    border-radius: 32px;
    padding: 22px 28px 28px;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.18), rgba(255,255,255,0.04)),
        #f2d5a0;
    box-shadow:
        inset 0 0 0 2px rgba(255,245,220,0.4),
        inset 0 8px 16px rgba(255,255,255,0.18),
        inset 0 -10px 18px rgba(151, 96, 36, 0.12);
}

/* Top header (raised wood panel) */
.top-header {
    position: relative;
    margin: -6px -10px 18px;
    padding: 24px 24px 20px;
    border-radius: 24px;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.26), rgba(255,255,255,0.08)),
        #f5dcae;
    box-shadow:
        0 4px 12px rgba(114, 69, 28, 0.12),
        inset 0 2px 0 rgba(255,255,255,0.5),
        inset 0 -2px 0 rgba(145, 95, 38, 0.18);
    text-align: center;
    overflow: hidden;
}
.title-logo {
    max-width: 100%;
    height: auto;
}

/* Language switch */
.lang-switch {
    position: absolute;
    top: 18px;
    right: 18px;
    display: flex;
    gap: 8px;
}
.lang-btn {
    border: 2px solid rgba(122, 74, 32, 0.18);
    background: rgba(255,255,255,0.45);
    color: #8f8f8f;
    border-radius: 10px;
    width: 38px;
    height: 32px;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    font-family: 'Outfit', sans-serif;
    transition: all 0.2s;
}
.lang-btn.active {
    background: linear-gradient(180deg, #3f97d6, #2c77b7);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 10px rgba(44, 119, 183, 0.25);
}

/* Section layout */
.section {
    margin-top: 22px;
}
.section-title {
    margin: 0 0 12px;
    color: #8b5a2b;
    font-size: clamp(16px, 2vw, 22px);
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-shadow: 0 1px 0 rgba(255,255,255,0.4);
}

/* Button rows */
.button-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}
.difficulty-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

/* Menu buttons (wood) */
.menu-btn {
    min-height: 60px;
    border-radius: 18px;
    border: 2px solid rgba(161, 112, 49, 0.36);
    background:
        linear-gradient(180deg, rgba(255,255,255,0.7), rgba(255,255,255,0.3)),
        linear-gradient(180deg, #fff8eb, #f0ddba);
    color: #5d3516;
    font-family: 'Outfit', sans-serif;
    font-size: clamp(16px, 1.8vw, 20px);
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow:
        0 4px 10px rgba(120, 72, 24, 0.12),
        inset 0 2px 0 rgba(255,255,255,0.7),
        inset 0 -2px 0 rgba(148, 101, 43, 0.16);
}
.menu-btn:hover {
    background:
        linear-gradient(180deg, rgba(255,255,255,0.85), rgba(255,255,255,0.5)),
        linear-gradient(180deg, #fff8eb, #f0ddba);
}

/* Active green state */
.menu-btn.active-green {
    color: white;
    border-color: rgba(59, 130, 33, 0.55);
    background:
        linear-gradient(180deg, rgba(255,255,255,0.15), rgba(255,255,255,0.02)),
        linear-gradient(180deg, #6bce4d, #40b83b 55%, #2a8f2c);
    text-shadow: 0 1px 1px rgba(0,0,0,0.18);
    box-shadow:
        0 6px 14px rgba(62, 136, 44, 0.2),
        inset 0 2px 0 rgba(255,255,255,0.22),
        inset 0 -2px 0 rgba(22, 105, 21, 0.28);
}

/* Start button */
.start-btn {
    width: 100%;
    margin-top: 16px;
    min-height: 70px;
    border-radius: 20px;
    border: 2px solid rgba(59, 130, 33, 0.55);
    background:
        linear-gradient(180deg, rgba(255,255,255,0.14), rgba(255,255,255,0.02)),
        linear-gradient(180deg, #5bd648, #33bc44 58%, #24952d);
    color: white;
    font-family: 'Outfit', sans-serif;
    font-size: clamp(20px, 2.5vw, 30px);
    font-weight: 900;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow:
        0 8px 18px rgba(50, 126, 41, 0.22),
        inset 0 2px 0 rgba(255,255,255,0.24),
        inset 0 -2px 0 rgba(17, 100, 17, 0.32);
    text-shadow: 0 1px 1px rgba(0,0,0,0.18);
}
.start-btn:hover {
    transform: translateY(-2px);
    box-shadow:
        0 12px 24px rgba(50, 126, 41, 0.28),
        inset 0 2px 0 rgba(255,255,255,0.24),
        inset 0 -2px 0 rgba(17, 100, 17, 0.32);
}

/* Bottom links */
.bottom-links {
    margin-top: 18px;
    display: flex;
    justify-content: center;
    gap: 18px;
    flex-wrap: wrap;
}
.small-btn {
    min-width: 180px;
    min-height: 56px;
    border-radius: 999px;
    border: 2px solid rgba(161, 112, 49, 0.28);
    background:
        linear-gradient(180deg, rgba(255,255,255,0.6), rgba(255,255,255,0.22)),
        linear-gradient(180deg, #fff8ea, #f1dfbc);
    color: #8a5828;
    font-family: 'Outfit', sans-serif;
    font-size: clamp(16px, 1.8vw, 19px);
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow:
        0 4px 10px rgba(120, 72, 24, 0.1),
        inset 0 2px 0 rgba(255,255,255,0.7),
        inset 0 -2px 0 rgba(148, 101, 43, 0.14);
}
.small-btn:hover {
    background:
        linear-gradient(180deg, rgba(255,255,255,0.8), rgba(255,255,255,0.45)),
        linear-gradient(180deg, #fff8ea, #f1dfbc);
}

/* General button base */
.btn {
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    padding: 12px 28px;
    border: none;
    border-radius: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.5px;
}
.btn:hover {
    transform: translateY(-2px);
}
.btn-primary {
    color: white;
    border: 2px solid rgba(59, 130, 33, 0.55);
    background:
        linear-gradient(180deg, rgba(255,255,255,0.14), rgba(255,255,255,0.02)),
        linear-gradient(180deg, #5bd648, #33bc44 58%, #24952d);
    font-size: 1.1rem;
    padding: 14px 36px;
    box-shadow:
        0 6px 14px rgba(50, 126, 41, 0.2),
        inset 0 2px 0 rgba(255,255,255,0.22),
        inset 0 -2px 0 rgba(17, 100, 17, 0.28);
    text-shadow: 0 1px 1px rgba(0,0,0,0.18);
}
.btn-primary:hover {
    box-shadow:
        0 10px 22px rgba(50, 126, 41, 0.28),
        inset 0 2px 0 rgba(255,255,255,0.22),
        inset 0 -2px 0 rgba(17, 100, 17, 0.28);
}
.btn-secondary {
    border: 2px solid rgba(161, 112, 49, 0.36);
    background:
        linear-gradient(180deg, rgba(255,255,255,0.7), rgba(255,255,255,0.3)),
        linear-gradient(180deg, #fff8eb, #f0ddba);
    color: #5d3516;
    box-shadow:
        0 4px 10px rgba(120, 72, 24, 0.12),
        inset 0 2px 0 rgba(255,255,255,0.7),
        inset 0 -2px 0 rgba(148, 101, 43, 0.16);
}

/* ---- Game Screen ---- */
:root {
    --ui-brown: #6d4924;
    --ui-border: rgba(151, 110, 53, 0.75);
    --ui-shadow: 0 8px 18px rgba(61, 38, 14, 0.22);
    --ui-highlight: rgba(255, 255, 255, 0.75);
    --ui-separator: rgba(119, 82, 35, 0.25);
}

.game-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 100%;
    padding: 20px 24px;
}

/* Top bar */
.top-bar {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 14px;
    width: 100%;
    max-width: 620px;
}
.score-left { justify-self: start; }
.score-right { justify-self: end; }

/* Wood panel shared */
.score-panel,
.turn-panel,
.bottom-bar {
    border-radius: 999px;
    border: 2px solid var(--ui-border);
    background:
        linear-gradient(180deg,
            rgba(255, 250, 238, 0.98) 0%,
            rgba(241, 224, 185, 0.96) 52%,
            rgba(225, 196, 137, 0.95) 100%
        );
    box-shadow:
        var(--ui-shadow),
        inset 0 2px 0 var(--ui-highlight),
        inset 0 -4px 10px rgba(145, 98, 42, 0.14),
        0 0 0 4px rgba(255, 245, 221, 0.12);
}

/* Score panels */
.score-panel {
    min-width: 120px;
    min-height: 58px;
    padding: 8px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
}
.score-value {
    font-size: clamp(24px, 3vw, 36px);
    font-weight: 800;
    line-height: 1;
    color: var(--ui-brown);
    min-width: 24px;
}

/* Turn panel */
.turn-panel {
    min-width: min(40vw, 400px);
    min-height: 58px;
    padding: 8px 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: clamp(15px, 1.8vw, 20px);
    font-weight: 700;
    color: var(--ui-brown);
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.55);
}
.turn-text {
    white-space: nowrap;
}

/* CSS stones */
.stone {
    flex: 0 0 auto;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    box-shadow:
        inset -7px -8px 10px rgba(0, 0, 0, 0.22),
        inset 8px 8px 10px rgba(255, 255, 255, 0.15),
        0 6px 10px rgba(0, 0, 0, 0.22);
}
.stone.small {
    width: 28px;
    height: 28px;
}
.stone.black {
    background: radial-gradient(circle at 32% 28%, #5e6681 0%, #273149 34%, #121826 70%, #070a10 100%);
    border: 1px solid rgba(20, 26, 40, 0.75);
}
.stone.white {
    background: radial-gradient(circle at 30% 28%, #ffffff 0%, #f6f7fb 36%, #d9dfe8 70%, #c2cad6 100%);
    border: 1px solid rgba(184, 191, 201, 0.8);
}

/* Board container */
.board-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 500px;
    aspect-ratio: 1;
}
canvas {
    display: block;
    cursor: pointer;
}

/* Pass message */
.pass-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.7);
    color: #fff;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1rem;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    z-index: 50;
}
.pass-message.visible {
    opacity: 1;
}

/* Bottom bar */
.bottom-bar {
    align-self: center;
    display: flex;
    align-items: center;
    gap: 0;
    padding: 8px;
}
.ui-button {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--ui-brown);
    font-family: 'Outfit', sans-serif;
    font-size: clamp(16px, 1.8vw, 20px);
    font-weight: 700;
    padding: 12px 24px;
    min-width: 140px;
    border-radius: 999px;
    cursor: pointer;
    position: relative;
    transition: background 0.2s ease, transform 0.2s ease;
}
.ui-button:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.24);
    transform: translateY(-1px);
}
.ui-button:disabled {
    opacity: 0.35;
    cursor: default;
}
.ui-button + .ui-button::before {
    content: "";
    position: absolute;
    left: 0;
    top: 14px;
    bottom: 14px;
    width: 1px;
    background: var(--ui-separator);
}
.icon {
    display: inline-block;
    width: 1.2em;
    text-align: center;
    margin-right: 6px;
}

/* ---- Overlays ---- */
.overlay-panel {
    border-radius: 32px;
    padding: 28px 30px;
    max-width: 580px;
    width: 90%;
    text-align: center;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.18), rgba(255,255,255,0.04)),
        #f2d5a0;
    border: 4px solid;
    border-image: linear-gradient(180deg, #d49a58, #8e5526) 1;
    border-image: none;
    border-color: #b87739;
    box-shadow:
        0 18px 36px rgba(84, 49, 19, 0.35),
        inset 0 0 0 2px rgba(255,245,220,0.4),
        inset 0 8px 16px rgba(255,255,255,0.18),
        inset 0 -10px 18px rgba(151, 96, 36, 0.12);
    color: #5d3516;
}
.overlay-panel h2 {
    font-size: 1.5rem;
    font-weight: 800;
    color: #8b5a2b;
    margin-bottom: 16px;
    text-shadow: 0 1px 0 rgba(255,255,255,0.4);
}
.overlay-panel-white {
    /* same wood style */
    color: #5d3516;
}
.overlay-panel-white h2 {
    color: #8b5a2b;
    font-size: 1.5rem;
    font-weight: 800;
}
.quit-subtitle {
    color: rgba(93, 53, 22, 0.6);
    font-size: 0.95rem;
    margin-bottom: 8px;
}
.btn-quit {
    color: #5d3516;
    border: 2px solid rgba(161, 112, 49, 0.36);
    background:
        linear-gradient(180deg, rgba(255,255,255,0.7), rgba(255,255,255,0.3)),
        linear-gradient(180deg, #fff8eb, #f0ddba);
    font-size: 1.05rem;
    font-weight: 800;
    padding: 12px 28px;
    border-radius: 18px;
    box-shadow:
        0 4px 10px rgba(120, 72, 24, 0.12),
        inset 0 2px 0 rgba(255,255,255,0.7),
        inset 0 -2px 0 rgba(148, 101, 43, 0.16);
}
.btn-quit:hover {
    transform: translateY(-2px);
}
.overlay-scroll {
    max-height: 80vh;
    overflow-y: auto;
}
.overlay-buttons {
    display: flex;
    gap: 12px;
    margin-top: 18px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Game over */
.gameover-score {
    font-size: 1.1rem;
    color: rgba(93, 53, 22, 0.6);
    margin-bottom: 8px;
}

/* Help body */
.help-body {
    text-align: left;
    color: rgba(93, 53, 22, 0.75);
    font-size: 0.9rem;
    line-height: 1.6;
}
.help-body h3 {
    color: #8b5a2b;
    margin: 12px 0 4px;
    font-size: 1rem;
}
.help-body ul {
    padding-left: 18px;
    margin: 6px 0;
}

/* Settings */
.settings-options {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin: 20px 0;
}
.settings-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: rgba(255,255,255,0.35);
    border-radius: 14px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 700;
    color: #5d3516;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.5);
    position: relative;
}
.settings-option input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-slider {
    width: 52px;
    height: 28px;
    background: #c4b69a;
    border-radius: 14px;
    position: relative;
    transition: background 0.3s;
    flex-shrink: 0;
    margin-left: 12px;
}
.toggle-slider::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.3s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.settings-option input:checked + .toggle-slider {
    background: linear-gradient(180deg, #6bce4d, #40b83b);
}
.settings-option input:checked + .toggle-slider::after {
    transform: translateX(24px);
}

/* Stats grid */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin: 12px 0;
}
.stat-item {
    background: rgba(255,255,255,0.35);
    border-radius: 14px;
    padding: 12px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.5);
}
.stat-label {
    display: block;
    font-size: 0.75rem;
    color: rgba(93, 53, 22, 0.5);
    text-transform: uppercase;
    margin-bottom: 4px;
}
.stat-value {
    font-size: 1.4rem;
    font-weight: 800;
    color: #8b5a2b;
}

/* Playit-Online Logo */
.playit-logo-link {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 100;
    opacity: 0.6;
    transition: opacity 0.2s;
}
.playit-logo-link:hover {
    opacity: 1;
}
.playit-logo {
    height: 50px;
    width: auto;
    display: block;
}

/* Build Version */
.build-version {
    position: fixed;
    bottom: 6px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    color: rgba(255, 255, 255, 0.3);
    z-index: 100;
    pointer-events: none;
    font-family: monospace;
}
/* ---- Lobby ---- */
#lobby-screen {
    justify-content: center;
    align-items: center;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 20px;
    background: url('../img/background.png') center center / cover no-repeat fixed;
}
#lobby-screen::-webkit-scrollbar { display: none; }

.lobby-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: #8b5a2b;
    text-shadow: 0 1px 0 rgba(255,255,255,0.4);
    text-align: center;
    margin: 0;
}
.player-name-display {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
    color: #5d3516;
    font-weight: 600;
}
.player-name-value {
    font-weight: 800;
    color: #4fa83d;
    font-size: 1.1rem;
}
.lobby-input {
    width: 100%;
    padding: 14px 18px;
    border-radius: 14px;
    border: 2px solid rgba(161, 112, 49, 0.3);
    background: rgba(255,255,255,0.5);
    color: #5d3516;
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.06);
    box-sizing: border-box;
}
.lobby-input:focus {
    outline: none;
    border-color: #4fa83d;
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.06), 0 0 0 3px rgba(79,168,61,0.15);
}
.lobby-code-input {
    text-transform: uppercase;
    letter-spacing: 0.2em;
    font-size: 1.3rem;
    text-align: center;
    font-weight: 800;
}
.join-row {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.join-row .lobby-input { flex: 1; }
.join-confirm-btn {
    min-height: 0 !important;
    padding: 14px 24px !important;
    margin-top: 0 !important;
    white-space: nowrap;
    font-size: 1rem !important;
}

.waiting-panel {
    text-align: center;
    padding: 24px 0;
    color: #5d3516;
}
.waiting-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(139, 90, 43, 0.2);
    border-top-color: #4fa83d;
    border-radius: 50%;
    margin: 0 auto 16px;
    animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.room-code-display {
    margin: 16px 0 8px;
    font-size: 1rem;
}
.room-code-value {
    display: inline-block;
    background: rgba(255,255,255,0.5);
    padding: 8px 20px;
    border-radius: 12px;
    font-size: 1.6rem;
    font-weight: 900;
    letter-spacing: 0.15em;
    color: #4fa83d;
    border: 2px solid rgba(79,168,61,0.3);
    margin-left: 8px;
    user-select: all;
    cursor: pointer;
}
.code-hint {
    font-size: 0.85rem;
    color: rgba(93, 53, 22, 0.5);
    margin-top: 8px;
}

.connection-status {
    text-align: center;
    font-size: 0.8rem;
    margin-top: 8px;
    color: rgba(93, 53, 22, 0.5);
}

.private-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    font-size: 0.88rem;
    color: #5d3516;
    cursor: pointer;
    user-select: none;
}
.private-toggle input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 44px;
    height: 24px;
    background: rgba(139, 90, 43, 0.2);
    border-radius: 12px;
    position: relative;
    cursor: pointer;
    transition: background 0.25s;
    flex-shrink: 0;
}
.private-toggle input[type="checkbox"]::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    transition: transform 0.25s;
}
.private-toggle input[type="checkbox"]:checked {
    background: #4fa83d;
}
.private-toggle input[type="checkbox"]:checked::after {
    transform: translateX(20px);
}

.button-row-3 {
    grid-template-columns: 1fr 1fr 1fr !important;
}

.room-list {
    max-height: 180px;
    overflow-y: auto;
    scrollbar-width: thin;
}
.room-list-empty {
    text-align: center;
    padding: 16px;
    color: rgba(93, 53, 22, 0.4);
    font-size: 0.9rem;
}
.room-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: rgba(255,255,255,0.35);
    border-radius: 12px;
    margin-bottom: 8px;
}
.room-item:last-child { margin-bottom: 0; }
.room-host {
    font-weight: 700;
    color: #5d3516;
    font-size: 0.95rem;
}
.room-host::before {
    content: '🟢 ';
}
.room-join-btn {
    background: linear-gradient(to bottom, #58c246, #3d9b2e);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 6px 16px;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}
.room-join-btn:hover {
    background: linear-gradient(to bottom, #6dd25a, #4aaf38);
}
.invite-link-display {
    display: flex;
    gap: 6px;
    margin-top: 8px;
}
.invite-link-input {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid rgba(139, 90, 43, 0.2);
    border-radius: 10px;
    background: rgba(255,255,255,0.5);
    font-family: 'Outfit', sans-serif;
    font-size: 0.8rem;
    color: #5d3516;
    outline: none;
    min-width: 0;
}
.copy-invite-btn {
    background: linear-gradient(to bottom, #f0c97a, #d4a84a);
    border: none;
    border-radius: 10px;
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    color: #5d3516;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
    white-space: nowrap;
}
.copy-invite-btn:hover {
    background: linear-gradient(to bottom, #f5d68a, #ddb55a);
}
.code-hint {
    text-align: center;
    font-size: 1.05rem;
    font-weight: 700;
    color: #5d3516;
    margin-top: 12px;
}
.score-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.player-label {
    display: none;
    font-size: 0.6rem;
    font-weight: 700;
    color: rgba(93, 53, 22, 0.55);
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
    line-height: 1;
    margin-top: 2px;
}
.player-label.visible {
    display: block;
}
.score-panel.has-label {
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    padding: 6px 14px;
    min-height: 54px;
}
.score-panel.has-label .score-row { gap: 6px; }
.score-panel.has-label .stone { width: 22px; height: 22px; }
.score-panel.has-label .score-value { font-size: clamp(16px, 2vw, 22px); }

/* ---- Responsive ---- */
@media (max-width: 900px) {
    .game-layout { padding: 14px; }
    .top-bar { gap: 8px; }
    .score-panel { min-width: 80px; min-height: 44px; padding: 4px 10px; }
    .score-value { font-size: clamp(18px, 2.5vw, 28px); }
    .turn-panel { min-height: 44px; padding: 4px 12px; }
    .turn-text { font-size: clamp(12px, 1.6vw, 16px); }
    .stone { width: 24px; height: 24px; }
    .stone.small { width: 20px; height: 20px; }
    .bottom-bar { width: min(90vw, 380px); justify-content: center; }
    .ui-button { min-width: 0; flex: 1; padding-inline: 16px; }
    .playit-logo-link { display: none; }
}
@media (max-width: 720px) {
    .menu-inner { padding: 18px 18px 22px; }
    .small-btn { min-width: 0; width: 100%; }
    .bottom-links { gap: 12px; }
}
@media (max-width: 480px) {
    .game-layout { padding: 8px; }
    .score-panel { min-width: 70px; min-height: 46px; padding: 6px 10px; }
    .turn-panel { width: 180px; min-width: 0; min-height: 46px; padding: 6px 10px; font-size: 13px; }
    .turn-text { white-space: normal; text-align: center; line-height: 1.2; }

    /* Menu adjustments */
    .menu-inner { padding: 14px 14px 18px; }
    .section { margin-top: 14px; }
    .section-title { font-size: 14px; margin-bottom: 8px; }
    .button-row, .difficulty-row { gap: 8px; }
    .button-row-3 { grid-template-columns: 1fr 1fr 1fr !important; }
    .menu-btn { min-height: 48px; font-size: 14px; border-radius: 14px; padding: 4px 8px; }
    .start-btn { padding: 14px 20px; font-size: 18px; border-radius: 18px; }
    .small-btn { padding: 12px 16px; font-size: 14px; }
    .game-title { max-width: 200px; }

    /* Lobby adjustments */
    .lobby-title { font-size: 1.2rem; }
    .player-name-display { font-size: 0.85rem; }
    .player-name-value { font-size: 0.95rem; }
    .room-item { padding: 8px 10px; }
    .room-host { font-size: 0.85rem; }
    .room-join-btn { padding: 5px 12px; font-size: 0.8rem; }
    .private-toggle { font-size: 0.8rem; }
    .private-toggle input[type="checkbox"] { width: 38px; height: 20px; }
    .private-toggle input[type="checkbox"]::after { width: 14px; height: 14px; }
    .private-toggle input[type="checkbox"]:checked::after { transform: translateX(18px); }
    .invite-link-input { font-size: 0.7rem; padding: 6px 8px; }
    .room-code-value { font-size: 1.4rem; }
}
@media (max-height: 750px) {
    .menu { transform: scale(0.85); transform-origin: center center; }
}
@media (max-height: 620px) {
    .menu { transform: scale(0.72); transform-origin: center center; }
}
