/* ==========================================================================
   Apple Juice - Tilt Drinking Game
   ========================================================================== */

/* ---------- Variables ---------- */
:root {
    --juice-gold: #D4890A;
    --juice-amber: #E8A317;
    --juice-light: #F5D280;
    --card-radius: 16px;
}

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #1a1205;
    color: #fff;
    -webkit-user-select: none;
    user-select: none;
}

/* ---------- Skip to content ---------- */
.skip-to-content {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 1000;
    padding: 8px 16px;
    background: var(--juice-gold);
    color: #000;
    font-weight: 600;
    border-radius: 0 0 8px 0;
}

.skip-to-content:focus {
    left: 0;
}

/* ---------- Header ---------- */
.game-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(26, 18, 5, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(212, 137, 10, 0.2);
    padding: env(safe-area-inset-top, 0) 0 0;
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    max-width: 600px;
    margin: 0 auto;
}

.back-link {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--juice-light);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

.back-link:hover {
    color: #fff;
}

.back-arrow {
    font-size: 18px;
}

.game-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--juice-amber);
    letter-spacing: 0.5px;
}

.mute-button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 20px;
    padding: 4px;
    line-height: 1;
}

.mute-button .sound-off {
    display: none;
}

.mute-button[aria-pressed="true"] .sound-on {
    display: none;
}

.mute-button[aria-pressed="true"] .sound-off {
    display: inline;
}

/* ---------- Screens ---------- */
.game-main {
    width: 100%;
    height: 100%;
}

.screen {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hidden {
    display: none !important;
}

/* ---------- Start Screen ---------- */
.start-screen {
    background: linear-gradient(145deg, #1a1205 0%, #2d1f0a 50%, #1a1205 100%);
    flex-direction: column;
    padding: 20px;
}

.start-card {
    text-align: center;
    max-width: 360px;
    width: 100%;
}

.juice-emoji {
    font-size: 80px;
    margin-bottom: 16px;
    animation: float 3s ease-in-out infinite;
}

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

.start-title {
    font-size: 36px;
    font-weight: 800;
    color: var(--juice-amber);
    margin-bottom: 4px;
    letter-spacing: -0.5px;
}

.start-subtitle {
    font-size: 18px;
    color: var(--juice-light);
    margin-bottom: 8px;
    opacity: 0.9;
    font-weight: 600;
}

.start-description {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.5);
    line-height: 1.6;
    margin-bottom: 32px;
    max-width: 280px;
    margin-left: auto;
    margin-right: auto;
}

/* Start button */
.start-btn {
    display: inline-block;
    padding: 16px 48px;
    font-size: 18px;
    font-weight: 700;
    color: #000;
    background: linear-gradient(135deg, var(--juice-amber), var(--juice-gold));
    border: none;
    border-radius: 50px;
    cursor: pointer;
    letter-spacing: 0.5px;
    transition: transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 4px 20px rgba(212, 137, 10, 0.4);
}

.start-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 28px rgba(212, 137, 10, 0.5);
}

.start-btn:active {
    transform: translateY(0) scale(0.97);
}

/* ---------- Reward Sound Picker ---------- */
.sound-picker {
    border: 1px solid rgba(212, 137, 10, 0.2);
    border-radius: 12px;
    padding: 12px 12px 10px;
    margin: 20px auto 24px;
    max-width: 300px;
}

.sound-picker__legend {
    font-size: 11px;
    font-weight: 600;
    color: rgba(245, 210, 128, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 0 6px;
}

.sound-picker__options {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.sound-picker__btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 4px 6px;
    background: rgba(255, 255, 255, 0.04);
    border: 2px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.sound-picker__btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

.sound-picker__btn.selected {
    border-color: var(--juice-gold);
    background: rgba(212, 137, 10, 0.12);
}

.sound-picker__icon {
    font-size: 22px;
    line-height: 1;
}

.sound-picker__name {
    font-size: 10px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.6);
    white-space: nowrap;
}

.sound-picker__btn.selected .sound-picker__name {
    color: var(--juice-light);
}

.start-hint {
    margin-top: 24px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.3);
    font-style: italic;
    line-height: 1.5;
}

/* ---------- Game Screen ---------- */
.game-screen {
    background: #0D0A04;
}

#juice-canvas {
    width: 100%;
    height: 100%;
    display: block;
    touch-action: none;
}

/* ---------- Drink Prompt ---------- */
.drink-prompt {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
    pointer-events: none;
    transition: opacity 0.4s;
}

.drink-prompt-text {
    display: inline-block;
    padding: 8px 20px;
    background: rgba(26, 18, 5, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(212, 137, 10, 0.3);
    border-radius: 24px;
    font-size: 13px;
    font-weight: 600;
    color: var(--juice-light);
    white-space: nowrap;
}

.drink-prompt.fading {
    opacity: 0;
}

/* ---------- Another One Button ---------- */
.another-one {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
    padding-bottom: env(safe-area-inset-bottom, 0);
    animation: fadeIn 0.4s ease;
}

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

.another-one-btn {
    padding: 14px 40px;
    font-size: 18px;
    font-weight: 700;
    color: #000;
    background: linear-gradient(135deg, var(--juice-amber), var(--juice-gold));
    border: none;
    border-radius: 50px;
    cursor: pointer;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 24px rgba(212, 137, 10, 0.5);
    transition: transform 0.15s, box-shadow 0.15s;
}

.another-one-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 32px rgba(212, 137, 10, 0.6);
}

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

/* ---------- Permission Overlay ---------- */
.permission-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
    padding: 20px;
}

.permission-card {
    background: linear-gradient(145deg, #2d1f0a, #1a1205);
    border: 2px solid var(--juice-gold);
    border-radius: var(--card-radius);
    padding: 36px 28px;
    text-align: center;
    max-width: 340px;
    width: 100%;
}

.permission-card h2 {
    font-size: 24px;
    color: var(--juice-amber);
    margin-bottom: 12px;
}

.permission-card p {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.6;
    margin-bottom: 24px;
}

/* ---------- Stats HUD ---------- */
.stats-hud {
    position: fixed;
    bottom: 16px;
    right: 16px;
    z-index: 50;
    display: flex;
    gap: 12px;
    pointer-events: none;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(26, 18, 5, 0.75);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border: 1px solid rgba(212, 137, 10, 0.25);
    border-radius: 10px;
    padding: 6px 12px;
    min-width: 52px;
}

.stat-label {
    font-size: 10px;
    font-weight: 600;
    color: rgba(245, 210, 128, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 18px;
    font-weight: 800;
    color: var(--juice-amber);
    line-height: 1.2;
}

/* ---------- Tilt Compass ---------- */
.tilt-compass {
    position: fixed;
    top: 60px;
    left: 12px;
    z-index: 60;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    pointer-events: none;
    opacity: 0.85;
}

.tilt-compass canvas {
    display: block;
}

.tilt-compass__value {
    font-size: 11px;
    font-weight: 700;
    color: var(--juice-light);
    font-variant-numeric: tabular-nums;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

/* ---------- Desktop tilt hint ---------- */
.tilt-indicator {
    position: fixed;
    top: 50px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    color: rgba(255, 255, 255, 0.35);
    text-align: center;
    pointer-events: none;
    z-index: 40;
}

/* ---------- Responsive ---------- */
@media (max-height: 500px) {
    .juice-emoji {
        font-size: 48px;
        margin-bottom: 8px;
    }

    .start-title {
        font-size: 28px;
    }

    .start-description {
        margin-bottom: 16px;
    }
}
