:root {
  --bg: #f5f5f6;
  --panel: #ffffff;
  --panel-strong: #f0f0f2;
  --text: #1f1f22;
  --muted: #6c6d72;
  --line: #dedfe3;
  --accent: #c9001f;
  --accent-strong: #9f0018;
  --accent-soft: #fdecef;
  --blue: #2866a8;
  --amber: #b6690e;
  --green: #1c7a4c;
  --shadow: 0 18px 45px rgba(31, 31, 34, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.45;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

img {
  display: block;
  max-width: 100%;
}

.app-shell {
  min-height: 100vh;
  padding: 14px 18px 32px;
}

.topbar {
  align-items: center;
  display: flex;
  gap: 20px;
  justify-content: space-between;
  margin: 0 auto 12px;
  max-width: 1640px;
}

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

.brand img {
  height: 48px;
  object-fit: contain;
  width: 48px;
}

.brand h1,
.topbar h1,
.page-header h2,
.detail-header h2,
.hero h2,
.section-band h3,
.content-card h3,
.info-panel h3 {
  margin: 0;
}

.brand h1 {
  font-size: clamp(24px, 2.2vw, 34px);
  line-height: 1.05;
}

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

.main-nav {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.main-nav a {
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--muted);
  font-weight: 800;
  padding: 9px 11px;
}

.main-nav a:hover,
.main-nav a.active {
  background: white;
  border-color: var(--line);
  color: var(--text);
}

.main-nav a.active {
  border-color: var(--accent);
  color: var(--accent);
}

.workspace {
  margin: 0 auto;
  max-width: 1640px;
  outline: none;
}

.hero {
  align-items: stretch;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 0;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
  min-height: 430px;
  overflow: hidden;
}

.hero-copy {
  align-content: center;
  display: grid;
  gap: 16px;
  padding: clamp(24px, 5vw, 64px);
}

.hero-copy h2 {
  font-size: clamp(38px, 5vw, 76px);
  letter-spacing: 0;
  line-height: 0.98;
  max-width: 850px;
}

.hero-copy p:not(.eyebrow) {
  color: var(--muted);
  font-size: clamp(16px, 1.6vw, 22px);
  font-weight: 650;
  max-width: 680px;
}

.hero-media {
  background: var(--panel-strong);
  min-height: 320px;
  overflow: hidden;
  position: relative;
}

.hero-media img {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.button {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  display: inline-flex;
  font-weight: 800;
  justify-content: center;
  min-height: 38px;
  padding: 8px 12px;
}

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

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

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

.button.ghost:hover {
  border-color: var(--accent);
}

.button.small {
  min-height: 32px;
  padding: 5px 10px;
}

.action-row,
.topbar-actions,
.control-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.inline-actions {
  justify-content: stretch;
}

.inline-actions .button {
  flex: 1;
}

.quick-grid,
.card-grid,
.content-columns {
  display: grid;
  gap: 16px;
}

.quick-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 16px;
}

.feature-link,
.content-card,
.info-panel,
.state-panel,
.toolbar,
.media-panel,
.page-header,
.section-band {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.feature-link {
  display: grid;
  gap: 6px;
  min-height: 148px;
  padding: 18px;
}

.feature-link strong {
  font-size: 24px;
}

.feature-link span:last-child,
.content-card p,
.page-header p,
.detail-header p,
.info-panel p,
.state-panel p {
  color: var(--muted);
}

.section-band {
  margin-top: 16px;
  padding: 18px;
}

.section-heading {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.section-heading.wide {
  margin-bottom: 14px;
}

.section-heading h3 {
  font-size: 24px;
}

.text-link {
  color: var(--accent);
  font-weight: 850;
}

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

.content-card {
  display: grid;
  grid-template-rows: 170px 1fr;
  min-width: 0;
  overflow: hidden;
  transition: transform 150ms ease, border-color 150ms ease;
}

.content-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.content-card img {
  background: var(--panel-strong);
  height: 170px;
  object-fit: cover;
  width: 100%;
}

.content-card > div {
  display: grid;
  gap: 8px;
  padding: 14px;
}

.content-card h3 {
  font-size: 22px;
  line-height: 1.1;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  background: var(--accent-soft);
  border: 1px solid rgba(201, 0, 31, 0.18);
  border-radius: 999px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
  padding: 4px 8px;
}

.page-header,
.detail-header,
.state-panel {
  padding: clamp(18px, 3vw, 34px);
}

.page-header h2,
.detail-header h2,
.state-panel h2 {
  font-size: clamp(32px, 4vw, 58px);
  line-height: 1;
}

.page-header p,
.detail-header p {
  font-size: 17px;
  font-weight: 650;
  max-width: 820px;
}

.toolbar {
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(240px, 1fr) minmax(180px, 260px) minmax(160px, 220px);
  margin: 16px 0;
  padding: 14px;
}

label span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 5px;
}

input,
select {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  min-height: 38px;
  outline: none;
  padding: 8px 10px;
  width: 100%;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(201, 0, 31, 0.12);
}

.detail-layout {
  display: grid;
  gap: 16px;
}

.media-panel {
  overflow: hidden;
}

.media-panel img {
  aspect-ratio: 16 / 6;
  object-fit: cover;
  width: 100%;
}

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

.info-panel {
  min-width: 0;
  padding: 18px;
}

.info-panel ol,
.info-panel ul {
  display: grid;
  gap: 8px;
  margin: 10px 0 0;
  padding-left: 20px;
}

.info-panel li {
  color: var(--text);
  font-weight: 650;
}

.embedded-timer {
  padding: 0;
}

.embedded-timer > .section-heading {
  padding: 18px 18px 0;
}

.timer-layout {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(520px, 1fr) minmax(340px, 390px);
}

.main-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  min-width: 0;
  overflow: hidden;
}

.timer-panel {
  display: grid;
  grid-template-rows: minmax(260px, 1fr) auto auto;
  min-height: 560px;
  transition: background 180ms ease, border-color 180ms ease;
}

.timer-panel.is-running {
  background: #d6ecdd;
  border-color: #a9d4b8;
}

.timer-panel.is-paused {
  background: #ffe7aa;
  border-color: #e1bd63;
}

.timer-focus {
  align-items: center;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 10px;
  justify-content: center;
  min-height: 260px;
  padding: clamp(18px, 3vw, 34px) 18px;
  text-align: center;
  transition: background 180ms ease;
}

.timer-panel.is-running .timer-focus {
  background: #eaf7ee;
}

.timer-panel.is-paused .timer-focus {
  background: #fff7df;
}

.phase-pill {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  padding: 7px 12px;
}

.phase-pill.running {
  background: var(--green);
  border-color: var(--green);
  color: white;
}

.phase-pill.pause {
  background: var(--amber);
  border-color: var(--amber);
  color: white;
}

.timer-ring {
  aspect-ratio: 1;
  display: grid;
  max-width: min(46vh, 390px);
  min-width: 220px;
  place-items: center;
  position: relative;
  width: min(34vw, 390px);
}

.timer-ring-svg,
.timer-ring-content {
  grid-area: 1 / 1;
}

.timer-ring-svg {
  height: 100%;
  transform: rotate(-90deg);
  width: 100%;
}

.timer-ring-track,
.timer-ring-progress {
  fill: none;
  stroke-linecap: round;
  stroke-width: 8;
}

.timer-ring-track {
  stroke: rgba(31, 31, 34, 0.12);
}

.timer-ring-progress {
  stroke: var(--accent);
  stroke-dasharray: 339.292;
  stroke-dashoffset: 339.292;
  transition: stroke-dashoffset 120ms linear;
}

.timer-panel.is-running .timer-ring-progress {
  stroke: var(--green);
}

.timer-panel.is-paused .timer-ring-progress {
  stroke: var(--amber);
}

.timer-ring-content {
  align-items: center;
  display: flex;
  flex-direction: column;
  gap: 8px;
  justify-content: center;
  padding: 24px;
  text-align: center;
}

.timer-value {
  color: var(--text);
  font-size: clamp(42px, 6vw, 82px);
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1;
  overflow-wrap: anywhere;
}

.timer-work-label {
  color: var(--muted);
  font-size: clamp(16px, 1.8vw, 24px);
  font-weight: 900;
  text-transform: uppercase;
}

.timer-context {
  color: var(--muted);
  font-size: clamp(16px, 1.7vw, 22px);
  font-weight: 800;
}

.total-time {
  color: var(--muted);
  font-size: 15px;
  font-weight: 800;
}

.summary-strip {
  background: rgba(31, 31, 34, 0.08);
  border-top: 1px solid rgba(31, 31, 34, 0.08);
  display: grid;
  gap: 1px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

.metric {
  background: rgba(255, 255, 255, 0.72);
  min-width: 0;
  padding: 12px 18px;
}

.metric strong {
  display: block;
  font-size: clamp(28px, 3vw, 44px);
  line-height: 1;
  overflow-wrap: anywhere;
}

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

.control-row {
  justify-content: flex-start;
  padding: 14px 18px;
}

.timer-panel .control-row .button {
  min-height: 48px;
  min-width: 150px;
}

.settings-panel {
  padding: 14px;
}

form {
  display: grid;
  gap: 10px;
}

.form-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr;
}

.interval-list {
  display: grid;
  gap: 6px;
  max-height: 250px;
  overflow: auto;
  padding-right: 3px;
}

.interval-row {
  align-items: center;
  display: grid;
  gap: 6px;
  grid-template-columns: 28px 1fr 36px;
}

.interval-index {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: right;
}

.remove-interval {
  min-height: 36px;
  padding: 0;
  width: 36px;
}

.toast {
  background: #1f1f22;
  border-radius: 8px;
  bottom: 18px;
  color: white;
  font-weight: 800;
  left: 50%;
  opacity: 0;
  padding: 10px 14px;
  pointer-events: none;
  position: fixed;
  transform: translate(-50%, 20px);
  transition: opacity 160ms ease, transform 160ms ease;
  z-index: 20;
}

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

.visually-hidden {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

.error {
  border-color: var(--accent);
}

@media (max-width: 1100px) {
  .hero,
  .timer-layout,
  .content-columns {
    grid-template-columns: 1fr;
  }

  .settings-panel {
    order: -1;
  }

  .timer-panel {
    min-height: 460px;
  }
}

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

  .main-nav {
    justify-content: flex-start;
    width: 100%;
  }

  .quick-grid,
  .card-grid,
  .toolbar {
    grid-template-columns: 1fr;
  }

  .media-panel img {
    aspect-ratio: 16 / 9;
  }
}

@media (max-width: 640px) {
  .app-shell {
    padding: 12px;
  }

  .brand {
    min-width: 0;
  }

  .main-nav a {
    flex: 1;
    text-align: center;
  }

  .button {
    flex: 1;
  }

  .hero-copy {
    padding: 22px;
  }

  .hero-copy h2,
  .page-header h2,
  .detail-header h2 {
    font-size: 34px;
  }

  .timer-ring {
    min-width: 240px;
    width: min(78vw, 360px);
  }

  .summary-strip,
  .form-grid {
    grid-template-columns: 1fr 1fr;
  }

  .metric {
    padding: 10px;
  }
}
