*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0a0a0a;
  --surface: #141414;
  --surface2: #1a1a1a;
  --border: #2a2a2a;
  --border-strong: #333;
  --text: #fff;
  --text2: #aaa;
  --text3: #555;
  --accent: #7F77DD;
  --accent-dark: #534AB7;
  --accent-bg: #2a2760;
  --accent-text: #b0aaff;
  --radius: 10px;
  --radius-lg: 16px;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans KR', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1rem 4rem;
  -webkit-tap-highlight-color: transparent;
}

.page-top {
  width: 100%;
  max-width: 480px;
  display: flex;
  align-items: center;
  margin-bottom: 28px;
  position: relative;
  min-height: 36px;
}

.site-label {
  font-family: 'Syne', sans-serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #333;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'Syne', sans-serif;
  font-size: clamp(0.72rem, 2vw, 0.82rem);
  font-weight: 700;
  color: #ccc;
  text-decoration: none;
  padding: 8px 4px;
  min-height: 36px;
  transition: gap 0.2s;
  z-index: 1;
}
.back-btn:hover { gap: 10px; }
.back-btn:active { opacity: 0.7; }
.back-btn .arrow { display: inline-block; transition: transform 0.2s; pointer-events: none; }
.back-btn:hover .arrow { transform: translateX(-3px); }
.back-btn .label {
  background: linear-gradient(105deg, #666 30%, #fff 48%, #fff 52%, #666 70%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 2.8s linear infinite;
  pointer-events: none;
}

@keyframes shimmer {
  0%   { background-position: -200% center; }
  100% { background-position:  200% center; }
}

.app {
  width: 100%;
  max-width: 480px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: clamp(1.25rem, 4vw, 1.75rem);
  box-shadow: 0 8px 32px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.08);
}

.header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 1.5rem;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #4CAF50;
  flex-shrink: 0;
  animation: pulse 2s infinite;
}

.status-dot.paused { background: var(--text3); animation: none; }

@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(76,175,80,0.4); }
  50% { opacity: 0.7; box-shadow: 0 0 0 4px rgba(76,175,80,0); }
}

.header-text h1 {
  font-family: 'Syne', sans-serif;
  font-size: clamp(1rem, 3.5vw, 1.15rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}

.header-text p {
  font-size: 12px;
  color: var(--text3);
  margin-top: 2px;
}

.notif-bar {
  background: var(--accent-bg);
  border: 1px solid rgba(127,119,221,0.25);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  color: var(--accent-text);
  margin-bottom: 1rem;
  display: none;
  line-height: 1.5;
  gap: 8px;
  align-items: center;
}

.notif-bar.show { display: flex; }
.notif-bar span { flex: 1; }

.notif-bar button {
  background: var(--accent);
  border: none;
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  padding: 5px 12px;
  border-radius: 8px;
  font-family: inherit;
  white-space: nowrap;
  transition: background 0.15s;
}

.notif-bar button:hover { background: var(--accent-dark); }

.section-label {
  font-family: 'Syne', sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text3);
  margin-bottom: 8px;
}

.preset-row {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.preset-btn {
  padding: 7px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--surface2);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text2);
  font-family: inherit;
  transition: all 0.15s;
}

.preset-btn:hover { background: #222; border-color: #444; }

.preset-btn.active {
  border: 2px solid var(--accent);
  background: var(--accent-bg);
  color: var(--accent-text);
}

.custom-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.custom-label {
  font-size: 12px;
  color: var(--text3);
  white-space: nowrap;
}

.time-inputs {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
}

.time-field {
  display: flex;
  align-items: center;
  gap: 4px;
}

.time-input {
  width: 54px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  font-family: inherit;
  text-align: center;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.time-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(127,119,221,0.2);
}

.time-unit {
  font-size: 12px;
  color: var(--text3);
}

.time-sep {
  font-size: 16px;
  color: var(--border-strong);
  font-weight: 300;
}

.apply-btn {
  padding: 7px 16px;
  border-radius: 8px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: background 0.15s;
}

.apply-btn:hover { background: var(--accent-dark); }
.apply-btn:active { transform: scale(0.97); }

.timer-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.timer-ring {
  position: relative;
  width: 72px;
  height: 72px;
  flex-shrink: 0;
}

.timer-ring svg { transform: rotate(-90deg); }

.timer-pct {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}

.timer-info { flex: 1; min-width: 0; }

.next-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text3);
  margin-bottom: 3px;
}

.countdown {
  font-family: 'Syne', sans-serif;
  font-size: 30px;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.interval-badge {
  font-size: 12px;
  color: var(--text3);
  margin-top: 4px;
}

.action-row {
  display: flex;
  gap: 6px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.btn {
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  color: var(--text2);
  transition: all 0.15s;
}

.btn:hover { background: #222; border-color: #444; }
.btn:active { transform: scale(0.97); }

.btn.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }

.stretch-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: none;
  animation: slideUp 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.stretch-card.visible { display: block; }

@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.stretch-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.stretch-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.stretch-name {
  font-family: 'Syne', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  flex: 1;
}

.stretch-dur {
  font-size: 12px;
  color: var(--text3);
  white-space: nowrap;
}

.shuffle-btn {
  background: none;
  border: 1px solid var(--border-strong);
  font-size: 12px;
  color: var(--text3);
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 8px;
  font-family: inherit;
  transition: all 0.15s;
}

.shuffle-btn:hover { background: #222; color: var(--text2); }

.divider { height: 1px; background: var(--border); margin: 0 0 12px; }

.illustration {
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 12px;
  text-align: center;
  min-height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
}

.illustration svg { max-width: 240px; height: 130px; }

.steps {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 14px;
}

.step {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 13px;
  color: var(--text2);
  line-height: 1.45;
}

.step-num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  margin-top: 1px;
}

.stretch-btns { display: flex; gap: 8px; }

.history-section { margin-top: 1.25rem; }

.history-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
}

.history-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.history-name { flex: 1; color: var(--text2); }
.history-time { font-size: 11px; color: var(--text3); }

.empty-history {
  font-size: 13px;
  color: var(--text3);
  text-align: center;
  padding: 1rem;
}

@media (max-width: 480px) {
  body { padding: 1.25rem 0.75rem 3rem; }
  .timer-card { flex-direction: column; align-items: flex-start; }
}
