:root {
  --bg: #040404;
  --bg-soft: #0b0b0b;
  --panel: rgba(255, 255, 255, 0.025);
  --panel-strong: rgba(255, 255, 255, 0.04);
  --border: rgba(255, 255, 255, 0.09);
  --text: #f4f4f1;
  --muted: rgba(244, 244, 241, 0.62);
  --subtle: rgba(244, 244, 241, 0.38);
  --accent: #d8b08f;
  --coffee-dark: #4f3424;
  --coffee-mid: #7f5439;
  --coffee-light: #d9b38e;
  --success: #8fd2aa;
  --danger: #e09e92;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 16px;
  --font-display: "SF Pro Display", "Aptos Display", "Segoe UI Variable Display",
    "Segoe UI", sans-serif;
  --font-body: "SF Pro Text", "Aptos", "Segoe UI Variable Text", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--font-body);
  background:
    radial-gradient(circle at 78% 22%, rgba(255, 255, 255, 0.05), transparent 24%),
    radial-gradient(circle at 15% 10%, rgba(216, 176, 143, 0.08), transparent 18%),
    linear-gradient(180deg, #080808 0%, #040404 100%);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.012) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.012) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.45), transparent 82%);
  pointer-events: none;
}

button,
input {
  font: inherit;
}

a {
  color: inherit;
}

.page-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 22px auto 38px;
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.eyebrow,
.status-label,
.field span,
.stat-card span {
  margin: 0;
}

.eyebrow {
  font-size: 0.74rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--subtle);
}

.focus-exit,
.btn,
.mode-pill,
.toggle-chip {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 16px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  border-radius: 0;
  cursor: pointer;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.76rem;
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    opacity 160ms ease,
    transform 160ms ease;
}

.inline-button {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--subtle);
  border-radius: 0;
  cursor: pointer;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.72rem;
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    opacity 160ms ease;
}

.focus-exit:hover,
.btn:hover,
.mode-pill:hover,
.toggle-chip:hover,
.inline-button:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}

.btn:disabled,
.mode-pill:disabled,
.toggle-chip:disabled,
.field input:disabled,
.inline-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.field input:disabled {
  background: rgba(0, 0, 0, 0.16);
}

.masthead {
  width: 100%;
  min-height: 124px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.masthead-title {
  margin: 0;
  color: var(--text);
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 2.2vw, 1.45rem);
  font-weight: 400;
  letter-spacing: 0.32em;
  text-align: center;
  width: 100%;
}

.focus-exit {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 20;
  opacity: 0;
  pointer-events: none;
}

body.focus-view .focus-exit {
  opacity: 1;
  pointer-events: auto;
}
.timer-caption,
.timer-subcopy,
.status-card small,
.stat-card small,
.task-log li span {
  color: var(--muted);
}

.workspace-grid {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(290px, 0.72fr);
  gap: 22px;
  align-items: start;
}

.panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.018));
  border: 1px solid var(--border);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.3);
}

.timer-panel,
.stats-panel,
.log-panel {
  padding: 24px;
}

.planner-panel {
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.section-heading h2,
.section-heading h3 {
  margin: 8px 0 0;
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: -0.02em;
}

.section-heading h2 {
  font-size: clamp(1.8rem, 3vw, 2.4rem);
}

.section-heading.compact h3 {
  font-size: 1.25rem;
}

.planner-grid {
  margin-top: 20px;
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.015);
}

.field span {
  color: var(--subtle);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.field input {
  width: 100%;
  min-height: 52px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0;
  background: rgba(0, 0, 0, 0.28);
  color: var(--text);
  outline: none;
}

.field input:focus {
  border-color: rgba(255, 255, 255, 0.18);
}

.field-task {
  grid-column: span 2;
}

.mode-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.mode-pill.active,
.toggle-chip.active {
  background: rgba(255, 255, 255, 0.08);
  color: var(--accent);
}

.field-custom.hidden {
  display: none;
}

.status-row {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.status-card,
.stat-card,
.task-log li {
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.015);
}

.status-card strong,
.stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: 1.05rem;
  letter-spacing: -0.04em;
}

.status-card small,
.stat-card small {
  display: block;
  margin-top: 8px;
  line-height: 1.55;
}

.timer-block {
  padding-top: 24px;
}

.timer-topline {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
}

