:root {
  --bg: #f4ede4;
  --bg-tint: #fff7f1;
  --surface: rgba(255, 252, 247, 0.78);
  --surface-strong: rgba(255, 251, 246, 0.92);
  --surface-soft: rgba(255, 255, 255, 0.54);
  --line: rgba(39, 27, 20, 0.08);
  --line-strong: rgba(39, 27, 20, 0.12);
  --text: #171311;
  --muted: #74685f;
  --accent: #f26a4b;
  --accent-deep: #d94d34;
  --accent-soft: rgba(242, 106, 75, 0.12);
  --success-soft: rgba(81, 161, 108, 0.14);
  --success-text: #2f7a48;
  --warning-soft: rgba(216, 154, 67, 0.16);
  --warning-text: #9a651a;
  --shadow: 0 20px 50px rgba(78, 53, 35, 0.12);
  --shadow-soft: 0 12px 30px rgba(78, 53, 35, 0.08);
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 14px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

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

body {
  min-height: 100vh;
  min-height: 100dvh;
  font-family: "Plus Jakarta Sans", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.9), transparent 28%),
    radial-gradient(circle at 85% 10%, rgba(242, 106, 75, 0.16), transparent 18%),
    radial-gradient(circle at 15% 85%, rgba(206, 183, 156, 0.22), transparent 22%),
    linear-gradient(180deg, var(--bg-tint), var(--bg));
  overscroll-behavior-y: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  appearance: none;
  border: 0;
  outline: none;
  user-select: none;
  cursor: pointer;
}

input,
select,
textarea {
  appearance: none;
}

.startup-splash {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 18px;
  background:
    radial-gradient(circle at top, rgba(242, 106, 75, 0.15), transparent 26%),
    linear-gradient(180deg, #f8f1e9 0%, #f2e8dc 100%);
  transition: opacity 420ms ease, visibility 420ms ease;
}

.startup-splash.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.startup-mark {
  width: 108px;
  height: 108px;
  border-radius: 30px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow);
}

.startup-mark img {
  width: 80px;
  height: 80px;
}

.startup-title {
  margin: 0;
  font-family: "Sora", sans-serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.app-shell {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  padding:
    calc(16px + env(safe-area-inset-top))
    calc(16px + env(safe-area-inset-right))
    calc(112px + env(safe-area-inset-bottom))
    calc(16px + env(safe-area-inset-left));
}

.views {
  min-height: calc(100dvh - 128px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
}

.view {
  display: none;
  min-height: 100%;
  overflow: auto;
  padding-bottom: 8px;
  animation: view-in 320ms ease;
}

.view.is-active {
  display: block;
}

.update-fab.is-hidden,
.update-banner.is-hidden,
.modal.is-hidden {
  display: none;
}

.update-fab {
  position: fixed;
  top: calc(16px + env(safe-area-inset-top));
  right: calc(16px + env(safe-area-inset-right));
  z-index: 25;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  background: rgba(23, 19, 17, 0.88);
  color: #fff8f2;
  box-shadow: var(--shadow-soft);
  animation: drift 3.4s ease-in-out infinite;
}

.timer-panel,
.surface-card,
.summary-card,
.settings-card,
.history-item,
.note-item,
.update-banner,
.modal-card {
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.timer-panel {
  position: relative;
  padding: 16px;
  border-radius: var(--radius-xl);
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 252, 247, 0.92), rgba(255, 248, 241, 0.82)),
    var(--surface);
}

.timer-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at top right, rgba(242, 106, 75, 0.14), transparent 28%),
    radial-gradient(circle at bottom left, rgba(255, 255, 255, 0.6), transparent 32%);
  pointer-events: none;
}

.utility-row,
.section-head,
.control-row,
.history-top,
.note-top,
.settings-actions,
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.utility-row {
  position: relative;
  z-index: 1;
}

.utility-button {
  width: 44px;
  height: 44px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.55);
}

.phase-badge,
.status-pill,
.history-delete,
.note-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.phase-badge {
  background: var(--success-soft);
  color: var(--success-text);
}

.phase-badge.is-break {
  background: var(--warning-soft);
  color: var(--warning-text);
}

.dial-stage {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  margin: 18px 0 14px;
}

