:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #f0f4f8;
  --text: #071624;
  --muted: #637386;
  --line: #dce5ee;
  --blue: #3f81c4;
  --blue-2: #52a9d9;
  --blue-dark: #173d56;
  --shadow: 0 20px 60px rgba(7, 22, 36, 0.08);
  --shadow-soft: 0 10px 30px rgba(7, 22, 36, 0.06);
  --radius-xl: 26px;
  --radius-lg: 18px;
  --radius-md: 14px;
}

[data-theme='dark'] {
  --bg: #06111f;
  --surface: #0b1a2b;
  --surface-2: #11253a;
  --text: #f3f8ff;
  --muted: #9dafc4;
  --line: #22374d;
  --blue: #5aa4ed;
  --blue-2: #5bc0f0;
  --blue-dark: #dceeff;
  --shadow: 0 20px 70px rgba(0, 0, 0, 0.32);
  --shadow-soft: 0 10px 35px rgba(0, 0, 0, 0.24);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(82, 169, 217, 0.12), transparent 32rem),
    var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  transition: background 0.25s ease, color 0.25s ease;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 78px;
  padding: 14px clamp(18px, 4vw, 54px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  text-decoration: none;
  color: var(--text);
}

.logo {
  display: block;
  width: 116px;
  height: auto;
  object-fit: contain;
}

.logo-dark,
[data-theme='dark'] .logo-light {
  display: none;
}

[data-theme='dark'] .logo-dark {
  display: block;
}

.brand-focus {
  padding-left: 14px;
  border-left: 1px solid var(--line);
  color: var(--blue-dark);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 24px;
  line-height: 1;
}

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

.nav-btn,
.icon-btn,
.mini-btn,
.secondary-btn,
.ghost-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 12px;
  min-height: 44px;
  padding: 0 16px;
  box-shadow: var(--shadow-soft);
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.nav-btn:hover,
.icon-btn:hover,
.mini-btn:hover,
.secondary-btn:hover,
.ghost-btn:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--blue) 50%, var(--line));
}

.nav-btn.active {
  color: var(--blue-dark);
  background: var(--surface-2);
}

.icon-btn {
  width: 44px;
  padding: 0;
  font-size: 20px;
}

.page {
  width: min(1240px, calc(100% - 36px));
  margin: 0 auto;
  padding: 54px 0 70px;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 28px;
  align-items: start;
}

.timer-column {
  display: grid;
  gap: 18px;
}

.timer-card,
.settings-panel,
.tasks-wrap,
.modal-card {
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.timer-card {
  padding: clamp(26px, 5vw, 44px);
  text-align: center;
}

.tabs {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: clamp(32px, 5vw, 44px);
}

.tab {
  min-height: 46px;
  padding: 0 24px;
  border-radius: 13px;
  background: transparent;
  color: var(--text);
  font-weight: 700;
  transition: background 0.18s ease, color 0.18s ease;
}

.tab.active {
  color: var(--blue-dark);
  background: var(--surface-2);
}

.time {
  color: var(--text);
  font-size: clamp(86px, 14vw, 170px);
  font-weight: 700;
  letter-spacing: -0.075em;
  line-height: 0.9;
  margin: 0 auto 34px;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 10px 24px color-mix(in srgb, var(--blue) 16%, transparent);
}

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

.primary-btn {
  min-height: 56px;
  padding: 0 44px;
  border-radius: 12px;
  color: white;
  background: linear-gradient(135deg, var(--blue-dark), var(--blue));
  font-weight: 800;
  letter-spacing: 0.02em;
  box-shadow: 0 15px 35px color-mix(in srgb, var(--blue) 32%, transparent);
  transition: transform 0.18s ease, filter 0.18s ease;
}

.primary-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
}

.primary-btn.full {
  width: 100%;
}

.ghost-btn.hidden {
  display: none;
}

.focus-message {
  display: grid;
  justify-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 20px;
}

.focus-message strong {
  color: var(--blue);
  font-size: 18px;
}

