@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700;800&family=Sora:wght@600;700;800&display=swap");

:root {
  color-scheme: light;
  --signal-green: #3f6f5b;
  --cloud-rice: #f6f4ee;
  --fresh-basil: #88a06b;
  --persimmon: #d86f45;
  --graphite: #252a27;
  --ink: var(--graphite);
  --muted: #5f6962;
  --line: #d7d8cf;
  --surface: var(--cloud-rice);
  --panel: #fffdf8;
  --mobile-bg: #dfe9d6;
  --accent: var(--signal-green);
  --accent-dark: #315949;
  --warm: var(--persimmon);
  --soft: #edf2e8;
  --shadow: 0 18px 60px rgba(37, 42, 39, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--cloud-rice);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 24px;
  align-items: center;
  padding: 32px 0;
}

.focus-page[hidden] {
  display: none;
}

.is-focus-mode .app-shell {
  display: none;
}

.focus-page {
  width: min(920px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  place-items: center;
  padding: 32px 0;
}

.focus-card {
  width: 100%;
  min-height: min(760px, calc(100vh - 64px));
  display: grid;
  align-content: center;
  justify-items: start;
  padding: clamp(24px, 7vw, 72px);
  border: 1px solid rgba(215, 216, 207, 0.95);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.96);
  box-shadow: var(--shadow);
}

.timer-panel,
.routine-panel {
  background: rgba(255, 253, 248, 0.92);
  border: 1px solid rgba(215, 216, 207, 0.95);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.timer-panel {
  padding: clamp(24px, 5vw, 56px);
}

.routine-panel {
  max-height: calc(100vh - 64px);
  overflow: auto;
  padding: 20px;
}

.app-header,
.routine-header,
.controls,
.utility-row,
.action-select {
  display: flex;
  align-items: center;
}

.app-header,
.routine-header,
.utility-row {
  justify-content: space-between;
  gap: 16px;
}

.eyebrow,
.step-counter {
  margin: 0;
  color: var(--warm);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1,
h2,
h3,
.time-display {
  font-family: Sora, Inter, ui-sans-serif, system-ui, sans-serif;
}

h1 {
  margin: 4px 0 0;
  font-size: clamp(2.2rem, 5vw, 4.8rem);
  line-height: 0.98;
}

.focus-card h1 {
  margin: 14px 0 14px;
  font-size: clamp(3rem, 10vw, 7.2rem);
  line-height: 0.92;
}

.routine-header h2,
.current-list-panel h3,
.load-list-panel h3 {
  margin: 0;
  font-size: 1rem;
}

.icon-button,
.remove-action {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--panel);
}

.progress-wrap {
  height: 12px;
  margin: 34px 0 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e4e5dc;
}

.progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--signal-green);
  transition: width 220ms ease;
}

.current-action {
  min-height: 330px;
  display: grid;
  align-content: center;
  justify-items: start;
}

.session-summary {
  margin: 0 0 30px;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 800;
}

.current-action h2 {
  margin: 12px 0 10px;
  font-size: clamp(2.4rem, 7vw, 6rem);
  line-height: 0.94;
}

.current-action p:not(.step-counter) {
  max-width: 700px;
  margin: 0;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.28rem);
  line-height: 1.55;
}

.time-display {
  margin-top: 34px;
  font-size: clamp(4rem, 12vw, 9rem);
  font-weight: 850;
  line-height: 0.9;
  font-variant-numeric: tabular-nums;
}

.focus-prompt {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  font-size: clamp(1.1rem, 2.4vw, 1.45rem);
  line-height: 1.5;
}

.focus-time-display {
  margin-top: 36px;
  font-family: Sora, Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: clamp(5rem, 18vw, 12rem);
  font-weight: 850;
  line-height: 0.9;
  font-variant-numeric: tabular-nums;
}

.focus-progress-wrap {
  width: 100%;
  height: 14px;
  margin: 34px 0;
  overflow: hidden;
  border-radius: 999px;
  background: #e4e5dc;
}

.controls {
  gap: 12px;
}

.focus-controls {
  width: 100%;
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  gap: 12px;
}

.primary-button,
.secondary-button,
.text-button,
.stop-button {
  min-height: 46px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 800;
}

.primary-button {
  flex: 1;
  color: #ffffff;
  background: var(--accent);
  border-color: var(--accent);
}

.primary-button:hover,
.primary-button:focus-visible {
  background: var(--accent-dark);
}

