/* === Visual Timer — soft cozy palette === */
:root {
  --bg: oklch(0.97 0.018 75);
  --bg-deeper: oklch(0.94 0.025 70);
  --surface: oklch(0.99 0.012 80);
  --ink: oklch(0.32 0.04 50);
  --ink-soft: oklch(0.52 0.035 55);
  --ink-faint: oklch(0.72 0.02 60);
  --line: oklch(0.88 0.02 70);

  /* Cozy warm pastels — same chroma, varied hue */
  --peach: oklch(0.78 0.11 40);
  --peach-deep: oklch(0.68 0.13 35);
  --rose: oklch(0.80 0.09 15);
  --sage: oklch(0.82 0.07 145);
  --lavender: oklch(0.82 0.07 290);
  --butter: oklch(0.90 0.09 90);

  /* Active disk + accents pulled from palette */
  --disk: var(--peach);
  --disk-deep: var(--peach-deep);
  --accent: var(--peach-deep);

  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --shadow-soft: 0 1px 0 oklch(1 0 0 / 0.6) inset,
                 0 12px 30px -18px oklch(0.32 0.04 50 / 0.25),
                 0 2px 6px -2px oklch(0.32 0.04 50 / 0.08);
  --shadow-pop: 0 1px 0 oklch(1 0 0 / 0.5) inset,
                0 18px 40px -20px oklch(0.32 0.04 50 / 0.35),
                0 4px 12px -4px oklch(0.32 0.04 50 / 0.1);
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Quicksand", -apple-system, system-ui, sans-serif;
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: 100dvh;
  overscroll-behavior: none;
}

button {
  font-family: inherit;
  font-weight: 600;
  border: none;
  background: none;
  color: inherit;
  cursor: pointer;
  padding: 0;
}

input, select {
  font-family: inherit;
  color: inherit;
}

/* Subtle dot grid texture in background */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(oklch(0.85 0.025 65 / 0.5) 1px, transparent 1.4px);
  background-size: 22px 22px;
  background-position: 0 0;
  z-index: 0;
}

#root {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ===== App shell ===== */
.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
}

@media (min-width: 640px) {
  .app {
    margin-top: 28px;
    margin-bottom: 28px;
    min-height: calc(100dvh - 56px);
    background: var(--surface);
    border-radius: 36px;
    box-shadow: var(--shadow-pop);
    overflow: hidden;
  }
}

/* ===== Top bar ===== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 22px 10px;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: "Caprasimo", "Quicksand", serif;
  font-size: 22px;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.brand-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: conic-gradient(from -90deg, var(--peach) 0%, var(--peach) 30%, var(--bg-deeper) 30%);
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--line);
}

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface);
  border: 1.5px solid var(--line);
  display: grid;
  place-items: center;
  color: var(--ink-soft);
  transition: transform 120ms ease, background 120ms ease, color 120ms ease;
}
.icon-btn:hover { background: var(--bg-deeper); color: var(--ink); }
.icon-btn:active { transform: scale(0.94); }

/* ===== Timer screen ===== */
.timer-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0 22px 28px;
}

.timer-title {
  font-family: var(--title-font, "Caprasimo", serif);
  font-size: 28px;
  text-align: center;
  margin: 4px 0 4px;
  letter-spacing: -0.01em;
  color: var(--ink);
  line-height: 1.15;
  text-wrap: balance;
}

.timer-subtitle {
  text-align: center;
  color: var(--ink-faint);
  font-size: 14px;
  margin-bottom: 18px;
  letter-spacing: 0.02em;
}

.disk-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 280px;
}

.disk {
  position: relative;
  width: min(var(--disk-size, 78vw), var(--disk-size-max, 360px));
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: hidden;
  box-shadow:
    0 0 0 6px var(--surface),
    0 0 0 8px var(--line),
    0 22px 50px -22px oklch(0.32 0.04 50 / 0.35),
    inset 0 0 0 1px oklch(1 0 0 / 0.3);
  background: var(--bg-deeper);
}

.disk-image {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
  transform-origin: center center;
}

/* Placeholder pattern when no image */
.disk-placeholder {
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(135deg,
      oklch(0.93 0.04 75) 0 14px,
      oklch(0.96 0.03 80) 14px 28px);
  display: grid;
  place-items: center;
  color: var(--ink-faint);
  font-family: "JetBrains Mono", "Courier New", monospace;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-align: center;
  padding: 0 24px;
}

