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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0a0e27;
    background-image: 
        radial-gradient(at 20% 30%, rgba(102, 126, 234, 0.15) 0px, transparent 50%),
        radial-gradient(at 80% 70%, rgba(118, 75, 162, 0.15) 0px, transparent 50%),
        radial-gradient(at 50% 50%, rgba(255, 215, 0, 0.05) 0px, transparent 50%);
    min-height: 100vh;
    overflow: hidden;
}

.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.screen.active {
    display: flex;
    opacity: 1;
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.overlay.active {
    display: flex;
    opacity: 1;
}

/* Splash Screen */
.splash-content {
    text-align: center;
    color: white;
}

.game-logo {
    animation: fadeInUp 1s ease;
}

.logo-icon {
    font-size: 80px;
    margin-bottom: 15px;
    animation: bounce 2s infinite;
    filter: drop-shadow(0 8px 15px rgba(255, 215, 0, 0.4));
}

.logo-text {
    font-size: 2.5em;
    font-weight: 900;
    background: linear-gradient(135deg, #ffd700, #ffed4e, #ffd700);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 2px;
    margin-bottom: 8px;
}

.logo-subtitle {
    font-size: 1em;
    opacity: 0.9;
    letter-spacing: 3px;
    color: #a8dadc;
}

.loading-bar {
    width: 200px;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    margin: 30px auto 12px;
    overflow: hidden;
}

.loading-progress {
    height: 100%;
    background: linear-gradient(90deg, #ffd700, #ffed4e, #ffd700);
    border-radius: 10px;
    animation: loading 2s ease-in-out;
}

.loading-text {
    font-size: 0.9em;
    opacity: 0.8;
    color: #a8dadc;
    letter-spacing: 1px;
}

@keyframes loading {
    0% { width: 0%; }
    100% { width: 100%; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}

/* Main Menu */
.menu-background {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.gradient-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.3;
    animation: orbFloat 8s ease-in-out infinite;
}

.orb-1 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(102, 126, 234, 0.6), transparent);
    top: -100px;
    left: -100px;
}

.orb-2 {
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.4), transparent);
    top: 50%;
    right: -80px;
    animation-delay: 2s;
}

.orb-3 {
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(118, 75, 162, 0.5), transparent);
    bottom: -50px;
    left: 50%;
    animation-delay: 4s;
}

@keyframes orbFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -30px) scale(1.1); }
    66% { transform: translate(-20px, 20px) scale(0.9); }
}

.floating-piece {
    position: absolute;
    font-size: 35px;
    opacity: 0.12;
    animation: float 6s ease-in-out infinite;
}

.piece-1 { top: 10%; left: 10%; }
.piece-2 { top: 20%; right: 15%; animation-delay: 1.5s; }
.piece-3 { bottom: 20%; left: 15%; animation-delay: 3s; }
.piece-4 { bottom: 15%; right: 10%; animation-delay: 4.5s; }

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); opacity: 0.12; }
    50% { transform: translateY(-30px) rotate(180deg); opacity: 0.18; }
}

.menu-content {
    position: relative;
    z-index: 1;
    width: 90%;
    max-width: 360px;
    padding: 20px 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 25px;
}

.menu-header {
    text-align: center;
    animation: fadeInDown 0.8s ease;
}

.game-logo-main {
    margin-bottom: 18px;
}

.logo-circle {
    width: 85px;
    height: 85px;
    margin: 0 auto;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.2), rgba(255, 215, 0, 0.05));
    border: 3px solid rgba(255, 215, 0, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.3);
    animation: logoRotate 10s linear infinite, logoPulse 2s ease-in-out infinite;
}

.logo-inner {
    font-size: 2.8em;
    filter: drop-shadow(0 4px 8px rgba(255, 215, 0, 0.5));
}

@keyframes logoRotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes logoPulse {
    0%, 100% { box-shadow: 0 0 30px rgba(255, 215, 0, 0.3); }
    50% { box-shadow: 0 0 50px rgba(255, 215, 0, 0.5); }
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.game-title-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
}

.title-decoration {
    font-size: 1.5em;
    color: #ffd700;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.2); }
}

.game-title {
    font-size: 2.2em;
    font-weight: 900;
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 50%, #ffd700 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 3px;
    animation: shimmerText 3s linear infinite;
}

@keyframes shimmerText {
    0% { background-position: 0% center; }
    100% { background-position: 200% center; }
}

.game-subtitle {
    font-size: 0.85em;
    color: #a8dadc;
    letter-spacing: 5px;
    font-weight: 700;
    margin-bottom: 10px;
}

.title-underline {
    width: 120px;
    height: 3px;
    background: linear-gradient(90deg, transparent, #ffd700, transparent);
    margin: 0 auto;
    border-radius: 2px;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.menu-main {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.play-button {
    position: relative;
    width: 100%;
    height: 65px;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 50%, #ff6b6b 100%);
    border: none;
    border-radius: 16px;
    cursor: pointer;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.4);
    transition: all 0.3s ease;
}

.continue-button {
    width: 100%;
    height: 52px;
    border: 2px solid rgba(255, 215, 0, 0.35);
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.16), rgba(255, 255, 255, 0.08));
    color: #fff7d0;
    font-weight: 800;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.25s ease;
}

.continue-button:active {
    transform: scale(0.98);
    border-color: rgba(255, 215, 0, 0.6);
}

.continue-icon {
    font-size: 1.1em;
}

.continue-text {
    font-size: 0.9em;
}

.hidden {
    display: none !important;
}

.play-button:active {
    transform: scale(0.96);
}

.play-button-inner {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    height: 100%;
}

.play-icon-wrapper {
    width: 38px;
    height: 38px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.play-icon {
    font-size: 1.3em;
    color: white;
    margin-left: 2px;
}

.play-text {
    font-size: 1.5em;
    font-weight: 900;
    color: white;
    letter-spacing: 2px;
}

.menu-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.menu-card {
    position: relative;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.06));
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 14px;
    padding: 18px 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: hidden;
}

.menu-card:active {
    transform: translateY(-3px) scale(0.98);
    border-color: rgba(255, 215, 0, 0.6);
}

.card-icon {
    font-size: 2.2em;
    transition: transform 0.3s ease;
}

.card-label {
    font-size: 0.85em;
    font-weight: 700;
    color: white;
    text-align: center;
}

.menu-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.social-links {
    display: flex;
    gap: 14px;
}

.social-btn {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.06));
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.social-btn:active {
    transform: scale(0.9);
}

.social-icon {
    font-size: 1.4em;
}

