:root {
  --bg: #0c0f14;
  --surface: #151a22;
  --surface2: #1d2530;
  --card: #1a212b;
  --ink: #f1f5f9;
  --muted: #8a97a8;
  --line: #2a333f;
  --accent: #c6f24e;      /* electric lime */
  --accent-ink: #1a2300;
  --cardio: #ff7a45;
  --strength: #c6f24e;
}
/* ===== 3-way theme (Light/Dark/System) — base :root above = native DARK. Opposite (light) WCAG-aware auto-generated (contrast-solving ink/accent vs worst-case surface). ===== */
:root[data-theme="light"]{
  --bg: #f4f5f6;
  --surface: #f5f6f7;
  --surface2: #f8f8f9;
  --card: #f7f7f8;
  --ink: #325476;
  --muted: #606f81;
  --line: rgba(0,0,0,0.10);
  --accent: #587609;
  --accent-ink: #ffffff;
  --cardio: #fdfcfc;
  --strength: #587609;
}












* { box-sizing: border-box; }
[hidden] { display: none !important; } /* 명시적 display가 [hidden]을 무력화하지 않도록 */
html, body { margin: 0; }
body {
  font-family: "Noto Sans KR", system-ui, -apple-system, sans-serif;
  background: var(--bg); color: var(--ink); line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  display: flex; justify-content: center; min-height: 100vh;
}
input { font-family: inherit; }

/* Phone frame */
.phone {
  width: 100%; max-width: 440px; min-height: 100vh; position: relative;
  background:
    radial-gradient(600px 300px at 50% -5%, #1b2738 0%, transparent 60%),
    var(--bg);
  padding-bottom: 76px; display: flex; flex-direction: column;
  border-left: 1px solid var(--line); border-right: 1px solid var(--line);
}

/* Appbar */
.appbar { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 8px; }
.brand { display: flex; align-items: center; gap: 8px; }
.brand-mark { font-size: 20px; }
.brand-name { font-family: "Barlow Condensed", sans-serif; font-weight: 700; font-size: 24px; letter-spacing: .02em; text-transform: uppercase; }
.appbar-right { display: flex; align-items: center; gap: 10px; }
.today-label { font-size: 12.5px; color: var(--muted); }

/* Tabs */
.tab { display: none; padding: 8px 18px 20px; animation: fade .2s ease; }
.tab.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } }

.section-h { font-size: 13px; font-weight: 700; color: var(--muted); margin: 22px 0 10px; letter-spacing: .01em; }
.muted-n { color: var(--accent); font-family: "Barlow Condensed", sans-serif; font-size: 15px; }

/* Streak */
.streak-pill {
  display: inline-flex; align-items: center; gap: 7px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 99px; padding: 7px 14px; font-size: 13px;
  font-weight: 600; margin: 6px 0 4px;
}
.streak-pill b { color: var(--accent); font-family: "Barlow Condensed", sans-serif; font-size: 16px; }

