/**
 * Fruit Rabbit Orb Puzzle - v40.0 [Masterpiece Edition]
 */

:root {
    --bg-color: #0d091a;
    --accent-color: #fbbf24;
    --accent-pink: #d946ef;
    --glass: rgba(255, 255, 255, 0.15);
    --glass-border: rgba(255, 255, 255, 0.25);
    --glass-dark: rgba(0, 0, 0, 0.8);
    --font-main: 'Outfit', sans-serif;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
    --app-height: 100dvh;
    --hud-top: calc(18px + var(--safe-top));
    --hud-height: 46px;
    --recipe-top: calc(85px + var(--safe-top));
    --recipe-height: 125px;
    --stage-top: calc(75px + var(--safe-top));
    --stage-recipe-offset: calc(220px + var(--safe-top));
    --score-bottom: calc(38px + var(--safe-bottom));
}

html.ios-device {
    --safe-top: 42px !important;
}
html.ios-device .orb-stage {
    transform: translateY(-35px);
}

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

html {
    width: 100%;
    height: 100%;
    min-height: 100dvh;
    overflow: hidden;
    background: #000;
    overscroll-behavior: none;
    touch-action: manipulation;
}

body {
    width: 100%;
    height: var(--app-height, 100dvh);
    min-height: 100dvh;
    overflow: hidden;
    background: radial-gradient(circle at center, #1a143b 0%, #0a071d 100%);
    font-family: var(--font-main); color: white;
    overscroll-behavior: none;
    -webkit-text-size-adjust: 100%;
    -webkit-user-select: none;
    user-select: none;
}

#root,
#app,
#game-container {
    width: 100%;
    height: var(--app-height, 100dvh);
    margin: 0;
    padding: 0;
    overflow: hidden;
}

html.ios-device,
html.ios-device body {
    position: fixed;
    inset: 0;
    width: 100%;
    min-height: var(--app-height, 100dvh);
    height: var(--app-height, 100dvh);
    overflow: hidden;
    overscroll-behavior: none;
    background: #000;
}

html.ios-device.fake-fullscreen,
html.ios-device.fake-fullscreen body {
    width: 100vw;
    height: var(--app-height, 100dvh);
    min-height: -webkit-fill-available;
}

.app-container {
    position: relative; width: 100%; height: var(--app-height, 100dvh);
    overflow: hidden;
    background: #000;
}

html.ios-device .app-container {
    width: 100vw;
    height: var(--app-height, 100dvh);
    min-height: var(--app-height, 100dvh);
    padding-top: var(--safe-top);
    padding-bottom: var(--safe-bottom);
    padding-left: var(--safe-left);
    padding-right: var(--safe-right);
}

html.android-device,
html.android-device body {
    overflow: hidden;
    background: #000;
    overscroll-behavior: none;
}

@media (orientation: landscape) and (pointer: coarse) {
    html.android-device .app-container {
        width: min(100vw, calc(var(--app-height, 100dvh) * 9 / 16));
        height: var(--app-height, 100dvh);
        min-height: var(--app-height, 100dvh);
        margin: 0 auto;
        overflow: hidden;
        background: #000;
    }

    html.android-device .top-hud,
    html.android-device .bottom-hud,
    html.android-device .recipe-card {
        max-width: min(100vw, calc(var(--app-height, 100dvh) * 9 / 16));
        left: 50%;
        transform: translateX(-50%);
    }
}

