/* ──────────────────────────────────────────────
   TimeCheck · design tokens
   ────────────────────────────────────────────── */
:root {
  --bg: #080b12;
  --bg-soft: #0d121c;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-2: rgba(255, 255, 255, 0.075);
  --surface-solid: #131a26;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #eef2f8;
  --text-dim: #9aa6bd;
  --text-faint: #6b7793;

  --accent: #7c8cff;
  --accent-2: #27d8e0;
  --accent-ink: #0a0f1c;
  --go: #35d6a4;
  --rest: #ffb13d;
  --danger: #ff6b7e;

  --grad: linear-gradient(135deg, #7c8cff 0%, #27d8e0 100%);
  --grad-go: linear-gradient(135deg, #35d6a4 0%, #7ce8c0 100%);
  --grad-rest: linear-gradient(135deg, #ffb13d 0%, #ff8a5c 100%);

  --radius: 20px;
  --radius-sm: 12px;
  --shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.75);
  --shadow-soft: 0 8px 24px -14px rgba(0, 0, 0, 0.7);
  --ring: 0 0 0 3px rgba(124, 140, 255, 0.32);
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont,
    "Segoe UI", "Malgun Gothic", "Apple SD Gothic Neo", system-ui, sans-serif;
}

[data-theme="light"] {
  --bg: #f4f6fb;
  --bg-soft: #ffffff;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-2: rgba(16, 24, 48, 0.045);
  --surface-solid: #ffffff;
  --line: rgba(16, 24, 48, 0.09);
  --line-strong: rgba(16, 24, 48, 0.18);
  --text: #141a28;
  --text-dim: #5a6681;
  --text-faint: #8c97ad;
  --accent: #4f5fe6;
  --accent-2: #0ea5b7;
  --go: #0f9f74;
  --rest: #c97a0a;
  --danger: #dc3a52;
  --grad: linear-gradient(135deg, #5566f0 0%, #16b6c4 100%);
  --shadow: 0 18px 44px -24px rgba(21, 32, 64, 0.4);
  --shadow-soft: 0 8px 20px -14px rgba(21, 32, 64, 0.35);
  --ring: 0 0 0 3px rgba(79, 95, 230, 0.25);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
  padding-bottom: env(safe-area-inset-bottom);
}

h1, h2, h3 { margin: 0; letter-spacing: -0.02em; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ── 배경 글로우 ── */
.aurora { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.aurora span {
  position: absolute; display: block; border-radius: 50%;
  filter: blur(90px); opacity: 0.45;
}
.aurora span:nth-child(1) { width: 46vw; height: 46vw; left: -10vw; top: -14vw; background: #4756ff; }
.aurora span:nth-child(2) { width: 38vw; height: 38vw; right: -8vw; top: 6vh; background: #0fb8c8; opacity: 0.3; }
.aurora span:nth-child(3) { width: 42vw; height: 42vw; left: 30vw; bottom: -22vw; background: #8b5cf6; opacity: 0.22; }
[data-theme="light"] .aurora span { opacity: 0.2; }

/* ── 상단바 ── */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px clamp(16px, 4vw, 40px);
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(18px) saturate(140%);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  display: grid; place-items: center; width: 42px; height: 42px;
  border-radius: 13px; background: var(--grad); color: var(--accent-ink);
  box-shadow: 0 8px 22px -10px var(--accent);
  flex: none;
}
.brand-mark svg { width: 24px; height: 24px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-text strong { font-size: 1.08rem; letter-spacing: -0.03em; }
.brand-text small { color: var(--text-faint); font-size: 0.74rem; white-space: nowrap; }
.topbar-actions { display: flex; gap: 8px; flex: none; }

.icon-btn {
  display: grid; place-items: center; width: 40px; height: 40px;
  border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text-dim);
  cursor: pointer; transition: 0.18s ease;
}
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn:hover { color: var(--text); border-color: var(--line-strong); background: var(--surface-2); }
.icon-btn:focus-visible, .btn:focus-visible, .tab:focus-visible { outline: none; box-shadow: var(--ring); }
.icon-btn.ghost { border-color: transparent; background: transparent; }
.icon-btn.is-on { color: var(--accent-2); border-color: color-mix(in srgb, var(--accent-2) 45%, transparent); }
.ico-sun { display: none; }
[data-theme="light"] .ico-sun { display: block; }
[data-theme="light"] .ico-moon { display: none; }

/* ── 탭 ── */
.tabs {
  display: flex; gap: 4px; padding: 14px clamp(16px, 4vw, 40px) 0;
  max-width: 1180px; margin: 0 auto; width: 100%;
}
.tab {
  position: relative; padding: 10px 18px; border: 0; border-radius: 999px;
  background: transparent; color: var(--text-faint); font-weight: 600;
  font-size: 0.94rem; cursor: pointer; transition: 0.18s ease;
}
.tab:hover { color: var(--text-dim); }
.tab.is-active { color: var(--text); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }

/* ── 레이아웃 ── */
.wrap {
  max-width: 1180px; margin: 0 auto;
  padding: 18px clamp(16px, 4vw, 40px) 40px; width: 100%;
}
.panel-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin: 10px 0 22px;
}
.panel-title h2 { font-size: clamp(1.35rem, 4vw, 1.7rem); }
.panel-title p { color: var(--text-faint); font-size: 0.88rem; margin-top: 4px; }

.grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}
.grid-wide { grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); }

/* ── 버튼 ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 11px 18px; border-radius: 13px; border: 1px solid transparent;
  font-weight: 650; font-size: 0.92rem; cursor: pointer;
  transition: transform 0.12s ease, filter 0.18s ease, background 0.18s ease;
  white-space: nowrap;
}
.btn svg { width: 17px; height: 17px; flex: none; }
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 10px 26px -14px var(--accent); }
[data-theme="light"] .btn-primary { color: #fff; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-soft { background: var(--surface-2); color: var(--text); border-color: var(--line); }
.btn-soft:hover { border-color: var(--line-strong); }
.btn-ghost { background: transparent; color: var(--text-dim); border-color: var(--line); }
.btn-ghost:hover { color: var(--text); }
.btn-danger-soft {
  background: color-mix(in srgb, var(--danger) 14%, transparent);
  color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, transparent);
}
.btn.full { width: 100%; }
.link-btn {
  background: none; border: 0; padding: 0; color: var(--text-faint);
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-size: 0.82rem;
}
.link-btn:hover { color: var(--text-dim); }

/* ── 카드 ── */
.card {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 14px;
  padding: 20px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(14px);
  transition: border-color 0.2s ease, transform 0.2s ease;
}
[data-theme="light"] .card { background: var(--surface-solid); }
.card::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: var(--grad); opacity: 0; transition: opacity 0.3s ease;
  pointer-events: none; mix-blend-mode: soft-light;
}
.card.is-running { border-color: color-mix(in srgb, var(--accent) 42%, transparent); }
.card.is-running::before { opacity: 0.1; }
.card.is-rest.is-running { border-color: color-mix(in srgb, var(--rest) 48%, transparent); }
.card.flash { animation: flash 0.9s ease-out 2; }
@keyframes flash {
  0%, 100% { box-shadow: var(--shadow-soft); }
  40% { box-shadow: 0 0 0 3px var(--accent), 0 0 46px -6px var(--accent); }
}

.card-head { display: flex; align-items: flex-start; gap: 10px; }
.card-head h3 {
  font-size: 1.06rem; flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card-tools { display: flex; gap: 2px; flex: none; }
.card-tools .icon-btn { width: 32px; height: 32px; border-radius: 9px; }
.card-tools .icon-btn svg { width: 16px; height: 16px; }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px; font-size: 0.72rem; font-weight: 650;
  background: var(--surface-2); color: var(--text-dim); border: 1px solid var(--line);
  white-space: nowrap;
}
.badge.accent { color: var(--accent-2); border-color: color-mix(in srgb, var(--accent-2) 35%, transparent); }
.badge.rec {
  color: var(--danger); border-color: color-mix(in srgb, var(--danger) 36%, transparent);
  background: color-mix(in srgb, var(--danger) 12%, transparent);
}
.badge-row { display: flex; gap: 6px; flex-wrap: wrap; }

/* 시간 표시 */
.time-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.time {
  font-size: clamp(2.6rem, 11vw, 3.4rem); font-weight: 750; letter-spacing: -0.04em;
  line-height: 1; font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}
.card.is-running .time { color: var(--text); }
.card.is-idle .time { color: var(--text-dim); }
.state {
  font-size: 0.8rem; font-weight: 650; color: var(--text-faint);
  display: inline-flex; align-items: center; gap: 6px;
}
.state .dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--text-faint);
}
.card.is-running .state { color: var(--accent-2); }
.card.is-running .state .dot { background: var(--accent-2); animation: pulse 1.6s ease-in-out infinite; }
.card.is-paused .state { color: var(--rest); }
.card.is-paused .state .dot { background: var(--rest); }
@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent-2) 60%, transparent); }
  70% { opacity: 0.7; box-shadow: 0 0 0 7px transparent; }
}

