@import url('https://fonts.googleapis.com/css2?family=Itim&display=swap');

/* Tomatodo — warm, cheeky, sticker-cartoon brand.
   Fredoka = fat rounded display (logo, timer, buttons).
   Baloo 2 = rounded friendly body/UI. Itim = handwritten accents.
   Fredoka/Baloo are self-hosted (from /assets/fonts); Itim is imported above. */
@font-face {
  font-family: "Fredoka";
  src: url("/assets/fonts/fredoka.woff2") format("woff2");
  font-weight: 300 700;
  font-display: swap;
}
@font-face {
  font-family: "Baloo 2";
  src: url("/assets/fonts/baloo2.woff2") format("woff2");
  font-weight: 400 800;
  font-display: swap;
}

:root {
  /* ── Tomatodo brand palette (extra helper tokens) ─────────────── */
  --tomato: #e8432e;
  --tomato-deep: #c8341f;
  --leaf: #5ba845;
  --leaf-deep: #4a8c38;
  --sunny: #ffc93c;
  --sunny-deep: #f0b21f;
  --aubergine: #3b1f3a;
  --cream: #fff4e2;
  --cream-card: #fffaf0;
  --cream-track: #ece0c8;
  --orange: #f2813c;
  --pale: #f3e8d5;
  --soft: #e8d8be;

  /* ── shadcn base tokens ───────────────────────────────────────── */
  --background: #fff4e2;
  --foreground: #3b1f3a;
  --card: #fffaf0;
  --card-foreground: #3b1f3a;
  --popover: #fffaf0;
  --popover-foreground: #3b1f3a;
  --primary: #3b1f3a;
  --primary-foreground: #fff4e2;
  --secondary: #ffc93c;
  --secondary-foreground: #3b1f3a;
  --muted: #f3e7d0;
  --muted-foreground: #8a6d78;
  --accent: #f3e7d0;
  --accent-foreground: #3b1f3a;
  --destructive: #e8432e;
  --destructive-foreground: #fff4e2;
  --border: #3b1f3a;
  --input: #d9c6ab;
  --ring: #e8432e;
  --success: #5ba845;
  --warning: #ffc93c;
  --chart-1: #e8432e;
  --chart-2: #5ba845;
  --chart-3: #ffc93c;
  --chart-4: #f2813c;
  --chart-5: #3b1f3a;
  --sidebar: #fff4e2;
  --sidebar-foreground: #3b1f3a;
  --sidebar-primary: #e8432e;
  --sidebar-primary-foreground: #fff4e2;
  --sidebar-accent: #ffc93c;
  --sidebar-accent-foreground: #3b1f3a;
  --sidebar-border: #3b1f3a;
  --sidebar-ring: #e8432e;

  /* ── surface hierarchy ────────────────────────────────────────── */
  --background-secondary: #fbeed6;
  --surface-hover: #fdf1dc;
  --surface-active: #f7e8cc;
  --surface-elevated: #fffaf0;

  /* ── border hierarchy ─────────────────────────────────────────── */
  --border-subtle: #e4d4ba;
  --border-muted: #d6c09f;
  --border-strong: #3b1f3a;

  /* ── text hierarchy ───────────────────────────────────────────── */
  --foreground-secondary: #6c5160;

  /* ── primary depth ────────────────────────────────────────────── */
  --primary-hover: #4d2b4b;
  --primary-muted: #e7d7df;
  --primary-soft: #f2e8ee;
  --primary-tint: #f7eff3;

  /* ── focus ring ───────────────────────────────────────────────── */
  --focus-ring: rgba(232, 67, 46, 0.4);

  /* ── error ────────────────────────────────────────────────────── */
  --error: #e8432e;
  --error-foreground: #fff4e2;

  /* ── radius: chunky and rounded ───────────────────────────────── */
  --radius: 1rem;
  --radius-none: 0rem;
  --radius-sm: 0.5rem;
  --radius-lg: 1.25rem;
  --radius-xl: 1.75rem;
  --radius-full: 9999px;

  /* ── typography ───────────────────────────────────────────────── */
  --font-display: "Fredoka", ui-rounded, system-ui, sans-serif;
  --font-sans: "Baloo 2", ui-rounded, system-ui, sans-serif;
  --font-mono: "Fredoka", ui-monospace, monospace;
  --font-weight-display: 600;
  --line-height-display: 1.05;
  --tracking-display: 0em;
  --font-weight-body: 500;
  --line-height-body: 1.4;
  --tracking-body: 0em;
  --font-weight-mono: 600;

  /* ── shadows ──────────────────────────────────────────────────── */
  --shadow-sm: 0 2px 0 0 rgba(59, 31, 58, 0.12);
  --shadow-md: 0 4px 0 0 rgba(59, 31, 58, 0.14);
  --shadow-lg: 0 8px 24px rgba(59, 31, 58, 0.16);

  /* ── motion: springy ──────────────────────────────────────────── */
  --duration-fast: 120ms;
  --duration-normal: 240ms;
  --duration-slow: 420ms;
  --ease-standard: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-accelerate: cubic-bezier(0.4, 0, 1, 1);
  --ease-decelerate: cubic-bezier(0, 0, 0.2, 1);

  /* ── spacing ──────────────────────────────────────────────────── */
  --spacing-base: 0.25rem;
}