.copyright {
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.72em;
}

/* Mode Selection */
.mode-background {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.mode-content {
    position: relative;
    z-index: 1;
    width: 90%;
    max-width: 320px;
    padding: 15px 10px 20px;
    top: -5rem;
}

#modeScreen {
    align-items: flex-start;
    overflow-y: auto;
    overflow-x: hidden;
    padding-top: calc(10px + env(safe-area-inset-top, 0px));
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    -webkit-overflow-scrolling: touch;
}

#modeScreen .mode-content {
    top: 0;
    margin: 0 auto;
}

.back-btn-modern {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.06));
    border: 2px solid rgba(255, 255, 255, 0.2);
    width: 35px;
    height: 35px;
    border-radius: 10px;
    font-size: 1.1em;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
}

.back-btn-modern:active {
    transform: scale(0.9);
}

.mode-header {
    text-align: center;
    margin-bottom: 18px;
}

.mode-title {
    font-size: 1.4em;
    font-weight: 900;
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 5px;
}

.mode-subtitle {
    color: #a8dadc;
    font-size: 0.75em;
}

.mode-cards-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#modeScreen::-webkit-scrollbar {
    width: 6px;
}

#modeScreen::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.08);
}

#modeScreen::-webkit-scrollbar-thumb {
    background: rgba(255, 215, 0, 0.45);
    border-radius: 999px;
}

.mode-card-modern {
    position: relative;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.06));
    backdrop-filter: blur(15px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 14px;
    padding: 14px;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s ease;
}

.mode-card-modern:active {
    transform: translateY(-3px) scale(0.98);
    border-color: rgba(255, 215, 0, 0.6);
}

.mode-card-content {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.mode-icon-large {
    font-size: 2.2em;
    line-height: 1;
    white-space: nowrap;
    letter-spacing: -2px;
}

.mode-name {
    font-size: 1.15em;
    font-weight: 800;
    color: white;
}

.mode-desc {
    color: #a8dadc;
    font-size: 0.75em;
    margin: 0 0 4px 0;
}

.mode-badge-modern {
    display: flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.25), rgba(255, 215, 0, 0.15));
    border: 2px solid rgba(255, 215, 0, 0.4);
    padding: 5px 10px;
    border-radius: 10px;
    color: #ffd700;
    font-weight: 700;
    font-size: 0.7em;
}

.mode-difficulty {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 3px;
}

.mode-online-state {
    margin-top: 6px;
    font-size: 0.68em;
    font-weight: 700;
    letter-spacing: 0.35px;
    color: rgba(168, 218, 220, 0.9);
    text-align: center;
}

.mode-card-modern.online-disabled {
    opacity: 0.62;
    filter: saturate(0.7);
    border-color: rgba(255, 255, 255, 0.15);
}

.mode-card-modern.online-disabled:active {
    transform: none;
    border-color: rgba(255, 255, 255, 0.15);
}

.difficulty-label {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.7em;
    font-weight: 600;
}

.difficulty-stars {
    font-size: 0.85em;
    color: #ffe27a;
    font-weight: 800;
}

.difficulty-selector {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.difficulty-btn {
    border: 1px solid rgba(255, 255, 255, 0.24);
    background: linear-gradient(135deg, rgba(18, 30, 62, 0.7), rgba(12, 22, 50, 0.65));
    color: rgba(255, 255, 255, 0.9);
    border-radius: 999px;
    padding: 4px 11px;
    font-size: 0.68em;
    font-weight: 700;
    letter-spacing: 0.3px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.difficulty-btn.active {
    border-color: rgba(255, 215, 0, 0.65);
    color: #ffe27a;
    background: linear-gradient(135deg, rgba(68, 95, 144, 0.95), rgba(38, 62, 106, 0.95));
    box-shadow: 0 0 14px rgba(255, 215, 0, 0.22);
}

.difficulty-btn:active {
    transform: scale(0.95);
}

/* Game Screen */
.game-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 14px 12px 12px;
    max-width: 450px;
    min-width: 320px;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
    border-radius: 26px;
    background:
        radial-gradient(130% 80% at 50% -10%, rgba(255, 215, 0, 0.12), transparent 56%),
        radial-gradient(100% 70% at 50% 120%, rgba(79, 172, 254, 0.14), transparent 62%),
        linear-gradient(180deg, rgba(9, 16, 44, 0.82), rgba(6, 11, 30, 0.94));
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 18px 46px rgba(0, 0, 0, 0.48), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.game-container::before,
.game-container::after {
    content: "";
    position: absolute;
    pointer-events: none;
    z-index: 0;
}

.game-container::before {
    width: 230px;
    height: 230px;
    top: -115px;
    right: -95px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.22), rgba(255, 215, 0, 0));
    filter: blur(8px);
}

.game-container::after {
    width: 180px;
    height: 180px;
    bottom: -90px;
    left: -75px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(79, 172, 254, 0.2), rgba(79, 172, 254, 0));
    filter: blur(10px);
}

.game-container > * {
    position: relative;
    z-index: 1;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding: 4px;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(14, 22, 54, 0.72), rgba(8, 14, 36, 0.52));
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
    position: relative;
}

.icon-btn {
    background: linear-gradient(135deg, rgba(36, 50, 88, 0.96), rgba(20, 31, 62, 0.95));
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.24);
    width: 48px;
    height: 48px;
    border-radius: 14px;
    font-size: 1.5em;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.46), inset 0 1px 0 rgba(255, 255, 255, 0.22);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 400;
    flex-shrink: 0;
}

.icon-btn:active {
    transform: scale(0.92);
}

.menu-btn {
    font-size: 1.5em;
    font-weight: 300;
    letter-spacing: -1px;
}

.game-close-btn {
    font-size: 1.7em;
    font-weight: 300;
    line-height: 1;
}

.game-mode-indicator {
    font-weight: 900;
    font-size: 1.02em;
    color: #ffe27a;
    letter-spacing: 1.2px;
    filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.5));
    flex: 1;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 10px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 132px);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
    border-radius: 0;
    border: none;
    background: transparent;
    box-shadow: none;
}

.score-board {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    padding: 6px 8px;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(13, 21, 52, 0.68), rgba(8, 14, 36, 0.44));
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.player-info {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    border-radius: 16px;
    flex: 1;
    min-width: 0;
    max-width: 45%;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.24);
}

