/* THE JUICE JOINT: Lemonade Empire — CSS Styling */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800;900&display=swap');

:root {
    --navy: #1A2E4A;
    --navy-dark: #0D1A2E;
    --gold: #F4C430;
    --gold-hover: #E5B218;
    --green: #2ECC71;
    --green-dark: #27AE60;
    --red: #E74C3C;
    --red-dark: #C0392B;
    --cream: #FFF8EE;
    --white: #FFFFFF;
    --text: #1A2E4A;
}

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #0d1a2e;
    font-family: 'Nunito', system-ui, -apple-system, sans-serif;
    color: var(--text);
}

/* Outer layout */
#game-wrapper {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, #1a2e4a 0%, #0a1322 100%);
}

/* Floating top site header */
#site-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 48px;
    background: rgba(13, 26, 46, 0.9);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 20;
    border-bottom: 2px solid rgba(244, 196, 48, 0.3);
}

.brand-link {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: #fff;
    font-weight: 900;
    font-size: 17px;
    letter-spacing: -0.2px;
}

.brand-link span {
    color: var(--gold);
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-ctrl {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.btn-ctrl:hover {
    background: rgba(244, 196, 48, 0.25);
    border-color: var(--gold);
    color: var(--gold);
    transform: translateY(-1px);
}

/* Game canvas container */
#canvas-stage {
    position: relative;
    width: 100%;
    max-width: 1024px;
    height: auto;
    aspect-ratio: 4 / 3;
    max-height: calc(100vh - 56px);
    margin-top: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 18px;
    box-shadow: 0 16px 50px rgba(0, 0, 0, 0.6), 0 0 0 4px var(--gold);
    overflow: hidden;
}

#game-canvas-wrap {
    width: 100%;
    height: 100%;
}

#game-canvas-wrap canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

/* Floating HUD overlay on top of canvas */
#hud-overlay {
    position: absolute;
    top: 8px;
    left: 12px;
    right: 12px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    pointer-events: none;
    z-index: 15;
}

.hud-card {
    background: rgba(26, 46, 74, 0.94);
    border: 2px solid rgba(244, 196, 48, 0.5);
    border-radius: 14px;
    padding: 8px 14px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    pointer-events: auto;
}

.hud-label {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--gold);
}

.hud-val-cash {
    font-size: 24px;
    font-weight: 900;
    color: var(--green);
    line-height: 1.1;
}

.hud-progress-bar {
    width: 130px;
    height: 8px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 999px;
    overflow: hidden;
    margin-top: 4px;
}

#hud-progress-fill {
    width: 0%;
    height: 100%;
    background: var(--green);
    border-radius: 999px;
    transition: width 0.3s ease;
}

.hud-goal-sub {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 2px;
}

.hud-center {
    text-align: center;
}

#hud-level {
    font-size: 15px;
    font-weight: 900;
    color: #fff;
    margin-top: 2px;
}

.hud-right {
    text-align: right;
}

.hud-cups-val {
    font-size: 14px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 3px;
}

#hud-hearts {
    font-size: 16px;
    display: flex;
    gap: 4px;
    justify-content: flex-end;
}

/* Modals & Overlays */
.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(10, 19, 34, 0.78);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 30;
    padding: 16px;
    transition: opacity 0.25s ease;
}

.modal-overlay.hidden {
    display: none !important;
}

.modal-window {
    background: #FFFFFF;
    border-radius: 20px;
    width: 100%;
    max-width: 440px;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5), 0 0 0 3px rgba(244, 196, 48, 0.6);
    animation: modalPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalPop {
    from { transform: scale(0.85); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-header {
    background: var(--navy);
    color: #fff;
    padding: 18px 24px;
    text-align: center;
}

.modal-tag {
    display: inline-block;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--gold);
    margin-bottom: 4px;
}

.modal-title {
    font-size: 22px;
    font-weight: 900;
    line-height: 1.2;
}

.modal-body {
    padding: 20px 24px;
    background: #FFFDF9;
}

.modal-story {
    font-size: 14.5px;
    line-height: 1.6;
    color: #2D3748;
    background: #FFF8EE;
    border: 1px solid #E8DFD0;
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 16px;
}

.modal-section-title {
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--navy);
    text-align: center;
    margin-bottom: 12px;
}