/* 진행 바 */
.bar {
  position: relative; height: 12px; border-radius: 999px; overflow: hidden;
  background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line);
}
.bar > i {
  display: block; height: 100%; width: 0%; border-radius: inherit;
  background: var(--grad); transition: width 0.25s linear;
}
.bar.go > i { background: var(--grad-go); }
.bar.rest > i { background: var(--grad-rest); }
.bar.thin { height: 7px; }
.bar.thin > i { transition: width 0.3s ease; }

.msg {
  font-size: 0.9rem; color: var(--text-dim); line-height: 1.5;
  background: var(--surface-2); border-radius: var(--radius-sm);
  padding: 10px 13px; border: 1px solid var(--line);
  display: flex; gap: 8px; align-items: flex-start;
}
.msg svg { width: 15px; height: 15px; flex: none; margin-top: 3px; color: var(--text-faint); }
.msg span { word-break: break-word; }

.actions { display: flex; gap: 8px; margin-top: auto; }
.actions .btn { flex: 1; }
.actions .btn.narrow { flex: 0 0 auto; padding: 11px 13px; }

/* 루틴 카드 */
.step-track { display: flex; flex-direction: column; gap: 8px; }
.step-row {
  display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  border: 1px solid transparent; font-size: 0.86rem; color: var(--text-dim);
  transition: 0.2s ease;
}
.step-row .n {
  display: grid; place-items: center; width: 22px; height: 22px; border-radius: 7px;
  background: var(--surface-2); font-size: 0.72rem; font-weight: 700; color: var(--text-faint);
}
.step-row .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.step-row .dur { font-variant-numeric: tabular-nums; font-size: 0.8rem; color: var(--text-faint); }
.step-row.is-current {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border-color: color-mix(in srgb, var(--accent) 34%, transparent);
  color: var(--text);
}
.step-row.is-current .n { background: var(--grad); color: var(--accent-ink); }
.step-row.is-done { opacity: 0.45; }
.step-row.is-done .n::after { content: "✓"; }
.step-row.is-done .n { font-size: 0.68rem; }

