/* ===== TOKENS ===== */
:root {
    --cream: #FAF7F1;
    --cream-dark: #F0E9DE;
    --ink: #1C1410;
    --ink-soft: #41332A;
    --ink-muted: #8D7B6E;
    --ink-ghost: #C6B6A8;
    --gold: #A87E42;
    --gold-light: #C8A96E;
    --gold-pale: #F6EDDC;
    --gold-border: #E2D0AC;
    --accent: #2C5F8A;
    --accent-light: #EAF2FB;
    --success: #2D6A4F;
    --success-bg: #E8F5EE;
    --danger: #C0392B;
    --danger-bg: #FDECEA;
    --panel: #FFFFFF;
    --border: rgba(64,46,30,0.10);
    --border-strong: rgba(64,46,30,0.18);
    --shadow-sm: 0 1px 2px rgba(64,46,30,0.05), 0 2px 6px rgba(64,46,30,0.05);
    --shadow-md: 0 2px 6px rgba(64,46,30,0.05), 0 10px 26px rgba(64,46,30,0.09);
    --shadow-lg: 0 4px 12px rgba(64,46,30,0.06), 0 26px 60px rgba(64,46,30,0.13);
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 22px;
    --radius-xl: 30px;
    --ink-dark: #000000;
    --bg-deep: #0D0B0A;
    --font-brand: 'Cormorant Garamond', serif;
    --font-display: 'Cormorant Garamond', Georgia, serif;
    --font-body: 'DM Sans', system-ui, sans-serif;
    --font-mono: 'DM Mono', monospace;
    --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    --spring: 0.5s cubic-bezier(0.34, 1.4, 0.4, 1);
}

/* ===== NOISE TEXTURE ===== */
body::after {
    content: "";
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    /* 외부 CDN 의존 제거 — 오프라인(PWA)에서도 그레인이 유지되도록 인라인 SVG 노이즈 사용 */
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
    opacity: 0.04;
    pointer-events: none;
    z-index: 9999;
}

/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background: var(--cream);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.5;
    min-height: 100vh;
    background-image:
        radial-gradient(1100px 480px at 50% -8%, rgba(200,169,110,0.14) 0%, transparent 62%),
        radial-gradient(circle at 12% 30%, rgba(168,126,66,0.05) 0%, transparent 52%),
        radial-gradient(circle at 88% 78%, rgba(44,95,138,0.04) 0%, transparent 50%);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
}

/* ===== TRUST BAR ===== */
.trust-bar {
    background: linear-gradient(100deg, #191009 0%, #261811 50%, #191009 100%);
    color: rgba(240,230,216,0.82);
    text-align: center;
    padding: 9px 20px;
    font-size: 12px;
    letter-spacing: 0.02em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.trust-dot {
    width: 6px; height: 6px;
    background: #4CAF50;
    border-radius: 50%;
    animation: pulse-dot 2s ease-in-out infinite;
    flex-shrink: 0;
}
@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(0.8); }
}
.trust-bar strong { color: var(--gold-light); font-weight: 600; }

/* ===== APP SHELL ===== */
.app-shell {
    max-width: 480px;
    margin: 0 auto;
    padding: 20px 16px 60px;
}

/* ===== HEADER ===== */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0 24px;
}
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}
.brand-mark { font-size: 24px; display: flex; align-items: center; }
.brand-mark img { height: 34px; width: auto; display: block; }
.brand-text { display: flex; flex-direction: column; }
.brand-name { font-family: var(--font-display); font-size: 22px; font-weight: 600; color: var(--ink); letter-spacing: -0.01em; line-height: 1.1; }
.brand-tagline { font-size: 11px; color: var(--ink-muted); letter-spacing: 0.06em; text-transform: uppercase; margin-top: 1px; }

.header-actions { display: flex; align-items: center; gap: 10px; }

.lang-toggle { display: flex; background: var(--cream-dark); border-radius: 999px; padding: 3px; gap: 2px; }
.lang-btn { background: none; border: none; color: var(--ink-muted); font-family: var(--font-body); font-size: 11px; font-weight: 500; padding: 4px 10px; border-radius: 999px; cursor: pointer; transition: var(--transition); }
.lang-btn.active { background: var(--panel); color: var(--ink); box-shadow: var(--shadow-sm); }