/* 3D Canvas Context */
.orb-stage {
    position: absolute; 
    top: calc(75px + var(--safe-top)); 
    width: 100%; 
    height: calc(100% - (75px + var(--safe-top))); 
    z-index: 1;
    transition: top 0.3s cubic-bezier(0.4, 0, 0.2, 1), height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
#orb-canvas-container { width: 100%; height: 100%; cursor: grab; touch-action: none; }
#orb-canvas-container:active { cursor: grabbing; }

.top-hud.screen,
.orb-stage.screen {
    display: flex;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.orb-stage.screen {
    align-items: center;
    justify-content: center;
    inset: auto;
}

/* === PREMIUM HUD v40.0 === */
.top-hud { 
    position: fixed; top: calc(20px + var(--safe-top)); left: 0; width: 100%; 
    display: flex; justify-content: center; align-items: center; 
    gap: 6px; z-index: 100; box-sizing: border-box; pointer-events: none; 
}
.top-hud button, .top-hud div { pointer-events: auto; }
.stage-info { min-width: 72px !important; }
.score-display { min-width: 100px !important; }

.hud-item-3d { 
    background: rgba(15, 23, 42, 0.85); backdrop-filter: blur(12px); 
    border: 1px solid rgba(255,255,255,0.2); 
    height: 44px; display: flex; flex-direction: column; align-items: center; justify-content: center;
    min-width: 80px; padding: 0 10px; box-shadow: 0 4px 12px rgba(0,0,0,0.3), inset 0 2px 4px rgba(255,255,255,0.1);
    border-radius: 12px;
}

.hud-item-3d .label { font-size: 0.65rem; font-weight: 800; color: #94a3b8; letter-spacing: 0.05em; margin-bottom: 2px; }
.hud-item-3d .value { font-size: 1.15rem; font-weight: 900; color: #fbbf24; line-height: 1; }

.target-fruit-wrap { position: relative; display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; }
#target-img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5)); transition: transform 0.3s; }
.target-multiplier { position: absolute; bottom: -2px; right: -8px; background: #f43f5e; color: #fff; font-size: 0.65rem; font-weight: 900; padding: 1px 4px; border-radius: 4px; border: 1px solid #fff; box-shadow: 0 2px 4px rgba(0,0,0,0.3); }

.hud-btn-3d { 
    width: 44px; height: 44px; background: rgba(30, 41, 59, 0.9) !important; border: 1px solid rgba(255,255,255,0.15) !important; border-radius: 12px !important;
    display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.2s;
    box-shadow: 0 4px 8px rgba(0,0,0,0.4) !important;
    touch-action: none;
}
.hud-btn-3d img { width: 30px; height: 30px; opacity: 1; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3)); }
.hud-btn-3d:active { transform: translateY(2px) scale(0.95); box-shadow: 0 2px 4px rgba(0,0,0,0.4) !important; }

.bottom-hud {
    position: absolute; bottom: 35px; left: 0; width: 100%;
    display: flex; justify-content: center; z-index: 50;
    pointer-events: none;
}

.score-display {
    padding: 5px 24px; border-radius: 20px;
    border: 2px solid var(--glass-border);
    background: var(--glass-dark); backdrop-filter: blur(20px);
    pointer-events: auto;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.6);
    animation: h-pulse 2.5s infinite ease-in-out;
}
.score-display .label { font-size: 11px; font-weight: 800; opacity: 0.7; letter-spacing: 3px; margin-bottom: 2px; }
.score-display .value { 
    font-size: 22px; font-weight: 800; letter-spacing: 2px; font-variant-numeric: tabular-nums; 
    background: linear-gradient(135deg, #fff 0%, #fbbf24 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}

.target-display {
    padding: 5px 24px; border-radius: 20px;
    border: 2px solid var(--glass-border);
    background: var(--glass-dark); backdrop-filter: blur(20px);
    pointer-events: auto;
    display: flex; flex-direction: row; align-items: center; justify-content: center; gap: 10px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.6);
    animation: h-pulse 2.5s infinite ease-in-out;
}
.target-display .target-name { 
    font-size: 16px; font-weight: 800; letter-spacing: 2px;
    background: linear-gradient(135deg, #fff 0%, #fbbf24 100%); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}

@keyframes h-pulse {
    0% { transform: scale(1); box-shadow: 0 15px 40px rgba(0,0,0,0.6); }
    50% { transform: scale(1.03); box-shadow: 0 15px 50px rgba(255, 152, 161, 0.2); }
    100% { transform: scale(1); box-shadow: 0 15px 40px rgba(0,0,0,0.6); }
}

/* Settings & Overlays (Tetris Style) */
/* Settings & Overlays - High Contrast Upgrade */
/* === MASTERPIECE REWARD PAGE === */
.overlay { position: fixed; inset: 0; background: rgba(0, 0, 10, 0.9); backdrop-filter: blur(12px); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.masterpiece-card {
    width: 90%; max-width: 340px; padding: 45px 24px; text-align: center; border-radius: 36px;
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%); border: 3px solid #fbbf24;
    box-shadow: 0 30px 70px rgba(0,0,0,0.7), 0 0 45px rgba(251,191,36,0.3);
    animation: cardAppear 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes cardAppear { from { transform: scale(0.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.crown-icon { font-size: 4rem; margin-bottom: -15px; filter: drop-shadow(0 0 12px #fbbf24); animation: crownBounce 2s infinite; }
@keyframes crownBounce { 0%, 100% { transform: translateY(0) rotate(-5deg); } 50% { transform: translateY(-12px) rotate(5deg); } }

.reward-title { font-size: 2.3rem; font-weight: 900; color: #fbbf24; text-shadow: 0 4px 10px rgba(0,0,0,0.5); margin-bottom: 25px; letter-spacing: -0.01em; }

.sticker-reveal-box {
    position: relative; width: 170px; height: 170px; margin: 0 auto 30px;
    background: radial-gradient(circle, rgba(251,191,36,0.25) 0%, transparent 70%);
}
.sticker-reward-img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 12px 24px rgba(0,0,0,0.5)); transform: scale(1.15); animation: stickerSpin 12s linear infinite; }
@keyframes stickerSpin { from { transform: rotate(0deg) scale(1.15); } to { transform: rotate(360deg) scale(1.15); } }

.reward-info { margin-bottom: 35px; }
.reward-text { font-size: 1.15rem; color: #fff; font-weight: 700; margin-bottom: 5px; }
.reward-sub { font-size: 0.9rem; color: #94a3b8; }

.claim-btn-premium {
    width: 100%; padding: 20px; border-radius: 18px; font-size: 1.3rem; font-weight: 900;
    background: linear-gradient(to bottom, #fbbf24, #d97706); color: #1e1b4b; border: none;
    box-shadow: 0 6px 0 #92400e, 0 10px 20px rgba(0,0,0,0.4); cursor: pointer; transition: all 0.1s;
    font-family: var(--font-main);
}
.claim-btn-premium:active { transform: translateY(4px); box-shadow: 0 2px 0 #92400e; }

/* Mobile Portrait Optimization */
@media (max-width: 480px) {
    .top-hud { padding: 0 15px; }
    .icon-btn { width: 44px; height: 44px; }
    .score-display { padding: 4px 18px; border-radius: 16px; gap: 2px; }
    .score-display .label { font-size: 10px; margin-bottom: 2px; }
    .score-display .value { font-size: 18px; }
    .target-display { padding: 4px 18px; border-radius: 16px; gap: 8px; }
    .target-display .target-name { font-size: 14px; }
}

@media (max-width: 480px) {
    html.ios-device .top-hud {
        top: var(--hud-top);
        left: var(--safe-left);
        width: calc(100% - var(--safe-left) - var(--safe-right));
        min-height: var(--hud-height);
        padding: 0 10px;
        inset-inline: var(--safe-left) var(--safe-right);
    }

    html.ios-device .hud-left,
    html.ios-device .hud-right {
        gap: 6px;
    }

    html.ios-device .hud-btn-group {
        gap: 5px;
    }

    html.ios-device .hud-btn-3d {
        width: var(--hud-height);
        height: var(--hud-height);
    }

    html.ios-device .hud-btn-3d img {
        width: 28px;
        height: 28px;
    }

    html.ios-device .hud-item-3d {
        height: var(--hud-height);
        min-width: 80px;
        padding: 0 8px;
        border-radius: 12px;
    }

    html.ios-device .orb-stage {
        top: var(--stage-top);
        left: var(--safe-left);
        width: calc(100% - var(--safe-left) - var(--safe-right));
        height: calc(var(--app-height, 100dvh) - var(--stage-top));
    }

    html.ios-device .bottom-hud {
        bottom: var(--score-bottom);
        left: var(--safe-left);
        width: calc(100% - var(--safe-left) - var(--safe-right));
    }

    html.ios-device .score-display {
        padding: 4px 16px;
        border-radius: 16px;
        gap: 2px;
    }

    html.ios-device .score-display .label {
        font-size: 9px;
        letter-spacing: 2px;
        margin-bottom: 2px;
    }

    html.ios-device .score-display .value {
        font-size: 18px;
        letter-spacing: 2px;
    }

    html.ios-device .target-display {
        padding: 4px 16px;
        border-radius: 16px;
        gap: 6px;
    }

    html.ios-device .target-display .target-name {
        font-size: 14px;
        letter-spacing: 1px;
    }
}

@media (max-width: 480px) {
    html.ios-device.ios-browser-chrome {
        --hud-top: calc(12px + var(--safe-top));
        --hud-height: 42px;
        --recipe-top: calc(80px + var(--safe-top));
        --recipe-height: 110px;
        --stage-top: calc(70px + var(--safe-top));
        --stage-recipe-offset: calc(200px + var(--safe-top));
        --score-bottom: calc(30px + var(--safe-bottom));
    }

    html.ios-device.ios-browser-chrome .score-display {
        padding: 3px 14px;
        border-radius: 14px;
        gap: 2px;
    }

    html.ios-device.ios-browser-chrome .score-display .label {
        font-size: 8px;
        margin-bottom: 2px;
    }

    html.ios-device.ios-browser-chrome .score-display .value {
        font-size: 16px;
    }

    html.ios-device.ios-browser-chrome .target-display {
        padding: 3px 14px;
        border-radius: 14px;
        gap: 6px;
    }

    html.ios-device.ios-browser-chrome .target-display .target-name {
        font-size: 12px;
    }

    html.ios-device.ios-browser-chrome .recipe-card {
        padding: 7px 10px;
    }
}

@media (max-width: 380px) and (max-height: 740px) {
    html.ios-device {
        --hud-top: calc(10px + var(--safe-top));
        --hud-height: 40px;
        --recipe-top: calc(75px + var(--safe-top));
        --recipe-height: 110px;
        --stage-top: calc(65px + var(--safe-top));
        --stage-recipe-offset: calc(195px + var(--safe-top));
        --score-bottom: calc(32px + var(--safe-bottom));
    }

    html.ios-device .hud-item-3d .label {
        font-size: 0.56rem;
    }

    html.ios-device .hud-item-3d .value {
        font-size: 0.96rem;
    }

    html.ios-device .hud-btn-3d img {
        width: 24px;
        height: 24px;
    }
}

@media (max-width: 380px) and (max-height: 740px) {
    html.ios-device.ios-browser-chrome {
        --hud-top: calc(8px + var(--safe-top));
        --hud-height: 38px;
        --recipe-top: calc(70px + var(--safe-top));
        --recipe-height: 100px;
        --stage-top: calc(60px + var(--safe-top));
        --stage-recipe-offset: calc(180px + var(--safe-top));
        --score-bottom: calc(28px + var(--safe-bottom));
    }
}

@media (min-width: 414px) and (min-height: 880px) {
    html.ios-device {
        --hud-top: calc(20px + var(--safe-top));
        --hud-height: 48px;
        --recipe-top: calc(90px + var(--safe-top));
        --recipe-height: 130px;
        --stage-top: calc(80px + var(--safe-top));
        --stage-recipe-offset: calc(230px + var(--safe-top));
        --score-bottom: calc(40px + var(--safe-bottom));
    }
}

/* Start Screen - Masterpiece Edition */
#start-screen.overlay {
    position: fixed; inset: 0; z-index: 2000;
    background: rgba(10, 7, 29, 0.15) !important;
    backdrop-filter: blur(1.5px) !important;
    -webkit-backdrop-filter: blur(1.5px) !important;
    display: flex; justify-content: center; align-items: center;
    overflow: hidden;
}
.game-title {
    font-size: 1.25rem; font-weight: 800; color: #38bdf8;
    letter-spacing: 4px; margin: 15px 0 2px 0; line-height: 1;
    text-transform: uppercase; text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    font-family: var(--font-main);
}
.game-subtitle {
    font-size: 2.8rem; font-weight: 950; font-style: italic;
    color: #f43f5e;
    text-shadow: 0 4px 0 #fff, 0 8px 20px rgba(244, 63, 94, 0.4);
    letter-spacing: -1px; margin-bottom: 25px; line-height: 1;
    text-transform: uppercase;
    font-family: var(--font-main);
}

.start-card {
    text-align: center; padding: 40px; border-radius: 40px;
    background: var(--glass-dark); border: 2px solid var(--glass-border);
    backdrop-filter: blur(25px); width: 85%; max-width: 400px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}
.logo-container {
    width: 100%; display: flex; justify-content: center; margin-bottom: 5px;
}
.game-logo-img {
    max-width: 250px; width: 100%; height: auto;
    filter: drop-shadow(0 0 20px rgba(251, 191, 36, 0.4));
}
.game-logo-text {
    font-size: 3.5rem; font-weight: 900; color: var(--accent-color);
    letter-spacing: -2px; margin-bottom: 5px; line-height: 1;
    text-shadow: 0 0 30px rgba(251, 191, 36, 0.6);
}
.start-btn-3d {
    width: 100%; padding: 22px; border-radius: 25px;
    border: none; background: #fbbf24; color: #000;
    font-size: 1.6rem; font-weight: 950; cursor: pointer;
    box-shadow: 0 8px 0 #b45309, 0 15px 35px rgba(251, 191, 36, 0.4);
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-family: var(--font-main);
}
.start-btn-3d:active {
    transform: translateY(4px);
    box-shadow: 0 4px 0 #b45309, 0 8px 15px rgba(251, 191, 36, 0.3);
}

@keyframes h-pulse {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50% { transform: scale(1.05); opacity: 1; }
}

/* === JACKPOT 3D ANIMATION === */
.jackpot-3d-container {
    perspective: 1000px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    animation: jackpotPop 2.5s ease-out forwards;
}

.jackpot-3d-title {
    font-size: 4rem;
    font-weight: 900;
    color: #fbbf24;
    text-transform: uppercase;
    text-shadow: 0 10px 20px rgba(0,0,0,0.8), 0 0 40px #fbbf24, 0px 5px 0px #b45309;
    margin: 0;
    line-height: 1.1;
    text-align: center;
    transform-style: preserve-3d;
}

.jackpot-3d-score {
    font-size: 3rem;
    font-weight: 900;
    color: #f43f5e;
    text-shadow: 0 10px 20px rgba(0,0,0,0.8), 0 0 40px #f43f5e, 0px 5px 0px #be123c;
    margin-top: 10px;
    transform: translateZ(50px);
}

@keyframes jackpotPop {
    0% { transform: scale(0) rotateX(45deg) rotateY(-45deg) translateZ(-500px); opacity: 0; }
    15% { transform: scale(1.2) rotateX(-10deg) rotateY(10deg) translateZ(100px); opacity: 1; }
    25% { transform: scale(1) rotateX(0) rotateY(0) translateZ(50px); opacity: 1; }
    85% { transform: scale(1.1) rotateX(0) rotateY(0) translateZ(50px); opacity: 1; filter: hue-rotate(360deg); }
    100% { transform: scale(2) rotateX(20deg) rotateY(0) translateZ(500px); opacity: 0; }
}

/* === PREMIUM RECIPE CARD SYSTEM v5.5 === */
.recipe-card {
    position: absolute;
    top: calc(110px + var(--safe-top));
    left: 20px;
    width: calc(100% - 40px);
    height: 140px;
    z-index: 95;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0.04) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 20px;
    padding: 12px 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 480px) {
    html.ios-device .recipe-card {
        top: var(--recipe-top);
        left: calc(14px + var(--safe-left));
        width: calc(100% - 28px - var(--safe-left) - var(--safe-right));
        height: var(--recipe-height);
        padding: 10px 14px;
        border-radius: 16px;
    }

    html.ios-device .recipe-card-compact-wrap-vertical {
        gap: 4px;
    }

    html.ios-device .recipe-card-category-compact {
        font-size: 0.68rem;
        padding: 2px 8px;
    }

    html.ios-device .recipe-btn-close-compact {
        font-size: 0.85rem;
        padding: 1px 6px;
    }

    html.ios-device .recipe-card-middle-compact {
        gap: 8px;
    }

    html.ios-device .recipe-card-title-compact {
        font-size: 1.05rem;
    }

    html.ios-device .recipe-btn-detail-compact {
        font-size: 0.72rem;
        padding: 4px 10px;
        border-radius: 8px;
    }

    html.ios-device .recipe-card-benefit-compact {
        font-size: 0.75rem;
    }

    html.ios-device .recipe-card-ingredients-grid {
        gap: 6px;
        margin-top: 0;
    }

    html.ios-device .recipe-ingredient-item {
        border-radius: 9px;
        padding: 1px 6px;
        gap: 3px;
    }

    html.ios-device .recipe-ingredient-emoji {
        font-size: 0.8rem;
    }

    html.ios-device .recipe-ingredient-name {
        font-size: 0.68rem;
    }
}

.recipe-card.switching {
    opacity: 0;
    transform: scale(0.95);
}

.recipe-card.switching-in {
    opacity: 0;
    transform: scale(1.05);
    animation: recipeCardIn 0.30s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes recipeCardIn {
    to { opacity: 1; transform: scale(1); }
}

/* Compact layout styling matching js/recipes.js output */
.recipe-card-compact-wrap-vertical {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    gap: 4px;
}

.recipe-card-header-compact {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.recipe-card-category-compact {
    font-size: 0.72rem;
    font-weight: 800;
    color: #38bdf8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(56, 189, 248, 0.15);
    padding: 2px 8px;
    border-radius: 20px;
}

.recipe-btn-close-compact {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.95rem;
    cursor: pointer;
    padding: 2px 6px;
    transition: color 0.2s, transform 0.2s;
}
.recipe-btn-close-compact:hover {
    color: #ef4444;
    transform: scale(1.1);
}

.recipe-card-middle-compact {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.recipe-card-title-compact {
    font-size: 1.15rem;
    font-weight: 800;
    color: #ffffff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.recipe-btn-detail-compact {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    border: none;
    color: #1e1b4b;
    font-size: 0.75rem;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: all 0.2s;
    white-space: nowrap;
}
.recipe-btn-detail-compact:active {
    transform: translateY(1px);
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.recipe-card-benefit-compact {
    font-size: 0.8rem;
    font-weight: 700;
    color: #a7f3d0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.recipe-card-ingredients-grid {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
    margin-top: 2px;
    scrollbar-width: none;
}
.recipe-card-ingredients-grid::-webkit-scrollbar {
    display: none;
}

.recipe-ingredient-item {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 2px 8px;
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.recipe-ingredient-emoji {
    font-size: 0.85rem;
}

.recipe-ingredient-name {
    font-size: 0.7rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
}

/* === DETAIL OVERLAY GLASSMORPHISM === */
#recipe-detail-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 7, 24, 0.8);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#recipe-detail-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

#recipe-detail-overlay.closing {
    opacity: 0;
}

.recipe-detail-card {
    width: 90%;
    max-width: 380px;
    border-radius: 28px;
    padding: 24px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: linear-gradient(135deg, rgba(30, 27, 75, 0.95) 0%, rgba(15, 23, 42, 0.95) 100%) !important;
    box-shadow: 0 30px 60px rgba(0,0,0,0.6);
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#recipe-detail-overlay.active .recipe-detail-card {
    transform: scale(1);
}

.recipe-detail-close-btn {
    position: absolute;
    top: 18px;
    right: 20px;
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    transition: color 0.2s, transform 0.2s;
}
.recipe-detail-close-btn:hover {
    color: #ef4444;
    transform: rotate(90deg);
}

.recipe-detail-emoji {
    font-size: 3.2rem;
    margin-bottom: 8px;
    filter: drop-shadow(0 4px 10px rgba(0,0,0,0.3));
    animation: floating-emoji 3s infinite ease-in-out;
}

@keyframes floating-emoji {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.recipe-detail-category {
    font-size: 0.75rem;
    font-weight: 800;
    color: #38bdf8;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: rgba(56, 189, 248, 0.15);
    padding: 4px 12px;
    border-radius: 20px;
    margin-bottom: 12px;
}

.recipe-detail-title {
    font-size: 1.6rem;
    font-weight: 800;
    color: #ffffff;
    text-shadow: 0 2px 8px rgba(0,0,0,0.4);
    margin-bottom: 20px;
    text-align: center;
}

.recipe-detail-content {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
    max-height: 280px;
    overflow-y: auto;
    padding-right: 4px;
}

.recipe-detail-content::-webkit-scrollbar {
    width: 4px;
}
.recipe-detail-content::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.05);
    border-radius: 10px;
}
.recipe-detail-content::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 10px;
}

.recipe-detail-section {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 12px 14px;
}

.recipe-detail-section .section-label {
    font-size: 0.8rem;
    font-weight: 800;
    color: #fbbf24;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.recipe-detail-section .section-value {
    font-size: 0.85rem;
    line-height: 1.45;
    color: rgba(255, 255, 255, 0.9);
}

.recipe-detail-confirm-btn {
    width: 100%;
    padding: 14px;
    border-radius: 16px;
    font-size: 1rem;
    font-weight: 800;
    background: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
    color: #1e1b4b;
    border: none;
    box-shadow: 0 4px 12px rgba(251, 191, 36, 0.3);
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-main);
}
.recipe-detail-confirm-btn:active {
    transform: scale(0.98);
}

/* Fullscreen game-layer overrides */
.top-hud.screen {
    inset: auto var(--safe-right) auto var(--safe-left);
    top: var(--hud-top);
    width: auto;
    z-index: 100;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.orb-stage.screen {
    inset: auto;
    z-index: 1;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

html.ios-device .overlay {
    padding-top: var(--safe-top);
    padding-bottom: var(--safe-bottom);
    padding-left: var(--safe-left);
    padding-right: var(--safe-right);
}
