body {
    margin: 0;
    padding: 0;
    color: #f5efe6;
    background-color: #1c120c;
    font-family: 'Georgia', 'Palatino', serif;
    overflow: hidden;
}

#app {
    width: 100%;
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

#game-container {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

#hud {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

#hud > * {
    pointer-events: auto;
}

/* ===================== BUTTONS ===================== */
.btn-primary {
    background: linear-gradient(135deg, #8c5836, #d48c3b);
    color: #fff8ed;
    border: 2px solid #ffd175;
    padding: 14px 32px;
    font-size: 18px;
    font-family: 'Georgia', serif;
    font-weight: bold;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    min-width: 200px;
}
.btn-primary:hover {
    background: linear-gradient(135deg, #d48c3b, #e6a15c);
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(212,140,59,0.4);
}
.btn-primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background: rgba(45,30,23,0.9);
    color: #f5efe6;
    border: 1px solid #8c5836;
    padding: 10px 20px;
    font-size: 14px;
    font-family: 'Georgia', serif;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}
.btn-secondary:hover {
    background: rgba(140,88,54,0.8);
    border-color: #d48c3b;
}

.btn-danger {
    background: rgba(231,76,60,0.8);
    color: #fff8ed;
    border: 1px solid #e74c3c;
    padding: 10px 20px;
    font-size: 14px;
    font-family: 'Georgia', serif;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}
.btn-danger:hover {
    background: rgba(231,76,60,1);
}

.btn-icon {
    background: rgba(45,30,23,0.8);
    color: #f5efe6;
    border: 1px solid #8c5836;
    width: 36px;
    height: 36px;
    font-size: 18px;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.btn-icon:hover {
    background: rgba(140,88,54,0.8);
}

/* NEW GLOBAL FONT STACK + WARM PALETTE IMPORTS */
:root {
    --coffee-ink: #18100c;
    --coffee-dark: #2d1e17;
    --coffee-mocha: #3a241b;
    --coffee-roast: #8c5836;
    --coffee-gold: #d48c3b;
    --cream: #f5efe6;
    --amber: #ffd175;
    --terracotta: #c7673a;
    --ice: rgba(245,239,230,0.08);
    --glass-border: rgba(255,209,117,0.28);
    --glass-glow: 0 0 24px rgba(212,140,59,0.18), inset 0 1px 0 rgba(255,255,255,0.08);
    --font-head: 'Playfair Display', Georgia, 'Palatino', serif;
    --font-body: 'Inter', 'Segoe UI', system-ui, sans-serif;
}

body {
    font-family: var(--font-body);
    letter-spacing: 0.01em;
}

/* ---------- Glassmorphism helpers ---------- */
.glass-panel {
    background: linear-gradient(160deg, rgba(58,36,27,0.72), rgba(24,16,12,0.82));
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-glow), 0 12px 40px rgba(0,0,0,0.45);
    border-radius: 20px;
}

.menu-backdrop {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 30%, rgba(45,30,23,0.55) 0%, rgba(24,16,12,0.88) 75%);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: 20;
}