.logbook-btn {
    display: flex; align-items: center; gap: 6px; background: var(--panel); border: 1px solid var(--border-strong); color: var(--ink-soft); font-family: var(--font-body); font-size: 11px; font-weight: 500; padding: 7px 12px 7px 10px; border-radius: 999px; cursor: pointer; transition: var(--transition); position: relative; box-shadow: var(--shadow-sm);
}
.logbook-btn:hover { background: var(--cream-dark); transform: translateY(-1px); }
.logbook-badge { position: absolute; top: -6px; right: -6px; background: var(--gold); color: #fff; font-size: 10px; font-weight: 600; width: 18px; height: 18px; border-radius: 50%; display: flex; align-items: center; justify-content: center; border: 2px solid var(--cream); }

/* ===== ENV STRIP ===== */
.env-strip {
    background: var(--panel); border: 1px solid var(--border); border-radius: 999px; padding: 10px 18px; display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; box-shadow: var(--shadow-sm); gap: 12px;
}
.env-info { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-soft); flex-shrink: 0; }
.env-dot { width: 5px; height: 5px; background: var(--success); border-radius: 50%; }
.env-hint { font-size: 11px; color: var(--gold); font-weight: 500; text-align: right; line-height: 1.3; }

/* ===== MODE RAIL ===== */
.mode-rail { display: flex; gap: 8px; margin-bottom: 18px; }
.mode-pill { flex: 1; display: flex; align-items: center; justify-content: center; gap: 7px; background: var(--panel); border: 1.5px solid var(--border); color: var(--ink-muted); font-family: var(--font-body); font-size: 12px; font-weight: 500; letter-spacing: 0.05em; padding: 12px 16px; border-radius: 999px; cursor: pointer; transition: var(--transition); box-shadow: var(--shadow-sm); }
.mode-pill:hover { border-color: var(--gold-border); color: var(--ink-soft); transform: translateY(-1px); }
.mode-pill.active { background: linear-gradient(135deg, #2F2116 0%, var(--ink) 60%, #362718 100%); color: #F5EBDD; border-color: var(--ink); box-shadow: 0 10px 24px rgba(28,20,16,0.22), inset 0 1px 0 rgba(255,255,255,0.08); transform: none; }

/* ===== PROGRESS ===== */
.progress-section { margin-bottom: 18px; padding: 0 2px; }
.progress-label { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.progress-label span:first-child { font-size: 11px; color: var(--ink-muted); text-transform: uppercase; font-weight: 500; }
.progress-pct { font-family: var(--font-mono); font-size: 12px; color: var(--gold); font-weight: 500; }
.progress-track { height: 5px; background: var(--cream-dark); border-radius: 999px; overflow: hidden; box-shadow: inset 0 1px 2px rgba(64,46,30,0.06); }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--gold) 0%, var(--gold-light) 100%); transition: width 0.5s var(--transition); }
.progress-hint { font-size: 11px; color: var(--ink-ghost); margin-top: 6px; text-align: right; }

