/* diet ダッシュボード - 「アガる」優しい配色。レスポンシブ。 */
:root {
    --bg: #0f1320;
    --bg-card: #161b2c;
    --bg-soft: #1d2238;
    --fg: #e8ecf3;
    --fg-mute: #9aa3b9;
    --accent: #4ea1ff;
    --accent-2: #ff7e60;
    --ok: #8be78b;
    --warn: #ffd84e;
    --soft-grey: #5a627a;
    --shadow: 0 4px 20px rgba(0, 0, 0, .35);
    --radius: 14px;
    --space: clamp(12px, 2vw, 20px);
}

* { box-sizing: border-box; }
html, body {
    margin: 0; padding: 0;
    background: var(--bg);
    color: var(--fg);
    font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", system-ui, sans-serif;
    line-height: 1.55;
}
a { color: var(--accent); text-decoration: none; }
a.muted { color: var(--fg-mute); }
a:hover { text-decoration: underline; }
button { font: inherit; cursor: pointer; }

/* ===== Login ===== */
.login-body { display: flex; min-height: 100dvh; align-items: center; justify-content: center; padding: var(--space); }
.login-card { background: var(--bg-card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 32px 28px; max-width: 360px; width: 100%; text-align: center; }
.login-card h1 { margin: 0 0 8px; font-size: 2rem; letter-spacing: 0.05em; }
.login-card .hint { color: var(--fg-mute); margin: 0 0 18px; font-size: 0.95rem; }
.login-card input { width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--soft-grey); background: var(--bg-soft); color: var(--fg); font-size: 1rem; margin-bottom: 12px; }
.login-card button { width: 100%; padding: 12px; border: 0; border-radius: 10px; background: var(--accent); color: white; font-weight: 600; font-size: 1rem; }
.login-card .err { color: var(--accent-2); margin-top: 12px; }

/* ===== Header ===== */
.dash-header { display: flex; justify-content: space-between; align-items: center; padding: var(--space); border-bottom: 1px solid var(--bg-soft); position: sticky; top: 0; background: rgba(15, 19, 32, 0.85); backdrop-filter: blur(8px); z-index: 10; }
.dash-header h1 { font-size: 1.4rem; margin: 0; letter-spacing: 0.06em; }
.dash-header nav { display: flex; gap: 14px; font-size: 0.9rem; }

/* ===== Main ===== */
#root, .logs-list { padding: var(--space); max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.loading, .empty { color: var(--fg-mute); text-align: center; padding: 32px 0; }

/* ===== Card ===== */
.card { background: var(--bg-card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 18px 22px; }
.card h2 { font-size: 1rem; color: var(--fg-mute); margin: 0 0 10px; letter-spacing: 0.04em; }
.card .big { font-size: 2rem; font-weight: 700; }

/* ===== Streak ===== */
.streak { background: linear-gradient(135deg, rgba(255, 126, 96, .22), rgba(255, 216, 78, .08)); border-radius: var(--radius); padding: 18px; }
.streak .row { display: flex; align-items: center; gap: 12px; }
.streak .fire { font-size: 2.2rem; }
.streak .days { font-size: 2rem; font-weight: 700; }
.streak .sub { color: var(--fg-mute); font-size: 0.85rem; margin-top: 4px; }

/* ===== AI comment ===== */
.ai-bubble { background: var(--bg-soft); border-radius: 18px; padding: 14px 16px; position: relative; font-size: 0.95rem; }
.ai-bubble::before { content: "💬"; position: absolute; top: -14px; left: 14px; font-size: 1.4rem; background: var(--bg); padding: 2px 6px; border-radius: 50%; }

/* ===== Weight card ===== */
.weight .current { display: flex; align-items: baseline; gap: 8px; }
.weight .unit { color: var(--fg-mute); }
.progress { background: var(--bg-soft); border-radius: 999px; height: 8px; overflow: hidden; margin-top: 8px; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--ok)); transition: width .4s ease; }

/* ===== PFC ===== */
.pfc-summary { display: flex; align-items: center; gap: 16px; }
.pfc-summary canvas { max-width: 140px; max-height: 140px; }
.pfc-summary dl { margin: 0; flex: 1; display: grid; grid-template-columns: auto 1fr; column-gap: 8px; row-gap: 4px; font-size: 0.92rem; }
.pfc-summary dt { color: var(--fg-mute); }