.player-red {
    background: linear-gradient(135deg, #ff6b6b, #ee5a6f);
    color: white;
}

.player-blue {
    background: linear-gradient(135deg, #4facfe, #00f2fe);
    color: white;
}

.player-avatar {
    font-size: 1.6em;
    filter: drop-shadow(0 3px 10px rgba(0, 0, 0, 0.5));
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.player-details {
    display: flex;
    flex-direction: column;
    gap: 1px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.player-name {
    font-weight: 800;
    font-size: 0.8em;
    letter-spacing: 0.5px;
    text-shadow: 
        0 2px 0 rgba(0, 0, 0, 0.3),
        0 2px 6px rgba(0, 0, 0, 0.4);
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pieces-count {
    font-size: 0.7em;
    opacity: 0.88;
    font-weight: 600;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
}

.timer-display {
    font-size: 0.65em;
    opacity: 0.9;
    font-weight: 600;
    line-height: 1.3;
    white-space: nowrap;
    font-family: 'Courier New', monospace;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
}

.captured-badge {
    background: rgba(0, 0, 0, 0.35);
    padding: 5px 9px;
    border-radius: 12px;
    font-weight: 900;
    font-size: 0.95em;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.5);
    min-width: 28px;
    text-align: center;
    flex-shrink: 0;
}

.vs-divider {
    font-weight: 900;
    font-size: 1em;
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 1px;
    filter: drop-shadow(0 2px 10px rgba(255, 215, 0, 0.7));
    flex-shrink: 0;
    padding: 0 4px;
}

.game-board-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 10px;
    padding: 14px;
    background:
        radial-gradient(120% 90% at 50% 0%, rgba(255, 215, 0, 0.12), rgba(255, 215, 0, 0)),
        linear-gradient(135deg, rgba(24, 35, 68, 0.9), rgba(13, 22, 48, 0.92));
    border-radius: 22px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 
        0 12px 36px rgba(0, 0, 0, 0.56),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    perspective: 1500px;
    perspective-origin: center 40%;
}

#gameBoard {
    border: 3px solid rgba(139, 69, 19, 0.8);
    border-radius: 18px;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.8),
        0 10px 30px rgba(0, 0, 0, 0.6),
        inset 0 2px 6px rgba(255, 255, 255, 0.2);
    background: linear-gradient(135deg, #f5deb3 0%, #deb887 100%);
    max-width: 100%;
    height: auto;
    touch-action: none;
    transform: rotateX(15deg) rotateZ(0deg);
    transform-style: preserve-3d;
    transition: transform 0.3s ease;
}

#gameBoard.board-16 {
    max-width: none;
    transform: none;
}

#gameBoard:hover {
    transform: rotateX(12deg) rotateZ(0deg) scale(1.01);
}

#gameBoard.board-16:hover {
    transform: none;
}

.game-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px;
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(11, 17, 44, 0.72), rgba(7, 12, 30, 0.7));
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.game-action-bar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.action-btn {
    border: 1px solid rgba(255, 215, 0, 0.45);
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(56, 78, 122, 0.98), rgba(35, 55, 96, 0.98));
    color: rgba(255, 255, 255, 1);
    font-size: 0.82em;
    font-weight: 700;
    padding: 10px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 6px 16px rgba(5, 12, 35, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
}

.action-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.15), rgba(255, 215, 0, 0.08));
    opacity: 1;
    transition: opacity 0.2s ease;
}

.action-btn:hover:not(:disabled)::before {
    opacity: 1.5;
}

.action-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, rgba(68, 95, 144, 1), rgba(45, 72, 120, 1));
    border-color: rgba(255, 215, 0, 0.7);
    box-shadow: 0 8px 20px rgba(8, 18, 44, 0.55), 0 0 22px rgba(255, 215, 0, 0.22);
    transform: translateY(-2px);
}

.action-btn:active:not(:disabled) {
    transform: scale(0.92) translateY(0);
    background: linear-gradient(135deg, rgba(70, 95, 140, 1), rgba(60, 85, 125, 1));
    border-color: rgba(255, 215, 0, 0.9);
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.6), inset 0 3px 6px rgba(0, 0, 0, 0.5);
}

.action-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
    background: linear-gradient(135deg, rgba(22, 30, 58, 0.86), rgba(15, 22, 45, 0.9));
    border-color: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.78);
}

.action-btn:disabled::before {
    opacity: 0;
}

.turn-indicator {
    font-size: 1.05em;
    font-weight: 700;
    padding: 2px 0;
    text-align: center;
    background: transparent;
    border: none;
    box-shadow: none;
    color: #ffffff;
    letter-spacing: 1px;
    text-shadow: 
        0 2px 4px rgba(0, 0, 0, 0.4),
        0 0 20px rgba(255, 255, 255, 0.2);
    text-transform: capitalize;
    transition: all 0.3s ease;
    position: relative;
    outline: none;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.turn-text {
    display: inline-block;
    font-weight: 800;
}

.thinking-dots {
    display: none;
    align-items: center;
    gap: 4px;
    margin-left: 4px;
}

.thinking-dots.active {
    display: flex;
}

.thinking-dots .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    animation: dotPulse 1.4s ease-in-out infinite;
}

.thinking-dots .dot:nth-child(1) {
    animation-delay: 0s;
}

.thinking-dots .dot:nth-child(2) {
    animation-delay: 0.2s;
}

.thinking-dots .dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes dotPulse {
    0%, 60%, 100% {
        opacity: 0.3;
        transform: scale(0.8);
    }
    30% {
        opacity: 1;
        transform: scale(1.2);
    }
}

.turn-indicator::after {
    content: '';
    display: none;
}

@keyframes turnGlow {
    0%, 100% {
        text-shadow: 
            0 2px 4px rgba(0, 0, 0, 0.5),
            0 0 15px rgba(255, 215, 0, 0.3);
    }
    50% {
        text-shadow: 
            0 2px 4px rgba(0, 0, 0, 0.5),
            0 0 20px rgba(255, 215, 0, 0.5);
    }
}

.message {
    font-size: 0.84em;
    color: rgba(232, 240, 255, 0.92);
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    text-align: center;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
    font-weight: 700;
    letter-spacing: 0.3px;
    line-height: 1.4;
    text-shadow: none;
    position: relative;
    overflow: visible;
    opacity: 0.92;
}

.message[data-tone="alert"] {
    color: #ffe89e;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.25);
}

.message[data-tone="error"] {
    color: #ffb7b7;
    text-shadow: 0 0 10px rgba(255, 107, 107, 0.28);
}

.message[data-tone="success"] {
    color: #c9ffd7;
    text-shadow: 0 0 10px rgba(82, 196, 120, 0.28);
}

.message::before {
    display: none;
}