/* ===== CONSOLE BOX ===== */
.console-box {
    position: relative; background: linear-gradient(180deg, #FFFFFF 0%, #FFFDF8 100%); border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 28px 24px; box-shadow: var(--shadow-lg);
}
.console-box::before {
    content: ""; position: absolute; top: -1px; left: 36px; right: 36px; height: 1px;
    background: linear-gradient(90deg, transparent, rgba(200,169,110,0.7), transparent);
    pointer-events: none;
}

/* ===== VISUAL BARS (NEW) ===== */
.visual-container {
    height: 12px; background: var(--cream-dark); border-radius: 999px; margin-bottom: 12px; position: relative; overflow: hidden; border: 1px solid rgba(0,0,0,0.03);
}
.visual-bar {
    height: 100%; width: 50%; transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1), background 0.5s;
}
.visual-dosing-bar {
    background: linear-gradient(90deg, #4B3621 0%, #8B4513 100%); /* Coffee Brown */
    box-shadow: inset 0 1px 2px rgba(255,255,255,0.1);
}
.visual-temp-bar {
    background: linear-gradient(90deg, #3498DB 0%, #E74C3C 100%); /* Blue to Red */
}

/* ===== CONTROL GROUPS ===== */
.control-group { padding: 20px 0; }
.control-header { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 14px; }
.control-meta { display: flex; flex-direction: column; gap: 3px; }
.control-label { font-size: 11px; font-weight: 600; color: var(--ink-muted); text-transform: uppercase; }
.control-pro-hint { font-size: 11px; color: var(--ink-ghost); }
.control-value { display: flex; align-items: baseline; gap: 3px; }
.control-value > span:first-child { font-family: var(--font-display); font-size: 46px; font-weight: 600; letter-spacing: -0.02em; color: var(--ink); line-height: 1; transition: color var(--transition); }
.control-unit { font-family: var(--font-display); font-style: italic; font-size: 16px; color: var(--ink-muted); margin-left: 2px; align-self: flex-end; padding-bottom: 6px; }

.quality-badge { font-size: 9px; font-weight: 700; padding: 3px 7px; border-radius: 999px; align-self: center; margin-left: 6px; }
.quality-badge.ideal { background: var(--success-bg); color: var(--success); }
.quality-badge.low, .quality-badge.high { background: #FEF3E2; color: #B45309; }
.quality-badge.extreme { background: var(--danger-bg); color: var(--danger); }

/* ===== SLIDER ===== */
.slider-wrapper {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 0;
}
.fine-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1.5px solid var(--border-strong);
    background: var(--panel);
    color: var(--ink);
    font-size: 20px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
}
.fine-btn:hover {
    background: var(--cream-dark);
    border-color: var(--ink-muted);
}
.fine-btn:active {
    transform: scale(0.92);
    background: var(--cream-dark);
}

input[type=range] {
    flex: 1;
    height: 10px;
    appearance: none;
    background: var(--cream-dark);
    border-radius: 999px;
    outline: none;
    cursor: pointer;
    box-shadow: inset 0 1px 3px rgba(64,46,30,0.08);
}
input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 32px;
    height: 32px;
    background: var(--panel);
    border: 2.5px solid var(--ink);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(64,46,30,0.2), inset 0 0 0 4px #fff;
    transition: var(--transition);
}
input[type=range]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    border-color: var(--gold);
    box-shadow: 0 6px 16px rgba(64,46,30,0.26), inset 0 0 0 4px #fff;
}
input[type=range]::-moz-range-thumb {
    width: 30px;
    height: 30px;
    background: var(--panel);
    border: 2.5px solid var(--ink);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(64,46,30,0.2);
    transition: var(--transition);
}
input[type=range]::-moz-range-thumb:hover { border-color: var(--gold); }

.slider-zones { 
    display: flex; 
    justify-content: space-between; 
    margin-top: 4px; 
    padding: 0 60px; 
    font-size: 11px; 
    color: var(--ink-ghost); 
    font-family: var(--font-mono); 
    font-weight: 500;
}

.divider { height: 1px; background: var(--border); margin: 0 -4px; }

/* ===== SCA GUIDE POPOVER ===== */
.control-meta { position: relative; }
.control-label-row { display: flex; align-items: center; gap: 6px; }

.info-btn {
    width: 15px; height: 15px;
    border-radius: 50%;
    border: 1px solid var(--ink-ghost);
    background: none;
    color: var(--ink-muted);
    font-family: var(--font-display);
    font-style: italic;
    font-size: 10px;
    font-weight: 600;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
    flex-shrink: 0;
    transition: var(--transition);
}
.info-btn:hover, .info-btn.active {
    border-color: var(--gold);
    color: var(--gold);
    background: var(--gold-pale);
}