.timer-topline h3 {
  margin: 8px 0 0;
  font-size: clamp(1.65rem, 3vw, 2.3rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  font-weight: 400;
}

.live-pill {
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--subtle);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  white-space: nowrap;
}

.timer-caption {
  margin: 12px 0 24px;
  max-width: 42ch;
  line-height: 1.65;
}

.timer-core {
  display: grid;
  grid-template-columns: minmax(210px, 280px) minmax(0, 1fr);
  gap: 28px;
  align-items: center;
}

.cup-stage {
  display: flex;
  justify-content: center;
}

.cup-svg {
  width: min(100%, 280px);
  overflow: visible;
}

.cup-shadow {
  fill: rgba(0, 0, 0, 0.38);
}

.cup-body,
.cup-handle-outer,
.cup-handle-inner,
.cup-rim {
  fill: none;
  stroke: rgba(255, 255, 255, 0.9);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cup-handle-inner {
  opacity: 0.62;
  stroke-width: 4;
}

.cup-rim {
  opacity: 0.9;
}

.coffee-fill {
  fill: url(#coffeeGradient);
}

.coffee-surface {
  fill: var(--coffee-light);
  opacity: 0.9;
}

.clock-block {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.timer {
  font-family: var(--font-display);
  font-size: clamp(4rem, 10vw, 6.4rem);
  line-height: 0.88;
  letter-spacing: -0.03em;
  font-weight: 250;
  font-variant-numeric: tabular-nums;
}

.timer-subcopy {
  margin: 0;
  max-width: 30ch;
}

.timer-actions {
  margin-top: 28px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.btn-primary {
  background: rgba(255, 255, 255, 0.94);
  color: #050505;
}

.btn-success {
  color: var(--success);
}

.btn-danger {
  color: var(--danger);
}

.sidebar-stack {
  display: grid;
  gap: 22px;
}

.stat-grid,
.task-log {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

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

.stat-card strong {
  font-size: 1.7rem;
}

.task-log {
  list-style: none;
  padding: 0;
}

.task-log li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.task-log li strong {
  display: block;
  letter-spacing: -0.03em;
}

.task-log li.empty {
  display: block;
  color: var(--muted);
}

.site-footer {
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 26px 0 10px;
}

.site-footer a {
  display: block;
  color: var(--subtle);
  text-decoration: none;
  font-size: 0.8rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  text-align: center;
  width: 100%;
}

.site-footer a:hover,
.site-footer a:focus-visible {
  color: var(--text);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%) translateY(12px);
  padding: 12px 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(14, 14, 14, 0.92);
  color: var(--text);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
  z-index: 30;
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

body.focus-view .masthead,
body.focus-view .sidebar-stack,
body.focus-view .planner-panel,
body.focus-view .site-footer {
  display: none;
}

body.focus-view .page-shell {
  width: min(900px, calc(100% - 24px));
}

body.focus-view .workspace-grid {
  grid-template-columns: 1fr;
}

body.focus-view .timer-panel {
  min-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

body.focus-view .timer-core {
  grid-template-columns: 1fr;
  justify-items: center;
  text-align: center;
}

body.focus-view .timer-subcopy,
body.focus-view .timer-caption {
  max-width: none;
}

body.focus-view .timer-actions {
  justify-content: center;
}

.paused .cup-body,
.paused .cup-handle-outer,
.paused .cup-handle-inner,
.paused .cup-rim,
.paused .coffee-fill,
.paused .coffee-surface,
.paused .timer {
  opacity: 0.72;
}

.field-task.shake {
  animation: fieldShake 260ms ease;
}

@keyframes fieldShake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-4px);
  }
  40% {
    transform: translateX(4px);
  }
  60% {
    transform: translateX(-2px);
  }
  80% {
    transform: translateX(2px);
  }
}

@media (max-width: 980px) {
  .workspace-grid,
  .planner-grid,
  .status-row,
  .timer-core {
    grid-template-columns: 1fr;
  }

  .field-task {
    grid-column: span 1;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: min(100% - 18px, 100%);
    margin: 14px auto 24px;
  }

  .timer-panel,
  .stats-panel,
  .log-panel {
    padding: 18px;
  }

  .masthead {
    min-height: 104px;
  }

  .timer-actions,
  .mode-pills {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

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

  .btn,
  .mode-pill,
  .toggle-chip,
  .inline-button {
    width: 100%;
  }

  .task-log li {
    flex-direction: column;
    align-items: start;
  }
}