@keyframes messageShine {
    0% { left: -100%; }
    50%, 100% { left: 100%; }
}

/* Pause & Result Screens */
.pause-content, .result-content {
    background: linear-gradient(135deg, rgba(20, 30, 60, 0.98), rgba(15, 25, 50, 0.98));
    backdrop-filter: blur(20px);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 24px;
    padding: 35px 30px;
    text-align: center;
    max-width: 340px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
}


.pause-content h2, .result-title {
    font-size: 2em;
    margin-bottom: 25px;
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 900;
    letter-spacing: 1px;
    filter: drop-shadow(0 2px 10px rgba(255, 215, 0, 0.5));
}

.result-icon {
    font-size: 80px;
    margin-bottom: 15px;
    animation: scaleIn 0.5s ease;
}

@keyframes scaleIn {
    from { transform: scale(0); }
    to { transform: scale(1); }
}

.result-content.win .result-title {
    background: linear-gradient(135deg, #4CAF50, #66BB6A);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.result-content.lose .result-title {
    background: linear-gradient(135deg, #f44336, #ef5350);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.result-message {
    font-size: 1.1em;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 15px;
}

.result-stats {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.15);
    padding: 15px;
    border-radius: 14px;
    margin-bottom: 25px;
    font-size: 1em;
    color: white;
}

.pause-buttons, .result-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pause-btn, .result-btn {
    padding: 14px 25px;
    font-size: 1em;
    font-weight: 800;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    letter-spacing: 0.5px;
}

.result-btn.primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: rgba(102, 126, 234, 0.5);
}

.result-btn.primary:active {
    transform: scale(0.96);
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.4);
}

.pause-btn, .result-btn:not(.primary) {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.08));
    backdrop-filter: blur(10px);
    color: white;
    border-color: rgba(255, 255, 255, 0.2);
}

.pause-btn:active, .result-btn:not(.primary):active {
    transform: scale(0.96);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.12));
}

#onlineResignBtn {
    display: none;
}

/* Confirmation Dialog */
.confirm-content {
    background: linear-gradient(135deg, rgba(20, 30, 60, 0.98), rgba(15, 25, 50, 0.98));
    backdrop-filter: blur(20px);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    padding: 24px 20px;
    text-align: center;
    max-width: 280px;
    width: 85%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
}

.confirm-icon {
    font-size: 48px;
    margin-bottom: 10px;
    animation: pulse 1.5s ease-in-out infinite;
}

.confirm-title {
    font-size: 1.3em;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.confirm-message {
    font-size: 0.8em;
    color: rgba(255, 255, 255, 0.75);
    margin-bottom: 18px;
    line-height: 1.4;
    font-weight: 400;
}

.confirm-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.confirm-btn {
    padding: 11px 20px;
    font-size: 0.85em;
    font-weight: 700;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    letter-spacing: 0.3px;
}

.confirm-yes {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    color: white;
    border-color: rgba(255, 107, 107, 0.5);
}

.confirm-yes:hover {
    background: linear-gradient(135deg, #ff5252 0%, #e53935 100%);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
    transform: translateY(-1px);
}

.confirm-yes:active {
    transform: scale(0.97) translateY(0);
    box-shadow: 0 2px 10px rgba(255, 107, 107, 0.4);
}

.confirm-no {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.06));
    backdrop-filter: blur(10px);
    color: rgba(255, 255, 255, 0.95);
    border-color: rgba(255, 255, 255, 0.2);
}

.confirm-no:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.12));
    border-color: rgba(255, 215, 0, 0.3);
    transform: translateY(-1px);
}

.confirm-no:active {
    transform: scale(0.97) translateY(0);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.08));
}

/* Info Screens */
.info-content {
    background: linear-gradient(135deg, rgba(20, 30, 60, 0.98), rgba(15, 25, 50, 0.98));
    backdrop-filter: blur(20px);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 24px;
    padding: 35px 30px;
    max-width: 450px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    overflow-x: visible;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
}

.info-content::-webkit-scrollbar {
    width: 8px;
}

.info-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.info-content::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.4), rgba(255, 215, 0, 0.2));
    border-radius: 4px;
}

.info-content::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.6), rgba(255, 215, 0, 0.3));
}

.close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.25);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.3em;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    line-height: 1;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: rotate(90deg) scale(1.05);
}

.close-btn:active {
    transform: rotate(90deg) scale(0.95);
    background: rgba(255, 255, 255, 0.35);
}

.info-content h2 {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 2em;
    margin-bottom: 25px;
    font-weight: 900;
    letter-spacing: 1px;
    filter: drop-shadow(0 2px 10px rgba(255, 215, 0, 0.5));
    text-align: center;
}

.rules-list {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.rule-item {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.04));
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 12px;
    transition: all 0.3s ease;
}

.rule-item:hover {
    border-color: rgba(255, 215, 0, 0.3);
    transform: translateX(5px);
}

.rule-icon {
    font-size: 1.5em;
    flex-shrink: 0;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
}

.rule-text h4 {
    color: #ffd700;
    margin-bottom: 4px;
    font-size: 0.9em;
    font-weight: 800;
    letter-spacing: 0.3px;
}

.rule-text p {
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.4;
    font-size: 0.75em;
    font-weight: 500;
}

.about-text {
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.7;
    text-align: left;
    font-size: 0.95em;
}

.about-text strong {
    color: #ffd700;
    font-weight: 800;
}

.about-text ul {
    margin-left: 20px;
    margin-top: 12px;
}

.about-text li {
    margin-bottom: 8px;
    color: rgba(255, 255, 255, 0.85);
}

.about-text p {
    margin-bottom: 12px;
}

/* Settings Screen */
.settings-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.04));
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 18px;
    transition: all 0.3s ease;
}

.setting-item:hover {
    border-color: rgba(255, 215, 0, 0.3);
}

.setting-item.clickable {
    cursor: pointer;
}

.setting-item.clickable:active {
    transform: scale(0.98);
}

.setting-info {
    display: flex;
    gap: 14px;
    align-items: center;
    flex: 1;
}

.setting-icon {
    font-size: 2em;
    flex-shrink: 0;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
}

.setting-text h4 {
    color: #ffd700;
    margin-bottom: 4px;
    font-size: 1.05em;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.setting-text p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85em;
}