.now-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.82rem; font-weight: 650; color: var(--text-faint);
}
.now-label strong { color: var(--text); font-size: 1rem; }

/* 빈 상태 */
.empty {
  text-align: center; padding: 56px 20px; border-radius: var(--radius);
  border: 1px dashed var(--line-strong); color: var(--text-faint);
}
.empty-art { font-size: 2.6rem; margin-bottom: 10px; }
.empty h3 { font-size: 1.05rem; color: var(--text-dim); margin-bottom: 6px; }
.empty p { font-size: 0.88rem; }

.foot {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  flex-wrap: wrap; padding: 0 20px 34px; color: var(--text-faint); font-size: 0.82rem;
}
.foot-sep { opacity: 0.5; }

/* ──────────────────────────────────────────────
   회전형 다이얼
   ────────────────────────────────────────────── */
.dial-area { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.dial {
  position: relative; width: min(268px, 72vw); aspect-ratio: 1;
  touch-action: none; user-select: none; -webkit-user-select: none;
  cursor: grab;
}
.dial-area.compact .dial { width: min(216px, 56vw); }
.dial.is-dragging { cursor: grabbing; }
.dial svg { width: 100%; height: 100%; display: block; overflow: visible; }
.dial .track-ring { stroke: var(--surface-2); }
.dial .prog-ring {
  stroke: url(#dialGrad); stroke-linecap: round;
  transition: stroke-dashoffset 0.12s linear;
}
.dial .tick { stroke: var(--line-strong); }
.dial .tick.major { stroke: var(--text-faint); }
.dial .num {
  fill: var(--text-faint); font-size: 12px; font-weight: 650;
  font-family: var(--font); pointer-events: none; user-select: none;
}
.dial .knob-ring { fill: #fff; filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.45)); }
.dial .knob-dot { fill: var(--accent); }
.dial.is-dragging .knob-ring { r: 11; }
.dial-center {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px; pointer-events: none;
}
.dial-value {
  font-size: clamp(2.1rem, 9vw, 2.7rem); font-weight: 750; letter-spacing: -0.045em;
  font-variant-numeric: tabular-nums; line-height: 1;
}
.dial-area.compact .dial-value { font-size: clamp(1.7rem, 7vw, 2.1rem); }
.dial-sub { font-size: 0.74rem; color: var(--text-faint); font-weight: 600; text-align: center; }
.dial-center::before {
  content: ""; position: absolute; top: 50%; left: 50%; width: 52%; height: 52%;
  transform: translate(-50%, -50%); border-radius: 50%;
  background: var(--surface-2); opacity: 0.55;
}
.dial-center > * { position: relative; }
.dial-hint { font-size: 0.72rem; color: var(--text-faint); display: flex; align-items: center; gap: 5px; }

.dial-ctl { display: flex; align-items: center; gap: 10px; }
.step-btn {
  width: 44px; height: 44px; border-radius: 50%; flex: none;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
  font-size: 1.35rem; font-weight: 600; line-height: 1; cursor: pointer;
  display: grid; place-items: center; transition: 0.16s ease; touch-action: manipulation;
}
.step-btn:hover { border-color: var(--line-strong); background: var(--surface); color: var(--accent-2); }
.step-btn:active { transform: scale(0.92); }

.unit-switch {
  display: inline-flex; padding: 3px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line);
}
.unit-switch button {
  border: 0; background: transparent; color: var(--text-faint);
  padding: 6px 20px; border-radius: 999px; font-size: 0.84rem; font-weight: 650; cursor: pointer;
  transition: 0.16s ease;
}
.unit-switch button.is-active { background: var(--grad); color: #fff; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.chips button {
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line);
  background: transparent; color: var(--text-dim); font-size: 0.8rem; font-weight: 600;
  cursor: pointer; transition: 0.16s ease;
}
.chips button:hover { color: var(--text); border-color: var(--line-strong); background: var(--surface-2); }
.chips button.is-active {
  color: var(--accent-2); border-color: color-mix(in srgb, var(--accent-2) 48%, transparent);
  background: color-mix(in srgb, var(--accent-2) 12%, transparent);
}

/* ──────────────────────────────────────────────
   모달
   ────────────────────────────────────────────── */
.overlay {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(4, 7, 14, 0.66); backdrop-filter: blur(8px);
  animation: fade 0.18s ease;
}
.overlay[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } }
.sheet {
  width: 100%; max-width: 460px; max-height: calc(100dvh - 32px);
  display: flex; flex-direction: column;
  background: var(--surface-solid); border: 1px solid var(--line);
  border-radius: 24px; box-shadow: var(--shadow);
  animation: rise 0.24s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.sheet-lg { max-width: 880px; }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(0.985); } }