/* ===== Meals ===== */
.meal-thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.meal-thumbs img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; background: var(--bg-soft); }
.meal-card { display: flex; gap: 12px; background: var(--bg-card); border-radius: var(--radius); padding: 12px; }
.meal-card img { width: 90px; height: 90px; object-fit: cover; border-radius: 10px; flex-shrink: 0; background: var(--bg-soft); }
.meal-card .meal-body { flex: 1; min-width: 0; }
.meal-card .time { color: var(--fg-mute); font-size: 0.8rem; }
.meal-card .kcal { font-size: 1.2rem; font-weight: 700; margin: 4px 0; }
.meal-card .pfc { color: var(--fg-mute); font-size: 0.85rem; }
.meal-card .items { margin: 6px 0 0; padding-left: 18px; font-size: 0.88rem; color: var(--fg-mute); }

/* ===== Activity ===== */
.activity dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; }
.activity dt { color: var(--fg-mute); }

/* ===== Misc ===== */
.date-picker { display: flex; gap: 8px; margin-bottom: 12px; }
.date-picker input { padding: 6px 10px; border-radius: 8px; border: 1px solid var(--soft-grey); background: var(--bg-soft); color: var(--fg); }
.date-picker button { padding: 6px 14px; border-radius: 8px; border: 0; background: var(--accent); color: white; }
.hint { color: var(--fg-mute); }

@media (min-width: 800px) {
    #root { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; max-width: 960px; }
    .span-two { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}

/* ===== PWA ===== */
.pwa-body { padding-bottom: 80px; }
.pwa-header { display: flex; justify-content: space-between; align-items: center; padding: 16px var(--space); background: var(--bg-card); border-radius: 0 0 18px 18px; }
.pwa-header h1 { font-size: 1.2rem; margin: 0; }
.pwa-header a { font-size: 1.4rem; text-decoration: none; }

#quick-grid {
    padding: var(--space);
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}
.quick-btn {
    background: var(--bg-card);
    border: 0;
    border-radius: 20px;
    color: var(--fg);
    padding: 24px 14px 18px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    transition: transform 0.15s ease;
    aspect-ratio: 1.05;
}
.quick-btn:active { transform: scale(0.96); }
.quick-btn .emoji { font-size: 3rem; line-height: 1; }
.quick-btn .label { font-size: 1.05rem; font-weight: 600; }
.quick-btn .today { font-size: 0.85rem; color: var(--fg-mute); margin-top: 4px; }

#recent {
    padding: var(--space);
}
#recent h2 { font-size: 1rem; color: var(--fg-mute); margin: 0 0 10px; }
#recent-list { list-style: none; padding: 0; margin: 0; }
#recent-list li {
    display: grid;
    grid-template-columns: 30px 1fr auto 28px;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg-card);
    border-radius: 14px;
    margin-bottom: 8px;
}
#recent-list li.empty { display: block; color: var(--fg-mute); text-align: center; }
.r-emoji { font-size: 1.5rem; }
.r-label { font-size: 0.95rem; }
time { color: var(--fg-mute); font-size: 0.8rem; }
.del { background: transparent; border: 0; color: var(--fg-mute); font-size: 1.2rem; cursor: pointer; padding: 4px; }

#toast {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
    background: var(--ok); color: var(--bg);
    padding: 12px 22px; border-radius: 999px; font-weight: 600;
    box-shadow: var(--shadow);
    z-index: 100;
    animation: toast-in 0.25s ease;
}
@keyframes toast-in {
    from { opacity: 0; transform: translate(-50%, 16px); }
    to { opacity: 1; transform: translate(-50%, 0); }
}

#notification-bar {
    margin: 0 var(--space) 12px;
    background: var(--bg-card);
    border-radius: 14px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
}
#notification-bar button {
    background: var(--accent);
    color: white;
    border: 0;
    border-radius: 10px;
    padding: 8px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

#confirm-bar {
    position: fixed; bottom: 20px; left: 16px; right: 16px;
    background: var(--bg-card);
    border-radius: 14px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow);
    z-index: 100;
}
#confirm-bar .msg { flex: 1; font-size: 0.95rem; }
#confirm-bar button {
    border: 0;
    border-radius: 10px;
    padding: 8px 14px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}
#confirm-yes { background: var(--accent); color: white; }
#confirm-no { background: var(--bg-soft); color: var(--fg); }

#toast button.undo {
    background: transparent;
    border: 1px solid var(--bg);
    color: var(--bg);
    border-radius: 999px;
    padding: 2px 10px;
    font-size: 0.85rem;
    margin-left: 8px;
    cursor: pointer;
}