.toggle-btn {
    width: 56px;
    height: 30px;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 15px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.toggle-btn.active {
    background: linear-gradient(135deg, #4CAF50, #66BB6A);
    border-color: #4CAF50;
}

.toggle-slider {
    position: absolute;
    width: 22px;
    height: 22px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.toggle-btn.active .toggle-slider {
    left: 28px;
}

.setting-arrow {
    font-size: 1.5em;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 300;
}

/* Online Play Modal */
.online-play-modal {
    max-width: 520px;
    padding: 30px 28px 24px;
}

.online-settings-list {
    gap: 14px;
}

.online-setting-item {
    align-items: stretch;
    gap: 14px;
    padding: 16px;
}

.online-setting-info {
    align-items: center;
    min-width: 0;
}

.online-setting-item .setting-icon {
    font-size: 1.9em;
}

.online-setting-item .setting-text h4 {
    margin-bottom: 3px;
    line-height: 1.05;
}

.online-setting-item .setting-text p {
    line-height: 1.2;
}

.online-input {
    width: 170px;
    max-width: 44%;
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    background: rgba(6, 16, 38, 0.55);
    color: #fff;
    padding: 10px 12px;
    font-size: 0.98em;
    font-weight: 600;
    align-self: center;
}

.online-input::placeholder {
    color: rgba(255, 255, 255, 0.45);
}

.online-input:focus {
    outline: none;
    border-color: rgba(255, 215, 0, 0.6);
    box-shadow: 0 0 0 2px rgba(255, 215, 0, 0.18);
}

.online-code-input {
    text-transform: uppercase;
    letter-spacing: 0.7px;
}

.online-action-btn {
    min-width: 160px;
    align-self: center;
}

.online-join-btn {
    width: 100%;
    margin-top: 2px;
}

.online-secondary-btn {
    width: 100%;
    min-width: 0;
    padding: 11px 14px;
    font-size: 0.9em;
    border-color: rgba(255, 255, 255, 0.16);
    color: rgba(255, 255, 255, 0.9);
}

.online-room-code {
    color: #ffd700;
    text-align: center;
    font-weight: 700;
    min-height: 1.2em;
    letter-spacing: 0.3px;
    font-size: 0.84em;
    opacity: 0;
    transform: translateY(-2px);
    transition: opacity 0.25s ease, transform 0.25s ease, color 0.2s ease;
}

.online-room-code.has-code {
    opacity: 1;
    transform: translateY(0);
}

.online-room-code.clickable {
    cursor: pointer;
}

.online-room-code.clickable:active {
    color: #fff4ae;
}

.online-action-btn.online-cancel-state {
    border-color: rgba(255, 129, 129, 0.45);
    color: #ffd3d3;
    background: linear-gradient(135deg, rgba(128, 32, 32, 0.35), rgba(90, 20, 20, 0.3));
}

.online-status {
    color: rgba(255, 255, 255, 0.9);
    text-align: center;
    font-size: 0.95em;
    line-height: 1.3;
    min-height: 1.35em;
}

.online-status.is-searching {
    color: #ffe27a;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.online-status.is-searching::before {
    content: "";
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid rgba(255, 226, 122, 0.28);
    border-top-color: #ffd700;
    animation: onlineSpin 0.8s linear infinite;
}

.online-status.is-searching::after {
    content: "...";
    display: inline-block;
    width: 0;
    overflow: hidden;
    animation: onlineDots 1.2s steps(4, end) infinite;
}

@keyframes onlineSpin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes onlineDots {
    from {
        width: 0;
    }
    to {
        width: 1.2em;
    }
}

/* Stats Screen */
.stats-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    margin-bottom: 24px;
}

.stat-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    backdrop-filter: blur(15px);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 14px;
    padding: 14px 12px;
    text-align: center;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    min-height: 110px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, rgba(255, 215, 0, 0.5), transparent);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.stat-card:hover {
    border-color: rgba(255, 215, 0, 0.5);
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 12px 30px rgba(255, 215, 0, 0.2);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-icon {
    font-size: 1.6em;
    margin-bottom: 6px;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.4));
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-6px); }
}

.stat-card:nth-child(1) .stat-icon { animation-delay: 0s; }
.stat-card:nth-child(2) .stat-icon { animation-delay: 0.2s; }
.stat-card:nth-child(3) .stat-icon { animation-delay: 0.4s; }
.stat-card:nth-child(4) .stat-icon { animation-delay: 0.6s; }
.stat-card:nth-child(5) .stat-icon { animation-delay: 0.8s; }
.stat-card:nth-child(6) .stat-icon { animation-delay: 1s; }

.stat-value {
    font-size: 1.8em;
    font-weight: 900;
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 50%, #ffd700 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 4px;
    letter-spacing: 0.5px;
    animation: shimmer 3s linear infinite;
    line-height: 1;
}

@keyframes shimmer {
    0% { background-position: 0% center; }
    100% { background-position: 200% center; }
}

.stat-label {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.65em;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    line-height: 1.2;
}

.reset-stats-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, rgba(244, 67, 54, 0.9), rgba(229, 57, 53, 0.9));
    border: 2px solid rgba(244, 67, 54, 0.6);
    border-radius: 16px;
    color: white;
    font-size: 1em;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    box-shadow: 0 6px 20px rgba(244, 67, 54, 0.3);
    position: relative;
    overflow: hidden;
}

.reset-stats-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.reset-stats-btn:hover::before {
    width: 300px;
    height: 300px;
}

.reset-stats-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(244, 67, 54, 0.4);
    border-color: rgba(244, 67, 54, 0.8);
}

.reset-stats-btn:active {
    transform: translateY(0) scale(0.98);
}

/* Premium stat card variants */
.stat-card:nth-child(1) {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15), rgba(102, 126, 234, 0.08));
}

.stat-card:nth-child(2) {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.15), rgba(255, 215, 0, 0.08));
}

.stat-card:nth-child(3) {
    background: linear-gradient(135deg, rgba(244, 67, 54, 0.15), rgba(244, 67, 54, 0.08));
}

.stat-card:nth-child(4) {
    background: linear-gradient(135deg, rgba(156, 39, 176, 0.15), rgba(156, 39, 176, 0.08));
}

.stat-card:nth-child(5) {
    background: linear-gradient(135deg, rgba(33, 150, 243, 0.15), rgba(33, 150, 243, 0.08));
}

.stat-card:nth-child(6) {
    background: linear-gradient(135deg, rgba(255, 152, 0, 0.15), rgba(255, 152, 0, 0.08));
}

/* Theme Selection */
.setting-item.clickable {
    cursor: pointer;
}

.setting-item.clickable:hover {
    border-color: rgba(255, 215, 0, 0.5);
}

.setting-arrow {
    font-size: 1.5em;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 300;
}

