:root {
  --bg: #000000;
  --surface: #0e0f10;
  --surface-2: #17181a;
  --text: #f4f5f4;
  --muted: #7c8079;
  --accent: #34d399;
  --accent-dim: #0f3b2e;
  --danger: #ef4444;
  --radius: 18px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
}

body { overflow: hidden; }

.view {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: calc(var(--safe-t) + 20px) 24px calc(var(--safe-b) + 24px);
  animation: fade .35s ease;
}

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* Buttons */
.btn {
  border: none;
  border-radius: 999px;
  font-size: 18px;
  font-weight: 600;
  padding: 17px 28px;
  cursor: pointer;
  font-family: inherit;
  transition: transform .12s ease, opacity .2s ease;
}
.btn:active { transform: scale(.97); }
.btn-primary {
  background: var(--accent);
  color: #04150f;
  box-shadow: 0 0 40px -8px var(--accent);
}
.btn-ghost {
  background: var(--surface-2);
  color: var(--text);
}
.icon-btn {
  background: none;
  border: none;
  color: var(--text);
  font-size: 26px;
  cursor: pointer;
  padding: 6px 10px;
  line-height: 1;
}

/* Welcome */
#view-welcome { justify-content: center; align-items: center; text-align: center; }
.welcome-wrap { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.logo-mark {
  width: 92px; height: 92px;
  border-radius: 26px;
  background: linear-gradient(160deg, var(--accent), #0e8f66);
  display: grid; place-items: center;
  font-size: 54px; font-weight: 800; color: #04150f;
  box-shadow: 0 0 60px -10px var(--accent);
  margin-bottom: 6px;
}
.brand { font-size: 44px; font-weight: 800; letter-spacing: -1px; }

/* Guide */
.guide-scroll { display: flex; flex-direction: column; gap: 16px; overflow-y: auto; padding-bottom: 12px; }
.logo-mark.small { width: 56px; height: 56px; border-radius: 16px; font-size: 32px; }
.guide-title { font-size: 26px; font-weight: 800; letter-spacing: -.5px; margin-top: 4px; }
.guide-lead { color: var(--muted); font-size: 16px; line-height: 1.5; }
.guide-block { background: var(--surface); border-radius: 16px; padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.guide-tag { color: var(--accent); font-size: 11px; font-weight: 700; letter-spacing: 1.2px; }
.guide-steps { color: var(--text); font-size: 15px; line-height: 1.55; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.guide-steps b { font-weight: 700; }
.guide-note { color: var(--muted); font-size: 13px; line-height: 1.5; }
.btn-text { background: none; border: none; color: var(--muted); font-size: 15px; padding: 10px; cursor: pointer; font-family: inherit; }
.tagline { color: var(--muted); font-size: 17px; margin-bottom: 26px; }

/* Home */
#view-home { justify-content: center; align-items: center; text-align: center; }
.settings-gear { position: absolute; top: calc(var(--safe-t) + 12px); right: 12px; }
.home-wrap { display: flex; flex-direction: column; align-items: center; gap: 18px; width: 100%; max-width: 420px; }
.home-clock { font-size: 22px; color: var(--muted); font-variant-numeric: tabular-nums; letter-spacing: 1px; }
.home-sub { color: var(--muted); font-size: 16px; margin-top: 4px; }
.timer-set { display: flex; align-items: center; gap: 26px; margin-top: 6px; }
.step-btn {
  width: 58px; height: 58px; border-radius: 50%;
  background: var(--surface-2); color: var(--text);
  border: none; font-size: 30px; cursor: pointer;
  display: grid; place-items: center;
}
.step-btn:active { background: var(--surface); }
.timer-display { display: flex; align-items: baseline; gap: 6px; min-width: 150px; justify-content: center; }
.timer-display span { font-size: 76px; font-weight: 700; font-variant-numeric: tabular-nums; }
.timer-display small { font-size: 18px; color: var(--muted); }
.presets { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.chip {
  background: var(--surface-2); color: var(--text);
  border: 1px solid transparent; border-radius: 999px;
  padding: 9px 18px; font-size: 15px; cursor: pointer; font-family: inherit;
}
.chip.active { border-color: var(--accent); color: var(--accent); }
.btn-lock { width: 100%; max-width: 360px; margin-top: 14px; font-size: 20px; }

/* Lock */
.view-lock {
  justify-content: space-between;
  align-items: center;
  text-align: center;
  background:
    radial-gradient(140% 90% at 50% 0%, #0b1f18 0%, #000 60%);
}
.lock-quote {
  color: var(--muted);
  font-size: 17px;
  line-height: 1.5;
  max-width: 560px;
  min-height: 52px;
  font-style: italic;
  transition: opacity .6s ease;
  padding-top: 8px;
}
.lock-center { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.lock-countdown {
  font-size: clamp(64px, 22vw, 128px);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -2px;
  text-shadow: 0 0 60px -10px var(--accent);
}
.lock-clock { font-size: 20px; color: var(--muted); font-variant-numeric: tabular-nums; }
.lock-actions { display: flex; gap: 20px; margin-bottom: 52px; }
.round-btn {
  background: none; border: none; color: var(--text);
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  cursor: pointer; font-family: inherit;
}
.round-btn .ic {
  width: 62px; height: 62px; border-radius: 50%;
  background: var(--surface-2); display: grid; place-items: center;
  font-size: 26px; transition: background .15s;
}
.round-btn:active .ic { background: var(--surface); }
.round-btn.on .ic { background: var(--accent); color: #04150f; }
.round-btn .lbl { font-size: 12px; color: var(--muted); }
.lock-hint {
  position: absolute; left: 16px; right: 16px; bottom: calc(var(--safe-b) + 210px);
  background: var(--surface-2); border-radius: 14px;
  padding: 13px 40px 13px 16px; font-size: 13px; color: var(--muted); line-height: 1.4;
}
.hint-x { position: absolute; right: 8px; top: 8px; background: none; border: none; color: var(--muted); font-size: 20px; cursor: pointer; }
.give-up {
  position: absolute; bottom: calc(var(--safe-b) + 20px);
  background: none; border: none; color: #3a3d38; font-size: 13px; cursor: pointer;
  font-family: inherit; letter-spacing: .3px;
}
.give-up.arming { color: var(--danger); }

/* Black overlay */
#black-overlay {
  position: fixed; inset: 0; background: #000; z-index: 50;
  display: grid; place-items: center;
}
.black-time { display: none; }

/* Flash overlay */
#flash-overlay { position: fixed; inset: 0; background: #fff; z-index: 60; }

/* Dial */
#dial-overlay {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(0,0,0,.85); backdrop-filter: blur(6px);
  display: grid; place-items: center; padding: 24px;
}
.dial-card { width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: 22px; }
.dial-number { min-height: 44px; text-align: center; font-size: 34px; font-variant-numeric: tabular-nums; letter-spacing: 2px; }
.dial-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.dial-key {
  aspect-ratio: 1; border-radius: 50%; border: none;
  background: var(--surface-2); color: var(--text);
  font-size: 30px; cursor: pointer; font-family: inherit;
}
.dial-key:active { background: var(--surface); }
.dial-controls { display: flex; align-items: center; justify-content: space-between; }
.dial-cancel, .dial-back { background: none; border: none; color: var(--muted); font-size: 17px; cursor: pointer; font-family: inherit; }
.dial-call {
  background: var(--accent); color: #04150f; border: none;
  width: 66px; height: 66px; border-radius: 50%; font-size: 16px; font-weight: 700; cursor: pointer;
}

/* Done */
#view-done { justify-content: center; align-items: center; text-align: center; }
.done-wrap { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.done-check {
  width: 96px; height: 96px; border-radius: 50%;
  background: var(--accent-dim); color: var(--accent);
  display: grid; place-items: center; font-size: 50px; margin-bottom: 8px;
  box-shadow: 0 0 60px -14px var(--accent);
}
.done-wrap h2 { font-size: 32px; }
.done-sub { color: var(--muted); font-size: 17px; margin-bottom: 22px; }

/* Settings + Hardcore */
.topbar { display: flex; align-items: center; gap: 6px; margin-bottom: 20px; }
.topbar h2 { font-size: 22px; font-weight: 700; }
.settings-list, .hardcore-scroll { display: flex; flex-direction: column; gap: 12px; overflow-y: auto; }
.hardcore-scroll { gap: 16px; padding-bottom: 20px; }
.row {
  background: var(--surface); border: none; border-radius: 14px;
  padding: 17px 18px; font-size: 16px; color: var(--text);
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; font-family: inherit; text-align: left;
}
.row-nav { cursor: pointer; }
.row-arrow { color: var(--muted); font-size: 20px; }
.muted { color: var(--muted); }
.toggle-row input { width: 50px; height: 30px; appearance: none; background: var(--surface-2); border-radius: 999px; position: relative; cursor: pointer; transition: background .2s; }
.toggle-row input:checked { background: var(--accent); }
.toggle-row input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .2s; }
.toggle-row input:checked::after { transform: translateX(20px); }

.hc-badge { align-self: flex-start; background: var(--accent-dim); color: var(--accent); font-size: 12px; font-weight: 700; letter-spacing: 1px; padding: 6px 12px; border-radius: 999px; }
.hc-badge.soon { background: #2a1f06; color: #f5c451; }
.hc-lead { color: var(--muted); font-size: 16px; line-height: 1.5; }
.hardcore-scroll h3 { font-size: 19px; margin-top: 6px; }
.hc-list, .hc-steps { color: var(--muted); font-size: 15px; line-height: 1.6; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.hc-choices { display: flex; flex-direction: column; gap: 12px; margin-top: 10px; }
.hc-sad { font-size: 52px; text-align: center; }

[hidden] { display: none !important; }
