* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Apfel Grotezk', sans-serif;
    background: #fff200;
    color: #282322;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    right: 0;
    width: 40%;
    height: 100%;
    background-image: url('bartender.webp');
    background-size: contain;
    background-position: right bottom;
    background-repeat: no-repeat;
    opacity: 1;
    pointer-events: none;
    z-index: 0;
}

#app {
    position: relative;
    z-index: 1;
    max-width: 600px;
    margin: 20px auto;
    padding: 32px;
    background: #ffffff;
    border-radius: 24px;
    border: 1px solid #eceae8;
}

.game-active #app {
    background: transparent;
    border: none;
    margin: 0 auto;
    padding: 20px;
    max-width: 800px;
}

.screen {
    display: none;
    flex-direction: column;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.screen.active {
    display: flex;
}

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

.logo img {
    width: 100px;
    height: 100px;
}

.logo-small img {
    width: 80px;
    height: 80px;
}

h1 {
    font-size: 1.75rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 20px;
    color: #282322;
    letter-spacing: -0.02em;
}

h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: #282322;
    letter-spacing: -0.02em;
}

.subtitle {
    text-align: center;
    font-size: 0.95rem;
    color: #93847c;
    margin-bottom: 30px;
    max-width: 400px;
}

.countdown {
    font-size: 1rem;
    color: #282322;
    margin-bottom: 30px;
    font-weight: 500;
}

.countdown-small {
    color: #93847c;
    font-size: 0.9rem;
}

.btn {
    padding: 14px 32px;
    font-size: 14px;
    font-weight: 500;
    font-family: 'Apfel Grotezk', sans-serif;
    border: none;
    border-radius: 100px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

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

.btn-primary {
    background: #282322;
    color: #ffffff;
    margin: 10px 0;
}

.btn-primary:hover {
    background: #000000;
}

.btn-secondary {
    background: #ffffff;
    color: #282322;
    margin: 10px 0;
    border: 1px solid #282322;
}

.btn-secondary:hover {
    background: #f6f5f4;
}

.btn-link {
    background: transparent;
    color: #282322;
    border: 1px solid #d8d4d0;
    margin: 10px 0;
}

.btn-link:hover {
    background: #f6f5f4;
}

.link {
    color: #282322;
    text-decoration: underline;
    margin-top: 15px;
    font-size: 14px;
}

.link:hover {
    color: #5d524f;
}

.form-group {
    width: 100%;
    max-width: 400px;
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #5d524f;
    font-size: 14px;
}

.form-group input[type="text"],
.form-group input[type="email"] {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #d8d4d0;
    border-radius: 100px;
    background: #ffffff;
    color: #282322;
    font-size: 14px;
    font-family: 'Apfel Grotezk', sans-serif;
}

.form-group input:focus {
    outline: none;
    border-color: #282322;
    box-shadow: 0 0 0 3px rgba(40, 35, 34, 0.2);
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
}

.checkbox-group input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #282322;
}

.status {
    margin-top: 8px;
    font-size: 13px;
}

.status.success {
    color: #0db14b;
}

.status.info {
    color: #93847c;
}

.status.error {
    color: #ed1c24;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 15px;
}

.temp-display {
    font-size: 1.1rem;
    font-weight: 700;
    color: #282322;
}

.game-container {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    flex-wrap: wrap;
    justify-content: center;
}

.canvas-wrapper {
    background: #f6f5f4;
    border-radius: 24px;
    padding: 10px;
    box-shadow: 0 2px 8px rgba(40, 35, 34, 0.08);
    border: 1px solid #eceae8;
    position: relative;
    display: inline-block;
}

#game-canvas {
    position: relative;
    z-index: 1;
    background: transparent;
    display: block;
}

.game-sidebar {
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-width: 150px;
}

.sidebar-section {
    background: #f6f5f4;
    border-radius: 24px;
    padding: 15px;
    border: 1px solid #eceae8;
}

.sidebar-section h3 {
    font-size: 12px;
    color: #93847c;
    margin-bottom: 10px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    font-weight: 500;
}

#next-canvas {
    display: block;
    margin: 0 auto;
    background: #f6f5f4;
    border-radius: 12px;
}

.stat {
    font-size: 14px;
    margin: 5px 0;
    color: #5d524f;
}

.stat span {
    color: #282322;
    font-weight: 700;
}

.shaker-bar {
    width: 100%;
    height: 8px;
    background: #f6f5f4;
    border-radius: 100px;
    overflow: hidden;
    margin-bottom: 5px;
}

.shaker-progress {
    height: 100%;
    width: 0%;
    background: #282322;
    transition: width 0.3s;
}

.shaker-count {
    font-size: 12px;
    color: #93847c;
}

.game-controls {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.btn-control {
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
    border: none;
    border-radius: 100px;
    background: #282322;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.1s;
    border: 1px solid #282322;
    font-family: 'Apfel Grotezk', sans-serif;
}

.btn-control:active {
    transform: scale(0.95);
    background: #000000;
    color: #fff200;
}

#btn-pause {
    width: auto;
    padding: 0 20px;
    font-size: 14px;
}