.theme-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 55vh;
    overflow-y: auto;
    padding-right: 8px;
    padding-bottom: 8px;
}

.theme-list::-webkit-scrollbar {
    width: 8px;
}

.theme-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.theme-list::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.4), rgba(255, 215, 0, 0.2));
    border-radius: 4px;
    border: 2px solid rgba(255, 255, 255, 0.05);
}

.theme-list::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.6), rgba(255, 215, 0, 0.3));
}

.theme-option {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: hidden;
}

.theme-option::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.1), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.theme-option:hover::before {
    opacity: 1;
}

.theme-option:hover {
    border-color: rgba(255, 215, 0, 0.4);
    transform: translateX(5px);
    box-shadow: 0 4px 16px rgba(255, 215, 0, 0.2);
}

.theme-option.active {
    border-color: rgba(255, 215, 0, 0.7);
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.2), rgba(255, 215, 0, 0.1));
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.3);
}

.theme-option.active::before {
    opacity: 1;
}

.theme-preview {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    border: 2px solid rgba(255, 255, 255, 0.25);
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease;
}

.theme-option:hover .theme-preview {
    transform: scale(1.05);
}

.classic-preview {
    background: linear-gradient(135deg, #D2B48C, #C19A6B);
    position: relative;
    overflow: hidden;
}

.classic-preview::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        90deg,
        rgba(139, 69, 19, 0.1) 0px,
        transparent 2px,
        transparent 4px
    );
}

.modern-preview {
    background: linear-gradient(135deg, #2C3E50, #34495E);
}

.marble-preview {
    background: linear-gradient(135deg, #F5F5F5, #E0E0E0);
    position: relative;
    overflow: hidden;
}

.marble-preview::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        linear-gradient(45deg, transparent 40%, rgba(180, 180, 180, 0.2) 50%, transparent 60%),
        linear-gradient(-45deg, transparent 40%, rgba(180, 180, 180, 0.2) 50%, transparent 60%);
}

.royal-preview {
    background: linear-gradient(135deg, #1a1a2e, #16213e, #0f3460);
    border: 2px solid rgba(255, 215, 0, 0.5);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.3);
}

.neon-preview {
    background: linear-gradient(135deg, #0a0a0a, #1a1a1a);
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.5);
    border: 2px solid rgba(0, 255, 255, 0.3);
}

.ocean-preview {
    background: linear-gradient(135deg, #006994, #0099cc, #00b4d8);
    position: relative;
    overflow: hidden;
}

.ocean-preview::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 30% 40%, rgba(255, 255, 255, 0.3) 2px, transparent 3px),
                radial-gradient(circle at 70% 60%, rgba(255, 255, 255, 0.2) 2px, transparent 3px);
}

.sunset-preview {
    background: linear-gradient(135deg, #ff6b6b, #ff8e53, #ffd93d);
}

.forest-preview {
    background: linear-gradient(135deg, #1b4332, #2d6a4f, #40916c);
}

.galaxy-preview {
    background: linear-gradient(135deg, #0d1b2a, #1b263b, #415a77);
    box-shadow: 0 0 15px rgba(138, 43, 226, 0.5);
    position: relative;
    overflow: hidden;
}

.galaxy-preview::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.8) 1px, transparent 2px),
                radial-gradient(circle at 60% 70%, rgba(255, 255, 255, 0.6) 1px, transparent 2px),
                radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.7) 1px, transparent 2px);
}