.disk-cover-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.disk-digital {
  position: absolute;
  left: 50%;
  bottom: 14%;
  transform: translateX(-50%);
  font-family: var(--title-font, "Caprasimo", serif);
  font-size: var(--digital-size, 40px);
  color: oklch(1 0 0 / 0.95);
  letter-spacing: 0.02em;
  text-shadow: 0 2px 18px oklch(0.32 0.04 50 / 0.4), 0 0 24px oklch(0.32 0.04 50 / 0.25);
  pointer-events: none;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.disk-digital.done {
  color: var(--ink);
  text-shadow: none;
}

/* Pixel tiles overlay */
.pixel-grid {
  position: absolute;
  inset: 0;
  display: grid;
  pointer-events: none;
}
.pixel-tile {
  background: var(--disk);
  transition: opacity 320ms ease, transform 320ms ease;
}
.pixel-tile.gone {
  opacity: 0;
  transform: scale(0.4);
}

/* ===== Controls row ===== */
.controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  margin-top: 22px;
}

.btn {
  font-family: "Quicksand", sans-serif;
  font-weight: 700;
  border-radius: 999px;
  padding: 14px 22px;
  font-size: 15px;
  letter-spacing: 0.01em;
  background: var(--surface);
  border: 1.5px solid var(--line);
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform 120ms ease, background 120ms ease, box-shadow 120ms ease;
  box-shadow: var(--shadow-soft);
}
.btn:hover { background: var(--bg-deeper); }
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--accent);
  color: oklch(0.99 0.01 80);
  border-color: oklch(0 0 0 / 0);
  box-shadow:
    0 1px 0 oklch(1 0 0 / 0.4) inset,
    0 -2px 0 oklch(0 0 0 / 0.08) inset,
    0 12px 24px -12px oklch(0.68 0.13 35 / 0.7);
}
.btn-primary:hover { background: oklch(0.65 0.14 35); }

.btn-ghost {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--ink-soft);
}
.btn-ghost:hover { background: var(--bg-deeper); color: var(--ink); }

.btn-round {
  width: 56px;
  height: 56px;
  padding: 0;
  border-radius: 50%;
  justify-content: center;
}
.btn-round.big {
  width: 72px;
  height: 72px;
}

.timer-meta {
  text-align: center;
  margin-top: 18px;
  color: var(--ink-faint);
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.timer-meta strong {
  color: var(--ink-soft);
  font-weight: 700;
}

/* ===== Settings screen ===== */
.settings-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0 22px 32px;
  overflow-y: auto;
}

.section {
  margin-top: 22px;
}
.section-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
  margin-bottom: 10px;
}

.text-input {
  width: 100%;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--line);
  background: var(--surface);
  font-size: 16px;
  color: var(--ink);
  outline: none;
  transition: border-color 120ms ease, background 120ms ease;
}
.text-input:focus {
  border-color: var(--accent);
  background: var(--bg);
}
.text-input::placeholder { color: var(--ink-faint); }

/* Preset chips */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1.5px solid var(--line);
  font-weight: 700;
  font-size: 14px;
  color: var(--ink-soft);
  transition: transform 120ms ease, background 120ms ease, color 120ms ease, border-color 120ms ease;
}
.chip:hover { background: var(--bg-deeper); color: var(--ink); }
.chip.active {
  background: var(--accent);
  color: oklch(0.99 0.01 80);
  border-color: transparent;
}
.chip:active { transform: scale(0.96); }

/* HMS picker */
.hms {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  padding: 12px;
  justify-content: space-between;
}
.hms-cell {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.hms-cell label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-faint);
}
.hms-input {
  width: 100%;
  text-align: center;
  font-family: "Caprasimo", serif;
  font-size: 30px;
  background: transparent;
  border: none;
  color: var(--ink);
  outline: none;
  padding: 4px 0;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
}
.hms-input::-webkit-outer-spin-button,
.hms-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.hms-sep {
  font-family: "Caprasimo", serif;
  font-size: 26px;
  color: var(--ink-faint);
  padding-bottom: 12px;
}

/* Segmented (reveal mode, end behavior) */
.segmented {
  display: grid;
  gap: 10px;
}
.segmented.cols-3 { grid-template-columns: repeat(3, 1fr); }

.seg-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 8px 12px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1.5px solid var(--line);
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}
.seg-card:hover { background: var(--bg-deeper); }
.seg-card.active {
  border-color: var(--accent);
  background: oklch(0.97 0.04 65);
  box-shadow: 0 0 0 4px oklch(0.78 0.11 40 / 0.18);
}
.seg-card-preview {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--bg-deeper);
  overflow: hidden;
  position: relative;
}
.seg-card-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-soft);
}
.seg-card.active .seg-card-label { color: var(--ink); }

/* Toggle row */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
}
.toggle-row-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.toggle-row-text .t {
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
}
.toggle-row-text .s {
  font-size: 12px;
  color: var(--ink-faint);
}
.toggle {
  position: relative;
  width: 48px;
  height: 28px;
  border-radius: 999px;
  background: var(--bg-deeper);
  border: 1.5px solid var(--line);
  flex-shrink: 0;
  transition: background 160ms ease, border-color 160ms ease;
}
.toggle::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 2px 6px -1px oklch(0.32 0.04 50 / 0.25);
  transition: transform 180ms cubic-bezier(0.4, 1.4, 0.6, 1);
}
.toggle.on {
  background: var(--accent);
  border-color: var(--accent);
}
.toggle.on::after { transform: translateX(20px); }

