:root {
  color-scheme: light;
  --bg: #f3eee3;
  --bg-deep: #e6dcc9;
  --surface: rgba(255, 251, 244, 0.76);
  --surface-strong: rgba(255, 248, 239, 0.92);
  --surface-soft: rgba(255, 250, 243, 0.6);
  --surface-muted: rgba(39, 52, 43, 0.05);
  --surface-card-start: rgba(255, 251, 244, 0.86);
  --surface-card-end: rgba(247, 239, 228, 0.92);
  --surface-field: rgba(255, 255, 255, 0.84);
  --surface-tab-group: rgba(39, 52, 43, 0.06);
  --surface-tab-active: rgba(255, 255, 255, 0.92);
  --surface-badge: rgba(255, 255, 255, 0.74);
  --surface-panel: rgba(255, 255, 255, 0.62);
  --surface-button: rgba(255, 255, 255, 0.76);
  --surface-button-secondary: rgba(255, 255, 255, 0.84);
  --surface-command: #212a24;
  --line: rgba(39, 52, 43, 0.12);
  --line-strong: rgba(39, 52, 43, 0.18);
  --text: #1f2924;
  --text-strong: #1d261f;
  --muted: #667368;
  --muted-strong: #4d5a50;
  --accent: #2f5b4d;
  --accent-strong: #1f3f34;
  --accent-contrast: #f6f0e3;
  --command-text: #f6f0e3;
  --body-sheen-start: rgba(255, 255, 255, 0.38);
  --body-sheen-end: rgba(255, 255, 255, 0);
  --orb-warm: rgba(213, 194, 143, 0.36);
  --orb-warm-fade: rgba(213, 194, 143, 0.06);
  --orb-cool: rgba(113, 142, 122, 0.18);
  --orb-cool-fade: rgba(113, 142, 122, 0.04);
  --stage-orb: rgba(213, 194, 143, 0.22);
  --stage-orb-fade: rgba(213, 194, 143, 0.06);
  --brand-start: #345d4f;
  --brand-end: #507664;
  --brand-shadow: rgba(47, 91, 77, 0.26);
  --focus-ring: rgba(47, 91, 77, 0.12);
  --progress-track: rgba(39, 52, 43, 0.08);
  --progress-border: rgba(39, 52, 43, 0.06);
  --shadow: 0 28px 72px rgba(83, 69, 43, 0.14);
  --shadow-soft: 0 12px 28px rgba(83, 69, 43, 0.08);
  font-family: "Avenir Next", "Helvetica Neue", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background:
    linear-gradient(180deg, var(--body-sheen-start), var(--body-sheen-end)),
    linear-gradient(180deg, var(--bg), var(--bg-deep));
}

body::before,
body::after {
  content: "";
  position: fixed;
  pointer-events: none;
  z-index: -1;
  border-radius: 999px;
}

body::before {
  top: -11rem;
  right: -10rem;
  width: 34rem;
  height: 34rem;
  background: radial-gradient(circle, var(--orb-warm), var(--orb-warm-fade) 62%, transparent 72%);
}

body::after {
  bottom: -16rem;
  left: -12rem;
  width: 40rem;
  height: 40rem;
  background: radial-gradient(circle, var(--orb-cool), var(--orb-cool-fade) 58%, transparent 72%);
}

button,
input,
code {
  font: inherit;
}

a {
  color: inherit;
}

.app-shell {
  width: min(1100px, calc(100vw - 40px));
  margin: 0 auto;
  padding: 28px 0 64px;
  display: grid;
  gap: 24px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
  gap: 18px 24px;
  align-items: end;
}

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

.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--brand-start), var(--brand-end));
  color: var(--accent-contrast);
  font-size: 1.35rem;
  font-weight: 800;
  box-shadow: 0 18px 32px var(--brand-shadow);
}

