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

:root {
  --bg: #F7F5F0;
  --ink: #1A1814;
  --ink-muted: #8A8680;
  --rule: #DDD9D0;
  --card: #FFFFFF;
  --calm: #5A4A8A;
  --calm-light: #EDEAF5;
}

html { font-size: 16px; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'DM Mono', monospace;
  min-height: 100vh;
}

.hidden { display: none !important; }

/* ── SETUP SCREEN ── */
#setupScreen {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
}

header {
  width: 100%;
  max-width: 520px;
  padding: 2rem 2rem 0;
}

.back-link {
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  text-decoration: none;
  transition: color 0.2s;
}
.back-link:hover { color: var(--ink); }

main {
  width: 100%;
  max-width: 520px;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.setup-hero {
  padding: 0.5rem 0 0.25rem;
  animation: fadeUp 0.5s ease both;
}
.setup-tag {
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 0.5rem;
}
.setup-title {
  font-family: 'DM Serif Display', serif;
  font-size: 2.8rem;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
}
.setup-desc {
  font-size: 0.75rem;
  color: var(--ink-muted);
  line-height: 1.6;
  max-width: 340px;
}

/* ── CONFIG CARD ── */
.config-card {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 12px;
  overflow: hidden;
  animation: fadeUp 0.5s 0.1s ease both;
}

.config-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
}

.config-name {
  font-size: 0.85rem;
  margin-bottom: 0.2rem;
}
.config-hint {
  font-size: 0.6rem;
  color: var(--ink-muted);
  letter-spacing: 0.04em;
}

/* ── STEPPER ── */
.config-stepper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.step-btn {
  font-family: 'DM Mono', monospace;
  font-size: 0.85rem;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--rule);
  border-radius: 50%;
  color: var(--ink-muted);
  cursor: pointer;
  transition: all 0.15s;
  padding: 0;
}
.step-btn:hover { border-color: var(--calm); color: var(--calm); }
.step-btn:disabled { opacity: 0.3; cursor: default; }
.step-val {
  font-size: 0.8rem;
  font-weight: 500;
  min-width: 4rem;
  text-align: center;
}

/* ── START ── */
.start-btn {
  font-family: 'DM Mono', monospace;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: var(--ink);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 1rem;
  cursor: pointer;
  transition: all 0.2s;
  animation: fadeUp 0.5s 0.2s ease both;
}
.start-btn:hover { background: #2A7A4A; }
.start-btn:active { transform: scale(0.98); }

/* ── ACTIVE SCREEN ── */
#activeScreen {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg);
}

.active-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
}

.session-label {
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 1.5rem;
}

.big-clock {
  font-size: 8rem;
  font-weight: 500;
  letter-spacing: -0.06em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--calm);
  margin-bottom: 2rem;
  transition: opacity 0.3s;
}
.big-clock.urgent { opacity: 0.6; }

.progress-wrap {
  width: 240px;
  height: 3px;
  background: var(--rule);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 1.25rem;
}
.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 2px;
  background: #2A7A4A;
  transition: width 1s linear;
}

.time-label {
  font-size: 0.65rem;
  color: var(--ink-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Controls */
.active-controls {
  display: flex;
  gap: 0.75rem;
  padding: 1.5rem 2rem 2.5rem;
  justify-content: center;
}
.ctrl-btn {
  font-family: 'DM Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border-radius: 8px;
  padding: 0.85rem 2rem;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
}
.ctrl-btn.pause {
  background: var(--ink);
  color: #fff;
}
.ctrl-btn.pause:hover { background: #2A7A4A; }
.ctrl-btn.pause.paused { background: #2A7A4A; }
.ctrl-btn.stop {
  background: none;
  color: var(--ink-muted);
  border: 1px solid var(--rule);
}
.ctrl-btn.stop:hover { color: var(--ink); border-color: var(--ink-muted); }

/* ── DONE SCREEN ── */
#doneScreen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
}
.done-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1rem;
  max-width: 320px;
  animation: fadeUp 0.5s ease both;
}
.done-icon {
  font-size: 2.5rem;
  width: 5rem;
  height: 5rem;
  background: var(--calm-light);
  color: var(--calm);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.5rem;
}
.done-title {
  font-family: 'DM Serif Display', serif;
  font-size: 2.2rem;
  letter-spacing: -0.02em;
}
.done-sub {
  font-size: 0.75rem;
  color: var(--ink-muted);
  margin-bottom: 0.5rem;
}
.done-back {
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  text-decoration: none;
  margin-top: 0.25rem;
}
.done-back:hover { color: var(--ink); }

/* ── CHIME TOGGLE ── */
.chime-toggle {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 8px;
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--ink-muted);
  transition: color 0.2s, border-color 0.2s;
  z-index: 100;
}
.chime-toggle:hover { color: var(--ink); border-color: var(--ink-muted); }
.chime-toggle .icon-off { display: none; }
.chime-toggle.muted { color: var(--ink-muted); }
.chime-toggle.muted .icon-on  { display: none; }
.chime-toggle.muted .icon-off { display: flex; }

/* ── ANIMATIONS ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── SHARE BUTTON ── */
.share-btn {
  font-family: 'DM Mono', monospace;
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: #2A7A4A;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 1.1rem;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
}
.share-btn:hover { filter: brightness(1.1); }
.share-btn:active { transform: scale(0.98); }

.history-btn {
  font-family: 'DM Mono', monospace;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  display: block;
  text-align: center;
  background: none;
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 1rem;
  text-decoration: none;
  transition: all 0.2s;
  width: 100%;
  box-sizing: border-box;
}
.history-btn:hover { border-color: var(--ink-muted); }