.secondary-button {
  min-width: 116px;
  color: var(--accent-dark);
  background: var(--soft);
  border-color: #cbd9c0;
}

.text-button {
  min-height: auto;
  padding: 0;
  color: var(--accent-dark);
  background: transparent;
}

.stop-button {
  color: #ffffff;
  background: var(--persimmon);
  border-color: var(--persimmon);
}

.done-button {
  min-height: 58px;
}

.utility-row {
  margin-top: 18px;
}

.sound-toggle {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-weight: 700;
}

.action-list {
  display: grid;
  gap: 10px;
  margin: 20px 0;
  padding: 0;
  list-style: none;
}

.load-list-panel {
  display: grid;
  gap: 14px;
  margin: 18px 0;
  padding: 14px;
  border: 1px solid #d8dfcc;
  border-radius: 8px;
  background: #fffaf0;
}

.load-list-panel h3,
.session-length-panel h4 {
  color: var(--signal-green);
}

.session-length-panel {
  display: grid;
  gap: 12px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.setup-section {
  display: grid;
  gap: 10px;
  padding-top: 14px;
  border: 1px solid #d8dfcc;
  border-width: 1px 0 0;
  border-radius: 0;
}

.current-list-panel {
  margin-top: 18px;
}

.current-list-panel h3 {
  color: var(--signal-green);
}

.setup-details,
.weekly-addons,
.add-action-details {
  border: 1px solid #d8dfcc;
  border-radius: 8px;
  background: var(--panel);
}

.setup-details {
  padding: 0;
}

.session-length-panel h4 {
  margin: 0;
  font-size: 0.95rem;
}

.selection-summary {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 850;
}

.quick-minutes {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.minute-chip {
  min-height: 40px;
  border: 1px solid #cbd9c0;
  border-radius: 8px;
  color: var(--accent-dark);
  background: var(--panel);
  font-weight: 800;
}

.minute-chip.is-selected {
  color: #ffffff;
  background: var(--signal-green);
  border-color: var(--signal-green);
}

.setup-steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 16px;
}

.setup-step-tab {
  min-height: 46px;
  border: 1px solid #cbd9c0;
  border-radius: 8px;
  color: var(--accent-dark);
  background: var(--soft);
  font-weight: 850;
}

.setup-step-tab.is-active {
  color: #ffffff;
  background: var(--signal-green);
  border-color: var(--signal-green);
}

.setup-step-panel {
  display: none;
}

.setup-step-panel.is-active {
  display: grid;
  gap: 14px;
}

.setup-step-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.mobile-start-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 58px;
}

.routine-button-list {
  display: grid;
  gap: 10px;
  max-height: min(46vh, 520px);
  overflow: auto;
  padding-right: 2px;
}

.setup-step-kicker {
  display: none;
}

.routine-card {
  min-height: 58px;
  width: 100%;
  display: grid;
  align-content: center;
  gap: 4px;
  border: 1px solid #cbd9c0;
  border-radius: 8px;
  padding: 12px;
  color: var(--ink);
  background: var(--panel);
  text-align: left;
  white-space: normal;
}

.routine-card.is-selected {
  color: #ffffff;
  background: var(--signal-green);
  border-color: var(--signal-green);
}

.routine-card span {
  display: block;
}

.routine-card-name {
  font-weight: 850;
  line-height: 1.18;
}

.routine-card-group {
  margin-top: 4px;
  color: inherit;
  font-size: 0.82rem;
  opacity: 0.78;
}

.load-list-panel label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.setup-details label {
  margin-top: 12px;
}

.setup-details summary,
.weekly-addons summary,
.add-action-details summary {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  color: var(--signal-green);
  font-weight: 850;
  list-style: none;
  cursor: pointer;
}

.setup-details summary::-webkit-details-marker,
.weekly-addons summary::-webkit-details-marker,
.add-action-details summary::-webkit-details-marker {
  display: none;
}

.setup-details summary::after,
.weekly-addons summary::after,
.add-action-details summary::after {
  content: "+";
  color: var(--persimmon);
  font-size: 1.25rem;
  line-height: 1;
}

.setup-details[open] summary::after,
.weekly-addons[open] summary::after,
.add-action-details[open] summary::after {
  content: "-";
}

.setup-details > label,
.setup-details > .load-button {
  margin: 0 14px 14px;
}

.load-list-panel select,
.load-list-panel input,
.load-list-panel textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
  background: var(--panel);
}

.load-button {
  width: 100%;
}