/* Image upload area */
.upload-card {
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1.5px dashed var(--line);
  padding: 18px;
  display: flex;
  gap: 14px;
  align-items: center;
}
.upload-card.has-image {
  border-style: solid;
}
.upload-thumb {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  background-color: var(--bg-deeper);
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}
.upload-thumb.empty {
  background:
    repeating-linear-gradient(135deg,
      oklch(0.93 0.04 75) 0 8px,
      oklch(0.96 0.03 80) 8px 16px);
  display: grid;
  place-items: center;
  color: var(--ink-faint);
}
.upload-meta {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.upload-meta .t {
  font-weight: 700;
  font-size: 14px;
  color: var(--ink);
}
.upload-meta .s {
  font-size: 12px;
  color: var(--ink-faint);
}
.upload-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.btn-small {
  padding: 8px 14px;
  font-size: 13px;
  border-radius: 999px;
}

/* Save bar (sticky bottom) */
.save-bar {
  position: sticky;
  bottom: 0;
  padding: 14px 0 0;
  background: linear-gradient(to top, var(--bg) 60%, transparent);
  display: flex;
  gap: 10px;
  margin-top: 14px;
}
.save-bar .btn { flex: 1; justify-content: center; }

@media (min-width: 640px) {
  .save-bar { background: linear-gradient(to top, var(--surface) 60%, transparent); }
}

/* ===== Image editor modal ===== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: oklch(0.32 0.04 50 / 0.4);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  z-index: 100;
  padding: 16px;
  animation: fade 180ms ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--surface);
  border-radius: 28px;
  width: 100%;
  max-width: 460px;
  padding: 22px;
  box-shadow: 0 30px 80px -30px oklch(0.32 0.04 50 / 0.5);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.modal-title {
  font-family: "Caprasimo", serif;
  font-size: 22px;
  margin: 0;
  color: var(--ink);
}
.modal-sub {
  margin: -8px 0 4px;
  color: var(--ink-faint);
  font-size: 13px;
}

.editor-stage {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg-deeper);
  position: relative;
  touch-action: none;
  cursor: grab;
  box-shadow: inset 0 0 0 2px var(--line);
}
.editor-stage:active { cursor: grabbing; }
.editor-img {
  position: absolute;
  top: 50%;
  left: 50%;
  transform-origin: center center;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

.editor-zoom {
  display: flex;
  align-items: center;
  gap: 12px;
}
.editor-zoom input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
}
.editor-zoom .label {
  font-size: 12px;
  color: var(--ink-faint);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  min-width: 36px;
}

.modal-actions {
  display: flex;
  gap: 10px;
}
.modal-actions .btn { flex: 1; justify-content: center; }

/* ===== Done overlay ===== */
.done-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: grid;
  place-items: center;
  z-index: 5;
}
.done-banner {
  pointer-events: auto;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: 20px;
  padding: 14px 22px;
  font-family: "Caprasimo", serif;
  font-size: 18px;
  color: var(--ink);
  box-shadow: var(--shadow-pop);
  animation: pop 260ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes pop {
  from { transform: scale(0.7); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* Pulse animation for "pulse_dismiss" end behavior */
.disk.pulse {
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow:
    0 0 0 6px var(--surface),
    0 0 0 8px var(--line),
    0 22px 50px -22px oklch(0.32 0.04 50 / 0.35),
    0 0 0 0 oklch(0.78 0.11 40 / 0.6);
  }
  50% { box-shadow:
    0 0 0 6px var(--surface),
    0 0 0 8px var(--line),
    0 22px 50px -22px oklch(0.32 0.04 50 / 0.35),
    0 0 0 20px oklch(0.78 0.11 40 / 0);
  }
}

/* Confetti */
.confetti-piece {
  position: absolute;
  width: 10px;
  height: 14px;
  border-radius: 2px;
  pointer-events: none;
  animation: fall 2.4s ease-out forwards;
}
@keyframes fall {
  0% { transform: translate(0, -10vh) rotate(0deg); opacity: 1; }
  100% { transform: translate(var(--dx, 0), 110vh) rotate(720deg); opacity: 0; }
}

/* Screen transition */
.screen-fade-enter { opacity: 0; transform: translateY(10px); }
.screen-fade-enter-active {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 260ms ease, transform 260ms ease;
}

/* Help text */
.help {
  font-size: 12px;
  color: var(--ink-faint);
  margin-top: 8px;
  line-height: 1.5;
}