#btn-rotate {
    width: auto;
    padding: 0 20px;
    font-size: 14px;
}

.final-score {
    text-align: center;
    margin: 30px 0;
}

.score-label {
    font-size: 14px;
    color: #93847c;
    margin-bottom: 10px;
}

.score-value {
    font-size: 3rem;
    font-weight: 700;
    color: #282322;
}

.gameover-message {
    text-align: center;
    font-size: 14px;
    margin-bottom: 30px;
    padding: 20px;
    background: #f6f5f4;
    border-radius: 24px;
    max-width: 400px;
    border: 1px solid #eceae8;
    color: #5d524f;
}

.gameover-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.leaderboard-info {
    display: flex;
    justify-content: space-between;
    width: 100%;
    max-width: 500px;
    margin-bottom: 20px;
    padding: 12px 20px;
    background: #f6f5f4;
    border-radius: 100px;
    border: 1px solid #eceae8;
    font-size: 14px;
}

.leaderboard-table-wrapper {
    width: 100%;
    max-width: 500px;
    overflow-x: auto;
    margin-bottom: 20px;
    background: #f6f5f4;
    border-radius: 24px;
    border: 1px solid #eceae8;
}

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

.leaderboard-table th,
.leaderboard-table td {
    padding: 12px 15px;
    text-align: left;
}

.leaderboard-table th {
    background: #f6f5f4;
    color: #93847c;
    font-size: 12px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    font-weight: 500;
}

.leaderboard-table tr {
    border-bottom: 1px solid #eceae8;
}

.leaderboard-table tr:last-child {
    border-bottom: none;
}

.leaderboard-table tr:nth-child(1) td:first-child {
    color: #f26522;
    font-weight: 700;
}

.leaderboard-table tr:nth-child(2) td:first-child {
    color: #93847c;
    font-weight: 700;
}

.leaderboard-table tr:nth-child(3) td:first-child {
    color: #bfb8b2;
    font-weight: 700;
}

.leaderboard-table tr.my-rank {
    background: rgba(40, 35, 34, 0.1);
}

.leaderboard-table tr.my-rank td {
    color: #282322;
    font-weight: 700;
}

.my-rank {
    text-align: center;
    padding: 15px;
    background: #282322;
    color: #ffffff;
    border-radius: 100px;
    margin-bottom: 20px;
    font-weight: 500;
    font-size: 14px;
}

.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(40, 35, 34, 0.8);
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.overlay.active {
    display: flex;
}

.overlay-content {
    text-align: center;
    padding: 40px;
    background: #ffffff;
    border-radius: 24px;
}

@media (max-width: 600px) {
    body::before {
        width: 60%;
        opacity: 1;
    }

    #app {
        margin: 0;
        border-radius: 0;
        max-width: 100%;
    }

    .game-active #app {
        margin: 0;
        padding: 0;
        max-width: 100%;
        height: 100vh;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 10;
        background: #fff200;
    }

    .game-active .screen {
        display: none;
    }

    .game-active #game-screen {
        display: flex !important;
        flex-direction: column;
        height: 100%;
        padding: 8px;
        padding-top: calc(8px + env(safe-area-inset-top, 0));
        padding-bottom: calc(8px + env(safe-area-inset-bottom, 0));
        box-sizing: border-box;
        overflow: hidden;
    }

    .game-active .game-header {
        flex-shrink: 0;
        margin-bottom: 2px;
    }

    .game-active .game-container {
        flex: 1;
        min-height: 0;
        flex-direction: column;
        align-items: center;
        gap: 4px;
        overflow: hidden;
    }

    .game-active .canvas-wrapper {
        flex: 1;
        min-height: 0;
        max-height: calc(100vh - 180px);
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        padding: 2px;
        overflow: hidden;
    }

    .game-active #game-canvas {
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
    }

    .game-active .game-sidebar {
        flex-shrink: 0;
        flex-direction: row;
        width: 100%;
        gap: 4px;
    }

    .game-active .sidebar-section {
        flex: 1;
        padding: 4px 6px;
    }

    .game-active .sidebar-section h3 {
        font-size: 8px;
        margin-bottom: 2px;
    }

    .game-active .stat {
        font-size: 9px;
        margin: 1px 0;
    }

    .game-active .shaker-count {
        font-size: 8px;
    }

    .game-active #next-canvas {
        width: 40px;
        height: 40px;
    }

    .game-active .game-controls {
        display: none;
    }

    .game-active .logo-small img {
        width: 50px;
        height: 50px;
    }

    .game-active .temp-display {
        font-size: 0.9rem;
    }

    .logo img {
        width: 80px;
        height: 80px;
    }

    h1 {
        font-size: 1.4rem;
    }

    .game-container {
        flex-direction: column;
        align-items: center;
    }

    .game-sidebar {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        min-width: auto;
    }

    .sidebar-section {
        flex: 1;
        min-width: 120px;
    }
}

button, .btn, .btn-control, input, a {
    touch-action: manipulation;
}
