:root {
  color-scheme: dark;
  --bg: #0b0c0e;
  --surface: #111316;
  --surface-raised: #15181c;
  --surface-soft: #181b20;
  --text: #f3f4f6;
  --text-soft: #b8bdc7;
  --muted: #777f8c;
  --line: rgba(255, 255, 255, 0.075);
  --line-strong: rgba(255, 255, 255, 0.13);
  --accent: #ff7a1a;
  --accent-hover: #ff8a33;
  --accent-soft: rgba(255, 122, 26, 0.11);
  --danger: #ff7a7a;
  --radius-xl: 26px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --shadow-lg: 0 24px 70px rgba(0, 0, 0, 0.32);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 50% -30%, rgba(255, 122, 26, 0.08), transparent 34rem),
    var(--bg);
}

button {
  font: inherit;
}

button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

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

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 30px 0 46px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand__mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 122, 26, 0.32);
  border-radius: 12px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 14px;
  font-weight: 850;
  letter-spacing: -0.02em;
}

.brand__text {
  min-width: 0;
}

.brand__text strong,
.brand__text span {
  display: block;
}

.brand__text strong {
  font-size: 15px;
  letter-spacing: -0.01em;
}

.brand__text span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.018);
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.status__dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #5e6672;
  box-shadow: 0 0 0 4px rgba(94, 102, 114, 0.12);
}

.status[data-state="running"] {
  color: #ffc89f;
  border-color: rgba(255, 122, 26, 0.22);
  background: rgba(255, 122, 26, 0.035);
}

.status[data-state="running"] .status__dot {
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(255, 122, 26, 0.12);
}

.timer-panel {
  position: relative;
  overflow: hidden;
  padding: clamp(24px, 4vw, 44px);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.timer-panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 44px;
  right: 44px;
  height: 1px;
  background: rgba(255, 122, 26, 0.42);
}

.timer-panel__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

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

.keyboard-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.key {
  min-width: 28px;
  padding: 3px 7px;
  border: 1px solid var(--line-strong);
  border-bottom-color: rgba(255, 255, 255, 0.18);
  border-radius: 7px;
  background: var(--surface-soft);
  color: var(--text-soft);
  text-align: center;
  font-size: 10px;
  font-weight: 750;
  line-height: 1.2;
}

.timer {
  display: flex;
  align-items: baseline;
  margin: 0 0 30px;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  font-size: clamp(56px, 10.5vw, 124px);
  font-weight: 780;
  letter-spacing: -0.065em;
  line-height: 0.92;
  white-space: nowrap;
}

.timer__milliseconds {
  color: var(--accent);
}

.controls {
  display: grid;
  grid-template-columns: minmax(180px, 1.35fr) minmax(160px, 1fr) minmax(150px, 0.9fr) auto;
  gap: 10px;
}

.button {
  min-height: 50px;
  padding: 0 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  font-weight: 750;
  transition: transform 120ms ease, border-color 120ms ease, background-color 120ms ease, color 120ms ease;
}

.button:not(:disabled):hover {
  border-color: var(--line-strong);
  background: #1a1e23;
  transform: translateY(-1px);
}

.button:not(:disabled):active {
  transform: translateY(0);
}

.button--primary {
  border-color: transparent;
  background: var(--accent);
  color: #16110d;
}

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

.button--danger {
  color: #ffb3b3;
}

.button--ghost {
  background: transparent;
  color: var(--text-soft);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  margin-top: 18px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: hidden;
}

.panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 58px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
}

.panel__header h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 760;
  letter-spacing: -0.01em;
}

.panel__header span {
  color: var(--muted);
  font-size: 12px;
}

.session-list {
  max-height: 455px;
  overflow: auto;
  scrollbar-color: #353a42 transparent;
}

.session-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto 36px;
  align-items: center;
  gap: 14px;
  min-height: 70px;
  padding: 10px 15px 10px 20px;
  border-bottom: 1px solid var(--line);
}

.session-row:last-child {
  border-bottom: 0;
}

