:root {
  --bg-deep: #0c0e14;
  --bg-mid: #13161f;
  --surface: rgba(22, 26, 36, 0.82);
  --border: rgba(255, 255, 255, 0.08);
  --text: #eef1f7;
  --text-muted: #949eac;
  --accent: #b8d4f0;
  --accent-soft: rgba(184, 212, 240, 0.14);
  --focus: #8fd4a2;
  --break: #e0b878;
  --alarm: #e898a8;
  --radius: 16px;
  --radius-sm: 10px;
  --font-body: "DM Sans", system-ui, sans-serif;
  --font-display: "Fraunces", Georgia, serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg-deep);
  background-image:
    radial-gradient(ellipse 90% 50% at 50% -15%, rgba(70, 90, 120, 0.22), transparent 50%),
    linear-gradient(175deg, var(--bg-deep), var(--bg-mid) 45%, #0a0c12);
  background-attachment: fixed;
}

.page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 3rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.top {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.top__inner {
  margin-bottom: 0.75rem;
}

.brand {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 600;
  margin: 0 0 0.25rem;
  letter-spacing: -0.02em;
}

.tag {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.nav__link {
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  border: 1px solid transparent;
  font-weight: 500;
  font-size: 0.9rem;
}

.nav__link:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.nav__link--active {
  color: var(--text);
  border-color: var(--border);
  background: var(--accent-soft);
}

.main {
  flex: 1;
}

.main--settings .panel {
  margin-bottom: 1.25rem;
}

.hint {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0 0 1rem;
}

.timer-board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.timer-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem 1.15rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.timer-card--alarm {
  border-color: rgba(232, 152, 168, 0.45);
  box-shadow: 0 0 0 1px rgba(232, 152, 168, 0.28), 0 12px 40px rgba(0, 0, 0, 0.35);
  animation: pulse-border 1.4s ease-in-out infinite;
}

@keyframes pulse-border {
  50% {
    border-color: rgba(232, 152, 168, 0.75);
  }
}

@media (prefers-reduced-motion: reduce) {
  .timer-card--alarm {
    animation: none;
  }
}

.timer-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.timer-card__title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
  line-height: 1.3;
}

.timer-badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.25rem 0.55rem;
  border-radius: 6px;
  background: rgba(143, 212, 162, 0.18);
  color: #c4eccf;
}

.timer-badge--break {
  background: rgba(224, 184, 120, 0.2);
  color: #f0d9ae;
}

.timer-card__time {
  font-variant-numeric: tabular-nums;
  font-size: 2.35rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-bottom: 0.6rem;
}

.timer-card__bar {
  height: 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin-bottom: 1rem;
}

.timer-card__bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--focus), #5a9b6a);
  transition: width 0.2s linear;
}

.timer-card--alarm .timer-card__bar-fill {
  background: linear-gradient(90deg, var(--alarm), #b86a7c);
}

.timer-card__controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.timer-card__alarm-msg {
  margin: 0 0 0.75rem;
  font-size: 0.88rem;
  color: #f0c4cc;
}

.btn {
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  cursor: pointer;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btn--primary {
  background: var(--accent-soft);
  border-color: rgba(184, 212, 240, 0.35);
  color: var(--text);
}

.btn--primary:hover {
  background: rgba(184, 212, 240, 0.22);
}

.btn--ghost {
  background: transparent;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
}

.panel--actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.label-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  font-weight: 600;
}

.help {
  margin: 0.75rem 0 0;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.input {
  font: inherit;
  color: var(--text);
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.55rem;
}

.input--select {
  min-width: 4rem;
}

.settings-rows {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.settings-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
}

.settings-row__main {
  display: grid;
  gap: 0.65rem 1rem;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  margin-bottom: 0.9rem;
}

.settings-row__tone {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  align-items: flex-end;
}

.settings-row label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
}

.tone-custom {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  width: 100%;
  align-items: flex-end;
}

.tone-custom[hidden] {
  display: none !important;
}

.btn--test {
  flex-shrink: 0;
}

.status {
  margin: 0;
  font-size: 0.9rem;
  color: var(--focus);
}

.foot {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.foot__muted {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}