/* Single fixed warm theme — dark mirrors light so the mood never flips. */
.dark {
  --background: #fff4e2;
  --foreground: #3b1f3a;
  --card: #fffaf0;
  --card-foreground: #3b1f3a;
  --popover: #fffaf0;
  --popover-foreground: #3b1f3a;
  --primary: #3b1f3a;
  --primary-foreground: #fff4e2;
  --secondary: #ffc93c;
  --secondary-foreground: #3b1f3a;
  --muted: #f3e7d0;
  --muted-foreground: #8a6d78;
  --accent: #f3e7d0;
  --accent-foreground: #3b1f3a;
  --destructive: #e8432e;
  --destructive-foreground: #fff4e2;
  --border: #3b1f3a;
  --input: #d9c6ab;
  --ring: #e8432e;
  --success: #5ba845;
  --warning: #ffc93c;
  --chart-1: #e8432e;
  --chart-2: #5ba845;
  --chart-3: #ffc93c;
  --chart-4: #f2813c;
  --chart-5: #3b1f3a;
  --sidebar: #fff4e2;
  --sidebar-foreground: #3b1f3a;
  --sidebar-primary: #e8432e;
  --sidebar-primary-foreground: #fff4e2;
  --sidebar-accent: #ffc93c;
  --sidebar-accent-foreground: #3b1f3a;
  --sidebar-border: #3b1f3a;
  --sidebar-ring: #e8432e;
  --background-secondary: #fbeed6;
  --surface-hover: #fdf1dc;
  --surface-active: #f7e8cc;
  --surface-elevated: #fffaf0;
  --border-subtle: #e4d4ba;
  --border-muted: #d6c09f;
  --border-strong: #3b1f3a;
  --foreground-secondary: #6c5160;
  --primary-hover: #4d2b4b;
  --primary-muted: #e7d7df;
  --primary-soft: #f2e8ee;
  --primary-tint: #f7eff3;
  --focus-ring: rgba(232, 67, 46, 0.4);
  --error: #e8432e;
  --error-foreground: #fff4e2;
  --pale: #f3e8d5;
  --soft: #e8d8be;
}

/* ── Chunky sticker buttons ──────────────────────────────────── */
.tom-btn {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  padding: 0.7rem 1.5rem;
  border-radius: var(--radius-full);
  border: 3px solid var(--aubergine);
  cursor: pointer;
  transition: transform var(--duration-fast) var(--ease-standard),
    background-color var(--duration-fast) ease;
  box-shadow: 0 3px 0 0 var(--aubergine);
}
.tom-btn:hover {
  transform: translateY(-1px);
}
.tom-btn:active {
  transform: translateY(3px) scale(0.98);
  box-shadow: 0 0 0 0 var(--aubergine);
}
.tom-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: 0 3px 0 0 var(--aubergine);
  transform: none;
}
.tom-btn-primary {
  background: var(--aubergine);
  color: var(--cream);
}
.tom-btn-primary:hover {
  background: var(--primary-hover);
}
.tom-btn-ghost {
  background: var(--cream-card);
  color: var(--aubergine);
}
.tom-btn-ghost:hover {
  background: var(--surface-hover);
}
.tom-btn-tomato {
  background: var(--tomato);
  color: #fff;
}
.tom-btn-tomato:hover {
  background: var(--tomato-deep);
}

.tom-eyes {
  animation: tom-blink 5s infinite;
  transform-origin: center;
}
.tom-wrap[data-mood="priority"] .tom-svg {
  animation: tom-spin 0.7s var(--ease-standard) 1;
}
.tom-wrap[data-mood="day"] .tom-svg {
  animation: tom-bob 2.2s ease-in-out infinite;
}
.tom-can {
  position: absolute;
  bottom: 2%;
  right: -6%;
  animation: tom-bob 2.6s ease-in-out infinite;
}

