:root {
  --z: 1;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --bg: #060913;
  --surface: rgba(16, 22, 38, 0.72);
  --surface-solid: #111829;
  --surface2: rgba(255, 255, 255, 0.055);
  --line: rgba(255, 255, 255, 0.11);
  --rim: rgba(255, 255, 255, 0.22);
  --txt: #f3f6ff;
  --sub: #9aa7c7;
  --brand: #5b8def;
  --brand2: #8ab4ff;
  --ok: #10b981;
  --warn: #f59e0b;
  --bad: #f43f5e;
  --glass: rgba(14, 19, 34, 0.56);
  --glass-hi: rgba(22, 30, 52, 0.78);
  --sh: 0 8px 30px rgba(0, 0, 0, 0.32), inset 0 1px 0 var(--rim);
  --sh2: 0 24px 68px rgba(0, 0, 0, 0.58), inset 0 1px 0 var(--rim);
  --r-card: 1.25rem;
  --r-btn: 0.7rem;
  --r-pill: 999px;
  --rail-w: 4.9rem;
}

:root[data-atmo="paper"] {
  --bg: #f5f1e9;
  --surface: rgba(255, 252, 247, 0.84);
  --surface-solid: #fffdf9;
  --surface2: rgba(24, 21, 18, 0.045);
  --line: rgba(24, 21, 18, 0.10);
  --rim: rgba(255, 255, 255, 0.85);
  --txt: #1b1815;
  --sub: #665e55;
  --brand: #c85a32;
  --brand2: #e07a52;
  --glass: rgba(255, 252, 246, 0.72);
  --glass-hi: rgba(255, 253, 249, 0.90);
  --sh: 0 10px 30px rgba(28, 22, 15, 0.08), inset 0 1px 0 var(--rim);
  --sh2: 0 24px 60px rgba(28, 22, 15, 0.16), inset 0 1px 0 var(--rim);
}

:root[data-atmo="rain"] {
  --brand: #10b981;
  --brand2: #34d399;
  --surface: rgba(12, 24, 20, 0.74);
  --surface-solid: #0f1f1a;
  --glass: rgba(11, 22, 18, 0.58);
  --glass-hi: rgba(16, 33, 27, 0.80);
}

:root[data-atmo="sunset"] {
  --brand: #f97316;
  --brand2: #fb923c;
  --surface: rgba(26, 17, 36, 0.74);
  --surface-solid: #1b1126;
  --glass: rgba(24, 15, 34, 0.58);
  --glass-hi: rgba(36, 22, 50, 0.82);
}

* { box-sizing: border-box; }
html { font-size: calc(16px * var(--z)); height: 100%; }
body {
  margin: 0; min-height: 100%; overflow: hidden;
  font-family: 'Pretendard', 'Apple SD Gothic Neo', 'Malgun Gothic', system-ui, sans-serif;
  background: var(--bg); color: var(--txt); line-height: 1.5;
  -webkit-font-smoothing: antialiased; word-break: keep-all; overflow-wrap: break-word;
}
.num { font-variant-numeric: tabular-nums; }
svg { width: 1.12em; height: 1.12em; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

#bgCanvas { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.bg-grain {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: 0.03;
  background-image: radial-gradient(rgba(255,255,255,0.8) 0.5px, transparent 0.5px);
  background-size: 6px 6px;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  padding: 0.55rem 1.05rem; border-radius: var(--r-btn); border: 1px solid var(--line);
  background: var(--surface2); font-weight: 600; font-size: 0.88rem; transition: all .2s var(--ease);
}
.btn:hover { transform: translateY(-1px); border-color: var(--rim); }
.btn.pri { background: linear-gradient(135deg, var(--brand), var(--brand2)); color: #fff; border-color: transparent; box-shadow: 0 6px 20px rgba(0,0,0,0.22); }
.btn.lg { padding: 0.85rem 2rem; font-size: 0.98rem; border-radius: var(--r-pill); }
.btn.bad { background: rgba(244, 63, 94, 0.14); color: var(--bad); border-color: rgba(244, 63, 94, 0.35); }
.icon-sm {
  width: 1.6rem; height: 1.6rem; border: 0; border-radius: 0.5rem;
  background: transparent; color: var(--sub); display: inline-flex; align-items: center; justify-content: center; font-size: 0.82rem;
}
.icon-sm:hover { background: var(--surface2); color: var(--txt); }
.pill-row { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.9rem; }
.pill {
  padding: 0.38rem 0.9rem; border-radius: var(--r-pill); border: 1px solid var(--line);
  background: var(--surface2); font-size: 0.84rem; font-weight: 600; color: var(--sub); transition: all .18s var(--ease);
}
.pill.on { background: var(--brand); color: #fff; border-color: transparent; }

.modal-backdrop {
  position: fixed; inset: 0; z-index: 900; background: rgba(4, 7, 15, 0.52);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  display: flex; align-items: center; justify-content: center; padding: 1.2rem;
}
.modal-backdrop[hidden] { display: none; }

.welcome-card {
  width: min(560px, 100%); background: var(--glass-hi); border: 1px solid var(--rim);
  border-radius: 1.7rem; padding: 2.2rem 2.1rem; box-shadow: var(--sh2); text-align: center;
  backdrop-filter: blur(28px); -webkit-backdrop-filter: blur(28px);
}
.welcome-badge {
  display: inline-block; padding: 0.3rem 0.9rem; border-radius: var(--r-pill);
  background: var(--surface2); border: 1px solid var(--line); color: var(--brand2);
  font-weight: 700; font-size: 0.78rem; letter-spacing: 0.4px; margin-bottom: 0.9rem;
}
.welcome-card h1 { margin: 0 0 0.75rem; font-size: 1.75rem; letter-spacing: -0.7px; line-height: 1.28; font-weight: 800; }
.welcome-sub { margin: 0 0 1.4rem; color: var(--sub); font-size: 0.94rem; }
.welcome-feats { display: grid; gap: 0.65rem; text-align: left; margin-bottom: 1.6rem; }
.wf-item { padding: 0.8rem 1rem; border-radius: 0.95rem; background: var(--surface2); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 0.15rem; }
.wf-item strong { font-size: 0.9rem; }
.wf-item span { font-size: 0.82rem; color: var(--sub); }

#toast {
  position: fixed; bottom: 1.6rem; left: 50%; transform: translateX(-50%); z-index: 999;
  background: var(--glass-hi); color: var(--txt); border: 1px solid var(--rim);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  padding: 0.62rem 1.2rem; border-radius: var(--r-pill); box-shadow: var(--sh2);
  display: flex; align-items: center; gap: 0.75rem; font-size: 0.86rem; font-weight: 600;
}
#toast[hidden] { display: none; }
.toast-undo { background: var(--brand); color: #fff; border: 0; border-radius: var(--r-pill); padding: 0.24rem 0.75rem; font-size: 0.78rem; font-weight: 700; }

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