.btn-choice {
    width: 100%;
    border: none;
    border-radius: 14px;
    padding: 14px 16px;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    margin-bottom: 10px;
    transition: transform 0.15s ease, filter 0.15s ease;
}

.btn-choice:hover {
    transform: translateY(-2px);
    filter: brightness(1.05);
}

.btn-choice.choice-a {
    background: var(--green);
    color: #FFFFFF;
}

.btn-choice.choice-b {
    background: var(--navy);
    color: #FFFFFF;
}

.choice-tag {
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 1px;
    opacity: 0.8;
}

.choice-label {
    font-size: 16px;
    font-weight: 900;
    margin: 2px 0;
}

.choice-detail {
    font-size: 12.5px;
    opacity: 0.9;
    line-height: 1.35;
}

/* Outcome Modal */
.lesson-card {
    background: var(--navy);
    color: #fff;
    border-radius: 14px;
    padding: 16px;
    border-left: 6px solid var(--gold);
    margin-bottom: 18px;
}

.lesson-card-tag {
    font-size: 11px;
    font-weight: 900;
    color: var(--gold);
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.lesson-card-text {
    font-size: 14px;
    line-height: 1.5;
    color: #E2E8F0;
}

.btn-primary {
    width: 100%;
    background: var(--green);
    border: none;
    color: #fff;
    font-family: inherit;
    font-size: 16px;
    font-weight: 900;
    padding: 14px 20px;
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    background: var(--green-dark);
    transform: translateY(-2px);
}

.btn-gold {
    background: var(--gold);
    color: var(--navy);
}

.btn-gold:hover {
    background: var(--gold-hover);
}

/* Level Complete Modal */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    background: var(--navy);
    border-radius: 12px;
    padding: 12px 8px;
    text-align: center;
    margin-bottom: 16px;
}

.stat-item {
    color: #fff;
}

.stat-num {
    font-size: 20px;
    font-weight: 900;
    color: #fff;
}

/* Shop Modal */
.shop-items-list {
    max-height: 48vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 14px;
    padding-right: 4px;
}

.shop-item-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #F8FAFC;
    border: 2px solid #E2E8F0;
    border-radius: 14px;
    padding: 10px 14px;
    transition: all 0.2s ease;
}

.shop-item-card.in-cart {
    background: rgba(46, 204, 113, 0.12);
    border-color: var(--green);
}

.shop-item-icon {
    font-size: 28px;
}

.shop-item-info {
    flex: 1;
}

.shop-item-name {
    font-size: 14px;
    font-weight: 800;
    color: var(--navy);
}

.shop-item-desc {
    font-size: 11px;
    color: #64748B;
}