.progress-dial {
  --progress: 0;
  width: min(100%, 330px);
  aspect-ratio: 1;
  border-radius: 50%;
  padding: 14px;
  display: grid;
  place-items: center;
  background:
    conic-gradient(var(--accent) calc(var(--progress) * 1turn), rgba(23, 19, 17, 0.08) 0),
    radial-gradient(circle at center, rgba(255, 255, 255, 0.62) 0 55%, transparent 55%);
  box-shadow:
    0 18px 38px rgba(78, 53, 35, 0.14),
    inset 0 0 0 1px rgba(255, 255, 255, 0.34);
  animation: breathe 4.2s ease-in-out infinite;
}

.dial-content {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.08), transparent 28%),
    linear-gradient(180deg, #1b1714, #24201d);
  color: #fff8f1;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.time-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
}

.time-card {
  min-width: 102px;
  min-height: 116px;
  border-radius: 28px;
  display: grid;
  place-items: center;
  color: var(--accent-deep);
  background:
    linear-gradient(180deg, #fffdf9 0%, #fff5eb 100%);
  box-shadow:
    inset 0 -10px 18px rgba(196, 146, 109, 0.16),
    0 14px 28px rgba(0, 0, 0, 0.18);
}

.time-card span {
  font-family: "Sora", sans-serif;
  font-size: clamp(2.5rem, 11vw, 3.25rem);
  font-weight: 700;
  letter-spacing: -0.06em;
}

.time-separator {
  font-family: "Sora", sans-serif;
  font-size: 2.3rem;
  color: rgba(255, 248, 241, 0.42);
  transform: translateY(-4px);
}

.session-label {
  margin: 0;
  color: rgba(255, 248, 241, 0.68);
  font-size: 0.95rem;
  font-weight: 600;
}

.metrics-strip {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.metric-card,
.summary-card,
.settings-card {
  padding: 15px 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.54);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.38);
}

