:root {
  --bg: #0a0a0f;
  --bg-soft: #14141d;
  --fg: #f5f5f7;
  --muted: #8b8b9a;
  --accent: #ff5c39;
  --accent-soft: rgba(255, 92, 57, 0.15);
  --border: rgba(255, 255, 255, 0.08);
  --radius: 16px;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  background:
    radial-gradient(1200px 800px at 50% -10%, rgba(255, 92, 57, 0.12), transparent 60%),
    var(--bg);
  overflow-x: hidden;
}

#app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: max(20px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom));
}

.screen {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}
.screen[hidden] { display: none; }

/* ===================== SETUP ===================== */
.setup-card {
  width: 100%;
  max-width: 460px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 28px;
  box-shadow: var(--shadow);
}

.setup-title {
  font-family: "Space Grotesk", sans-serif;
  font-size: 2rem;
  letter-spacing: -0.02em;
}
.setup-title::after {
  content: "";
  display: block;
  width: 44px;
  height: 4px;
  margin-top: 10px;
  border-radius: 4px;
  background: var(--accent);
}

.setup-sub {
  color: var(--muted);
  margin: 14px 0 26px;
  font-size: 0.95rem;
  line-height: 1.5;
}

.field { display: block; margin-bottom: 16px; }
.field-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 7px;
}
.field-label em { font-style: normal; opacity: 0.6; }

.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }

input[type="text"],
input[type="date"],
input[type="time"] {
  width: 100%;
  background: #0e0e16;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--fg);
  font-size: 1rem;
  font-family: inherit;
  padding: 13px 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input::-webkit-calendar-picker-indicator { filter: invert(0.7); cursor: pointer; }

.presets-wrap {
  margin: 4px 0 24px;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.presets-wrap > summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 14px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}
.presets-wrap > summary::-webkit-details-marker { display: none; }
.presets-wrap > summary::after {
  content: "›";
  font-size: 1.2rem;
  line-height: 1;
  transition: transform 0.2s;
}
.presets-wrap[open] > summary::after { transform: rotate(90deg); }
.presets-wrap > summary:hover { color: var(--fg); }

.presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 14px 14px;
}
.preset {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}
.preset:hover { border-color: var(--accent); color: var(--accent); }
.preset:active { transform: scale(0.96); }

.primary-btn {
  width: 100%;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 15px;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.1s, filter 0.15s;
}
.primary-btn:hover { filter: brightness(1.08); }
.primary-btn:active { transform: scale(0.985); }

/* ===================== COUNTDOWN ===================== */
.countdown-inner {
  width: 100%;
  max-width: 900px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 30px;
}

.cd-title {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 500;
  font-size: clamp(1.3rem, 5vw, 2.4rem);
  letter-spacing: -0.01em;
  color: var(--fg);
  text-wrap: balance;
}

.cd-status {
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: -16px;
}
.cd-status[hidden] { display: none; }

.cd-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(8px, 3vw, 28px);
  width: 100%;
}

.unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.num {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: clamp(2.8rem, 16vw, 9rem);
  line-height: 0.95;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

.label {
  font-size: clamp(0.65rem, 2.2vw, 0.95rem);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  font-weight: 500;
}

/* celebration */
.celebrate { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.celebrate[hidden] { display: none; }
.celebrate-emoji { font-size: clamp(4rem, 22vw, 11rem); animation: pulse 1.4s ease-in-out infinite; }
.celebrate-text {
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: clamp(2rem, 9vw, 4.5rem);
  background: linear-gradient(90deg, var(--accent), #ffb199);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}

/* when counting, gentle accent on the live seconds */
.cd-grid.live #seconds { color: var(--accent); }

.cd-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.ghost-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg);
  border-radius: 999px;
  padding: 10px 20px;
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}
.ghost-btn:hover { border-color: var(--accent); color: var(--accent); }
.ghost-btn:active { transform: scale(0.96); }
.ghost-btn.copied { border-color: var(--accent); color: var(--accent); }

/* ===================== FOOTER ===================== */
.footer {
  text-align: center;
  padding-top: 24px;
  font-size: 0.82rem;
  color: var(--muted);
}
.footer a { color: var(--muted); text-decoration: none; transition: color 0.15s; }
.footer a:hover { color: var(--accent); }
.footer .dot { margin: 0 8px; opacity: 0.5; }

/* ===================== CONFETTI ===================== */
#confetti {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 50;
}

@media (max-width: 420px) {
  .cd-grid { gap: 10px; }
  .field-row { flex-direction: column; gap: 0; }
}
