:root {
  color-scheme: dark;
  --bg: #05070d;
  --panel: rgba(255, 255, 255, 0.075);
  --panel-strong: rgba(255, 255, 255, 0.12);
  --line: rgba(255, 255, 255, 0.15);
  --text: #f6f8fc;
  --muted: #a7b2c6;
  --cyan: #54e5ff;
  --green: #76ffc1;
  --amber: #ffd166;
  --pink: #ff78bb;
  --shadow: 0 28px 90px rgba(0, 0, 0, 0.46);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 12% 12%, rgba(84, 229, 255, 0.18), transparent 26rem),
    radial-gradient(circle at 82% 18%, rgba(118, 255, 193, 0.14), transparent 28rem),
    radial-gradient(circle at 50% 100%, rgba(255, 120, 187, 0.11), transparent 30rem),
    linear-gradient(135deg, #05070d 0%, #09111d 52%, #060713 100%);
  color: var(--text);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.72), transparent 86%);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

.shell {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
}

.glass {
  border: 1px solid var(--line);
  background:
    radial-gradient(circle at 20% 0%, rgba(84, 229, 255, 0.1), transparent 34%),
    linear-gradient(145deg, var(--panel-strong), rgba(255, 255, 255, 0.045));
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1120px, calc(100% - 40px));
  margin: 18px auto 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(5, 7, 13, 0.76);
  backdrop-filter: blur(22px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 850;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(84, 229, 255, 0.54);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(84, 229, 255, 0.22), rgba(118, 255, 193, 0.14));
}

.nav-links {
  display: flex;
  gap: 4px;
}

.nav-links a {
  padding: 10px 12px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 14px;
  transition: color 180ms ease, background 180ms ease, transform 180ms ease;
}

.nav-links a:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-1px);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(390px, 1fr);
  gap: 32px;
  align-items: center;
  min-height: calc(100vh - 84px);
  padding: 58px 0 36px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--cyan);
  font-size: 13px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 720px;
  margin-bottom: 20px;
  font-size: clamp(42px, 6vw, 76px);
  line-height: 1.05;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(26px, 3vw, 38px);
  line-height: 1.15;
}

.lead {
  max-width: 620px;
  color: var(--muted);
  font-size: clamp(17px, 2vw, 20px);
  line-height: 1.75;
}

.timer-panel {
  display: grid;
  gap: 22px;
  padding: 22px;
  border-radius: 28px;
}

.mode-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  background: rgba(1, 6, 17, 0.42);
}

.mode-tab {
  min-height: 42px;
  border: 0;
  border-radius: 13px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 820;
  transition: color 180ms ease, background 180ms ease, transform 180ms ease;
}

.mode-tab:hover {
  color: var(--text);
  transform: translateY(-1px);
}

.mode-tab.is-active {
  background: linear-gradient(135deg, var(--cyan), var(--green));
  color: #041018;
  box-shadow: 0 12px 28px rgba(84, 229, 255, 0.18);
}

.dial-wrap {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 330px;
}

.progress-ring {
  width: min(72vw, 330px);
  max-width: 100%;
  transform: rotate(-90deg);
  filter: drop-shadow(0 0 26px rgba(84, 229, 255, 0.18));
}

.ring-track,
.ring-progress {
  fill: none;
  stroke-width: 12;
}

.ring-track {
  stroke: rgba(255, 255, 255, 0.11);
}

.ring-progress {
  stroke: url("#none");
  stroke: var(--cyan);
  stroke-linecap: round;
  transition: stroke-dashoffset 260ms linear;
}

.time-core {
  position: absolute;
  inset: 50% auto auto 50%;
  display: grid;
  justify-items: center;
  gap: 8px;
  transform: translate(-50%, -50%);
  text-align: center;
}

.time-core strong {
  font-size: clamp(52px, 9vw, 82px);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

.time-core span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 760;
}

.state-label {
  color: var(--green) !important;
  text-transform: uppercase;
}

.controls {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 10px;
}

.button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 0 18px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  cursor: pointer;
  overflow: hidden;
  font-weight: 850;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease, background 180ms ease;
}

.button:hover {
  transform: translateY(-2px);
}

.button:active {
  transform: translateY(1px) scale(0.98);
}

.primary {
  border-color: transparent;
  background: linear-gradient(135deg, var(--cyan), var(--green));
  color: #041018;
  box-shadow: 0 16px 42px rgba(84, 229, 255, 0.22);
}

.secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.status-strip {
  min-height: 46px;
  padding: 12px 14px;
  border: 1px solid rgba(118, 255, 193, 0.18);
  border-radius: 16px;
  background: rgba(1, 6, 17, 0.48);
  color: var(--muted);
  line-height: 1.5;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 18px;
  padding: 34px 0 72px;
}

.settings-panel,
.stats-panel {
  padding: 22px;
  border-radius: 28px;
  scroll-margin-top: 110px;
}

.section-head {
  margin-bottom: 22px;
}

.input-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

.field {
  display: grid;
  gap: 9px;
}

.field span,
.switch {
  color: var(--muted);
  font-size: 14px;
  font-weight: 780;
}

.field input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 15px;
  outline: none;
  background: rgba(1, 6, 17, 0.62);
  color: var(--text);
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.field input:focus {
  border-color: rgba(84, 229, 255, 0.58);
  box-shadow: 0 0 0 4px rgba(84, 229, 255, 0.1);
}

.toggle-row {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.switch {
  display: flex;
  align-items: center;
  gap: 10px;
}

.switch input {
  position: absolute;
  opacity: 0;
}

.switch span {
  position: relative;
  width: 48px;
  height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  transition: background 180ms ease, border-color 180ms ease;
}

.switch span::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 180ms ease, background 180ms ease;
}

.switch input:checked + span {
  border-color: transparent;
  background: linear-gradient(135deg, var(--cyan), var(--green));
}

.switch input:checked + span::after {
  background: #041018;
  transform: translateX(20px);
}

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

.stat-card,
.next-panel {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  background: rgba(1, 6, 17, 0.5);
}

.stat-card {
  display: grid;
  gap: 8px;
  padding: 16px;
}

.stat-card span,
.next-panel span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 780;
}

.stat-card strong {
  font-size: 28px;
}

.next-panel {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding: 16px;
}

.next-panel strong {
  color: var(--green);
  line-height: 1.45;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 40;
  max-width: calc(100% - 32px);
  padding: 11px 16px;
  border: 1px solid rgba(118, 255, 193, 0.36);
  border-radius: 999px;
  background: rgba(4, 18, 16, 0.9);
  color: #e8fff4;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.36);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 180ms ease, transform 180ms ease;
  font-size: 14px;
  font-weight: 850;
  text-align: center;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 900px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .hero,
  .workspace {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
    padding-top: 52px;
  }
}

@media (max-width: 620px) {
  .shell,
  .topbar {
    width: min(100% - 24px, 1120px);
  }

  .topbar {
    margin-top: 12px;
    border-radius: 16px;
  }

  .nav-links {
    width: 100%;
    overflow-x: auto;
  }

  h1 {
    font-size: 40px;
  }

  .timer-panel,
  .settings-panel,
  .stats-panel {
    padding: 16px;
    border-radius: 22px;
  }

  .mode-tabs,
  .controls,
  .input-grid,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .dial-wrap {
    min-height: 280px;
  }

  .time-core strong {
    font-size: 54px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
