:root {
  --paper: #f3efe6;
  --panel: #fbfaf6;
  --ink: #202622;
  --muted: #626b63;
  --line: #c3c5ba;
  --line-strong: #626b63;
  --accent: #c65336;
  --accent-deep: #963b28;
  --display: Georgia, "Times New Roman", serif;
  --body: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: light;
}

[data-theme="dark"] {
  --paper: #1f2523;
  --panel: #28302d;
  --ink: #f3efe6;
  --muted: #c3c8bf;
  --line: #657269;
  --line-strong: #9aa89d;
  --accent: #ef8365;
  --accent-deep: #ffae92;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--body);
  font-size: 1rem;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
}

::selection {
  color: var(--paper);
  background: var(--accent-deep);
}

button,
textarea,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
textarea:focus-visible,
input:focus-visible {
  outline: 3px solid var(--accent-deep);
  outline-offset: 4px;
}

button {
  cursor: pointer;
}

.skip-link {
  position: fixed;
  z-index: 20;
  top: 12px;
  left: 12px;
  padding: 0.65rem 0.8rem;
  color: var(--paper);
  background: var(--ink);
  transform: translateY(-180%);
}

.skip-link:focus {
  transform: translateY(0);
}

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

.topbar {
  display: flex;
  min-height: 78px;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}

.brand-name {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.brand-note {
  color: var(--muted);
  font-family: var(--display);
  font-size: 1rem;
  font-style: italic;
}

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

.text-control {
  min-height: 44px;
  padding: 0;
  border: 0;
  border-bottom: 1px solid transparent;
  color: var(--muted);
  background: transparent;
  font-size: 0.76rem;
}

.text-control:hover,
.text-control[aria-pressed="true"] {
  border-bottom-color: var(--ink);
  color: var(--ink);
}

.text-control:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.app-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(290px, 0.65fr);
  gap: 0;
  padding: 70px 0 92px;
}

.timer-panel {
  min-height: 650px;
  padding: 4px 9% 0 0;
  border-right: 1px solid var(--line);
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 30px;
}

.eyebrow,
.block-number {
  margin: 0;
  color: var(--accent-deep);
  font-size: 0.67rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  line-height: 1.2;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-family: var(--display);
  font-size: clamp(3.6rem, 7vw, 7.2rem);
  font-weight: 400;
  letter-spacing: -0.07em;
  line-height: 0.88;
}

h1 em {
  color: var(--accent);
  font-style: italic;
}

.session-index {
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
}

.mode-switch {
  display: flex;
  gap: 0;
  margin-top: 62px;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line);
}

.mode-button {
  min-height: 48px;
  padding: 0 18px;
  border: 0;
  border-right: 1px solid var(--line);
  color: var(--muted);
  background: transparent;
  font-size: 0.8rem;
}

.mode-button:first-child {
  padding-left: 0;
}

.mode-button:last-child {
  border-right: 0;
}

.mode-button:hover,
.mode-button.is-active {
  color: var(--ink);
}

.mode-button.is-active {
  box-shadow: inset 0 -3px 0 var(--accent);
}

.timer-readout {
  display: flex;
  align-items: baseline;
  margin-top: 46px;
  color: var(--ink);
  font-family: var(--display);
  font-size: clamp(7rem, 16vw, 13rem);
  letter-spacing: -0.1em;
  line-height: 0.78;
}

.time-colon {
  padding: 0 0.08em;
  color: var(--accent);
}

.session-status {
  min-height: 27px;
  margin: 30px 0 18px;
  color: var(--muted);
  font-size: 0.9rem;
}

.progress-track,
.cycle-line {
  height: 6px;
  overflow: hidden;
  background: var(--line);
}

.progress-track span,
.cycle-line span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width 180ms linear;
}

.timer-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 32px;
}

.button {
  min-height: 48px;
  padding: 0 21px;
  border: 1px solid var(--ink);
  border-radius: 2px;
  font-size: 0.82rem;
}

.button-primary {
  border-color: var(--accent-deep);
  color: var(--paper);
  background: var(--accent-deep);
}

.button-primary:hover {
  background: var(--accent);
}

.button-secondary {
  color: var(--ink);
  background: transparent;
}

.button-secondary:hover {
  background: var(--panel);
}

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

.button-quiet:hover {
  color: var(--ink);
}

.shortcuts,
.helper-text {
  color: var(--muted);
  font-size: 0.74rem;
}

.shortcuts {
  margin: 20px 0 0;
}

kbd {
  padding: 2px 5px;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  color: var(--ink);
  font-size: 0.68rem;
}

.workspace {
  padding-left: 9%;
}

.workspace-block {
  padding: 0 0 32px;
  margin: 0 0 32px;
  border-bottom: 1px solid var(--line);
}

.workspace-block:last-child {
  margin-bottom: 0;
}

.block-heading {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 22px;
}

.block-heading h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.6rem;
  font-weight: 400;
  letter-spacing: -0.04em;
}

textarea,
input {
  display: block;
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  color: var(--ink);
  background: var(--panel);
}

textarea {
  min-height: 116px;
  padding: 14px;
  resize: vertical;
  line-height: 1.45;
}

textarea::placeholder {
  color: var(--muted);
  opacity: 1;
}

.helper-text {
  margin: 10px 0 0;
}

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

.settings-grid label {
  color: var(--muted);
  font-size: 0.72rem;
}

.settings-grid input {
  margin-top: 7px;
  padding: 10px 8px;
  text-align: center;
}

.cycle-total {
  display: flex;
  align-items: baseline;
  gap: 10px;
  color: var(--muted);
}

.cycle-total span:first-child {
  color: var(--ink);
  font-family: var(--display);
  font-size: 3rem;
  line-height: 1;
}

.cycle-line {
  margin-top: 18px;
}

.cycle-line span {
  width: 0;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 0 30px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.72rem;
}

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

@media (max-width: 900px) {
  .app-shell {
    width: min(100% - 40px, 680px);
  }

  .app-grid {
    grid-template-columns: 1fr;
    padding-top: 58px;
  }

  .timer-panel {
    min-height: 0;
    padding: 0 0 70px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .workspace {
    padding: 68px 0 0;
  }
}

@media (max-width: 600px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
    padding: 20px 0;
  }

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

  .text-control {
    font-size: 0.7rem;
  }

  .app-grid {
    padding-top: 52px;
    padding-bottom: 66px;
  }

  h1 {
    font-size: clamp(3.3rem, 16vw, 5.2rem);
  }

  .mode-switch {
    overflow-x: auto;
  }

  .mode-button {
    flex: 1 0 auto;
    padding: 0 13px;
    white-space: nowrap;
  }

  .mode-button:first-child {
    padding-left: 13px;
  }

  .timer-readout {
    margin-top: 42px;
    font-size: clamp(5.4rem, 25vw, 8rem);
  }

  .timer-actions {
    gap: 8px;
  }

  .button {
    flex: 1 1 auto;
    padding: 0 14px;
  }

  .settings-grid {
    gap: 7px;
  }

  .footer {
    align-items: flex-start;
    flex-direction: column;
  }
}

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

  .progress-track span,
  .cycle-line span {
    transition: none;
  }
}