.brand-name {
  font-size: clamp(1.32rem, 2.5vw, 1.6rem);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.brand-copy {
  margin-top: 4px;
  max-width: 42ch;
  color: var(--muted);
  font-size: 0.97rem;
  line-height: 1.5;
}

.session-row,
.session-meta,
.controls,
.settings-grid {
  display: grid;
  gap: 12px;
}

.session-row {
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  padding: 14px;
  border-radius: 24px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
}

.field {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.field span {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted-strong);
}

.field input {
  width: 100%;
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-field);
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.field input:focus-visible {
  outline: 0;
  border-color: rgba(47, 91, 77, 0.34);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.72),
    0 0 0 4px var(--focus-ring);
}

.timer-stage {
  display: grid;
  place-items: center;
  position: relative;
}

.timer-stage::before {
  content: "";
  position: absolute;
  width: min(90vw, 780px);
  aspect-ratio: 1;
  border-radius: 999px;
  background: radial-gradient(circle, var(--stage-orb), var(--stage-orb-fade) 38%, transparent 68%);
  z-index: -1;
}

.card {
  min-width: 0;
  border-radius: 32px;
  padding: 24px;
  border: 1px solid rgba(39, 52, 43, 0.1);
  background: linear-gradient(180deg, var(--surface-card-start), var(--surface-card-end));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.timer-card {
  width: min(100%, 620px);
  display: grid;
  gap: 20px;
  padding: 28px;
  position: relative;
  overflow: hidden;
  --phase-accent: #5f695e;
  --phase-progress-start: #5f695e;
  --phase-progress-end: #c9c3af;
  --phase-soft: #e6e1d5;
  --phase-glow: rgba(131, 132, 98, 0.18);
}

.timer-card::after {
  content: "";
  position: absolute;
  right: -110px;
  bottom: -110px;
  width: 260px;
  height: 260px;
  border-radius: 999px;
  background: radial-gradient(circle, var(--phase-glow), transparent 72%);
  pointer-events: none;
}

.timer-card[data-phase="work"] {
  --phase-accent: #2f5b4d;
  --phase-progress-start: #2f5b4d;
  --phase-progress-end: #d5c08a;
  --phase-soft: #dde9de;
  --phase-glow: rgba(47, 91, 77, 0.16);
}

.timer-card[data-phase="break"] {
  --phase-accent: #5d7b87;
  --phase-progress-start: #5d7b87;
  --phase-progress-end: #a5bdc5;
  --phase-soft: #dfe9ec;
  --phase-glow: rgba(93, 123, 135, 0.16);
}

.timer-overline,
.eyebrow,
.session-url-label,
.command-label,
.session-progress span {
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.timer-overline {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted-strong);
}

.timer-overline::before {
  content: "";
  width: 36px;
  height: 1px;
  background: rgba(39, 52, 43, 0.18);
}

.phase-tabs {
  justify-self: center;
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 6px;
  border-radius: 20px;
  background: var(--surface-tab-group);
  border: 1px solid rgba(39, 52, 43, 0.08);
}

.phase-tab {
  min-width: 132px;
  padding: 12px 16px;
  border-radius: 14px;
  text-align: center;
  color: var(--muted-strong);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.phase-tab[data-active="true"],
.phase-tab-active {
  background: var(--surface-tab-active);
  color: var(--text);
  box-shadow: 0 12px 22px rgba(68, 59, 42, 0.08);
}

.timer-face {
  display: grid;
  justify-items: center;
  gap: 12px;
  text-align: center;
  padding-block: 8px;
}

.phase-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid rgba(39, 52, 43, 0.08);
  background: var(--surface-badge);
  color: var(--phase-accent);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.phase-badge::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--phase-accent);
}

.countdown {
  margin: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  font-size: clamp(4.8rem, 18vw, 8rem);
  font-weight: 800;
  line-height: 0.9;
  letter-spacing: -0.08em;
  color: var(--text-strong);
}