.cherry-preview {
    background: linear-gradient(135deg, #ffc8dd, #ffafcc, #ff85a1);
}

.lava-preview {
    background: linear-gradient(135deg, #370617, #9d0208, #dc2f02);
}

.ice-preview {
    background: linear-gradient(135deg, #caf0f8, #ade8f4, #90e0ef);
}

.desert-preview {
    background: linear-gradient(135deg, #e9c46a, #f4a261, #e76f51);
}

.midnight-preview {
    background: linear-gradient(135deg, #240046, #3c096c, #5a189a);
}

.ruby-preview {
    background: linear-gradient(135deg, #1a1a1a, #2d2d2d);
    border: 2px solid rgba(220, 20, 60, 0.5);
}

.gold-preview {
    background: linear-gradient(135deg, #1c1c1c, #2a2a2a);
    border: 2px solid rgba(255, 215, 0, 0.5);
}

.candy-preview {
    background: linear-gradient(135deg, #FFB3D9, #FF69B4, #FFD700);
}

.rainbow-preview {
    background: linear-gradient(135deg, #FF6B6B, #4ECDC4, #45B7D1, #FFA07A, #98D8C8);
}

.copper-preview {
    background: linear-gradient(135deg, #B87333, #CD7F32, #8B4513);
}

.jade-preview {
    background: linear-gradient(135deg, #00A86B, #50C878, #F0EAD6);
}

.volcanic-preview {
    background: linear-gradient(135deg, #1C1C1C, #3A3A3A, #FF4500);
}

.sapphire-preview {
    background: linear-gradient(135deg, #0F52BA, #082567, #FFBF00);
}

.mint-preview {
    background: linear-gradient(135deg, #98FF98, #3EB489, #FF7F50);
}

.cosmic-preview {
    background: linear-gradient(135deg, #4B0082, #8A2BE2, #FF1493, #00CED1);
}

.theme-info {
    flex: 1;
    min-width: 0;
}

.theme-info h4 {
    color: #ffd700;
    margin-bottom: 4px;
    font-size: 1.1em;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.theme-info p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85em;
    font-weight: 500;
}

.theme-check {
    font-size: 1.8em;
    color: #ffd700;
    opacity: 0;
    transition: all 0.3s ease;
    filter: drop-shadow(0 2px 4px rgba(255, 215, 0, 0.5));
    flex-shrink: 0;
}

.theme-option.active .theme-check {
    opacity: 1;
    animation: checkPop 0.4s ease;
}

@keyframes checkPop {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* Theme Modal Specific */
.theme-modal {
    max-width: 600px;
    padding: 42px 38px 42px;
    position: relative;
}

.theme-header-main {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 24px;
}

.theme-emoji {
    font-size: 2em;
    filter: drop-shadow(0 2px 8px rgba(255, 215, 0, 0.4));
}

.theme-header-main h2 {
    font-size: 1.8em;
    margin: 0;
}

.close-btn-circle {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.25);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.2em;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 300;
    z-index: 100;
    line-height: 1;
}

.close-btn-circle:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    color: white;
    transform: rotate(90deg) scale(1.05);
}

.close-btn-circle:active {
    transform: rotate(90deg) scale(0.95);
    background: rgba(255, 255, 255, 0.35);
}

/* Compact Theme Options */
.theme-option-compact {
    position: relative;
    display: flex;
    align-items: center;
    gap: 20px;
    background: linear-gradient(135deg, rgba(30, 40, 70, 0.6), rgba(20, 30, 60, 0.6));
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 15px;
    padding: 16px 28px 16px 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: hidden;
    min-height: 64px;
}

.theme-option-compact::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, #ffd700, #ffed4e);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.theme-option-compact:hover {
    border-color: rgba(255, 215, 0, 0.4);
    background: linear-gradient(135deg, rgba(40, 50, 80, 0.7), rgba(30, 40, 70, 0.7));
}

.theme-option-compact.active {
    border-color: rgba(255, 215, 0, 0.6);
    background: linear-gradient(135deg, rgba(50, 60, 90, 0.8), rgba(40, 50, 80, 0.8));
}

.theme-option-compact.active::before {
    opacity: 1;
}

.theme-preview-small {
    width: 56px;
    height: 56px;
    border-radius: 11px;
    border: 2px solid rgba(255, 255, 255, 0.25);
    flex-shrink: 0;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
}

.bead-preview-compact {
    display: flex;
    gap: 6px;
    align-items: center;
    justify-content: center;
    width: 56px;
    flex-shrink: 0;
}

.bead-piece-mini {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.theme-info-compact {
    flex: 1;
    min-width: 0;
    padding: 2px 0 2px 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.theme-info-compact h4 {
    color: #ffd700;
    margin: 0 0 4px 0;
    padding: 0;
    font-size: 0.95em;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.theme-info-compact p {
    color: rgba(255, 255, 255, 0.58);
    font-size: 0.78em;
    font-weight: 500;
    margin: 0;
    padding: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.theme-check-compact {
    display: none !important;
}

.theme-option-compact.active .theme-check-compact {
    display: none !important;
}

@keyframes checkBounce {
    0% { transform: scale(0) rotate(-45deg); }
    50% { transform: scale(1.3) rotate(10deg); }
    100% { transform: scale(1) rotate(0deg); }
}

/* Theme List Compact */
.theme-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-height: 52vh;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px 12px 18px 12px;
    margin-bottom: 10px;
}

.theme-list::-webkit-scrollbar {
    width: 6px;
}

.theme-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.theme-list::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, rgba(255, 215, 0, 0.4), rgba(255, 215, 0, 0.2));
    border-radius: 3px;
}

.theme-list::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, rgba(255, 215, 0, 0.6), rgba(255, 215, 0, 0.3));
}
.theme-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    background: rgba(255, 255, 255, 0.08);
    padding: 7px;
    border-radius: 13px;
}

.theme-tab {
    flex: 1;
    padding: 12px 20px;
    background: transparent;
    border: none;
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.95em;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 0.5px;
}

.theme-tab.active {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.25), rgba(255, 215, 0, 0.15));
    color: #ffd700;
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.3);
}

.theme-tab:hover:not(.active) {
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.8);
}

.theme-tab-desc {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.78em;
    text-align: center;
    margin-bottom: 18px;
    margin-top: 6px;
    font-weight: 500;
    letter-spacing: 0.3px;
    padding: 0 12px;
}

.theme-tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
    padding-bottom: 8px;
}

.theme-tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Bead Preview */
.bead-preview-container {
    display: flex;
    gap: 6px;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 10px;
}

.bead-preview-piece {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
    transition: transform 0.2s ease;
}

.theme-option:hover .bead-preview-piece {
    transform: scale(1.1);
}

/* Enhanced Theme Options */
.theme-option {
    position: relative;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: hidden;
}

.theme-option::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.1), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.theme-option:hover::before {
    opacity: 1;
}

.theme-option:hover {
    border-color: rgba(255, 215, 0, 0.4);
    transform: translateX(5px);
    box-shadow: 0 4px 16px rgba(255, 215, 0, 0.2);
}

.theme-option.active {
    border-color: rgba(255, 215, 0, 0.7);
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.2), rgba(255, 215, 0, 0.1));
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.3);
}

.theme-option.active::before {
    opacity: 1;
}

.theme-preview {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    border: 2px solid rgba(255, 255, 255, 0.25);
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease;
}

.theme-option:hover .theme-preview {
    transform: scale(1.05);
}

.theme-info {
    flex: 1;
    min-width: 0;
}

.theme-info h4 {
    color: #ffd700;
    margin-bottom: 4px;
    font-size: 1.1em;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.theme-info p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85em;
    font-weight: 500;
}

.theme-check {
    font-size: 1.8em;
    color: #ffd700;
    opacity: 0;
    transition: all 0.3s ease;
    filter: drop-shadow(0 2px 4px rgba(255, 215, 0, 0.5));
    flex-shrink: 0;
}

.theme-option.active .theme-check {
    opacity: 1;
    animation: checkPop 0.4s ease;
}

@keyframes checkPop {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}


/* Responsive Theme Screen */
@media (max-width: 400px) {
    .info-content {
        padding: 25px 20px;
    }

    .online-play-modal {
        width: 94%;
        max-height: 88vh;
        padding: 22px 16px 18px;
    }

    .online-settings-list {
        gap: 10px;
    }

    .online-setting-item {
        padding: 12px;
        flex-direction: row;
        align-items: center;
        gap: 10px;
    }

    .online-setting-item .setting-info {
        gap: 10px;
    }

    .online-setting-item .setting-icon {
        font-size: 1.7em;
    }

    .online-setting-item .setting-text h4 {
        font-size: 0.88em;
    }

    .online-setting-item .setting-text p {
        font-size: 0.78em;
    }

    .online-input {
        width: 130px;
        max-width: 45%;
        padding: 8px 10px;
        font-size: 0.92em;
    }

    .online-action-btn {
        min-width: 138px;
        padding: 10px 12px;
        font-size: 0.92em;
    }

    .online-secondary-btn {
        font-size: 0.86em;
        padding: 9px 12px;
    }
    
    .theme-tabs {
        gap: 6px;
        padding: 4px;
    }
    
    .theme-tab {
        padding: 10px 14px;
        font-size: 0.85em;
    }
    
    .theme-option {
        padding: 12px;
        gap: 10px;
    }
    
    .theme-preview {
        width: 50px;
        height: 50px;
    }
    
    .bead-preview-piece {
        width: 24px;
        height: 24px;
        font-size: 14px;
    }
    
    .theme-info h4 {
        font-size: 1em;
    }
    
    .theme-info p {
        font-size: 0.8em;
    }
    
    .theme-check {
        font-size: 1.5em;
    }
}

/* Responsive adjustments for score board */
@media (max-width: 400px) {
    .player-info {
        padding: 7px 8px;
        gap: 5px;
        max-width: 46%;
    }
    
    .player-avatar {
        font-size: 1.4em;
        width: 28px;
        height: 28px;
    }
    
    .player-name {
        font-size: 0.75em;
    }
    
    .pieces-count {
        font-size: 0.65em;
    }
    
    .timer-display {
        font-size: 0.6em;
    }
    
    .captured-badge {
        padding: 4px 7px;
        font-size: 0.85em;
        min-width: 24px;
    }
    
    .vs-divider {
        font-size: 0.75em;
    }
}

@media (min-width: 401px) and (max-width: 600px) {
    .player-info {
        padding: 8px 10px;
        max-width: 45%;
    }
    
    .player-avatar {
        font-size: 1.5em;
        width: 30px;
        height: 30px;
    }
}

@media (min-width: 601px) {
    .player-info {
        padding: 10px 12px;
        gap: 8px;
        max-width: none;
    }
    
    .player-avatar {
        font-size: 1.8em;
        width: 36px;
        height: 36px;
    }
    
    .player-name {
        font-size: 0.85em;
    }
    
    .pieces-count {
        font-size: 0.75em;
    }
    
    .captured-badge {
        font-size: 1em;
        padding: 6px 10px;
        min-width: 30px;
    }
    
    .vs-divider {
        font-size: 0.9em;
    }
    
    .turn-indicator {
        font-size: 1.3em;
        padding: 6px 0;
        margin-bottom: 14px;
    }
    
    .message {
        font-size: 0.95em;
        padding: 8px 0;
    }
}

@media (max-width: 400px) {
    .turn-indicator {
        font-size: 1.1em;
        padding: 5px 0;
        margin-bottom: 10px;
    }
    
    .message {
        font-size: 0.9em;
        padding: 6px 0;
    }
}

/* Premium mobile gameplay layout */
@media (max-width: 600px) {
    .game-container {
        min-height: 100dvh;
        height: 100dvh;
        padding-top: calc(8px + env(safe-area-inset-top, 0px));
        padding-right: 6px;
        padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
        padding-left: 6px;
        gap: 6px;
        overflow: hidden;
        border-radius: 0;
        border: none;
        box-shadow: none;
    }

    .game-header {
        margin-bottom: 6px;
        padding: 4px;
        border-radius: 16px;
    }

    .game-mode-indicator {
        font-size: 0.86em;
        letter-spacing: 0.55px;
        padding: 0 8px;
    }

    .icon-btn {
        width: 44px;
        height: 44px;
        border-radius: 13px;
        top: 8px;
    }

    .score-board {
        margin-bottom: 6px;
        gap: 6px;
        padding: 6px;
        border-radius: 14px;
    }

    .player-info {
        padding: 6px 8px;
        border-radius: 18px;
    }

    .player-name {
        font-size: 0.72em;
    }

    .pieces-count {
        font-size: 0.62em;
    }

    .timer-display {
        font-size: 0.58em;
    }

    .captured-badge {
        padding: 4px 7px;
        font-size: 0.82em;
        min-width: 24px;
    }

    .turn-indicator {
        margin-bottom: 6px;
        padding: 1px 0;
        font-size: 0.96em;
        border-radius: 0;
    }

    .game-board-wrapper {
        flex: 1;
        min-height: 0;
        height: auto;
        padding: 10px 6px;
        margin-bottom: 6px;
        align-items: center;
        border-width: 1px;
        border-radius: 18px;
    }

    #gameBoard {
        width: 100%;
        max-height: 100%;
        transform: rotateX(5deg) rotateZ(0deg);
        border-width: 2px;
        border-radius: 16px;
    }

    #gameBoard.board-16 {
        width: auto;
        max-width: none;
    }

    .game-controls {
        gap: 8px;
        background: linear-gradient(180deg, rgba(10, 16, 44, 0.65), rgba(6, 10, 30, 0.74));
        border: 1px solid rgba(255, 255, 255, 0.13);
        border-radius: 16px;
        padding: 9px;
        backdrop-filter: blur(8px);
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
    }

    .game-action-bar {
        gap: 8px;
        padding: 2px;
        border-radius: 14px;
        background: linear-gradient(180deg, rgba(10, 16, 42, 0.28), rgba(8, 12, 34, 0.08));
    }

    .action-btn {
        min-height: 42px;
        font-size: 0.78em;
        border-radius: 13px;
        padding: 6px 10px;
        letter-spacing: 0.2px;
    }

    .message {
        min-height: 0;
        font-size: 0.75em;
        padding: 0;
        border-radius: 0;
        border-color: transparent;
        background: transparent;
    }

    /* 16-goti specific mobile polish */
    .game-container.mode-16 {
        gap: 5px;
    }

    .game-container.mode-16 .turn-indicator {
        margin-bottom: 4px;
        font-size: 0.92em;
    }

    .game-container.mode-16 .game-board-wrapper {
        padding: 8px 6px;
        margin-bottom: 4px;
    }

    .game-container.mode-16 .game-controls {
        gap: 7px;
        padding: 8px;
        border-radius: 14px;
        background: linear-gradient(180deg, rgba(9, 15, 44, 0.56), rgba(6, 10, 30, 0.72));
        border-color: rgba(255, 255, 255, 0.12);
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
    }

    .game-container.mode-16 .game-action-bar {
        gap: 8px;
    }

    .game-container.mode-16 .action-btn {
        min-height: 40px;
        font-size: 0.76em;
        letter-spacing: 0.2px;
        border-radius: 12px;
        padding: 6px 10px;
    }

    .game-container.mode-16 .message {
        min-height: 0;
        font-size: 0.72em;
        letter-spacing: 0.2px;
        padding: 0;
        border-radius: 0;
        border-color: transparent;
        background: transparent;
    }

    #modeScreen {
        padding-top: calc(6px + env(safe-area-inset-top, 0px));
        padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    }

    #modeScreen .mode-content {
        width: 92%;
        max-width: 360px;
        padding: 10px 8px 18px;
    }

    .online-play-modal {
        max-width: 94vw;
    }

    .online-input {
        width: 145px;
    }
}

@media (max-width: 400px) {
    .game-board-wrapper {
        flex: 1;
        min-height: 0;
        height: auto;
        padding: 8px 4px;
    }

    .action-btn {
        min-height: 34px;
        font-size: 0.7em;
    }
}