.badge-pill {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 999px;
    font-family: var(--font-head);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    background: rgba(212,140,59,0.16);
    border: 1px solid rgba(255,209,117,0.4);
    color: var(--amber);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.badge-amber { background: linear-gradient(120deg, #8c5836, #d48c3b); border-color: var(--amber); color: #fff8ed; box-shadow: 0 4px 16px rgba(212,140,59,0.35); }
.badge-green { background: linear-gradient(120deg, #1e8449, #27ae60); border-color: #55efc4; color: #eafff3; }
.badge-red   { background: linear-gradient(120deg, #a93226, #e74c3c); border-color: #ff9e97; color: #ffeaea; }

/* ---------- Modal (glass) ---------- */
.glass-modal {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    z-index: 40;
    min-width: 320px;
    max-width: 520px;
    max-height: 86vh;
    overflow-y: auto;
    text-align: center;
    padding: 30px;
    border-radius: 22px;
    background: linear-gradient(165deg, rgba(58,36,27,0.92), rgba(24,16,12,0.96));
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 24px 60px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,255,255,0.09);
    animation: modal-in 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.glass-modal-lg { min-width: 360px; max-width: 620px; }
.modal-close {
    position: absolute;
    top: 14px; right: 16px;
    width: 36px; height: 36px;
    border-radius: 50%;
    border: 1px solid rgba(255,209,117,0.35);
    background: rgba(45,30,23,0.7);
    color: var(--amber);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 2;
}
.modal-close:hover { background: var(--coffee-roast); transform: rotate(90deg); }
.modal-title {
    font-family: var(--font-head);
    color: var(--amber);
    font-size: 30px;
    margin: 10px 0 6px;
    letter-spacing: 0.02em;
}
.modal-sub { color: #c9a97e; font-size: 14px; margin: 0 0 18px; font-style: italic; }
@keyframes modal-in { from { opacity: 0; transform: translate(-50%,-46%) scale(0.96); } to { opacity: 1; transform: translate(-50%,-50%) scale(1); } }

/* ---------- Recipe grid ---------- */
.recipe-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin: 6px 0 20px;
}
.recipe-card {
    background: linear-gradient(160deg, rgba(140,88,54,0.28), rgba(45,30,23,0.7));
    border: 1px solid rgba(255,209,117,0.22);
    border-radius: 14px;
    padding: 14px;
    text-align: left;
    transition: all 0.2s;
}
.recipe-card:hover { transform: translateY(-3px); border-color: var(--amber); box-shadow: 0 8px 20px rgba(212,140,59,0.18); }
.recipe-name { font-family: var(--font-head); color: var(--amber); font-size: 17px; font-weight: 700; margin-bottom: 4px; }
.recipe-desc { color: #d9c6ad; font-size: 12px; line-height: 1.45; margin-bottom: 8px; min-height: 34px; }
.recipe-ing { font-size: 11px; }
.recipe-pip {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(212,140,59,0.18);
    border: 1px solid rgba(255,209,117,0.35);
    color: var(--amber);
    font-family: var(--font-head);
    font-weight: 600;
    letter-spacing: 0.04em;
}
.credits-line { margin: 0; font-size: 14px; }
.credits-line.muted { color: #c9a97e; font-size: 13px; }
.credits-line.ital { font-style: italic; }

/* ---------- Settings card ---------- */
.settings-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: rgba(45,30,23,0.5);
    border: 1px solid rgba(255,209,117,0.2);
    border-radius: 14px;
    padding: 18px;
    margin-bottom: 20px;
    text-align: left;
}
.settings-row {
    display: flex;
    align-items: center;
    gap: 12px;
}
.settings-label { color: var(--cream); font-size: 14px; font-weight: 600; min-width: 150px; }
.toggle-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 62px;
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid rgba(255,209,117,0.4);
    background: rgba(45,30,23,0.9);
    color: #b07d50;
    transition: all 0.2s;
}
.toggle-chip.on { background: linear-gradient(120deg, #8c5836, #d48c3b); color: #fff8ed; border-color: var(--amber); }

/* ===================== MENU SCREEN ===================== */
.screen-menu {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background:
        radial-gradient(ellipse at 50% 18%, rgba(212,140,59,0.22) 0%, transparent 45%),
        radial-gradient(ellipse at center, rgba(45,30,23,0.82) 0%, rgba(24,16,12,0.96) 100%);
    z-index: 20;
    overflow: hidden;
}

/* --- Ambient scene particles --- */
.ambient-scene { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.float-bit {
    position: absolute;
    width: 14px; height: 14px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(212,140,59,0.7), rgba(212,140,59,0.05));
    filter: blur(1px);
    animation: floaty 9s ease-in-out infinite;
}
.fb1 { left: 8%;  top: 22%; animation-delay: 0s; }
.fb2 { left: 84%; top: 30%; width: 10px; height: 10px; animation-delay: 1.6s; }
.fb3 { left: 14%; top: 66%; width: 8px; height: 8px; animation-delay: 2.8s; }
.fb4 { right: 10%; top: 72%; animation-delay: 4s; }
.fb5 { left: 50%; top: 14%; width: 6px; height: 6px; animation-delay: 5.5s; }
@keyframes floaty {
    0%,100% { transform: translateY(0) translateX(0) scale(1); opacity: 0.35; }
    25% { opacity: 0.75; }
    50% { transform: translateY(-34px) translateX(12px) scale(1.15); opacity: 0.4; }
    75% { opacity: 0.7; }
}
.steam-haze {
    position: absolute;
    width: 220px; height: 220px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,209,117,0.10), transparent 65%);
    animation: haze 12s ease-in-out infinite;
}
.sh1 { left: -40px; bottom: -40px; }
.sh2 { right: -60px; top: 10%; animation-delay: 5s; width: 300px; height: 300px; }
@keyframes haze {
    0%,100% { transform: translateY(0) scale(1); opacity: 0.5; }
    50% { transform: translateY(-40px) scale(1.15); opacity: 0.9; }
}

/* --- Coffee cup badge --- */
.menu-badge-wrap { margin: 0 0 4px; z-index: 2; filter: drop-shadow(0 8px 18px rgba(0,0,0,0.5)); }
.coffee-badge { display: flex; justify-content: center; }
.coffee-svg { width: 150px; height: 136px; }
.steam-wisp { animation: steam-rise 3.2s ease-in-out infinite; transform-origin: center; }
.w2 { animation-delay: 0.6s; }
.w3 { animation-delay: 1.2s; }
@keyframes steam-rise {
    0% { transform: translateY(10px) scale(0.8); opacity: 0; }
    30% { opacity: 0.8; }
    60% { opacity: 0.6; }
    100% { transform: translateY(-26px) scale(1.3); opacity: 0; }
}
.bean { animation: bean-float 5s ease-in-out infinite; }
.b2 { animation-delay: 2s; }
@keyframes bean-float { 0%,100% { transform: translateY(0) rotate(-7deg); } 50% { transform: translateY(-6px) rotate(7deg); } }

/* --- Menu content --- */
.menu-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    padding: 24px 20px;
    max-width: 760px;
    width: 100%;
    z-index: 2;
}
.menu-head { display: flex; flex-direction: column; align-items: center; gap: 8px; }

.title-coffee {
    font-size: 46px;
    color: var(--amber);
    text-shadow: 2px 2px 10px rgba(0,0,0,0.85), 0 0 42px rgba(255,209,117,0.35);
    margin: 0;
    letter-spacing: 3px;
    font-family: var(--font-head);
}

.subtitle {
    font-size: 16px;
    color: #c9a97e;
    font-style: italic;
    margin: 0;
}

/* --- Difficulty cards --- */
.difficulty-select {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    margin: 4px 0;
}
.difficulty-label {
    font-family: var(--font-head);
    color: var(--cream);
    font-size: 14px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    opacity: 0.85;
}
.difficulty-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    width: 100%;
}
.diff-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: left;
    padding: 14px 14px 12px;
    border-radius: 14px;
    cursor: pointer;
    font-family: var(--font-body);
    background: linear-gradient(160deg, rgba(45,30,23,0.6), rgba(24,16,12,0.85));
    border: 1px solid rgba(255,209,117,0.18);
    color: var(--cream);
    transition: all 0.22s;
}
.diff-card:hover { transform: translateY(-3px); border-color: rgba(255,209,117,0.5); box-shadow: 0 10px 24px rgba(0,0,0,0.4); }
.diff-card.active {
    border-color: var(--amber);
    background: linear-gradient(155deg, rgba(140,88,54,0.5), rgba(58,36,27,0.9));
    box-shadow: 0 12px 30px rgba(212,140,59,0.25), inset 0 0 0 1px rgba(255,209,117,0.25);
}
.diff-card-head { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.diff-name { font-family: var(--font-head); font-size: 17px; font-weight: 700; color: var(--cream); }
.diff-card.active .diff-name { color: #fff8ed; }
.diff-badge {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    padding: 3px 9px;
    border-radius: 999px;
    background: rgba(212,140,59,0.18);
    border: 1px solid rgba(255,209,117,0.4);
    color: var(--amber);
    white-space: nowrap;
}
.diff-desc { font-size: 11.5px; line-height: 1.45; color: #d9c6ad; min-height: 34px; }
.diff-perk { font-size: 11px; font-style: italic; color: #b07d50; }
.diff-check {
    position: absolute;
    top: -8px; right: -8px;
    width: 22px; height: 22px;
    border-radius: 50%;
    background: linear-gradient(120deg, #8c5836, #d48c3b);
    border: 2px solid #fff8ed;
    color: #fff8ed;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}
.diff-current { font-size: 13px; color: #c9a97e; font-style: italic; min-height: 18px; }

.btn-start {
    font-size: 22px;
    padding: 16px 52px;
    margin-top: 2px;
    border-radius: 14px;
    position: relative;
    overflow: hidden;
}
.btn-start .btn-gleam {
    position: absolute;
    top: 0; left: -80%;
    width: 50%; height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255,255,255,0.35), transparent);
    transform: skewX(-20deg);
    animation: gleam 4s ease-in-out infinite;
}
@keyframes gleam {
    0% { left: -80%; }
    55% { left: 130%; }
    100% { left: 130%; }
}

/* --- Feature cards --- */
.menu-feature-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    width: 100%;
    margin-top: 4px;
}
.feature-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 8px;
    border-radius: 12px;
    cursor: pointer;
    background: rgba(45,30,23,0.5);
    border: 1px solid rgba(255,209,117,0.16);
    color: var(--cream);
    font-family: var(--font-body);
    transition: all 0.2s;
}
.feature-card:hover { transform: translateY(-3px); background: rgba(140,88,54,0.4); border-color: var(--amber); }
.feature-ic { font-size: 22px; }
.feature-t { font-size: 12px; font-weight: 600; }
.feature-d { font-size: 10.5px; color: #c9a97e; }

/* --- Ambient music dock --- */
.ambient-dock-bottom {
    position: absolute;
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 30;
}
.ambient-dock-corner {
    position: absolute;
    bottom: 18px;
    right: 18px;
    z-index: 50;
}
.ambient-player {
    background: linear-gradient(160deg, rgba(45,30,23,0.92), rgba(24,16,12,0.95));
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    box-shadow: 0 14px 34px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.08);
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 300px;
}
.ambient-player.dock {
    min-width: 0;
    padding: 8px 8px;
    border-radius: 26px;
    width: 168px;
}
.ambient-track { display: flex; align-items: center; gap: 10px; }
.ambient-disc {
    position: relative;
    width: 40px; height: 40px;
    border-radius: 50%;
    background: repeating-radial-gradient(circle, #2d1e17 0 3px, #3a241b 3px 6px);
    border: 2px solid var(--coffee-roast);
    flex-shrink: 0;
    animation: disc-spin 6s linear infinite;
}
.ambient-player.dock .ambient-disc { animation-play-state: paused; }
.disc-hole { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); width: 10px; height: 10px; border-radius: 50%; background: var(--amber); }
@keyframes disc-spin { to { transform: rotate(360deg); } }
.ambient-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}
.ambient-title { font-family: var(--font-head); color: var(--amber); font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ambient-status { font-size: 11px; color: #c9a97e; }
.ambient-player.dock .ambient-status { font-size: 10px; }

.ambient-toggle {
    width: 40px; height: 40px;
    border-radius: 50%;
    border: 1px solid rgba(255,209,117,0.4);
    background: linear-gradient(135deg, #8c5836, #d48c3b);
    color: #fff8ed;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}
.ambient-toggle:hover { transform: scale(1.08); box-shadow: 0 4px 16px rgba(212,140,59,0.4); }
.ambient-toggle.on { background: linear-gradient(135deg, #27ae60, #2ecc71); border-color: #55efc4; }
.icon-play, .icon-pause { display: block; }
.icon-play { width: 0; height: 0; border-left: 12px solid currentColor; border-top: 7px solid transparent; border-bottom: 7px solid transparent; margin-left: 3px; }
.icon-pause { width: 12px; height: 14px; border-left: 4px solid currentColor; border-right: 4px solid currentColor; }

.ambient-controls { display: flex; align-items: center; gap: 10px; }
.ambient-vol-label { font-size: 11px; color: #c9a97e; font-weight: 600; letter-spacing: 0.06em; }
.ambient-vol-val { font-size: 12px; color: var(--amber); font-weight: 700; min-width: 34px; text-align: right; }

/* Range slider */
input[type="range"].ambient-slider {
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 999px;
    background: linear-gradient(to right, var(--amber) 0%, var(--amber) var(--fill,0%), #3a241b var(--fill,0%), #3a241b 100%);
    outline: none;
    cursor: pointer;
    flex: 1;
    min-width: 80px;
    border: 1px solid rgba(255,209,117,0.25);
}
input[type="range"].ambient-slider.grow { flex: 1; }
input[type="range"].ambient-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: radial-gradient(circle, #ffd175, #d48c3b);
    border: 2px solid #fff8ed;
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
    cursor: pointer;
}
input[type="range"].ambient-slider::-moz-range-thumb {
    width: 16px; height: 16px;
    border-radius: 50%;
    background: radial-gradient(circle, #ffd175, #d48c3b);
    border: 2px solid #fff8ed;
    cursor: pointer;
}

/* Equalizer bars */
.eq-bars { display: flex; align-items: flex-end; gap: 3px; height: 16px; margin-top: 2px; }
.ambient-player.dock .eq-bars { height: 12px; }
.eq-bar {
    display: block;
    width: 3px;
    border-radius: 2px;
    background: linear-gradient(to top, #d48c3b, #ffd175);
    height: 4px;
    transition: height 0.2s;
}
.eq-bars.playing .eq-bar { animation: eq-bounce 0.9s ease-in-out infinite; }
.eq-bars.idle .eq-bar { height: 3px; opacity: 0.35; }
@keyframes eq-bounce {
    0%,100% { height: 4px; }
    30% { height: 15px; }
    60% { height: 8px; }
    80% { height: 13px; }
}

/* --- Responsive --- */
@media (max-width: 720px) {
    .title-coffee { font-size: 34px; }
    .coffee-svg { width: 112px; height: 102px; }
    .difficulty-cards { grid-template-columns: 1fr; gap: 8px; }
    .diff-desc { min-height: 0; }
    .menu-feature-cards { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .menu-content { gap: 14px; padding: 16px 14px; }
    .btn-start { font-size: 19px; padding: 14px 40px; }
    .ambient-dock-bottom { bottom: 10px; width: calc(100% - 20px); }
    .ambient-dock-bottom .ambient-player { min-width: 0; width: 100%; }
    .recipe-grid { grid-template-columns: repeat(2, 1fr); }
    .glass-modal, .glass-modal-lg { min-width: 280px; max-width: 92vw; padding: 22px; }
    .ambient-dock-corner { right: 8px; bottom: 8px; }
}

/* ===================== INTRO SCREEN ===================== */
.screen-intro {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(ellipse at center, rgba(45,30,23,0.9) 0%, rgba(28,18,12,0.97) 100%);
    z-index: 20;
}

.intro-content {
    text-align: center;
    max-width: 600px;
    padding: 30px;
}

.intro-content h2 {
    color: #ffd175;
    font-size: 36px;
    margin-bottom: 20px;
}

.intro-text {
    color: #f5efe6;
    line-height: 1.8;
    font-size: 15px;
    text-align: left;
    margin-bottom: 24px;
}

.intro-text p {
    margin: 0 0 12px 0;
}

/* ===================== ENDING SCREEN ===================== */
.screen-ending {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(ellipse at center, rgba(45,30,23,0.92) 0%, rgba(28,18,12,0.97) 100%);
    z-index: 20;
}

.ending-content {
    text-align: center;
    max-width: 550px;
    padding: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.ending-content h2 {
    font-size: 32px;
    margin: 0;
}

.ending-content h3 {
    color: #ffd175;
    font-size: 22px;
    margin: 0;
}

.stats-recap {
    background: rgba(45,30,23,0.9);
    border: 1px solid #8c5836;
    border-radius: 8px;
    padding: 16px;
    width: 100%;
    max-width: 350px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid rgba(140,88,54,0.3);
    font-size: 14px;
}
.stat-item:last-child { border-bottom: none; }
.stat-item span:first-child { color: #b07d50; }
.stat-item span:last-child { color: #ffd175; font-weight: bold; }

.epilogues {
    width: 100%;
    max-width: 400px;
    text-align: left;
}
.epilogues h4 {
    color: #ffd175;
    margin: 0 0 8px 0;
    font-size: 16px;
}

.epilogue-item {
    padding: 6px 0;
    font-size: 13px;
    color: #f5efe6;
    border-bottom: 1px solid rgba(140,88,54,0.2);
}

.ending-buttons {
    display: flex;
    gap: 12px;
    margin-top: 12px;
}

/* ===================== OVERLAY MODAL ===================== */
.overlay-modal {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(28,18,12,0.95);
    border: 2px solid #8c5836;
    border-radius: 12px;
    padding: 30px;
    text-align: center;
    z-index: 30;
    min-width: 300px;
    max-width: 500px;
}
.overlay-modal h2 {
    color: #ffd175;
    margin: 0 0 16px 0;
}

/* ===================== HUD TOPBAR ===================== */
.hud-topbar {
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 44px;
    background: rgba(28,18,12,0.9);
    border-bottom: 2px solid #8c5836;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px;
    z-index: 15;
}

.hud-left, .hud-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.hud-period {
    color: #ffd175;
    font-size: 14px;
    font-weight: bold;
}

.hud-money {
    color: #27ae60;
    font-size: 16px;
    font-weight: bold;
}

.hud-reputation {
    color: #ffd175;
    font-size: 14px;
}

/* ===================== ORDER TICKET ===================== */
.order-ticket {
    position: absolute;
    top: 52px;
    right: 12px;
    background: rgba(245,239,230,0.95);
    border: 2px solid #8c5836;
    border-radius: 8px;
    padding: 12px;
    min-width: 220px;
    z-index: 15;
    color: #1c120c;
}

.ticket-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.ticket-customer {
    font-weight: bold;
    font-size: 14px;
    color: #2d1e17;
}

.ticket-order {
    font-size: 12px;
    color: #8c5836;
    font-style: italic;
}

.ticket-patience {
    font-size: 11px;
    color: #8c5836;
}

/* ===================== BREW STATION ===================== */
.brew-station {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    background: rgba(28,18,12,0.92);
    border-top: 2px solid #8c5836;
    padding: 10px 16px;
    display: flex;
    gap: 20px;
    align-items: flex-start;
    z-index: 15;
    flex-wrap: wrap;
}

.brew-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.brew-options {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.brew-btn {
    background: rgba(45,30,23,0.9);
    color: #f5efe6;
    border: 1px solid #8c5836;
    padding: 6px 10px;
    font-size: 12px;
    font-family: 'Georgia', serif;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.15s;
    white-space: nowrap;
}
.brew-btn:hover {
    background: rgba(140,88,54,0.7);
}
.brew-btn.active {
    background: #8c5836;
    border-color: #ffd175;
    color: #ffd175;
}

.ing-btn {
    font-size: 11px;
    padding: 5px 8px;
}

.brew-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-left: auto;
}

.btn-serve {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: #fff8ed;
    border: 2px solid #27ae60;
    padding: 10px 24px;
    font-size: 16px;
    font-weight: bold;
    font-family: 'Georgia', serif;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}
.btn-serve:hover {
    background: linear-gradient(135deg, #2ecc71, #55efc4);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(39,174,96,0.4);
}

.btn-reset {
    background: rgba(231,76,60,0.7);
    color: #fff8ed;
    border: 1px solid #e74c3c;
    padding: 10px 16px;
    font-size: 14px;
    font-family: 'Georgia', serif;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}
.btn-reset:hover {
    background: rgba(231,76,60,1);
}

/* ===================== SUPPLY STATUS ===================== */
.supply-status {
    position: absolute;
    bottom: 100px;
    left: 12px;
    background: rgba(28,18,12,0.85);
    border: 1px solid #8c5836;
    border-radius: 6px;
    padding: 8px 12px;
    z-index: 15;
    max-width: 200px;
}

.btn-restock {
    background: rgba(45,30,23,0.8);
    color: #b07d50;
    border: 1px solid #8c5836;
    padding: 3px 8px;
    font-size: 10px;
    font-family: 'Georgia', serif;
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.15s;
}
.btn-restock:hover {
    background: #8c5836;
    color: #fff8ed;
}

/* ===================== DIALOGUE OVERLAY ===================== */
.dialogue-overlay {
    position: absolute;
    bottom: 110px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 700px;
    z-index: 25;
}

.dialogue-box {
    background: rgba(28,18,12,0.95);
    border: 2px solid #d48c3b;
    border-radius: 12px;
    padding: 20px;
}

.dialogue-speaker {
    color: #ffd175;
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 8px;
}

.dialogue-text {
    color: #f5efe6;
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 16px;
    min-height: 40px;
}

.dialogue-choices {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn-dialogue {
    background: rgba(140,88,54,0.6);
    color: #f5efe6;
    border: 1px solid #d48c3b;
    padding: 10px 16px;
    font-size: 14px;
    font-family: 'Georgia', serif;
    cursor: pointer;
    border-radius: 6px;
    text-align: left;
    transition: all 0.2s;
}
.btn-dialogue:hover {
    background: rgba(140,88,54,0.9);
    border-color: #ffd175;
    transform: translateX(4px);
}

/* ===================== EVENT OVERLAY ===================== */
.event-overlay {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    z-index: 30;
}

.event-box {
    background: rgba(28,18,12,0.95);
    border: 2px solid #ffd175;
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    max-width: 450px;
}

.event-box h3 {
    color: #ffd175;
    margin: 0 0 12px 0;
    font-size: 20px;
}

.event-box p {
    color: #f5efe6;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 16px;
}

.event-choices {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn-event {
    background: rgba(140,88,54,0.7);
    color: #f5efe6;
    border: 1px solid #d48c3b;
    padding: 10px 16px;
    font-size: 14px;
    font-family: 'Georgia', serif;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}
.btn-event:hover {
    background: #8c5836;
    border-color: #ffd175;
}

/* ===================== CUSTOMER FEEDBACK SPEECH BUBBLE ===================== */
.speech-bubble {
    position: absolute;
    top: 58px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(245, 239, 230, 0.97);
    border: 2px solid #8c5836;
    border-left-width: 6px;
    border-radius: 16px;
    padding: 12px 18px;
    max-width: min(560px, 86vw);
    color: #1c120c;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
    z-index: 26;
    pointer-events: none;
    animation: bubble-in 0.32s cubic-bezier(0.2, 0.9, 0.3, 1.25);
}
.speech-bubble.good { border-left-color: #27ae60; }
.speech-bubble.bad  { border-left-color: #c7673a; }

.speech-face { font-size: 30px; line-height: 1; flex-shrink: 0; }
.speech-body { display: flex; flex-direction: column; gap: 2px; }
.speech-text { font-size: 15px; line-height: 1.45; font-weight: 600; color: #2d1e17; }
.speech-tip { font-size: 12px; font-weight: 700; color: #1e8449; }

.speech-tail {
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 0; height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid rgba(245, 239, 230, 0.97);
}

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

@media (max-width: 720px) {
    .speech-bubble { top: 50px; padding: 10px 14px; gap: 8px; }
    .speech-face { font-size: 24px; }
    .speech-text { font-size: 13px; }
}