@keyframes tom-blink {
  0%, 92%, 100% { transform: scaleY(1); }
  95% { transform: scaleY(0.1); }
}
@keyframes tom-spin {
  0% { transform: rotate(0) scale(1); }
  40% { transform: rotate(360deg) scale(1.12); }
  100% { transform: rotate(360deg) scale(1); }
}
@keyframes tom-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
@keyframes tomato-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}
@keyframes tom-pop-in {
  0% { transform: scale(0.6); opacity: 0; }
  70% { transform: scale(1.08); }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes start-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 3px 0 0 var(--aubergine); }
  50% { transform: scale(1.04); box-shadow: 0 6px 0 0 var(--aubergine); }
}
.start-pulse {
  animation: start-pulse 1.8s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .tom-eyes, .tom-can, .start-pulse,
  .tom-wrap[data-mood="priority"] .tom-svg,
  .tom-wrap[data-mood="day"] .tom-svg {
    animation: none !important;
  }
}

/* ───────────────────────────────────────────────────────────────
   Focus screen — ported to match the reference design exactly.
   Logo wordmark, conic timer ring, clip-path mascot, vines, doodles.
   ─────────────────────────────────────────────────────────────── */

/* Logo wordmark with a leaf sprouting from the final letter */
.tmd-logo {
  position: relative;
  display: inline-block;
  font-family: var(--font-display);
  font-size: 52px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: -3px;
  color: var(--tomato);
  -webkit-text-stroke: 3px var(--aubergine);
  paint-order: stroke fill;
  transform: rotate(-1deg);
}
.tmd-logo .leaf {
  position: absolute;
  width: 30px;
  height: 23px;
  right: 7px;
  top: -14px;
  background: var(--leaf);
  border: 3px solid var(--aubergine);
  border-radius: 4px 22px 4px 22px;
  transform: rotate(-22deg);
}
.tmd-logo .leaf:after {
  content: "";
  position: absolute;
  width: 3px;
  height: 22px;
  background: var(--aubergine);
  left: 12px;
  top: 1px;
  transform: rotate(28deg);
  border-radius: 3px;
}

/* Square speaker / sound toggle */
.tmd-speaker {
  width: 58px;
  height: 58px;
  border: 2.5px solid var(--aubergine);
  border-radius: 18px;
  background: transparent;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform var(--duration-fast) var(--ease-standard);
}
.tmd-speaker:hover {
  transform: translateY(-2px);
}
.tmd-speaker svg {
  width: 28px;
  height: 28px;
}

/* Label with flanking yellow dashes */
.tmd-focus-label {
  display: inline-flex;
  align-items: center;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.3px;
}
.tmd-focus-label:before,
.tmd-focus-label:after {
  content: "";
  display: inline-block;
  width: 18px;
  height: 5px;
  background: var(--sunny);
  border-radius: 8px;
  margin: 0 12px 2px 0;
  transform: rotate(-15deg);
}
.tmd-focus-label:after {
  margin: 0 0 2px 12px;
  transform: rotate(15deg);
}

/* Conic-gradient timer ring (fill driven inline) */
.tmd-ring {
  position: absolute;
  border-radius: 50%;
  -webkit-mask: radial-gradient(
    farthest-side,
    transparent calc(100% - 17px),
    #000 calc(100% - 16px)
  );
  mask: radial-gradient(
    farthest-side,
    transparent calc(100% - 17px),
    #000 calc(100% - 16px)
  );
  transition: background 0.4s linear;
}