/* Picker */
.picker { margin-top: 14px; }
.seg { display: flex; background: var(--surface); border-radius: 12px; padding: 4px; gap: 4px; }
.seg-btn {
  flex: 1; border: none; background: transparent; color: var(--muted); font-family: inherit;
  font-weight: 700; font-size: 14px; padding: 9px; border-radius: 9px; cursor: pointer; transition: all .15s ease;
}
.seg-btn.active { background: var(--surface2); color: var(--ink); }
.ex-chips { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 12px; }
.ex-chip {
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  border-radius: 99px; padding: 7px 13px; font-family: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all .12s ease;
}
.ex-chip[aria-checked="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.ex-chip.custom .rm { margin-left: 7px; opacity: .5; font-size: 11px; padding: 0 1px; }
.ex-chip.custom .rm:hover { opacity: 1; color: var(--cardio); }
.ex-chip.custom[aria-checked="true"] .rm:hover { color: var(--accent-ink); }
.ex-chip.add { border-style: dashed; border-color: #3c4a2b; color: var(--accent); background: transparent; }
.ex-chip.add:hover { background: rgba(198,242,78,.08); }

/* 사용자 정의 종목 추가 폼 */
.add-ex { margin-top: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px; animation: fade .18s ease; }
.add-name { width: 100%; background: var(--bg); border: 1px solid var(--line); color: var(--ink); border-radius: 10px; padding: 11px 13px; font-size: 15px; font-weight: 500; outline: none; }
.add-name:focus { border-color: var(--accent); }
.add-name::placeholder { color: #5b6878; }
.emoji-pick { display: flex; gap: 6px; flex-wrap: wrap; margin: 11px 0; }
.emoji-opt { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); font-size: 18px; cursor: pointer; display: grid; place-items: center; transition: all .1s ease; }
.emoji-opt:hover { border-color: #44525f; }
.emoji-opt[aria-checked="true"] { border-color: var(--accent); background: rgba(198,242,78,.14); }
.add-actions { display: flex; gap: 8px; justify-content: flex-end; }
.add-btn { font-family: inherit; font-weight: 700; font-size: 13.5px; border: none; border-radius: 9px; padding: 9px 17px; cursor: pointer; transition: filter .15s ease; }
.add-btn.cancel { background: var(--surface2); color: var(--muted); }
.add-btn.cancel:hover { color: var(--ink); }
.add-btn.confirm { background: var(--accent); color: var(--accent-ink); }
.add-btn.confirm:hover { filter: brightness(1.06); }

/* Entry card */
.entry-card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin-top: 14px; }
.fields { display: flex; gap: 10px; }
.field { flex: 1; display: flex; flex-direction: column; gap: 5px; }
.field span { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.field input {
  width: 100%; background: var(--surface); border: 1px solid var(--line); color: var(--ink);
  border-radius: 10px; padding: 11px 8px; font-size: 18px; font-weight: 700; text-align: center;
  font-family: "Barlow Condensed", sans-serif; outline: none;
}
.field input:focus { border-color: var(--accent); }

/* Buttons */
.btn { font-family: inherit; font-weight: 700; cursor: pointer; border: none; border-radius: 12px; transition: transform .08s ease, filter .15s ease; }
.btn:active { transform: scale(.985); }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.big { width: 100%; padding: 14px; font-size: 16px; margin-top: 14px; }

/* Entry list */
.entry-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.entry {
  display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px; animation: pop .2s ease backwards;
}
@keyframes pop { from { opacity: 0; transform: translateY(6px); } }
.entry .badge { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font-size: 17px; flex-shrink: 0; }
.badge.s { background: rgba(198,242,78,.14); } .badge.c { background: rgba(255,122,69,.16); }
.entry .ex { font-weight: 700; font-size: 14.5px; }
.entry .detail { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.entry .vol { margin-left: auto; text-align: right; }
.entry .vol b { font-family: "Barlow Condensed", sans-serif; font-size: 18px; color: var(--accent); }
.entry .vol.c b { color: var(--cardio); }
.entry .vol small { display: block; font-size: 10.5px; color: var(--muted); }
.entry .del { background: none; border: none; color: #586679; cursor: pointer; font-size: 15px; padding: 4px; margin-left: 4px; }
.entry .del:hover { color: var(--cardio); }
.entry .del.confirm { color: var(--cardio); background: rgba(255,122,69,.16); font-weight: 700; font-size: 12.5px; width: auto; padding: 4px 10px; border-radius: 8px; margin-left: 2px; }

.empty { text-align: center; color: var(--muted); padding: 30px 10px; font-size: 13.5px; }

/* Stats */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat-box { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.stat-box .v { font-family: "Barlow Condensed", sans-serif; font-size: 30px; font-weight: 700; line-height: 1; }
.stat-box .v small { font-size: 14px; color: var(--muted); font-weight: 600; }
.stat-box .k { font-size: 12px; color: var(--muted); margin-top: 6px; }
.stat-box.accent .v { color: var(--accent); }

/* Chart */
.chart-card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px 14px 10px; }
.chart-svg { width: 100%; height: 150px; display: block; }
.chart-bar { fill: var(--surface2); transition: fill .2s ease; }
.chart-bar.has { fill: var(--accent); }
.chart-bar.today { fill: var(--cardio); }
.chart-x { fill: var(--muted); font-size: 10px; font-family: "Noto Sans KR", sans-serif; }
.chart-val { fill: var(--ink); font-size: 10px; font-weight: 700; font-family: "Barlow Condensed", sans-serif; }

/* Bar list (by exercise) */
.bar-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.bar-row .bar-top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 5px; }
.bar-row .bar-top b { font-family: "Barlow Condensed", sans-serif; font-size: 14px; }
.bar-track { height: 8px; background: var(--surface2); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 99px; background: var(--accent); }

/* History */
.day-group { margin-bottom: 16px; }
.day-head { font-size: 12.5px; font-weight: 700; color: var(--muted); margin-bottom: 8px; }

/* Tabbar */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 440px;
  display: flex; background: rgba(12,15,20,.92); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
}
.tabbtn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; background: none; border: none;
  color: var(--muted); font-family: inherit; font-size: 11px; font-weight: 600; cursor: pointer; padding: 4px;
}
.tabbtn .ico { font-size: 18px; line-height: 1; }
.tabbtn.active { color: var(--accent); }

.link-btn { display: block; margin: 26px auto 8px; background: none; border: none; color: #586679; cursor: pointer; font-family: inherit; font-size: 12.5px; text-decoration: underline; }
.link-btn:hover { color: var(--cardio); }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 92px; transform: translateX(-50%) translateY(16px);
  background: var(--accent); color: var(--accent-ink); padding: 10px 20px; border-radius: 99px;
  font-weight: 700; font-size: 13.5px; opacity: 0; pointer-events: none; transition: all .25s ease; z-index: 60;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* 삭제 되돌리기 스낵바 */
.undobar {
  position: fixed; left: 50%; bottom: 92px; transform: translateX(-50%) translateY(16px);
  background: var(--surface2); color: var(--ink); border: 1px solid var(--line);
  padding: 8px 8px 8px 18px; border-radius: 99px; display: flex; align-items: center; gap: 14px;
  font-size: 13.5px; font-weight: 600; opacity: 0; pointer-events: none; transition: all .25s ease;
  z-index: 61; box-shadow: 0 12px 30px -8px rgba(0,0,0,.5);
}
.undobar.show { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
.undobar button {
  background: var(--accent); color: var(--accent-ink); border: none; border-radius: 99px;
  padding: 7px 15px; font-family: inherit; font-weight: 700; font-size: 13px; cursor: pointer;
}
.undobar button:hover { filter: brightness(1.06); }

/* i18n language switcher — 항상 어두운 테마이므로 런타임 기본값을 다크 톤으로 덮어쓴다. */
.phone .i18n-switch {
  --i18n-switch-bg: rgba(255, 255, 255, 0.07);
  --i18n-switch-border: rgba(255, 255, 255, 0.16);
  --i18n-switch-fg: rgba(255, 255, 255, 0.92);
  --i18n-switch-active-bg: rgba(198, 242, 78, 0.22);
  --i18n-switch-active-fg: var(--accent);
  --i18n-switch-menu-bg: var(--surface);
  --i18n-switch-menu-border: var(--line);
  --i18n-switch-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