.phase-message {
  margin: 0;
  max-width: 26ch;
  color: var(--muted);
  font-size: 1.06rem;
  line-height: 1.5;
}

.timer-progress {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--progress-track);
  border: 1px solid var(--progress-border);
}

.timer-progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--phase-progress-start), var(--phase-progress-end));
  transition: width 0.25s linear;
}

.primary-action-row {
  display: grid;
  justify-items: center;
}

.controls {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.controls[data-visible-count="1"] {
  grid-template-columns: minmax(0, 1fr);
}

.session-meta {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.session-progress {
  padding: 16px;
  border-radius: 22px;
  border: 1px solid rgba(39, 52, 43, 0.08);
  background: var(--surface-panel);
  display: grid;
  gap: 8px;
}

.session-progress span {
  color: var(--muted);
}

.session-progress strong {
  font-size: 1.45rem;
  letter-spacing: -0.04em;
}

.button {
  min-width: 0;
  border: 1px solid transparent;
  border-radius: 18px;
  padding: 14px 16px;
  background: var(--surface-button);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
  transition:
    transform 0.14s ease,
    box-shadow 0.14s ease,
    background 0.14s ease,
    border-color 0.14s ease;
}

.button:hover {
  transform: translateY(-1px);
}

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

.button:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 4px rgba(47, 91, 77, 0.14);
}

.button-primary {
  min-width: min(100%, 240px);
  padding: 16px 28px;
  border-color: rgba(24, 41, 33, 0.16);
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
  color: var(--accent-contrast);
  box-shadow: 0 18px 32px rgba(47, 91, 77, 0.22);
  font-size: 1.06rem;
  letter-spacing: 0.02em;
}

.button-secondary {
  border-color: var(--line);
  background: var(--surface-button-secondary);
  color: var(--text);
}

.button-ghost {
  border-color: rgba(39, 52, 43, 0.18);
  background: transparent;
  color: var(--muted-strong);
}

.topbar-button {
  min-height: 52px;
  padding-inline: 20px;
}

.support-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(0, 0.96fr);
  gap: 20px;
  align-items: start;
}

.eyebrow {
  color: var(--muted-strong);
  margin-bottom: 16px;
}

.settings-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 18px;
}

.settings-card,
.notes-card {
  width: auto;
  justify-self: stretch;
}

.session-url {
  min-width: 0;
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: 22px;
  border: 1px solid rgba(39, 52, 43, 0.08);
  background: var(--surface-panel);
}

.session-url-label {
  color: var(--muted);
}