.settings-panel {
  padding: 28px;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.settings-panel.closed {
  display: none;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.panel-header h2,
.section-title h2 {
  margin: 0;
  color: var(--text);
  font-size: 22px;
  letter-spacing: -0.02em;
}

.close-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 28px;
  line-height: 1;
}

.close-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.settings-form {
  display: grid;
  gap: 18px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  color: var(--text);
  font-weight: 700;
}

.number-field {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.number-field input {
  width: 82px;
  min-height: 52px;
  text-align: center;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  font-size: 22px;
  font-weight: 700;
}

.number-field input:focus,
.add-task input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--blue) 14%, transparent);
}

.number-field small {
  color: var(--muted);
  font-weight: 600;
}

.tasks-wrap {
  width: min(760px, 100%);
  margin: 42px auto 0;
  padding: 24px;
  box-shadow: none;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.mini-btn {
  min-height: 38px;
  padding: 0 12px;
  box-shadow: none;
  font-size: 14px;
  color: var(--muted);
}

.add-task {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.add-task input {
  width: 100%;
  min-height: 56px;
  padding: 0 16px;
  border: 1px dashed color-mix(in srgb, var(--blue) 45%, var(--line));
  border-radius: 13px;
  background: transparent;
  color: var(--text);
  outline: none;
}

.add-task button {
  white-space: nowrap;
  min-height: 56px;
  padding: 0 18px;
  border-radius: 13px;
  background: var(--surface-2);
  color: var(--blue-dark);
  font-weight: 800;
}

.task-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.task-empty {
  margin: 0;
  padding: 24px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
}

.task-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  min-height: 56px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 74%, var(--surface-2));
}

.task-check {
  width: 24px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
}

.task-item.done .task-check {
  border-color: var(--blue);
  background: var(--blue);
}

.task-title {
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-item.done .task-title {
  color: var(--muted);
  text-decoration: line-through;
}

.delete-task {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
}

.delete-task:hover {
  background: var(--surface-2);
  color: var(--text);
}

.modal {
  width: min(520px, calc(100% - 32px));
  padding: 0;
  border: 0;
  border-radius: var(--radius-xl);
  background: transparent;
  color: var(--text);
}

.modal::backdrop {
  background: rgba(2, 8, 16, 0.56);
  backdrop-filter: blur(4px);
}

.modal-card {
  padding: 26px;
}

.report-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.report-item {
  display: grid;
  gap: 6px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-2);
}

.report-item span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.report-item strong {
  color: var(--text);
  font-size: 24px;
}

.secondary-btn {
  width: 100%;
  color: var(--text);
  box-shadow: none;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 50;
  max-width: calc(100% - 32px);
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 16px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

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

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

  .settings-panel {
    width: min(520px, 100%);
    margin: 0 auto;
  }
}

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

  .top-actions {
    width: 100%;
    justify-content: space-between;
  }

  .nav-btn span:last-child {
    display: none;
  }

  .page {
    width: min(100% - 24px, 1240px);
    padding-top: 28px;
  }

  .timer-card {
    padding: 22px 16px;
  }

  .tabs {
    gap: 8px;
  }

  .tab {
    min-height: 40px;
    padding: 0 10px;
    font-size: 14px;
  }

  .primary-btn {
    width: 100%;
  }

  .add-task {
    flex-direction: column;
  }

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

  .brand-focus {
    font-size: 20px;
  }

  .logo {
    width: 104px;
  }
}

.done-modal {
  width: min(620px, calc(100% - 32px));
}

.done-card {
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: clamp(28px, 5vw, 44px);
  text-align: center;
  animation: popIn 0.22s ease both;
}

.done-icon {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, var(--blue-dark), var(--blue));
  box-shadow: 0 16px 38px color-mix(in srgb, var(--blue) 34%, transparent);
  font-size: 34px;
  font-weight: 900;
}

.done-card h2 {
  margin: 4px 0 0;
  color: var(--text);
  font-size: clamp(28px, 5vw, 42px);
  line-height: 1;
  letter-spacing: -0.04em;
}

.done-card p {
  max-width: 440px;
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.45;
}

.done-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  width: 100%;
  margin-top: 8px;
  flex-wrap: wrap;
}

.done-actions .secondary-btn {
  width: auto;
  min-width: 130px;
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 720px) {
  .done-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .done-actions .secondary-btn {
    width: 100%;
  }
}