.session-row__number {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.session-row__main {
  min-width: 0;
}

.session-row__main strong,
.session-row__main span {
  display: block;
}

.session-row__main strong {
  font-size: 17px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.025em;
}

.session-row__main span,
.session-row__seconds {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.session-row__seconds {
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.icon-button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #68707c;
  cursor: pointer;
}

.icon-button:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--danger);
}

.icon-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.empty-state {
  display: grid;
  justify-items: center;
  padding: 64px 22px;
  text-align: center;
}

.empty-state__mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-raised);
  color: #696f79;
  font-size: 11px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.empty-state p {
  margin: 0 0 6px;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 700;
}

.empty-state span {
  max-width: 330px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.stat {
  min-width: 0;
  min-height: 110px;
  padding: 21px 20px;
  border-bottom: 1px solid var(--line);
}

.stat:nth-child(odd) {
  border-right: 1px solid var(--line);
}

.stat:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.stat span,
.stat strong {
  display: block;
}

.stat span {
  margin-bottom: 11px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 720;
  letter-spacing: 0.075em;
  text-transform: uppercase;
}

.stat strong {
  overflow: hidden;
  color: var(--text);
  font-size: clamp(16px, 2vw, 20px);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.035em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-top: 18px;
  padding: 0 2px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.footer p {
  margin: 0;
}

.toast {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: rgba(20, 23, 27, 0.96);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.34);
  color: var(--text-soft);
  font-size: 12px;
  font-weight: 650;
}

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

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

  .button--ghost {
    grid-column: 1 / -1;
  }
}

@media (max-width: 620px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 18px;
  }

  .brand__text span,
  .keyboard-hint {
    display: none;
  }

  .timer-panel {
    padding: 24px 18px 18px;
    border-radius: 22px;
  }

  .timer-panel::before {
    left: 24px;
    right: 24px;
  }

  .timer-panel__meta {
    margin-bottom: 18px;
  }

  .timer {
    margin-bottom: 24px;
    font-size: clamp(48px, 16vw, 82px);
  }

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

  .button--primary,
  .button--ghost {
    grid-column: 1 / -1;
  }

  .session-row {
    grid-template-columns: 34px minmax(0, 1fr) 34px;
    gap: 10px;
    padding-left: 14px;
  }

  .session-row__seconds {
    display: none;
  }

  .footer {
    display: block;
  }

  .footer p + p {
    margin-top: 5px;
  }
}

@media (max-width: 390px) {
  .status {
    padding-inline: 10px;
  }

  .status span:last-child {
    display: none;
  }

  .timer {
    font-size: 15vw;
  }

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

  .button--primary,
  .button--ghost {
    grid-column: auto;
  }
}

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

/* Session descriptions */
.active-note {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px 12px;
  margin: -2px 0 22px;
}

.active-note > span {
  grid-column: 1 / -1;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 720;
  letter-spacing: 0.02em;
}

.active-note input,
.session-note input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--text);
  font: inherit;
  outline: none;
  transition: border-color 120ms ease, background-color 120ms ease, box-shadow 120ms ease;
}

.active-note input {
  grid-column: 1 / -1;
  min-height: 46px;
  padding: 0 14px;
  font-size: 13px;
}

.active-note input::placeholder,
.session-note input::placeholder {
  color: #626a76;
}

.active-note input:focus,
.session-note input:focus {
  border-color: rgba(255, 122, 26, 0.5);
  background: rgba(255, 122, 26, 0.035);
  box-shadow: 0 0 0 3px rgba(255, 122, 26, 0.07);
}

.active-note small {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.session-row {
  min-height: 86px;
}

.session-row__main {
  display: grid;
  gap: 8px;
}

.session-row__time strong,
.session-row__time span {
  display: block;
}

.session-row__time strong {
  font-size: 17px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.025em;
}

.session-row__time span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.session-note {
  display: block;
  min-width: 0;
}

.session-note input {
  height: 32px;
  padding: 0 10px;
  font-size: 11px;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@media (max-width: 620px) {
  .active-note {
    margin-bottom: 18px;
  }

  .session-row {
    align-items: start;
    padding-top: 13px;
    padding-bottom: 13px;
  }
}