.session-url a {
  color: var(--accent);
  font-size: 0.96rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.notes {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.65;
}

.command-block {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.command-block + .command-block {
  margin-top: 14px;
}

.command-label {
  color: var(--muted);
}

.command {
  margin: 0;
  display: block;
  width: 100%;
  padding: 16px;
  border-radius: 20px;
  background: var(--surface-command);
  color: var(--command-text);
  font-family: "SFMono-Regular", "SF Mono", Consolas, "Liberation Mono", monospace;
  font-size: 0.9rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: pre-wrap;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #101411;
    --bg-deep: #0a0e0c;
    --surface: rgba(23, 28, 23, 0.82);
    --surface-strong: rgba(28, 34, 29, 0.94);
    --surface-soft: rgba(27, 33, 28, 0.72);
    --surface-muted: rgba(236, 240, 232, 0.06);
    --surface-card-start: rgba(24, 30, 25, 0.92);
    --surface-card-end: rgba(18, 22, 19, 0.96);
    --surface-field: rgba(30, 37, 32, 0.9);
    --surface-tab-group: rgba(236, 240, 232, 0.06);
    --surface-tab-active: rgba(39, 47, 41, 0.96);
    --surface-badge: rgba(29, 35, 31, 0.94);
    --surface-panel: rgba(29, 35, 31, 0.78);
    --surface-button: rgba(31, 39, 33, 0.92);
    --surface-button-secondary: rgba(35, 43, 37, 0.96);
    --surface-command: #0d1110;
    --line: rgba(236, 240, 232, 0.12);
    --line-strong: rgba(236, 240, 232, 0.18);
    --text: #e9ece5;
    --text-strong: #f2f4ee;
    --muted: #9ba49c;
    --muted-strong: #b6beb5;
    --accent: #85af9c;
    --accent-strong: #608a77;
    --accent-contrast: #0f1713;
    --command-text: #e8ede4;
    --body-sheen-start: rgba(255, 255, 255, 0.04);
    --body-sheen-end: rgba(255, 255, 255, 0);
    --orb-warm: rgba(182, 149, 80, 0.18);
    --orb-warm-fade: rgba(182, 149, 80, 0.04);
    --orb-cool: rgba(85, 121, 131, 0.16);
    --orb-cool-fade: rgba(85, 121, 131, 0.03);
    --stage-orb: rgba(182, 149, 80, 0.12);
    --stage-orb-fade: rgba(182, 149, 80, 0.02);
    --brand-start: #5a7f6c;
    --brand-end: #355342;
    --brand-shadow: rgba(0, 0, 0, 0.32);
    --focus-ring: rgba(133, 175, 156, 0.24);
    --progress-track: rgba(236, 240, 232, 0.08);
    --progress-border: rgba(236, 240, 232, 0.06);
    --shadow: 0 28px 72px rgba(0, 0, 0, 0.42);
    --shadow-soft: 0 12px 28px rgba(0, 0, 0, 0.26);
  }
}

@media (max-width: 960px) {
  .app-shell {
    width: min(100vw - 28px, 880px);
  }

  .topbar,
  .support-grid {
    grid-template-columns: 1fr;
  }

  .session-row {
    max-width: 420px;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100vw - 20px, 720px);
    padding: 18px 0 42px;
    gap: 16px;
  }

  .card {
    padding: 20px;
    border-radius: 28px;
  }

  .topbar {
    gap: 14px;
  }

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

  .session-row {
    max-width: none;
  }

  .topbar-button {
    width: 100%;
  }

  .timer-card {
    padding: 22px;
  }

  .phase-tab {
    min-width: 0;
  }

  .countdown {
    font-size: clamp(4rem, 22vw, 6.5rem);
  }

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

  .session-progress {
    text-align: center;
  }
}

@media (max-width: 420px) {
  .brand-block {
    align-items: flex-start;
  }

  .brand-mark {
    width: 46px;
    height: 46px;
    border-radius: 16px;
    font-size: 1.15rem;
  }

  .brand-copy {
    font-size: 0.9rem;
  }

  .phase-tabs {
    width: 100%;
  }

  .countdown {
    font-size: clamp(3.5rem, 24vw, 5.2rem);
  }

  .button {
    width: 100%;
  }

  .button-primary {
    min-width: 0;
  }
}

@media (max-width: 320px) {
  body::before {
    width: 24rem;
    height: 24rem;
    top: -8rem;
    right: -10rem;
  }

  body::after {
    width: 26rem;
    height: 26rem;
    bottom: -10rem;
    left: -11rem;
  }

  .app-shell {
    width: min(100vw - 12px, 320px);
    padding-top: 10px;
    gap: 12px;
  }

  .card {
    padding: 16px;
    border-radius: 24px;
  }

  .brand-copy,
  .support-grid {
    display: none;
  }

  .timer-overline::before {
    width: 24px;
  }

  .phase-tabs {
    padding: 4px;
    gap: 4px;
  }

  .phase-tab {
    padding: 10px 8px;
    font-size: 0.82rem;
  }

  .countdown {
    font-size: clamp(3rem, 26vw, 4.4rem);
  }

  .phase-message {
    font-size: 0.94rem;
  }

  .button {
    border-radius: 16px;
    padding: 12px 14px;
    font-size: 0.92rem;
  }

  .session-meta {
    grid-template-columns: 1fr;
  }
}
