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

:root {
  --bg: #0f0f1a;
  --surface: #1a1a2e;
  --surface2: #16213e;
  --accent: #e94560;
  --accent2: #0f3460;
  --text: #eaeaea;
  --text-muted: #888;
  --radius: 12px;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

html, body {
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.app {
  width: 100%;
  max-width: 680px;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

header {
  text-align: center;
}

h1 {
  font-size: clamp(2rem, 6vw, 3.5rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #e94560, #a855f7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  color: var(--text-muted);
  margin-top: 0.4rem;
  font-size: 0.95rem;
}

/* --- Setup section --- */
.date-picker-section {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  border: 1px solid #ffffff10;
}

.date-picker-section label {
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.03em;
}

.input-row {
  display: flex;
  gap: 0.75rem;
}

input[type="datetime-local"] {
  flex: 1;
  background: var(--bg);
  border: 1px solid #ffffff20;
  border-radius: 8px;
  color: var(--text);
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.2s;
  color-scheme: dark;
}

input[type="datetime-local"]:focus {
  border-color: var(--accent);
}

button {
  cursor: pointer;
  font-family: var(--font);
  font-weight: 600;
  border: none;
  border-radius: 8px;
  transition: opacity 0.15s, transform 0.1s;
}

button:active {
  transform: scale(0.97);
}

#start-btn {
  background: var(--accent);
  color: #fff;
  padding: 0.4rem 1rem;
  font-size: 0.85rem;
  white-space: nowrap;
}

#start-btn:hover {
  opacity: 0.88;
}

/* --- Counter section --- */
.counter-section {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  border: 1px solid #ffffff10;
}

.counter-section.hidden {
  display: none;
}

.since-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.time-display {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  gap: 0.4rem;
  width: 100%;
}

.time-block {
  border-radius: 10px;
  padding: 0.75rem 0.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  min-width: 0;
  flex: 1;
  border: 1px solid #ffffff15;
}

.time-block:nth-child(1) { background: #5a1525; }
.time-block:nth-child(2) { background: #4a1535; }
.time-block:nth-child(3) { background: #351545; }
.time-block:nth-child(4) { background: #251550; }

.time-value {
  font-size: clamp(1.1rem, 4vw, 2.8rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  color: var(--text);
}

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

/* --- Total display --- */
.total-display {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  justify-content: center;
  padding-top: 0.5rem;
  border-top: 1px solid #ffffff10;
  width: 100%;
}

.total-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
}

.total-value {
  font-size: 1.1rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: #a78bfa;
}

.total-unit {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.reset-btn {
  background: transparent;
  border: 1px solid #ffffff20;
  color: var(--text-muted);
  padding: 0.5rem 1.25rem;
  font-size: 0.85rem;
  border-radius: 8px;
}

.reset-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}

footer {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  color: var(--text-muted);
  font-size: 0.75rem;
}

.version {
  position: absolute;
  right: 0;
  font-size: 0.7rem;
  opacity: 0.5;
}

