:root {
  color-scheme: light;
  --background: #f5f3ef;
  --card: #fff;
  --text: #292826;
  --muted: #77716b;
  --line: #e9e4dd;
  --accent: #e65b4f;
  --accent-dark: #c9443a;
  --accent-soft: #fff0ed;
  --focus: #28665a;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--background);
  color: var(--text);
}

button,
input {
  font: inherit;
}

button {
  min-height: 42px;
  padding: 9px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

button:hover:not(:disabled) {
  border-color: #cfc6bc;
  background: #faf9f7;
}

button:active:not(:disabled) {
  transform: translateY(1px);
}

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

button:focus-visible,
input:focus-visible {
  outline: 3px solid #28665a44;
  outline-offset: 2px;
}

button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

button.primary:hover:not(:disabled) {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
}

button.secondary {
  border-color: #d8d1c8;
  background: #ffffff99;
}

button.ghost {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

button.danger {
  color: var(--accent-dark);
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 36px 0 22px;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(30px, 5vw, 42px);
  letter-spacing: -0.04em;
}

h2 {
  margin-bottom: 0;
  font-size: 22px;
}

.eyebrow {
  margin-bottom: 5px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(340px, 0.85fr);
  gap: 20px;
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
}

.card {
  padding: 28px;
  border: 1px solid #ffffffcc;
  border-radius: 20px;
  background: var(--card);
  box-shadow: 0 12px 40px #3b2f2308;
}

.timer-card {
  display: flex;
  min-height: 450px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.timer-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
}

.phase-badge {
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 800;
}

.phase-badge.break {
  background: #eaf4f1;
  color: var(--focus);
}

.time {
  margin: 22px 0 12px;
  font-size: clamp(72px, 12vw, 112px);
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.07em;
  line-height: 1;
}

progress {
  width: min(400px, 100%);
  height: 7px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: var(--line);
}

progress::-webkit-progress-bar {
  border-radius: 999px;
  background: var(--line);
}

progress::-webkit-progress-value {
  border-radius: 999px;
  background: var(--accent);
}

progress::-moz-progress-bar {
  border-radius: 999px;
  background: var(--accent);
}

.current-task {
  max-width: 100%;
  min-height: 24px;
  margin: 24px 0 16px;
  overflow-wrap: anywhere;
  color: var(--muted);
}

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

.timer-controls .primary {
  min-width: 120px;
}

.status,
.inline-status {
  min-height: 21px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 24px;
}

.task-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 100px auto;
  align-items: end;
  gap: 10px;
}

label > span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

input[type="text"],
input[type="number"] {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--text);
}

.task-list {
  display: grid;
  gap: 9px;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
}

.task-item {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  transition: border-color 120ms ease, background 120ms ease;
}

.task-item.selected {
  border-color: #e65b4f88;
  background: var(--accent-soft);
}

.task-select {
  display: flex;
  min-width: 0;
  flex: 1;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 8px 12px 14px;
  border: 0;
  background: transparent;
  text-align: left;
}

.task-select:hover:not(:disabled) {
  border: 0;
  background: transparent;
}

.task-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-count {
  flex: none;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.delete-task {
  min-height: 36px;
  margin-right: 6px;
  padding: 5px 9px;
  border: 0;
  background: transparent;
  color: var(--muted);
}

.empty-state {
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  text-align: center;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.toggle-list {
  display: grid;
  gap: 12px;
  margin: 22px 0;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 9px;
}

.toggle input {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: var(--accent);
}

.toggle span {
  margin: 0;
  color: var(--text);
  font-weight: 500;
}

.inline-status {
  display: inline-block;
  margin-left: 10px;
}

.stats-summary {
  color: var(--muted);
  line-height: 1.6;
}

.chart-container {
  width: 100%;
  min-height: 240px;
}

canvas {
  display: block;
  width: 100%;
  height: 240px;
}

footer {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 24px 0 36px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

@media (max-width: 800px) {
  .dashboard {
    grid-template-columns: 1fr;
  }

  .timer-card {
    min-height: 420px;
  }
}

@media (max-width: 540px) {
  .app-header,
  .dashboard,
  footer {
    width: min(100% - 24px, 1120px);
  }

  .app-header {
    padding-top: 24px;
  }

  .card {
    padding: 22px 18px;
  }

  .task-form {
    grid-template-columns: minmax(0, 1fr) 90px;
  }

  .task-form button {
    grid-column: 1 / -1;
  }

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

  .inline-status {
    display: block;
    margin-left: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
