:root {
    --primary: #2d3436;
    --accent: #e17055; /* Orange-red for sugar alert theme */
    --accent-light: #fab1a0;
    --bg: #fffbf9;
    --card-bg: rgba(255, 255, 255, 0.95);
    --text: #2d3436;
    --text-muted: #636e72;
    --border: #dfe6e9;
    --shadow-bold: 0 20px 40px rgba(225, 112, 85, 0.08);
    --safe: #00b894;
    --danger: #d63031;
}

[data-theme="dark"] {
    --primary: #dfe6e9;
    --bg: #0d1117;
    --card-bg: rgba(22, 27, 34, 0.95);
    --text: #f0f6fc;
    --text-muted: #8b949e;
    --border: #30363d;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Inter', 'Noto Sans KR', sans-serif;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

header {
    height: 70px;
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(10px);
    position: sticky; top: 0; z-index: 1000;
    background: var(--card-bg);
    display: flex; align-items: center;
}

.nav-container {
    max-width: 1000px; margin: 0 auto; width: 100%; padding: 0 2rem;
    display: flex; justify-content: space-between; align-items: center;
}

.logo { font-size: 1.1rem; font-weight: 800; color: var(--accent); letter-spacing: 1px; }
.lang-selector { display: flex; background: var(--border); border-radius: 20px; padding: 2px; }
.lang-selector button { border: none; background: none; padding: 4px 10px; border-radius: 18px; font-size: 0.75rem; font-weight: 700; cursor: pointer; color: var(--text-muted); }
.lang-selector button.active { background: var(--accent); color: white; }
.icon-btn { background: none; border: 1px solid var(--border); width: 36px; height: 36px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; }

/* Hero */
.hero-section { max-width: 800px; margin: 4rem auto 3rem; text-align: center; padding: 0 2rem; }
.hero-badge { display: inline-block; padding: 0.5rem 1.2rem; background: var(--accent); color: white; font-weight: 800; border-radius: 30px; font-size: 0.8rem; margin-bottom: 1.5rem; }
.hero-title { font-size: 2.8rem; font-weight: 800; line-height: 1.2; margin-bottom: 1.5rem; word-break: keep-all; }
.hero-title span { color: var(--accent); }
.hero-subtitle { font-size: 1.15rem; color: var(--text-muted); max-width: 800px; margin: 0 auto; word-break: keep-all; }

/* Tool Area */
.tool-section { max-width: 550px; margin: 0 auto; padding: 0 2rem; }
.card-glass { background: var(--card-bg); border: 1px solid var(--border); border-radius: 32px; padding: 2.5rem; box-shadow: var(--shadow-bold); text-align: center; }

/* Gauge */
.sugar-gauge-area { position: relative; margin-bottom: 1rem; display: flex; justify-content: center; align-items: center; }
.progress-ring__background { stroke: var(--border); }
.progress-ring__circle {
    stroke: var(--safe);
    stroke-linecap: round;
    transition: stroke-dashoffset 0.8s ease, stroke 0.5s ease;
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
}
.gauge-text { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); }
#current-val { font-size: 3rem; font-weight: 800; color: var(--text); line-height: 1; }
.gauge-text small { font-size: 1.2rem; font-weight: 700; color: var(--text-muted); }
.gauge-text p { font-size: 0.8rem; font-weight: 700; color: var(--text-muted); margin-top: 5px; }

.limit-status { font-size: 1rem; margin-bottom: 2.5rem; color: var(--text-muted); font-weight: 600; }
#limit-val { color: var(--accent); }

/* Quick Add */
.quick-add-section { text-align: left; margin-bottom: 2rem; }
.quick-add-section h4 { font-size: 0.85rem; margin-bottom: 1rem; color: var(--text-muted); }
.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
.add-btn { padding: 0.8rem; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); color: var(--text); font-weight: 600; cursor: pointer; font-size: 0.85rem; text-align: left; }
.add-btn:hover { border-color: var(--accent); background: var(--accent-light); color: white; }

.custom-modal { display: flex; gap: 0.5rem; margin-bottom: 1.5rem; animation: fadeIn 0.3s ease; }
.custom-modal input { flex: 1; padding: 0.8rem; border-radius: 12px; border: 1px solid var(--border); font-weight: 700; }
#confirm-custom { background: var(--accent); color: white; border: none; padding: 0 1.2rem; border-radius: 12px; font-weight: 700; cursor: pointer; }

.secondary-btn { background: none; border: none; color: var(--text-muted); font-weight: 700; cursor: pointer; font-size: 0.85rem; text-decoration: underline; }

/* History */
.history-section { max-width: 550px; margin: 3rem auto; padding: 0 2rem; }
.history-list { background: var(--card-bg); border: 1px solid var(--border); border-radius: 20px; overflow: hidden; }
.history-item { padding: 1rem 1.5rem; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border); }
.hist-date { font-size: 0.8rem; color: var(--text-muted); font-weight: 700; }
.hist-bar-box { flex: 1; margin: 0 1.5rem; height: 10px; background: var(--bg); border-radius: 5px; overflow: hidden; }
.hist-bar { height: 100%; background: var(--safe); }
.hist-val { font-weight: 800; font-size: 0.95rem; }

.compliance-info { max-width: 550px; margin: 4rem auto; padding: 0 2rem; display: grid; gap: 1rem; }
.info-card { background: rgba(0,0,0,0.02); padding: 1.5rem; border-radius: 16px; font-size: 0.85rem; }
.info-card h4 { margin-bottom: 0.4rem; font-size: 0.9rem; }

footer { padding: 4rem 2rem; text-align: center; border-top: 1px solid var(--border); color: var(--text-muted); font-size: 0.8rem; }
.footer-logo { font-weight: 800; margin-bottom: 0.5rem; }

.hidden { display: none; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 480px) {
    .hero-title { font-size: 2rem; }
    .quick-grid { grid-template-columns: 1fr; }
}