/* Big Tom — clip-path mascot */
.tmd-tomato {
  width: 198px;
  height: 174px;
  position: relative;
  z-index: 2;
  border: 4px solid var(--aubergine);
  border-radius: 49% 49% 46% 46%;
  background: linear-gradient(
    90deg,
    #8bb449 0%,
    #bfc448 20%,
    #f19a38 45%,
    var(--tomato) 72%,
    #e8432e 100%
  );
  box-shadow: 0 8px 0 rgba(59, 31, 58, 0.06);
  transform: rotate(-2deg);
}
.tmd-tomato:before {
  content: "";
  position: absolute;
  left: 49px;
  top: -29px;
  width: 94px;
  height: 51px;
  background: var(--leaf);
  border: 4px solid var(--aubergine);
  clip-path: polygon(
    49% 100%,
    35% 55%,
    5% 76%,
    20% 20%,
    46% 45%,
    60% 0%,
    68% 45%,
    98% 20%,
    86% 75%,
    67% 58%
  );
}
.tmd-tomato .eye {
  position: absolute;
  top: 78px;
  width: 27px;
  height: 15px;
  border-top: 4px solid var(--aubergine);
  border-radius: 50%;
}
.tmd-tomato .eye.l {
  left: 49px;
  transform: rotate(4deg);
}
.tmd-tomato .eye.r {
  right: 49px;
  transform: rotate(-4deg);
}
.tmd-tomato .mouth {
  position: absolute;
  left: 88px;
  top: 91px;
  width: 24px;
  height: 13px;
  border-bottom: 4px solid var(--aubergine);
  border-radius: 0 0 50% 50%;
}
.tmd-tomato .cheek {
  position: absolute;
  width: 25px;
  height: 13px;
  border-radius: 50%;
  background: #f98b73;
  opacity: 0.85;
  top: 99px;
}
.tmd-tomato .cheek.l {
  left: 27px;
}
.tmd-tomato .cheek.r {
  right: 27px;
}
.tmd-tomato .highlight {
  position: absolute;
  left: 25px;
  top: 36px;
  width: 15px;
  height: 30px;
  border-left: 5px solid rgba(255, 255, 255, 0.75);
  border-radius: 50%;
  transform: rotate(16deg);
}

/* Speech bubble */
.tmd-speech {
  position: absolute;
  right: 18px;
  top: 32px;
  z-index: 4;
  width: 190px;
  padding: 16px 18px;
  background: var(--cream);
  border: 3px solid var(--aubergine);
  border-radius: 28px;
  font-size: 17px;
  line-height: 1.2;
  font-weight: 800;
  box-shadow: 0 4px 0 rgba(59, 31, 58, 0.04);
}
.tmd-speech:after {
  content: "";
  position: absolute;
  left: 22px;
  bottom: -17px;
  width: 25px;
  height: 23px;
  background: var(--cream);
  border-right: 3px solid var(--aubergine);
  border-bottom: 3px solid var(--aubergine);
  transform: skew(-25deg) rotate(18deg);
}

/* Big countdown */
.tmd-time {
  margin-top: -2px;
  font-family: var(--font-display);
  font-size: 92px;
  line-height: 0.9;
  font-weight: 700;
  letter-spacing: -7px;
  font-variant-numeric: tabular-nums;
}

/* Chunky pill controls */
.tmd-btn {
  min-width: 190px;
  height: 62px;
  padding: 0 30px;
  border-radius: 31px;
  border: 3px solid var(--aubergine);
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s ease, background-color 0.12s ease;
}
.tmd-btn:hover {
  transform: translateY(-2px);
}
.tmd-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
.tmd-btn.pause {
  background: var(--aubergine);
  color: var(--cream);
}
.tmd-btn.done {
  background: var(--cream);
  color: var(--aubergine);
}
.tmd-btn.tomato {
  background: var(--tomato);
  color: #fff;
}

/* Priority card + vine */
.tmd-priority {
  height: 128px;
  border: 2.5px solid var(--soft);
  border-radius: 25px;
  background: rgba(255, 249, 239, 0.46);
  padding: 18px 22px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 5px 0 rgba(59, 31, 58, 0.035);
  transition: background-color 0.2s ease, border-color 0.2s ease;
}
.tmd-priority.active {
  background: var(--sunny);
  border-color: var(--aubergine);
  box-shadow: 0 5px 0 rgba(59, 31, 58, 0.07);
}
.tmd-priority.muted {
  opacity: 0.72;
}
.tmd-priority-name {
  width: 145px;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.05;
}
.tmd-priority-name textarea {
  width: 100%;
  height: 100%;
  background: transparent;
  border: none;
  outline: none;
  font: inherit;
  color: inherit;
  line-height: 1.05;
  padding: 0;
  margin: 0;
  resize: none;
  overflow: hidden;
}
.tmd-priority-name textarea::placeholder {
  color: color-mix(in srgb, var(--aubergine) 45%, transparent);
  font-weight: 700;
}
.tmd-vine {
  flex: 1;
  height: 72px;
  position: relative;
}
.tmd-vine svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}
.tmd-vine .tomato-dot {
  stroke: var(--aubergine);
  stroke-width: 3;
}
.tmd-vine .tomato-dot.next {
  cursor: pointer;
}
.tmd-vine .tomato-dot.live {
  animation: tomato-pulse 1.4s ease-in-out infinite;
  transform-origin: center;
}
.tmd-vine .vine-line {
  stroke: var(--leaf);
  stroke-width: 5;
  fill: none;
  stroke-linecap: round;
}
.tmd-vine .vine-leaf {
  fill: var(--leaf);
  stroke: var(--aubergine);
  stroke-width: 2.5;
}
.tmd-vine .vine-stem {
  stroke: var(--aubergine);
  stroke-width: 2.5;
  fill: none;
  stroke-linecap: round;
}