.metric-label,
.summary-label,
.settings-label,
.preset-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.metric-value,
.summary-value,
.settings-value {
  font-family: "Sora", sans-serif;
  font-size: 1.32rem;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.control-row {
  position: relative;
  z-index: 1;
}

.primary-action,
.secondary-action,
.banner-action {
  min-height: 54px;
  padding: 0 18px;
  border-radius: 18px;
  font-weight: 800;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    background 180ms ease,
    opacity 180ms ease;
}

.primary-action {
  flex: 1.2;
  color: #fff8f2;
  background: linear-gradient(180deg, var(--accent), var(--accent-deep));
  box-shadow: 0 16px 30px rgba(217, 77, 52, 0.24);
}

.primary-action--small {
  min-height: 48px;
}

.secondary-action,
.banner-action {
  flex: 1;
  color: var(--text);
  background: rgba(255, 255, 255, 0.76);
  box-shadow: inset 0 0 0 1px rgba(39, 27, 20, 0.06);
}

.secondary-action--block {
  width: 100%;
}

.surface-card {
  margin-top: 14px;
  padding: 18px;
  border-radius: 28px;
}

.surface-card--compact {
  padding-top: 16px;
}

.surface-card--tall {
  min-height: calc(100dvh - 162px);
}

.section-head h2 {
  margin: 0;
  font-family: "Sora", sans-serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.preset-stack {
  display: grid;
  gap: 14px;
  margin-top: 12px;
}

.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.preset-button {
  min-width: 58px;
  min-height: 46px;
  padding: 0 16px;
  border-radius: 16px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.68);
  box-shadow: inset 0 0 0 1px rgba(39, 27, 20, 0.06);
  transition:
    transform 180ms ease,
    background 180ms ease,
    color 180ms ease,
    box-shadow 180ms ease;
}

.preset-button.is-active {
  color: #fff8f1;
  background: linear-gradient(180deg, var(--accent), var(--accent-deep));
  box-shadow: 0 14px 24px rgba(217, 77, 52, 0.2);
}

.update-banner {
  margin-top: 14px;
  padding: 16px;
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.update-banner-title,
.update-banner-text,
.settings-copy,
.feedback,
.modal-copy {
  margin: 0;
}

.update-banner-title,
.modal-title {
  font-family: "Sora", sans-serif;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.update-banner-text,
.settings-copy,
.feedback,
.field span,
.history-date,
.history-meta,
.note-date,
.note-content,
.modal-copy {
  color: var(--muted);
  line-height: 1.45;
}

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

.field {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.field span {
  font-size: 0.84rem;
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  padding: 14px 16px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.7);
  outline: none;
  transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.field textarea {
  min-height: 126px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(242, 106, 75, 0.42);
  box-shadow: 0 0 0 4px rgba(242, 106, 75, 0.12);
}

.stack-list {
  list-style: none;
  padding: 0;
  margin: 18px 0 0;
  display: grid;
  gap: 12px;
}

.history-item,
.note-item {
  padding: 16px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.66);
}

.history-top,
.note-top {
  align-items: flex-start;
}

.history-duration,
.note-title {
  font-weight: 800;
}

.history-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.history-delete,
.note-delete {
  background: rgba(217, 77, 52, 0.1);
  color: var(--accent-deep);
  letter-spacing: 0;
  text-transform: none;
}

.status-pill.is-progress {
  background: var(--success-soft);
  color: var(--success-text);
}

.status-pill.is-review {
  background: var(--warning-soft);
  color: var(--warning-text);
}

.settings-actions {
  margin-top: 16px;
  flex-direction: column;
}

.bottom-nav {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(14px + env(safe-area-inset-bottom));
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  border-radius: 28px;
  background: rgba(255, 252, 248, 0.8);
  border: 1px solid rgba(39, 27, 20, 0.08);
  box-shadow: 0 18px 44px rgba(78, 53, 35, 0.14);
  backdrop-filter: blur(22px);
}

.nav-item {
  min-height: 60px;
  border-radius: 20px;
  color: var(--muted);
  background: transparent;
  display: grid;
  place-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  transition:
    transform 180ms ease,
    background 180ms ease,
    color 180ms ease;
}

.nav-item.is-active {
  color: var(--text);
  background: rgba(23, 19, 17, 0.08);
}

.nav-icon {
  font-size: 1.38rem;
  line-height: 1;
  font-variation-settings: "FILL" 0, "wght" 600, "GRAD" 0, "opsz" 24;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: end center;
  padding: 18px;
  background: rgba(17, 13, 12, 0.28);
  backdrop-filter: blur(8px);
}

.modal-card {
  width: min(100%, 460px);
  padding: 22px;
  border-radius: 28px;
  animation: modal-in 240ms ease;
}

.modal-eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.modal-title {
  margin: 0;
  font-size: 1.34rem;
}

.modal-list {
  margin: 14px 0 0;
  padding-left: 18px;
}

.modal-list li + li {
  margin-top: 6px;
}

.modal-actions {
  margin-top: 18px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(98px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(16px);
  z-index: 100;
  min-width: 220px;
  max-width: calc(100vw - 32px);
  padding: 12px 16px;
  border-radius: 14px;
  color: #fff8f1;
  background: rgba(23, 19, 17, 0.9);
  text-align: center;
  box-shadow: var(--shadow-soft);
  opacity: 0;
  pointer-events: none;
  transition: transform 180ms ease, opacity 180ms ease;
}

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

.empty-state {
  padding: 18px;
  border-radius: 20px;
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  background: rgba(255, 255, 255, 0.46);
}

button:hover,
.preset-button:hover,
.nav-item:hover,
.utility-button:hover {
  transform: translateY(-1px);
}

button:active,
.preset-button:active,
.nav-item:active {
  transform: scale(0.97);
}

@keyframes breathe {
  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.012);
  }
}

@keyframes drift {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-4px);
  }
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 420px) {
  .app-shell {
    padding-left: calc(12px + env(safe-area-inset-left));
    padding-right: calc(12px + env(safe-area-inset-right));
  }

  .bottom-nav {
    left: 12px;
    right: 12px;
  }

  .time-card {
    min-width: 88px;
    min-height: 104px;
  }

  .nav-item {
    font-size: 0.68rem;
  }
}

@media (min-width: 760px) {
  .app-shell {
    max-width: 560px;
    margin: 0 auto;
  }

  .bottom-nav {
    left: 50%;
    right: auto;
    width: min(560px, calc(100vw - 32px));
    transform: translateX(-50%);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