.sca-popover {
    position: absolute;
    top: 100%; left: 0;
    z-index: 60;
    padding-top: 8px; /* 버튼→팝오버로 커서가 이동할 수 있게 하는 호버 브리지 */
    width: min(300px, calc(100vw - 60px));
    display: none;
}
.sca-popover.open { display: block; animation: sca-pop-in 0.18s ease-out; }
@keyframes sca-pop-in {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.sca-pop-card {
    position: relative;
    background: var(--ink);
    color: rgba(255,255,255,0.82);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    box-shadow: var(--shadow-lg);
    font-size: 12px;
    line-height: 1.55;
}
.sca-pop-card::before {
    content: "";
    position: absolute;
    top: -4px; left: 18px;
    width: 9px; height: 9px;
    background: var(--ink);
    transform: rotate(45deg);
    border-radius: 2px;
}

.sca-pop-title {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--gold-light);
    margin-bottom: 6px;
}
.sca-pop-std {
    font-size: 12px;
    font-weight: 500;
    color: #fff;
    padding-bottom: 8px;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.12);
}
.sca-pop-row { display: flex; gap: 8px; margin-bottom: 8px; }
.sca-pop-row:last-child { margin-bottom: 0; }
.sca-pop-row strong { color: #fff; font-weight: 600; }
.sca-dir { flex-shrink: 0; font-size: 10px; padding-top: 2px; }
.sca-dir.up { color: var(--gold-light); }
.sca-dir.down { color: #7FB3D9; }
.sca-pop-note {
    font-size: 10.5px;
    color: rgba(255,255,255,0.5);
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px dashed rgba(255,255,255,0.18);
}

/* ===== BREW RATIO ===== */
.brew-ratio-card { margin: 24px 0; background: var(--cream); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 16px 18px; }
.ratio-label { font-size: 10px; font-weight: 600; text-transform: uppercase; color: var(--ink-muted); margin-bottom: 12px; }
.ratio-bar-wrap { display: flex; height: 10px; border-radius: 999px; overflow: hidden; margin-bottom: 10px; gap: 2px; }
.ratio-coffee-bar { background: var(--ink); transition: width 0.4s; }
.ratio-water-bar { background: var(--accent-light); flex: 1; }
.ratio-numbers { display: flex; justify-content: space-between; align-items: center; }
.ratio-num { font-family: var(--font-mono); font-size: 14px; color: var(--ink-soft); font-weight: 500; }
.ratio-status { font-size: 11px; font-weight: 500; }
.ratio-status.ideal { color: var(--success); }
.ratio-status.warning { color: #B45309; }

/* ===== STOPWATCH ===== */
.stopwatch-trigger {
    display: flex; align-items: center; gap: 7px; width: 100%; margin-top: 12px; padding: 12px 14px; background: var(--cream); border: 1.5px dashed var(--border-strong); border-radius: var(--radius-sm); color: var(--ink-muted); font-family: var(--font-body); font-size: 12px; font-weight: 500; cursor: pointer; transition: var(--transition);
}
.stopwatch-trigger:hover { background: var(--cream-dark); border-color: var(--ink-muted); }
.stopwatch-trigger.active { background: var(--accent-light); border-color: var(--accent); border-style: solid; color: var(--accent); }

.stopwatch-panel {
    max-height: 0; overflow: hidden; transition: max-height 0.45s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease; opacity: 0; pointer-events: none;
}
.stopwatch-panel.open { max-height: 340px; opacity: 1; pointer-events: auto; padding-top: 10px; }

.sw-display { display: flex; flex-direction: column; align-items: center; padding: 20px 0 10px; gap: 4px; position: relative; }
.sw-ring-wrap { width: 140px; height: 140px; margin: 0 auto 10px; position: relative; }
.sw-ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.sw-ring-bg { fill: none; stroke: var(--cream-dark); stroke-width: 6; }
.sw-ring-progress { fill: none; stroke: var(--accent); stroke-width: 6; stroke-linecap: round; transition: stroke-dashoffset 0.1s linear, stroke 0.3s; }
.sw-time-overlay { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; }
.sw-time { font-family: var(--font-mono); font-size: 42px; font-weight: 400; color: var(--ink); line-height: 1; }
.sw-time.running { color: var(--accent); }
.sw-time.done { color: var(--success); }
.sw-status { font-size: 9px; font-weight: 700; letter-spacing: 0.1em; color: var(--ink-ghost); text-transform: uppercase; margin-top: 4px; }

.sw-controls { display: flex; gap: 8px; padding: 10px 0; justify-content: center; }
.sw-btn { display: flex; align-items: center; gap: 6px; padding: 10px 18px; border-radius: var(--radius-sm); font-family: var(--font-body); font-size: 11px; font-weight: 600; cursor: pointer; border: 1.5px solid var(--border-strong); background: var(--panel); color: var(--ink-soft); transition: var(--transition); }
.sw-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.sw-btn-start { background: var(--ink); color: #fff; border-color: var(--ink); min-width: 90px; justify-content: center; }
.sw-btn-start.stop-mode { background: var(--danger-bg); color: var(--danger); border-color: var(--danger); }
.sw-btn-apply { background: var(--success-bg); color: var(--success); border-color: var(--success); }
.sw-btn-apply:not(:disabled):hover { background: var(--success); color: #fff; }

/* ===== ANIMATIONS ===== */
@keyframes pop-badge {
    0% { transform: scale(0.8); opacity: 0.5; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

/* ===== SAVE BUTTON ===== */
.save-btn {
    width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px; background: linear-gradient(135deg, #312216 0%, var(--ink) 55%, #3A2A1B 100%); color: #F7EFE3; border: none; border-radius: var(--radius-md); padding: 18px 24px; font-size: 13px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; cursor: pointer; margin-top: 12px; transition: var(--transition); box-shadow: 0 10px 30px rgba(28,20,16,0.25), inset 0 1px 0 rgba(255,255,255,0.07); position: relative; overflow: hidden;
}
.save-btn::before { content: ''; position: absolute; inset: 0; background: linear-gradient(135deg, rgba(255,255,255,0.08) 0%, transparent 60%); }
.save-btn::after { content: ''; position: absolute; top: 0; bottom: 0; left: -70%; width: 45%; transform: skewX(-22deg); background: linear-gradient(100deg, transparent, rgba(255,235,200,0.16), transparent); animation: save-shine 3.8s ease-in-out infinite; }
@keyframes save-shine { 0%, 55% { left: -70%; } 100% { left: 145%; } }
.save-btn .save-icon { color: var(--gold-light); }
.save-btn:hover { transform: translateY(-2px); box-shadow: 0 14px 36px rgba(28,20,16,0.32), inset 0 1px 0 rgba(255,255,255,0.1); }
.save-nudge { text-align: center; font-size: 11px; color: var(--ink-ghost); margin-top: 10px; }

/* ===== MODAL ===== */
.modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: flex-end; justify-content: center; pointer-events: none; opacity: 0; transition: opacity 0.3s ease; }
.modal.active { opacity: 1; pointer-events: auto; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(26,22,20,0.5); backdrop-filter: blur(4px); }
.modal-content { position: relative; background: var(--panel); width: 100%; max-width: 480px; border-radius: var(--radius-xl) var(--radius-xl) 0 0; padding: 28px 24px 40px; transform: translateY(100%); transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1); max-height: 92vh; overflow-y: auto; }
.modal.active .modal-content { transform: translateY(0); }
.modal-content::before { content: ""; display: block; width: 44px; height: 5px; border-radius: 999px; background: var(--cream-dark); margin: -6px auto 18px; }

.modal-progress-steps { display: flex; align-items: center; justify-content: center; margin-bottom: 22px; }
.step { width: 28px; height: 28px; border-radius: 50%; background: var(--cream-dark); color: var(--ink-ghost); font-size: 12px; font-weight: 600; display: flex; align-items: center; justify-content: center; }
.step.active { background: var(--ink); color: #fff; }
.step-line { width: 36px; height: 2px; background: var(--border); margin: 0 4px; }

.modal-content h3 { font-family: var(--font-display); font-size: 28px; text-align: center; margin-bottom: 6px; color: var(--ink); }
.modal-subtitle { font-size: 13px; color: var(--ink-muted); text-align: center; margin-bottom: 24px; }

.modal-form-group { margin-bottom: 18px; }
.modal-form-group label { display: block; font-size: 11px; font-weight: 600; text-transform: uppercase; color: var(--ink-muted); margin-bottom: 7px; }
.modal-form-group input, .modal-form-group textarea { width: 100%; padding: 12px 14px; border: 1.5px solid var(--border-strong); background: var(--cream); border-radius: var(--radius-sm); outline: none; transition: var(--transition); font-family: var(--font-body); font-size: 14px; }
.modal-form-group input:focus, .modal-form-group textarea:focus { border-color: var(--gold); background: var(--panel); box-shadow: 0 0 0 3px rgba(168,126,66,0.14); }

/* Rating UI (Stars) */
.rating-input {
    display: flex;
    flex-direction: row-reverse;
    justify-content: flex-end;
    gap: 4px;
}
.rating-input input { display: none; }
.rating-input label {
    font-size: 28px;
    color: var(--ink-ghost);
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 0;
}
.rating-input label:hover,
.rating-input label:hover ~ label,
.rating-input input:checked ~ label {
    color: var(--gold);
}

/* Tag Cloud */
.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}
.taste-tag {
    font-size: 11px;
    font-weight: 600;
    padding: 5px 10px;
    background: var(--cream-dark);
    color: var(--ink-muted);
    border-radius: 999px;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
}
.taste-tag:hover {
    background: var(--gold-pale);
    color: var(--gold);
}
.taste-tag.active {
    background: var(--gold);
    color: #fff;
    box-shadow: 0 2px 8px rgba(184,134,11,0.25);
}

.file-input-wrapper { display: flex; align-items: center; }
.result-btn { flex: 1; padding: 10px; border-radius: var(--radius-sm); font-size: 11px; font-weight: 700; cursor: pointer; border: 1.5px solid var(--border-strong); background: var(--panel); color: var(--ink-muted); transition: var(--transition); }
.result-btn:hover { background: var(--cream-dark); border-color: var(--ink-muted); color: var(--ink-soft); }
.result-btn.active { border-color: var(--success); background: var(--success-bg); color: var(--success); }
.result-btn.fail.active { border-color: var(--danger); background: var(--danger-bg); color: var(--danger); }

.modal-actions { margin-top: 26px; display: flex; flex-direction: column; gap: 10px; }
.modal-save-btn { width: 100%; background: var(--ink); color: #fff; border: none; border-radius: var(--radius-md); padding: 16px 24px; font-weight: 600; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; transition: var(--transition); box-shadow: 0 4px 16px rgba(26,22,20,0.18); }
.modal-cancel-btn { width: 100%; background: none; border: none; color: var(--ink-muted); cursor: pointer; padding: 10px; transition: var(--transition); }
.modal-cancel-btn:hover { color: var(--ink); background: var(--cream-dark); }

/* ===== RESPONSIVE ===== */
@media (max-width: 480px) {
    .app-shell { padding: 16px 14px 60px; }
    .console-box { padding: 22px 18px; }
    .control-value > span:first-child { font-size: 40px; }
    .modal-row { flex-direction: column; }
}

/* Quality Badge Pop Animation Class */
.quality-badge.pop { animation: pop-badge 0.4s ease-out forwards; }

/* Auth UI */
.auth-container {
    display: flex;
    align-items: center;
    margin-right: 12px;
}

.login-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, var(--gold-light) 0%, var(--gold) 100%);
    color: #2A1C0E;
    border: none;
    padding: 7px 14px;
    border-radius: 999px;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 14px rgba(168,126,66,0.28);
}

.login-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(168,126,66,0.38);
    filter: brightness(1.04);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--cream-dark);
    padding: 4px 8px;
    border-radius: 20px;
}

.user-photo {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}

.user-name {
    font-size: 12px;
    font-family: var(--font-body);
    color: var(--ink-muted);
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.logout-btn {
    background: transparent;
    border: none;
    color: var(--ink-muted);
    cursor: pointer;
    padding: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}

.logout-btn:hover {
    background: var(--border);
    color: var(--danger);
}

.loading {
    text-align: center;
    padding: 40px;
    color: var(--ink-muted);
    font-family: var(--font-mono);
}

@media (max-width: 600px) {
    .user-name { display: none; }
    .auth-container { margin-right: 6px; }
}

/* Bean Status UI */
.status-btn.active {
    background: var(--gold) !important;
    color: var(--ink-dark) !important;
    border-color: var(--gold) !important;
}

#opened-beans-container {
    flex-wrap: wrap;
    gap: 6px;
    display: flex;
}

#opened-beans-container .taste-tag {
    font-size: 11px;
    padding: 4px 8px;
}

/* ===== LOGBOOK GRID & CARDS ===== */
.logbook-title {
    font-family: var(--font-display);
    font-size: clamp(26px, 5vw, 34px);
    font-weight: 600;
    letter-spacing: -0.01em;
    margin-bottom: 24px;
    text-align: center;
    color: var(--ink);
}

#recipe-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.recipe-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.35s ease, border-color 0.25s ease;
}

.recipe-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--gold-border);
}

