body {
    background-color: #121212; /* Dark Mode */
    color: white;
    font-family: sans-serif;
    margin: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    touch-action: manipulation;
}

/* HAMBURGER MENU */
.hamburger-btn {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1001;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* LANGUAGE SWITCHER */
.language-switcher {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1001;
}

.lang-btn {
    background: #2a2a2a;
    border: 1px solid #444;
    color: #aaa;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.2s ease;
}

.lang-btn:hover,
.lang-btn:active {
    background: #333;
}

.lang-dropdown {
    position: absolute;
    top: 45px;
    right: 0;
    background: #2a2a2a;
    border: 1px solid #444;
    border-radius: 8px;
    min-width: 80px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.lang-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.lang-option {
    display: block;
    padding: 10px 12px;
    color: #ccc;
    text-decoration: none;
    transition: background 0.2s ease;
    font-size: 14px;
    text-align: center;
}

.lang-option:first-child {
    border-radius: 8px 8px 0 0;
}

.lang-option:last-child {
    border-radius: 0 0 8px 8px;
}

.lang-option:hover,
.lang-option:active {
    background: #333;
}

.lang-option.active {
    background: #333;
    color: #ffd700;
}

.hamburger-btn span {
    display: block;
    width: 28px;
    height: 3px;
    background: #fff;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.hamburger-btn:active span {
    background: #ffd700;
}

/* SIDE DRAWER */
.side-drawer {
    position: fixed;
    top: 0;
    left: -320px;
    width: 280px;
    height: 100vh;
    background: #1e1e1e;
    z-index: 1002;
    transition: left 0.3s ease;
    padding: 20px;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.5);
    overflow-y: auto;
}

.side-drawer.open {
    left: 0;
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 36px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.close-btn:active {
    color: #ffd700;
}

.nav-menu {
    list-style: none;
    padding: 0;
    margin: 60px 0 0 0;
}

.nav-menu li {
    margin-bottom: 10px;
}

.nav-menu a {
    display: block;
    padding: 15px 20px;
    color: #fff;
    text-decoration: none;
    font-size: 18px;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.nav-menu a:hover,
.nav-menu a:active {
    background: #2a2a2a;
}

.nav-menu a.active {
    background: #333;
    color: #ffd700;
}

/* OVERLAY */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.overlay.active {
    opacity: 1;
    visibility: visible;
}

/* DISPLAY AREA (Top 40%) */
.display-area {
    flex: 4;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px;
    background: #1e1e1e;
    position: relative;
}

.header { font-size: 14px; color: #888; margin-bottom: 10px; letter-spacing: 2px; }

.hand-container {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    padding: 50px 0;
}

.slot {
    width: 50px;
    height: 70px;
    border: 2px solid #444;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
    background: #333;
    transition: transform 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55),
                background 0.3s ease,
                border-color 0.3s ease;
    position: relative;
}

.slot.base-card {
    border-color: #888;
    background: #2a2a2a;
}

.slot.base-card::after {
    content: 'BASE';
    position: absolute;
    bottom: 2px;
    font-size: 8px;
    color: #888;
    letter-spacing: 0.5px;
}

.slot.score-card {
    border-color: #ffd700;
    background: #3a3000;
}

.slot.score-card::after {
    content: 'SCORE';
    position: absolute;
    bottom: 2px;
    font-size: 8px;
    color: #ffd700;
    letter-spacing: 0.5px;
}

.slot.error-shake {
    animation: shake 0.5s;
    border-color: #ff6b6b;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* Firework animation */
.firework {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
}

@keyframes firework {
    0% {
        transform: translate(0, 0);
        opacity: 1;
    }
    100% {
        transform: translate(var(--x), var(--y));
        opacity: 0;
    }
}

.result-box {
    text-align: center;
    width: 100%;
}

.rank-title {
    font-size: 32px;
    font-weight: bold;
    color: #ffd700; /* Gold */
    margin-bottom: 5px;
    text-transform: uppercase;
}

.breakdown { font-size: 14px; color: #aaa; }

/* KEYPAD (Bottom 60%) */
.keypad {
    flex: 6;
    background: #000;
    padding: 12px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.row {
    display: flex;
    gap: 12px;
    flex: 1;
}

.row-actions {
    margin-top: 4px;
}

.key {
    flex: 1;
    background: #333;
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    min-height: 48px;
    transition: all 0.15s ease;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.3);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.key:active {
    background: #555;
    transform: translateY(2px);
    box-shadow: 0 0 0 rgba(0, 0, 0, 0.3);
}

.special {
    color: #87ceeb;
    border: 2px solid #87ceeb;
    background: #1a3a4a;
}

.special:active {
    background: #2a4a5a;
}

.special-red {
    color: #ff6b6b;
    border: 2px solid #ff6b6b;
    background: #4a1a1a;
}

.special-red:active {
    background: #5a2a2a;
}

.action-clear {
    background: #c73e1d;
}

.action-clear:active {
    background: #d74e2d;
}

.action-del {
    background: #555;
}

.action-del:active {
    background: #666;
}