.sheet-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px 18px 14px; border-bottom: 1px solid var(--line);
}
.sheet-head h3 { font-size: 1.1rem; }
.sheet-body { padding: 20px 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 22px; }
.sheet-foot {
  display: flex; gap: 10px; padding: 14px 18px 18px; border-top: 1px solid var(--line);
}
.sheet-foot .btn { flex: 1; }
.routine-body { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
.routine-left, .routine-right { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

/* 폼 */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field > span { font-size: 0.82rem; font-weight: 650; color: var(--text-dim); }
.field .val { color: var(--accent-2); font-style: normal; font-variant-numeric: tabular-nums; }
.field input[type="text"], .field textarea, .field select {
  width: 100%; padding: 12px 14px; border-radius: 13px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text);
  transition: 0.16s ease; resize: vertical;
}
.field textarea { line-height: 1.5; }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: color-mix(in srgb, var(--accent) 60%, transparent); box-shadow: var(--ring);
}
.field input::placeholder, .field textarea::placeholder { color: var(--text-faint); }
.field select { appearance: none; cursor: pointer; padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%239aa6bd' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
.field-hint { color: var(--text-faint); font-size: 0.76rem; line-height: 1.45; }
.field-hint.warn { color: var(--rest); }
.field-row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.field-row .field.tight { flex: 0 0 120px; }
.field-row .switch { flex: 1; min-width: 180px; }

input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: transparent; cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 6px; border-radius: 999px; background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 20px; height: 20px; margin-top: -7px;
  border-radius: 50%; background: #fff; border: 4px solid var(--accent);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}
input[type="range"]::-moz-range-track { height: 6px; border-radius: 999px; background: var(--surface-2); }
input[type="range"]::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 4px solid var(--accent);
}