.shop-item-action {
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-shop-buy, .btn-shop-plus, .btn-shop-minus {
    border: none;
    font-family: inherit;
    font-weight: 900;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-shop-buy {
    background: var(--navy);
    color: #fff;
    padding: 8px 14px;
    font-size: 13px;
}

.btn-shop-buy:disabled {
    background: #CBD5E1;
    cursor: not-allowed;
}

.btn-shop-plus {
    background: var(--green);
    color: #fff;
    width: 28px;
    height: 28px;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-shop-minus {
    background: var(--red);
    color: #fff;
    width: 28px;
    height: 28px;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.shop-item-qty {
    font-weight: 900;
    font-size: 15px;
    width: 20px;
    text-align: center;
    color: var(--navy);
}

/* Recipe Guide Modal */
.recipe-cards-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 55vh;
    overflow-y: auto;
}

.recipe-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #FFFDF9;
    border: 2px solid #E8DFD0;
    border-radius: 14px;
    padding: 12px 14px;
}

.recipe-badge {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
}

.recipe-info {
    flex: 1;
}

.recipe-title {
    font-size: 15px;
    font-weight: 900;
    color: var(--navy);
}

.recipe-ingredients {
    font-size: 12.5px;
    color: #4A5568;
    margin-top: 2px;
}

.recipe-price {
    font-size: 16px;
    font-weight: 900;
    color: var(--green);
}

/* Tutorial steps */
.tutorial-step {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    margin-bottom: 14px;
}

.step-num {
    background: var(--gold);
    color: var(--navy);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-weight: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.step-text {
    font-size: 13.5px;
    line-height: 1.5;
    color: #2D3748;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #site-header {
        height: 40px;
        padding: 0 8px;
    }
    .brand-link {
        font-size: 13px;
    }
    .btn-ctrl {
        font-size: 10px;
        padding: 3px 6px;
    }
    #canvas-stage {
        margin-top: 40px;
        max-height: calc(100vh - 42px);
        border-radius: 0;
        box-shadow: none;
    }
    #hud-overlay {
        top: 4px;
        left: 4px;
        right: 4px;
        gap: 4px;
    }
    .hud-card {
        padding: 4px 6px;
        border-radius: 8px;
        border-width: 1px;
    }
    .hud-label {
        font-size: 8px;
        letter-spacing: 0.2px;
    }
    .hud-val-cash {
        font-size: 14px;
    }
    .hud-progress-bar {
        width: 65px;
        height: 5px;
        margin-top: 2px;
    }
    .hud-goal-sub {
        font-size: 8px;
    }
    #hud-level {
        font-size: 10px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 130px;
    }
    .hud-cups-val {
        font-size: 10px;
    }
    #hud-hearts {
        font-size: 11px;
        gap: 2px;
    }
}

/* Mobile fixes (2026-11-22): popups use the full screen + scroll; compact one-line header */
.brand-sub { color: inherit; font-weight: inherit; }
.modal-window { max-height: 100%; overflow-y: auto; -webkit-overflow-scrolling: touch; }
@media (max-width: 768px) {
    .modal-overlay {
        position: fixed;
        top: 40px; left: 0; right: 0; bottom: 0;
        padding: 10px;
        align-items: flex-start;
        overflow-y: auto;
    }
    .modal-window { max-height: none; margin: auto 0; }
    .modal-header { padding: 12px 16px; }
    .modal-body { padding: 14px 16px; }
    .header-controls { gap: 4px; flex-shrink: 0; }
    .btn-ctrl { white-space: nowrap; }
    .brand-link { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
}
@media (max-width: 560px) {
    .brand-sub { display: none; }
    .brand-link { font-size: 12px; overflow: visible; }
    .header-controls { gap: 3px; }
    .btn-ctrl { font-size: 9.5px; padding: 3px 5px; }
}

/* Rotate-phone tip (2026-11-22): only on phones held upright */
#rotate-tip { display: none; }
@media (max-width: 768px) and (orientation: portrait) {
    #rotate-tip {
        display: flex;
        align-items: center;
        gap: 10px;
        position: fixed;
        left: 12px; right: 12px; bottom: calc(16px + env(safe-area-inset-bottom));
        z-index: 40;
        background: var(--navy, #1A2E4A);
        color: #fff;
        border: 2px solid var(--gold, #F4C430);
        border-radius: 14px;
        padding: 12px 14px;
        font-size: 14px;
        line-height: 1.4;
        box-shadow: 0 10px 30px rgba(0,0,0,0.45);
    }
    #rotate-tip b { color: var(--gold, #F4C430); }
    #rotate-tip.closed { display: none; }
    .rotate-icon { font-size: 22px; flex-shrink: 0; display: inline-block; animation: tipTurn 2.4s ease-in-out infinite; }
    #rotate-tip-close {
        margin-left: auto; flex-shrink: 0;
        background: rgba(255,255,255,0.15); border: 0; color: #fff;
        width: 30px; height: 30px; border-radius: 50%;
        font-size: 14px; cursor: pointer;
    }
}
@keyframes tipTurn { 0%,40% { transform: rotate(0); } 60%,100% { transform: rotate(-90deg); } }