.list-status {
  min-height: 1.2em;
  margin: 0;
  color: var(--persimmon);
  font-size: 0.88rem;
  font-weight: 700;
}

.weekly-addons {
  margin: 20px 0;
  background: #f1f4eb;
}

.addon-list {
  display: grid;
  gap: 8px;
  margin: 0 14px 14px;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.35;
}

.action-item {
  display: grid;
  grid-template-columns: 1fr 42px;
  gap: 8px;
}

.action-select {
  min-height: 56px;
  width: 100%;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--panel);
  text-align: left;
}

.action-item.is-active .action-select {
  border-color: var(--accent);
  background: var(--soft);
}

.action-name {
  font-weight: 800;
}

.action-duration {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

.add-action-form {
  display: grid;
  gap: 12px;
  padding: 0 14px 14px;
}

.add-action-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.add-action-form input,
.add-action-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
  background: var(--panel);
}

.add-button {
  width: 100%;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(63, 111, 91, 0.28);
  outline-offset: 2px;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .routine-panel {
    max-height: none;
  }
}

@media (max-width: 560px) {
  body {
    background: var(--mobile-bg);
  }

  .app-shell {
    width: min(100% - 24px, 1180px);
    min-height: 100vh;
    padding: 12px 0;
    gap: 12px;
  }

  .timer-panel,
  .routine-panel {
    padding: 18px;
    background: var(--panel);
  }

  body:not(.is-focus-mode) .timer-panel {
    display: none;
  }

  .routine-panel {
    min-height: calc(100vh - 24px);
    display: flex;
    flex-direction: column;
    gap: 14px;
    border: 0;
    box-shadow: none;
  }

  .routine-header {
    align-items: center;
  }

  .routine-header h2 {
    font-family: Sora, Inter, ui-sans-serif, system-ui, sans-serif;
    font-size: 1.7rem;
    line-height: 1;
    white-space: nowrap;
  }

  .setup-steps {
    margin-top: 0;
  }

  .setup-step-tab {
    min-height: 48px;
  }

  .load-list-panel {
    flex: 1;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
  }

  .load-list-panel h3 {
    display: none;
  }

  .setup-step-kicker {
    display: block;
    margin: 0;
    color: var(--muted);
    font-weight: 850;
  }

  .routine-button-list {
    max-height: min(56vh, 520px);
  }

  .routine-card {
    min-height: 72px;
  }

  .routine-card .routine-card-group {
    display: none;
  }

  .desktop-list-picker {
    display: none;
  }

  .session-length-panel h4 {
    font-family: Sora, Inter, ui-sans-serif, system-ui, sans-serif;
    font-size: 1.45rem;
  }

  .quick-minutes {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .minute-chip {
    min-height: 58px;
    font-size: 1.1rem;
  }

  .load-list-panel select,
  .load-list-panel input,
  .load-list-panel textarea,
  .add-action-form input,
  .add-action-form textarea {
    min-height: 50px;
    font-size: 1rem;
  }

  .primary-button,
  .secondary-button,
  .text-button,
  .stop-button {
    min-height: 52px;
    font-size: 1rem;
  }

  .text-button {
    display: inline-flex;
    align-items: center;
    padding: 0 4px;
  }

  .setup-details summary,
  .weekly-addons summary,
  .add-action-details summary {
    min-height: 52px;
  }

  .current-list-panel {
    flex: 1;
    margin-top: 0;
  }

  .current-list-panel h3 {
    font-family: Sora, Inter, ui-sans-serif, system-ui, sans-serif;
    font-size: 1.8rem;
  }

  .mobile-start-button {
    min-height: 60px;
  }

  .action-list {
    margin: 0;
  }

  .action-item {
    grid-template-columns: 1fr 52px;
  }

  .action-select {
    min-height: 60px;
  }

  .remove-action {
    width: 52px;
    height: 52px;
  }

  .setup-step-controls {
    margin-top: auto;
  }

  .current-action {
    min-height: 280px;
  }

  .controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .controls .primary-button {
    grid-column: 1 / -1;
    order: -1;
  }

  .secondary-button {
    min-width: 0;
  }

  .focus-page {
    width: min(100% - 24px, 920px);
    padding: 12px 0;
  }

  .focus-card {
    min-height: calc(100vh - 24px);
    padding: 22px;
    border: 0;
    box-shadow: none;
  }

  .focus-controls {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .done-button {
    grid-column: 1 / -1;
    min-height: 64px;
  }

  .focus-controls .stop-button {
    grid-column: 1 / -1;
  }
}