/* Corner leaf doodles */
.tmd-doodle {
  position: absolute;
  opacity: 0.68;
  pointer-events: none;
}
.tmd-doodle.tl {
  left: 16px;
  top: 34px;
  width: 90px;
}
.tmd-doodle.tr {
  right: 18px;
  top: 72px;
  width: 112px;
}
.tmd-doodle.bl {
  left: 24px;
  bottom: 38px;
  width: 78px;
}
.tmd-doodle.br {
  right: 26px;
  bottom: 38px;
  width: 82px;
}

@media (max-width: 640px) {
  .tmd-logo {
    font-size: 38px;
  }
  .tmd-time {
    font-size: 64px;
    letter-spacing: -4px;
  }
  .tmd-doodle {
    display: none;
  }
}

/* ───────────────────────────────────────────────────────────────
   Focus screen v2 — illustrated PNG assets (logo, ring, Tom, vines).
   ─────────────────────────────────────────────────────────────── */

.tmd-logo-img {
  height: 74px;
  width: auto;
  transform: rotate(-2deg);
}
@media (max-width: 640px) {
  .tmd-logo-img {
    height: 54px;
  }
}

/* Override the speaker border to the spec's 3px */
.tmd-speaker {
  border-width: 3px;
}

/* Little yellow sparkle dashes */
.tmd-spark {
  position: absolute;
  width: 20px;
  height: 5px;
  background: var(--sunny);
  border-radius: 8px;
  z-index: 3;
}
.tmd-spark-sm {
  position: static;
  width: 12px;
  height: 4px;
}

/* Chunky pill controls */
.tmd-pill {
  height: 66px;
  min-width: 210px;
  padding: 0 30px;
  border-radius: 9999px;
  border: 3px solid var(--aubergine);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 26px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s ease, background-color 0.12s ease;
}
.tmd-pill:hover:not(:disabled) {
  transform: translateY(-2px);
}
.tmd-pill:active:not(:disabled) {
  transform: translateY(2px);
}
.tmd-pill:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.tmd-pill-primary {
  background: #4a2347;
  color: var(--cream);
}
.tmd-pill-secondary {
  background: #fff9ef;
  color: var(--aubergine);
}

/* Quiet text link under the buttons */
.tmd-quiet {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 16px;
  color: color-mix(in srgb, var(--aubergine) 72%, transparent);
  background: none;
  border: none;
  cursor: pointer;
}
.tmd-quiet:hover {
  text-decoration: underline;
}

@media (max-width: 640px) {
  .tmd-pill {
    height: 58px;
    min-width: 160px;
    font-size: 21px;
    padding: 0 22px;
  }
}

/* Mascot + bubble motion */
@keyframes tmd-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
.tmd-tom-bob {
  animation: tmd-bob 3.2s ease-in-out infinite;
}
@keyframes tmd-squish {
  0% { transform: scale(1.04, 0.9); }
  35% { transform: scale(0.95, 1.06); }
  70% { transform: scale(1.02, 0.97); }
  100% { transform: scale(1); }
}
.tmd-tom-squish {
  animation: tmd-squish 0.7s ease;
}
@keyframes tmd-pop {
  0% { transform: scale(0.6); opacity: 0; }
  70% { transform: scale(1.06); }
  100% { transform: scale(1); opacity: 1; }
}
.tmd-bubble-pop {
  animation: tmd-pop 0.35s var(--ease-standard);
}

@media (prefers-reduced-motion: reduce) {
  .tmd-tom-bob, .tmd-tom-squish, .tmd-bubble-pop {
    animation: none !important;
  }
}

/* Leaf doodles + grain give the cream background life instead of a flat fill. */
body {
  background-color: var(--cream);
  background-image:
    radial-gradient(circle at 12% 18%, rgba(91, 168, 69, 0.08) 0 1.5px, transparent 2px),
    radial-gradient(circle at 88% 72%, rgba(91, 168, 69, 0.07) 0 1.5px, transparent 2px),
    radial-gradient(circle at 70% 12%, rgba(255, 201, 60, 0.1) 0 2px, transparent 3px);
  background-size: 540px 540px, 480px 480px, 620px 620px;
}
