:root {
  color-scheme: dark;
  --bg: #101114;
  --panel: #191b20;
  --panel-strong: #21242b;
  --text: #f3f5f7;
  --muted: #a7adb8;
  --line: #30343d;
  --accent: #ff6259;
  --accent-strong: #ff7d55;
  --focus: #63d2ff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at top left, rgba(255, 98, 89, 0.18), transparent 34rem),
    linear-gradient(135deg, #101114 0%, #151821 100%);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
}

button,
input {
  font: inherit;
}

.app {
  width: min(960px, calc(100vw - 48px));
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: 20px;
}

.timer-panel,
.settings-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(25, 27, 32, 0.92);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.32);
}

.timer-panel {
  padding: 32px;
  min-height: 480px;
  display: grid;
  align-content: center;
  gap: 28px;
  position: relative;
}

.settings-panel {
  padding: 24px;
  display: grid;
  align-content: start;
  gap: 22px;
}

.mode-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding: 6px;
  border-radius: 8px;
  background: var(--panel-strong);
}

.mode-tab {
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.mode-tab.active {
  background: #2e333d;
  color: var(--text);
}

.mode-tab:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.status {
  margin: 8px 0 0;
  color: var(--muted);
  text-align: center;
  font-size: 18px;
}

.time {
  min-height: 170px;
  display: grid;
  place-items: center;
  font-size: clamp(78px, 12vw, 136px);
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
}

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

button {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #242832;
  color: var(--text);
  cursor: pointer;
}

button:hover {
  border-color: #4a505c;
  background: #2a2f3a;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

button.primary {
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #170f0f;
  font-weight: 700;
}

.counter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}

.counter strong {
  min-width: 56px;
  min-height: 56px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #252a33;
  color: var(--text);
  font-size: 28px;
}

.durations {
  display: grid;
  gap: 14px;
}

.durations label {
  display: grid;
  grid-template-columns: 1fr 86px 42px;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.durations input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #111318;
  color: var(--text);
  padding: 0 10px;
}

.durations small {
  color: var(--muted);
}

.notify-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  cursor: pointer;
}

.notify-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.completion-dialog {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  border-radius: 8px;
  background: rgba(16, 17, 20, 0.76);
}

.completion-dialog[hidden] {
  display: none;
}

.completion-card {
  width: min(100%, 360px);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.36);
  text-align: center;
}

.completion-card h2 {
  margin: 0 0 10px;
  font-size: 24px;
}

.completion-card p {
  margin: 0 0 20px;
  color: var(--muted);
  line-height: 1.6;
}

.completion-card button {
  width: 100%;
}

@media (max-width: 780px) {
  body {
    place-items: start center;
    padding: 24px 0;
  }

  .app {
    width: min(100% - 28px, 520px);
    grid-template-columns: 1fr;
  }

  .timer-panel {
    min-height: 420px;
    padding: 22px;
  }

  .controls {
    grid-template-columns: 1fr;
  }
}