/* 세그먼트 선택 */
.seg {
  display: flex; padding: 3px; border-radius: 13px; gap: 3px;
  background: var(--surface-2); border: 1px solid var(--line);
}
.seg button {
  flex: 1; border: 0; background: transparent; color: var(--text-faint);
  padding: 9px 10px; border-radius: 10px; font-size: 0.86rem; font-weight: 650;
  cursor: pointer; transition: 0.16s ease; white-space: nowrap;
}
.seg button.is-active { background: var(--grad); color: #fff; }

/* 녹음 패널 */
.rec-box {
  display: flex; flex-direction: column; gap: 12px;
  padding: 14px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--line);
}
.rec-box[hidden] { display: none; }
.rec-main { display: flex; align-items: center; gap: 14px; }
.rec-btn {
  display: inline-flex; align-items: center; gap: 9px; flex: none;
  padding: 11px 18px; border-radius: 999px; cursor: pointer;
  border: 1px solid color-mix(in srgb, var(--danger) 36%, transparent);
  background: color-mix(in srgb, var(--danger) 14%, transparent);
  color: var(--danger); font-weight: 650; font-size: 0.9rem;
  transition: 0.16s ease;
}
.rec-btn:hover { background: color-mix(in srgb, var(--danger) 22%, transparent); }
.rec-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.rec-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--danger); flex: none; }
.rec-btn.is-rec { background: var(--danger); color: #fff; border-color: transparent; }
.rec-btn.is-rec .rec-dot { background: #fff; border-radius: 2px; animation: recPulse 1.1s ease-in-out infinite; }
@keyframes recPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.rec-meta { display: flex; flex-direction: column; gap: 7px; flex: 1; min-width: 0; }
.rec-time {
  font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em; line-height: 1;
}
.level {
  height: 8px; border-radius: 999px; background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line); overflow: hidden;
}
.level > i {
  display: block; height: 100%; width: 0%; border-radius: inherit;
  background: var(--grad-go); transition: width 0.08s linear;
}
.rec-actions { display: flex; gap: 8px; }
.rec-actions .btn { flex: 1; }
.rec-actions .btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* 스위치 */
.switch { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track {
  position: relative; flex: none; width: 46px; height: 28px; border-radius: 999px;
  background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); transition: 0.2s ease;
}
.switch .track::after {
  content: ""; position: absolute; top: 4px; left: 4px; width: 20px; height: 20px;
  border-radius: 50%; background: var(--text-faint); transition: 0.2s cubic-bezier(0.3, 1.4, 0.5, 1);
}
.switch input:checked + .track { background: var(--grad); box-shadow: none; }
.switch input:checked + .track::after { transform: translateX(18px); background: #fff; }
.switch input:focus-visible + .track { box-shadow: var(--ring); }
.switch-label { display: flex; flex-direction: column; font-size: 0.88rem; font-weight: 600; }
.switch-label small { color: var(--text-faint); font-weight: 500; font-size: 0.75rem; }

/* 단계 리스트 (편집) */
.steps-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 0.82rem; font-weight: 650; color: var(--text-dim);
}
.steps-head em { font-style: normal; color: var(--text); }
.total-chip {
  padding: 3px 10px; border-radius: 999px; background: var(--surface-2);
  border: 1px solid var(--line); font-size: 0.76rem;
}
.step-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.step-item {
  display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--line);
  cursor: pointer; transition: 0.16s ease;
}
.step-item:hover { border-color: var(--line-strong); }
.step-item.is-sel {
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.step-item .si-n {
  display: grid; place-items: center; width: 24px; height: 24px; border-radius: 8px;
  background: var(--surface); font-size: 0.74rem; font-weight: 700; color: var(--text-dim);
  box-shadow: inset 0 0 0 1px var(--line);
}
.step-item.is-sel .si-n { background: var(--grad); color: #fff; box-shadow: none; }
.step-item .si-body { min-width: 0; }
.step-item .si-label {
  font-size: 0.9rem; font-weight: 650;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.step-item .si-msg {
  font-size: 0.74rem; color: var(--text-faint);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.step-item .si-dur { font-size: 0.8rem; font-weight: 650; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.si-del {
  width: 26px; height: 26px; border-radius: 8px; border: 0; background: transparent;
  color: var(--text-faint); cursor: pointer; display: grid; place-items: center;
}
.si-del:hover { color: var(--danger); background: color-mix(in srgb, var(--danger) 14%, transparent); }
.si-del svg { width: 14px; height: 14px; }

.step-editor-head {
  display: flex; align-items: center; gap: 10px;
  font-size: 0.84rem; font-weight: 650; color: var(--text-dim);
  padding-bottom: 2px;
}
.step-badge {
  display: grid; place-items: center; width: 26px; height: 26px; border-radius: 9px;
  background: var(--grad); color: #fff; font-size: 0.78rem; font-weight: 700;
}

/* 멘트 배너 */
.big-banner {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%) scale(0.94);
  z-index: 80; max-width: min(620px, calc(100% - 32px));
  padding: 26px 30px; border-radius: 24px; text-align: center;
  font-size: clamp(1.35rem, 5.5vw, 2rem); font-weight: 750; letter-spacing: -0.03em;
  line-height: 1.35; color: #fff;
  background: linear-gradient(135deg, rgba(124, 140, 255, 0.96), rgba(39, 216, 224, 0.96));
  box-shadow: 0 30px 80px -24px rgba(0, 0, 0, 0.8);
  opacity: 0; pointer-events: none; transition: opacity 0.25s ease, transform 0.25s ease;
}
.big-banner.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }

/* 토스트 */
.toast-zone {
  position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom));
  transform: translateX(-50%); z-index: 90;
  display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none; width: calc(100% - 32px); max-width: 420px;
}
.toast {
  padding: 11px 18px; border-radius: 14px; font-size: 0.88rem; font-weight: 600;
  background: var(--surface-solid); border: 1px solid var(--line-strong);
  box-shadow: var(--shadow); animation: toastIn 0.22s ease;
  display: flex; align-items: center; gap: 9px;
}
.toast.err { border-color: color-mix(in srgb, var(--danger) 50%, transparent); color: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } }
.toast.out { opacity: 0; transform: translateY(8px); transition: 0.25s ease; }

/* 반응형 */
@media (max-width: 760px) {
  .routine-body { grid-template-columns: 1fr; }
  .panel-head { align-items: stretch; }
  .panel-head .btn { width: 100%; }
  .sheet { max-width: 100%; border-radius: 22px; }
  .brand-text small { display: none; }
}
@media (max-width: 420px) {
  .topbar { padding: 12px 14px; }
  .wrap { padding-left: 14px; padding-right: 14px; }
  .grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