.recipe-card-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    border-bottom: 1px solid var(--border);
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.recipe-card:hover .recipe-card-image { transform: scale(1.05); }

.recipe-card-content {
    padding: 20px;
    flex: 1;
}

.recipe-card-content h4 {
    font-family: var(--font-display);
    font-size: 20px;
    margin-bottom: 12px;
    color: var(--ink);
    border-bottom: 1px solid var(--gold-pale);
    padding-bottom: 8px;
}

.recipe-card-content p {
    font-size: 13px;
    color: var(--ink-soft);
    margin-bottom: 6px;
    display: flex;
    justify-content: space-between;
}

.recipe-card-content .label {
    font-weight: 600;
    color: var(--ink-muted);
    font-size: 11px;
    text-transform: uppercase;
}

.recipe-card-rating {
    color: var(--gold);
    font-size: 16px;
    margin: 12px 0;
    letter-spacing: 2px;
}

.recipe-card-footer {
    padding: 12px 20px;
    background: var(--cream-dark);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border);
}

.status-indicator {
    font-size: 10px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 4px;
    text-transform: uppercase;
}

.status-success {
    background: var(--success-bg);
    color: var(--success);
}

.status-fail {
    background: var(--danger-bg);
    color: var(--danger);
}

.delete-btn {
    background: transparent;
    border: 1px solid var(--danger);
    color: var(--danger);
    font-size: 10px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
}

