:root {
  --bg: #07111f;
  --card: rgba(15, 23, 42, 0.76);
  --card-border: rgba(148, 163, 184, 0.18);
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --shadow: 0 24px 70px rgba(2, 6, 23, 0.45);
}

* {
  box-sizing: border-box;
}

html {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", system-ui, sans-serif;
  color: var(--text);
  position: relative;
  background:
    radial-gradient(circle at top, rgba(56, 189, 248, 0.18), transparent 35%),
    radial-gradient(
      circle at bottom right,
      rgba(14, 165, 233, 0.18),
      transparent 30%
    ),
    linear-gradient(160deg, #020617 0%, var(--bg) 45%, #111827 100%);
  overflow-x: hidden;
  padding: 0;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.03) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: radial-gradient(circle at center, black 40%, transparent 95%);
}

.site-title {
  position: fixed;
  top: 18px;
  left: 20px;
  margin: 0;
  font-size: 0.92rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(226, 232, 240, 0.78);
  z-index: 2;
}

.app {
  width: min(680px, calc(100% - 32px));
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1;
}

.timer-card {
  width: 100%;
  display: grid;
  gap: 24px;
  border: 1px solid var(--card-border);
  background: var(--card);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
  border-radius: 28px;
  padding: 36px 32px;
}

.tab-nav {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.tab-nav__button {
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(2, 6, 23, 0.35);
  color: var(--text);
  border-radius: 999px;
  padding: 12px 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 180ms ease;
}

.tab-nav__button:hover {
  border-color: rgba(125, 211, 252, 0.3);
  transform: translateY(-1px);
}

.tab-nav__button.is-active {
  color: #00111a;
  border-color: transparent;
  background: linear-gradient(135deg, #7dd3fc, var(--accent));
}

.mode-panel {
  display: none;
  width: 100%;
  gap: 20px;
}

.mode-panel.is-active {
  display: grid;
  justify-items: center;
}

.timer-display {
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 4px;
  width: 8ch;
  min-width: 8ch;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  font-size: clamp(3.25rem, 8vw, 5.6rem);
  font-weight: 700;
  letter-spacing: -0.05em;
  line-height: 1;
  color: #f8fafc;
}

.timer-display__separator {
  color: var(--accent);
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

.input-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.input-grid--pomodoro {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field-label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.86rem;
}

.field-input {
  width: 100%;
  background: rgba(15, 23, 42, 0.62);
  border: 1px solid rgba(148, 163, 184, 0.2);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
}

.field-input:focus {
  outline: 2px solid rgba(56, 189, 248, 0.42);
  outline-offset: 1px;
}

.stepper {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  align-items: stretch;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.62);
}

.field-input--stepper {
  border: 0;
  border-radius: 0;
  background: transparent;
  text-align: center;
  font-weight: 700;
  padding-right: 8px;
}

.field-input--stepper:focus {
  outline: none;
}

.stepper:focus-within {
  outline: 2px solid rgba(56, 189, 248, 0.42);
  outline-offset: 1px;
}

.stepper__buttons {
  display: grid;
  grid-template-rows: 1fr 1fr;
  border-left: 1px solid rgba(148, 163, 184, 0.2);
  background: linear-gradient(
    160deg,
    rgba(2, 6, 23, 0.5),
    rgba(8, 47, 73, 0.45)
  );
}

.stepper__button {
  border: 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.15);
  background: transparent;
  color: #cbd5e1;
  font-size: 0.6rem;
  cursor: pointer;
  transition: all 160ms ease;
}

.stepper__button:last-child {
  border-bottom: 0;
}

.stepper__button:hover {
  color: #f8fafc;
  background: rgba(56, 189, 248, 0.2);
}

.field-input--stepper::-webkit-outer-spin-button,
.field-input--stepper::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.field-input--stepper[type="number"] {
  -moz-appearance: textfield;
}

.countdown-display {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  font-size: clamp(2.6rem, 8vw, 4.6rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  color: #f8fafc;
}

.countdown-display--split {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
}

.status-text {
  margin: 0;
  color: var(--text);
  font-weight: 500;
  text-align: center;
}

.status-text--muted {
  color: var(--muted);
  font-weight: 400;
}

.option-row {
  width: 100%;
  display: grid;
  gap: 8px;
}

.option-row__label {
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.option-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.option-btn {
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(15, 23, 42, 0.58);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 600;
  transition: all 180ms ease;
}

.option-btn:hover {
  transform: translateY(-1px);
}

.option-btn.is-active {
  border-color: rgba(125, 211, 252, 0.5);
  background: rgba(14, 116, 144, 0.62);
}

.btn {
  border: 0;
  cursor: pointer;
  transition:
    transform 180ms ease,
    background-color 180ms ease,
    border-color 180ms ease,
    color 180ms ease,
    opacity 180ms ease;
}

.btn {
  padding: 14px 18px;
  border-radius: 999px;
  min-width: 132px;
  font-weight: 700;
}

.btn:hover,
.text-button:hover {
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn--primary {
  color: #00111a;
  background: linear-gradient(135deg, #7dd3fc, var(--accent));
}

.btn--secondary {
  color: var(--text);
  background: rgba(8, 47, 73, 0.9);
  border: 1px solid rgba(125, 211, 252, 0.22);
}

.btn--ghost {
  color: var(--text);
  background: transparent;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

@media (max-width: 640px) {
  .site-title {
    top: 14px;
    left: 14px;
    font-size: 0.8rem;
  }

  .app {
    position: relative;
    top: auto;
    left: auto;
    transform: none;
    width: min(680px, calc(100% - 24px));
    margin: 72px auto 24px;
  }

  .timer-card {
    padding: 24px 18px;
    border-radius: 22px;
  }

  .tab-nav {
    grid-template-columns: 1fr;
  }

  .input-grid,
  .input-grid--pomodoro {
    grid-template-columns: 1fr;
  }

  .controls {
    width: 100%;
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }
}