.delete-btn:hover {
    background: var(--danger);
    color: #fff;
}

.no-recipes-message {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--ink-muted);
    font-style: italic;
    background: var(--cream-dark);
    border-radius: var(--radius-md);
    border: 1.5px dashed var(--border);
}

/* FAB Button */
.fab-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #312216 0%, var(--ink) 70%);
    color: #F7EFE3;
    border: none;
    font-size: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 14px 34px rgba(28,20,16,0.3), inset 0 1px 0 rgba(255,255,255,0.1);
    cursor: pointer;
    z-index: 100;
    transition: var(--spring);
}

.fab-btn:hover {
    transform: scale(1.08) rotate(90deg);
    box-shadow: 0 0 0 4px rgba(200,169,110,0.28), 0 16px 38px rgba(28,20,16,0.34);
}

@media (max-width: 480px) {
    #recipe-cards-grid {
        grid-template-columns: 1fr;
    }
    .fab-btn {
        bottom: 20px;
        right: 20px;
    }
}


/* ===== LANDING PAGE SPECIFIC OVERRIDES ===== */
.landing-page body {
    background: var(--bg-deep);
}

.glow-btn {
    position: relative;
    overflow: hidden;
}

.glow-btn::before {
    content: "";
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: radial-gradient(circle, rgba(212,175,55,0.2) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.glow-btn:hover::before {
    opacity: 1;
}

/* ===== SHARE / IMPORT FEATURE ===== */

/* Share button on recipe cards */
.recipe-card-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.share-btn {
    background: transparent;
    border: 1px solid var(--gold-border);
    color: var(--gold);
    font-size: 10px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.18s, color 0.18s;
}
.share-btn:hover { background: var(--gold); color: #fff; }

/* Shared-from badge inside card */
.shared-badge {
    font-size: 11px;
    color: var(--ink-muted);
    font-style: italic;
    margin-top: 4px;
}

/* ── Modal overlay ── */
.recipe-share-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0,0,0,0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(4px);
}

.recipe-share-box {
    background: #1A1614;
    border: 1px solid rgba(200,169,110,0.2);
    border-radius: 12px;
    width: 100%;
    max-width: 500px;
    overflow: hidden;
    box-shadow: 0 24px 64px rgba(0,0,0,0.6);
}

.recipe-share-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    font-family: 'DM Mono', monospace;
    font-size: 13px;
    color: #EBE5DC;
}

.recipe-share-close {
    background: none;
    border: none;
    color: #5A544E;
    font-size: 16px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 3px;
    transition: color 0.15s;
}
.recipe-share-close:hover { color: #EBE5DC; }

/* Style tabs (card vs. photo background) */
.recipe-share-tabs {
    display: flex;
    gap: 8px;
    padding: 14px 20px 0;
}
.recipe-share-tab {
    flex: 1;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    color: #9B9087;
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    font-weight: 500;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.18s, color 0.18s, border-color 0.18s;
}
.recipe-share-tab:hover { color: #EBE5DC; }
.recipe-share-tab.is-active {
    background: rgba(200,169,110,0.14);
    border-color: rgba(200,169,110,0.45);
    color: #C8A96E;
}

/* Preview frame — keeps the modal from jumping between aspect ratios */
.recipe-share-preview {
    position: relative;
    margin: 14px 20px;
    border-radius: 8px;
    overflow: hidden;
    background: #0F0D0C;
    border: 1px solid rgba(255,255,255,0.07);
    display: flex;
    align-items: center;
    justify-content: center;
}
.recipe-share-preview[data-style="story"] { aspect-ratio: 4 / 5; }
.recipe-share-preview[data-style="card"]  { aspect-ratio: 600 / 380; }

/* Generated card image */
.recipe-share-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: opacity 0.2s;
}

.recipe-share-spinner {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    font-family: 'DM Mono', monospace;
    font-size: 12px;
    color: #9B9087;
    pointer-events: none;
}

/* Action buttons row */
.recipe-share-actions {
    display: flex;
    gap: 10px;
    padding: 16px 20px;
}

.recipe-share-btn {
    flex: 1;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    color: #EBE5DC;
    font-family: 'DM Sans', sans-serif;
    font-size: 13px;
    font-weight: 500;
    padding: 12px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.18s;
}
.recipe-share-btn:hover { background: rgba(255,255,255,0.1); }

.recipe-share-btn--gold {
    background: #C8A96E;
    border-color: #C8A96E;
    color: #0A0704;
}
.recipe-share-btn--gold:hover { background: #b8946a; }
.recipe-share-btn--gold:disabled { opacity: 0.6; cursor: not-allowed; }

/* ── Import preview ── */
.import-preview {
    padding: 22px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}

.import-bean {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 24px;
    font-weight: 600;
    color: #EBE5DC;
    margin-bottom: 4px;
}

.import-sub {
    font-family: 'DM Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.1em;
    color: #5A544E;
    margin-bottom: 18px;
}

.import-params {
    display: flex;
    gap: 0;
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 16px;
    font-family: 'DM Mono', monospace;
}

.import-param {
    flex: 1;
    padding: 14px 10px;
    border-right: 1px solid rgba(255,255,255,0.07);
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.import-param:last-child { border-right: none; }

.ip-v {
    font-size: 16px;
    color: #C8A96E;
    font-weight: 600;
}
.ip-k {
    font-size: 9px;
    letter-spacing: 0.1em;
    color: #5A544E;
    text-transform: uppercase;
}

.import-notes {
    font-size: 13px;
    color: #9B9087;
    margin-bottom: 12px;
    line-height: 1.6;
}

.import-stars {
    color: #C8A96E;
    font-size: 17px;
    letter-spacing: 2px;
    margin-bottom: 10px;
}

/* ===== ONBOARDING TOUR (첫 방문 서비스 안내) ===== */
.help-btn {
    width: 20px; height: 20px;
    border-radius: 50%;
    border: 1px solid var(--ink-ghost);
    background: none;
    color: var(--ink-muted);
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
    flex-shrink: 0;
    transition: var(--transition);
    opacity: 0.55;
}
.help-btn:hover {
    opacity: 1;
    border-color: var(--gold);
    color: var(--gold);
    background: var(--gold-pale);
}

.onboarding-content { max-width: 400px; text-align: center; padding: 32px 28px 36px; }

.ob-dots { display: flex; justify-content: center; gap: 7px; margin-bottom: 24px; }
.ob-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--cream-dark);
    border: 1px solid var(--border);
    transition: var(--transition);
    cursor: pointer;
    padding: 0;
}
.ob-dot.active { background: var(--gold); border-color: var(--gold); transform: scale(1.25); }
.ob-dot.done { background: var(--gold-border); border-color: var(--gold-border); }

.ob-icon { font-size: 40px; line-height: 1; margin-bottom: 16px; }

.onboarding-content h3 { font-family: var(--font-display); font-size: 26px; color: var(--ink); margin-bottom: 10px; }

.ob-desc {
    font-size: 13.5px;
    color: var(--ink-soft);
    line-height: 1.7;
    margin-bottom: 28px;
    min-height: 68px;
}

.ob-actions { display: flex; gap: 10px; align-items: center; }
.ob-skip {
    flex: 0 0 auto;
    background: none;
    border: none;
    color: var(--ink-muted);
    font-family: var(--font-body);
    font-size: 12px;
    padding: 12px 14px;
    cursor: pointer;
    transition: var(--transition);
}
.ob-skip:hover { color: var(--ink); }
.ob-next {
    flex: 1;
    background: var(--ink);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.04em;
    padding: 13px 18px;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-md);
}
.ob-next:hover { background: var(--ink-soft); transform: translateY(-1px); }

/* ===== GLOBAL POLISH (디자인 고도화 공통 레이어) ===== */
::selection { background: var(--gold-pale); color: var(--ink); }

:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
input[type=range]:focus-visible { outline: none; }
input[type=range]:focus-visible::-webkit-slider-thumb {
    border-color: var(--gold);
    box-shadow: 0 0 0 4px rgba(168,126,66,0.18), 0 4px 12px rgba(64,46,30,0.2);
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(64,46,30,0.18); border-radius: 999px; border: 2px solid var(--cream); }
::-webkit-scrollbar-thumb:hover { background: rgba(64,46,30,0.32); }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
