:root {
  /* ---- Marco palette ---- */
  --water-teal:    #2a8a9b;
  --water-teal-90: #2a8a9be6;
  --water-teal-40: #2a8a9b66;
  --water-teal-25: #2a8a9b40;
  --sunset-coral:  #e07a5f;
  --sunset-coral-25: #e07a5f40;
  --sand:          #f3e8d8;
  --sand-60:       #f3e8d899;
  --sand-30:       #f3e8d84d;
  --sand-tint:     #fbf3e2;

  /* ---- Neutrals ---- */
  --bg:            #fafaf7;
  --card:          #ffffff;
  --ink:           #1c2433;
  --stone:         #5d6772;
  --hairline:      #ece6d8;

  /* ---- Rating + status semantics ---- */
  --rating-good:   var(--water-teal);
  --rating-fine:   #b8964a;
  --rating-fine-bg: var(--sand);
  --rating-warn:   #b35a3a;
  --rating-warn-bg: var(--sunset-coral-25);
  --rating-bad:    #8a3f3f;
  --rating-bad-bg: #f3dada;

  /* ---- Type scale ---- */
  --fs-eyebrow:    13px;
  --fs-meta:       13px;
  --fs-sub:        14px;
  --fs-body:       16px;
  --fs-card-h:     20px;
  --fs-card-big:   32px;
  --fs-h1:         clamp(2.5rem, 4vw, 3.5rem);
  --fs-mega:       clamp(3rem, 5vw, 4rem);

  /* ---- Motion ---- */
  --ease:          cubic-bezier(0.2, 0.8, 0.2, 1);
  --t-fast:        160ms;
  --t-base:        200ms;
  --t-slow:        800ms;

  /* ---- Elevation ---- */
  --shadow-1: 0 1px 2px rgba(28, 36, 51, 0.06),
              0 8px 24px rgba(28, 36, 51, 0.08);
  --shadow-2: 0 2px 4px rgba(28, 36, 51, 0.08),
              0 16px 40px rgba(28, 36, 51, 0.12);

  /* ---- Radii ---- */
  --radius-hero:   18px;
  --radius-card:   18px;
  --radius-tile:   16px;
  --radius-modal:  20px;

  /* ---- Legacy aliases (pruned in final cleanup phase) ---- */
  --text:          var(--ink);
  --muted:         var(--stone);
  --accent:        var(--water-teal);
  --accent-2:      var(--water-teal);
  --accent-soft:   var(--sand-30);
  --good:          var(--rating-good);
  --warn:          var(--rating-warn);
  --bad:           var(--rating-bad);
  --border:        var(--hairline);
  --shadow:        var(--shadow-1);
  --radius:        var(--radius-card);
}

/* ---- Self-hosted faces. Inter + Fraunces (variable, latin subset). ---- */
@font-face {
  font-family: 'Inter';
  src: url('../assets/fonts/Inter-Light.woff2') format('woff2');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('../assets/fonts/Inter-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('../assets/fonts/Inter-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('../assets/fonts/Inter-SemiBold.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Fraunces';
  src: url('../assets/fonts/Fraunces-Variable.woff2') format('woff2-variations'),
       url('../assets/fonts/Fraunces-Variable.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: var(--fs-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.shell {
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
  padding: 20px 0 32px;
}

/* ------- Hero ------- */

.hero {
  position: relative;
  isolation: isolate;
  background-color: var(--ink);
  background-image:
    linear-gradient(125deg,
      rgba(15, 78, 120, 0.65) 0%,
      rgba(109, 179, 201, 0.40) 50%,
      rgba(243, 232, 216, 0.42) 100%),
    url('../assets/hero.jpg?v=11');
  background-size: cover;
  background-position: 50% 30%;
  background-repeat: no-repeat;
  color: white;
  border-radius: var(--radius-hero);
  padding: 56px 40px 48px;
  box-shadow: var(--shadow-1);
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.30);
}

@media (prefers-reduced-motion: no-preference) {
  .hero {
    transition: background-image var(--t-slow) var(--ease);
  }
}

/* DAWN 05:00–07:59 */
.hero[data-state="dawn"] {
  background-image:
    linear-gradient(125deg,
      rgba(15, 30, 50, 0.62)  0%,
      rgba(244, 168, 150, 0.42) 45%,
      rgba(224, 122, 95, 0.40) 100%),
    url('../assets/hero.jpg?v=11');
}

/* MIDDAY 08:00–16:59 */
.hero[data-state="midday"] {
  background-image:
    linear-gradient(125deg,
      rgba(15, 78, 120, 0.65) 0%,
      rgba(109, 179, 201, 0.40) 50%,
      rgba(243, 232, 216, 0.42) 100%),
    url('../assets/hero.jpg?v=11');
}

/* DUSK 17:00–04:59 (v3 — covers evening + night) */
.hero[data-state="dusk"] {
  background-image:
    linear-gradient(125deg,
      rgba(20, 25, 45, 0.68) 0%,
      rgba(72, 60, 90, 0.50)  45%,
      rgba(184, 92, 138, 0.38) 100%),
    url('../assets/hero.jpg?v=11');
}

.hero h1 {
  margin: 6px 0 4px;
  font-family: 'Fraunces', 'Inter', ui-serif, serif;
  font-weight: 600;
  font-size: var(--fs-h1);
  line-height: 1.05;
  letter-spacing: -0.02em;
}
.hero .clock {
  font-size: var(--fs-sub);
  margin: 6px 0 0;
  opacity: 0.92;
  font-weight: 500;
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  opacity: 0.95;
  font-size: var(--fs-eyebrow);
  margin: 0;
}

/* ------- Hero cards ------- */

.grid.cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin: 18px 0;
}

.card, .assistant-panel {
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-card);
  padding: 18px 20px;
  box-shadow: var(--shadow-1);
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 12px;
}
.card h2 {
  margin: 0;
  font-size: var(--fs-card-h);
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.005em;
}
.card-big {
  font-family: 'Inter', sans-serif;
  font-weight: 300;
  font-size: var(--fs-card-big);
  margin: 0 0 8px;
  color: var(--ink);
  line-height: 1.15;
  letter-spacing: -0.015em;
}
.card-big:empty { display: none; }
.card p:not(.card-big):not(.card-meta) {
  color: var(--ink);
  margin: 0;
  line-height: 1.45;
  font-size: var(--fs-body);
}
.card .card-meta {
  color: var(--stone);
  margin: 8px 0 0;
  font-size: var(--fs-meta);
  line-height: 1.4;
  display: flex;
  align-items: center;
  gap: 6px;
}

.rating-good   { color: var(--good); }
.rating-fine   { color: var(--accent-2); }
.rating-warn   { color: var(--warn); }
.rating-bad    { color: var(--bad); }

/* ------- Tiles ------- */

.tiles {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.tile {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 8px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-tile);
  padding: 20px;
  background: var(--card);
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  box-shadow: var(--shadow-1);
  cursor: pointer;
  text-align: left;
  min-height: 110px;
  font-size: var(--fs-body);
}
@media (prefers-reduced-motion: no-preference) {
  .tile {
    transition: transform var(--t-base) var(--ease),
                box-shadow var(--t-base) var(--ease);
  }
}
.tile:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
}
.tile:focus-visible {
  outline: 3px solid var(--water-teal-40);
  outline-offset: 2px;
}
.tile:active {
  transform: translateY(0);
  box-shadow: var(--shadow-1);
}

.tile-icon {
  display: inline-flex;
  width: 28px;
  height: 28px;
  color: var(--water-teal);
}
.tile-icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
}
.tile-title { font-size: var(--fs-body); font-weight: 600; line-height: 1.3; }
.tile-sub   { font-size: var(--fs-sub); color: var(--stone); font-weight: 400; line-height: 1.35; }

.tile-primary {
  background: var(--sand-tint);
  border-color: var(--hairline);
}
.tile-primary .tile-icon { color: var(--water-teal); }

.tile-accent {
  background: var(--water-teal);
  color: white;
  border-color: var(--water-teal);
}
.tile-accent .tile-title { color: white; }
.tile-accent .tile-sub { color: rgba(255, 255, 255, 0.85); }
.tile-accent .tile-icon { color: white; }

/* Carson Help tile — personal photo as the artwork. */
.tile[data-prompt="carson"] {
  background-color: var(--ink);
  background-image:
    linear-gradient(155deg,
      rgba(15, 30, 40, 0.78) 0%,
      rgba(42, 138, 155, 0.42) 55%,
      rgba(224, 122, 95, 0.50) 100%),
    url('../assets/carson-help-tile.jpg?v=11');
  background-size: cover;
  background-position: 50% 22%;
  background-repeat: no-repeat;
  color: white;
  border-color: transparent;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.30);
}
.tile[data-prompt="carson"] .tile-title { color: white; }
.tile[data-prompt="carson"] .tile-sub { color: rgba(255, 255, 255, 0.92); }
.tile[data-prompt="carson"] .tile-icon { color: white; }

/* ------- Assistant panel ------- */

.assistant-panel { padding: 22px 22px 18px; }

.assistant-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 6px;
}
.assistant-header h2 { margin: 0; font-size: clamp(1.4rem, 2vw, 1.8rem); }

.status-pill {
  font-size: var(--fs-meta);
  font-weight: 600;
  background: var(--sand-30);
  color: #1a6470;
  padding: 6px 12px;
  border-radius: 999px;
  letter-spacing: 0.01em;
}
.status-pill.thinking { background: var(--sand); color: var(--rating-warn); }
.status-pill.offline  { background: var(--sunset-coral-25); color: var(--rating-bad); }

@media (prefers-reduced-motion: no-preference) {
  .status-pill {
    transition: background-color var(--t-fast) var(--ease),
                color var(--t-fast) var(--ease);
  }
}

.prompt-chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0; }
.prompt-chips button {
  padding: 9px 14px;
  font-size: var(--fs-sub);
  border-radius: 999px;
  border: 1px solid var(--hairline);
  background: transparent;
  color: var(--ink);
  font-weight: 500;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
}
@media (prefers-reduced-motion: no-preference) {
  .prompt-chips button {
    transition: background-color var(--t-fast) var(--ease),
                border-color var(--t-fast) var(--ease);
  }
}
.prompt-chips button:hover {
  background: var(--sand-30);
  border-color: var(--water-teal);
}
.prompt-chips button:focus-visible {
  outline: 2px solid var(--water-teal-40);
  outline-offset: 1px;
}

.chat-log {
  min-height: 160px;
  max-height: 320px;
  overflow: auto;
  padding: 14px;
  border: 0;
  border-radius: 16px;
  background: #fbf9f5;
  box-shadow: inset 0 1px 0 rgba(243, 232, 216, 0.7);
}

.message {
  max-width: 84%;
  padding: 10px 14px;
  border-radius: 18px;
  margin: 4px 0;
  line-height: 1.45;
  font-size: var(--fs-body);
  white-space: pre-wrap;
}
.message + .message { margin-top: 4px; }
.message.assistant + .message.user,
.message.user + .message.assistant { margin-top: 12px; }

.message.assistant {
  background: #f8f3eb;
  border: 1px solid var(--hairline);
  color: var(--ink);
  border-bottom-left-radius: 6px;
}
.message.user {
  background: var(--water-teal);
  color: white;
  margin-left: auto;
  border: 1px solid var(--water-teal);
  border-bottom-right-radius: 6px;
}

@media (prefers-reduced-motion: no-preference) {
  .message {
    animation: chat-fade-in var(--t-base) var(--ease);
  }
}
@keyframes chat-fade-in {
  from { opacity: 0; transform: translateY(2px); }
  to   { opacity: 1; transform: translateY(0); }
}

.chat-input-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  margin-top: 12px;
}

#chat-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px 16px;
  font-size: 1.05rem;
  font-family: inherit;
  background: white;
  color: var(--text);
}
#chat-input:focus { outline: 3px solid rgba(18, 78, 120, .25); }

#voice-button {
  border: 0;
  border-radius: var(--radius-tile);
  padding: 14px 18px;
  background: var(--water-teal);
  color: white;
  font-weight: 600;
  font-size: var(--fs-body);
  cursor: pointer;
  font-family: 'Inter', sans-serif;
}
#voice-button:hover { background: #226f7e; }

#send-button {
  border: 1px solid var(--water-teal);
  border-radius: var(--radius-tile);
  padding: 14px 18px;
  background: transparent;
  color: var(--water-teal);
  font-weight: 600;
  font-size: var(--fs-body);
  cursor: pointer;
  font-family: 'Inter', sans-serif;
}
#send-button:hover { background: var(--sand-30); }

#voice-button.listening {
  background: var(--sunset-coral);
}
@media (prefers-reduced-motion: no-preference) {
  #voice-button.listening {
    animation: pulse-listening 0.8s ease-in-out infinite;
  }
}
@keyframes pulse-listening {
  0%, 100% { box-shadow: 0 0 0 0 rgba(224, 122, 95, 0.55); }
  50%      { box-shadow: 0 0 0 10px rgba(224, 122, 95, 0); }
}

.fine-print {
  color: var(--stone);
  font-size: var(--fs-sub);
  margin: 16px 0 0;
  padding: 12px 0 0;
  line-height: 1.45;
  border-top: 1px solid var(--hairline);
  font-weight: 500;
}
.fine-print em { font-style: italic; color: var(--ink); font-weight: 500; }

.foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
  padding: 16px 8px;
  font-size: var(--fs-sub);
  color: var(--stone);
  font-weight: 500;
  letter-spacing: 0.02em;
  border-top: 1px solid var(--hairline);
}
.foot-right strong { color: var(--ink); }

.foot-link {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  font: inherit;
  color: var(--stone);
  cursor: pointer;
  text-align: left;
}
.foot-link:hover, .foot-link:focus-visible {
  color: var(--ink);
  outline: none;
}
.foot-link-cta {
  margin-left: 4px;
  color: var(--water-teal);
  font-weight: 600;
}
.foot-link:hover .foot-link-cta { text-decoration: underline; }

.foot-inline-link {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  font: inherit;
  color: var(--water-teal);
  font-weight: 600;
  cursor: pointer;
}
.foot-inline-link:hover, .foot-inline-link:focus-visible {
  text-decoration: underline;
  outline: none;
}

/* ------- About dialog ------- */

.about-dialog {
  border: 0;
  padding: 0;
  border-radius: var(--radius-modal);
  background: var(--card);
  color: var(--ink);
  width: min(640px, calc(100% - 32px));
  max-height: min(86vh, 760px);
  box-shadow: 0 28px 80px rgba(15, 40, 70, 0.30);
  overflow: hidden;
}
.about-dialog::backdrop {
  background: rgba(28, 36, 51, 0.55);
  backdrop-filter: blur(8px);
}
.about-inner {
  display: flex;
  flex-direction: column;
  max-height: inherit;
  overflow-y: auto;
  padding: 28px 32px 28px;
}
.about-header {
  position: relative;
  border-bottom: 1px solid var(--hairline);
  padding-bottom: 18px;
  margin-bottom: 8px;
}
.about-header .eyebrow { color: var(--water-teal); margin-bottom: 6px; }
.about-header h2 {
  margin: 0;
  font-family: 'Fraunces', 'Inter', ui-serif, serif;
  font-weight: 600;
  font-size: 32px;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.about-close {
  position: absolute;
  top: -8px;
  right: -10px;
  appearance: none;
  border: 0;
  background: transparent;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--stone);
  width: 36px;
  height: 36px;
  border-radius: 12px;
  cursor: pointer;
}
@media (prefers-reduced-motion: no-preference) {
  .about-close {
    transition: background-color var(--t-fast) var(--ease),
                color var(--t-fast) var(--ease);
  }
}
.about-close:hover, .about-close:focus-visible {
  background: var(--sand-30);
  color: var(--ink);
  outline: none;
}
.about-section { margin: 18px 0 4px; }
.about-section h3 {
  margin: 0 0 10px;
  font-size: var(--fs-meta);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--stone);
  font-weight: 600;
}
.about-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.about-list li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  line-height: 1.5;
  color: var(--ink);
  border-bottom: 1px solid var(--hairline);
  font-size: var(--fs-body);
}
.about-list li:last-child { border-bottom: 0; }
.about-bullet {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin-top: 4px;
  color: var(--water-teal);
  fill: none;
  stroke: currentColor;
}
.about-list em { color: var(--ink); font-style: italic; font-weight: 500; }
.about-list strong { color: var(--ink); font-weight: 600; }
.about-signoff {
  margin: 22px 0 16px;
  text-align: center;
  font-size: var(--fs-sub);
  color: var(--stone);
  font-style: italic;
  letter-spacing: 0.02em;
}
.about-got-it {
  align-self: center;
  appearance: none;
  border: 0;
  background: var(--water-teal);
  color: white;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: var(--fs-body);
  padding: 12px 28px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: var(--shadow-1);
}
@media (prefers-reduced-motion: no-preference) {
  .about-got-it {
    transition: background-color var(--t-fast) var(--ease),
                box-shadow var(--t-base) var(--ease),
                transform var(--t-fast) var(--ease);
  }
}
.about-got-it:hover { background: #226f7e; box-shadow: var(--shadow-2); }
.about-got-it:active { transform: translateY(1px); }

/* ------- Responsive ------- */

@media (max-width: 1180px) {
  .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .grid.cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  .shell { width: calc(100% - 24px); padding: 14px 0 28px; }
  .hero { padding: 22px 22px 18px; }
  .grid.cards { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tiles { grid-template-columns: 1fr 1fr; gap: 10px; }
  .chat-input-row { grid-template-columns: 1fr; }
  #voice-button, #send-button { padding: 14px; }
}

/* ------- iOS notch / Dynamic Island safe-area handling -------
   Pure-additive: applies extra padding when the user agent reports
   safe-area insets (iPhones in standalone PWA mode). Layered on top
   of whatever .shell/.hero padding the polish design system uses. */
@supports (padding-top: env(safe-area-inset-top)) {
  .shell {
    padding-top: max(20px, env(safe-area-inset-top));
    padding-left: max(0px, env(safe-area-inset-left));
    padding-right: max(0px, env(safe-area-inset-right));
    padding-bottom: max(32px, env(safe-area-inset-bottom));
  }
  .hero {
    padding-top: max(56px, calc(env(safe-area-inset-top) + 24px));
  }
}

/* ------- Rating chip family ------- */

.rating-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: var(--fs-meta);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.01em;
  background: var(--hairline);
  color: var(--stone);
  white-space: nowrap;
}
.rating-chip:empty {
  display: inline-block;
  width: 56px;
  height: 22px;
  background: var(--hairline);
}
.rating-chip.rating-good {
  background: var(--water-teal-25);
  color: #1a6470;
}
.rating-chip.rating-fine {
  background: var(--rating-fine-bg);
  color: var(--rating-fine);
}
.rating-chip.rating-warn {
  background: var(--rating-warn-bg);
  color: var(--rating-warn);
}
.rating-chip.rating-bad {
  background: var(--rating-bad-bg);
  color: var(--rating-bad);
}

/* ------- Skeleton shimmer ------- */

.skeleton {
  background: linear-gradient(
    90deg,
    var(--hairline) 0%,
    rgba(243, 232, 216, 0.45) 50%,
    var(--hairline) 100%
  );
  background-size: 200% 100%;
  border-radius: 8px;
  color: transparent;
  user-select: none;
  min-height: 1.2em;
  display: block;
}
.card-big.skeleton {
  width: 60%;
  height: 32px;
}

@media (prefers-reduced-motion: no-preference) {
  .skeleton {
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
  }
}
@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ------- Card-meta icon ------- */

.icon-meta {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  color: var(--stone);
  fill: none;
  stroke: currentColor;
}

/* ------- To-Do (#13) ------- */

.todo {
  background: var(--card);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-card);
  padding: 22px 24px;
  box-shadow: var(--shadow-1);
  margin: 18px 0;
}
.todo-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 12px;
}
.todo-title {
  margin: 0;
  font-family: 'Fraunces', 'Inter', ui-serif, serif;
  font-weight: 600;
  font-size: 24px;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.todo-counter {
  background: var(--sand);
  color: var(--rating-fine);
}
.todo-counter.todo-counter-done {
  background: transparent;
  color: var(--stone);
}

.todo-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.todo-row {
  display: grid;
  grid-template-columns: 32px 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--hairline);
}
.todo-row:last-child { border-bottom: 0; }

.todo-check {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  width: 32px;
  height: 32px;
  cursor: pointer;
  color: var(--water-teal);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.todo-check svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
}
.todo-check .icon-check { display: none; }
.todo-row.done .todo-check .icon-circle { display: none; }
.todo-row.done .todo-check .icon-check  { display: inline-block; }

.todo-text {
  font-size: var(--fs-body);
  color: var(--ink);
  line-height: 1.4;
}
.todo-row.done .todo-text {
  text-decoration: line-through;
  color: var(--stone);
}

.todo-age {
  font-size: var(--fs-meta);
  color: var(--stone);
  white-space: nowrap;
}

.todo-delete {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 4px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  color: var(--stone);
  opacity: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.todo-delete svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
}
@media (prefers-reduced-motion: no-preference) {
  .todo-delete { transition: opacity var(--t-fast) var(--ease); }
}
.todo-row:hover .todo-delete,
.todo-row:focus-within .todo-delete {
  opacity: 1;
}
.todo-delete:hover { color: var(--rating-bad); }

.todo-empty {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 24px 0 8px;
  color: var(--stone);
  font-size: var(--fs-body);
  line-height: 1.4;
}
.todo-empty-icon {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  color: var(--sunset-coral);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
}
.todo-empty-mic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-width: 48px;
  min-height: 48px;
  padding: 10px;
  border: 1px solid var(--water-teal-40, rgba(42, 138, 155, 0.4));
  border-radius: 999px;
  background: var(--bg-warm, #fafaf7);
  cursor: pointer;
  transition: transform var(--t-base, 200ms) var(--ease, ease),
              box-shadow var(--t-base, 200ms) var(--ease, ease),
              background var(--t-base, 200ms) var(--ease, ease);
}
.todo-empty-mic:hover {
  background: var(--sand-30, rgba(243, 232, 216, 0.3));
  box-shadow: var(--shadow-1, 0 1px 3px rgba(28, 36, 51, 0.08));
}
.todo-empty-mic:focus-visible {
  outline: 2px solid var(--water-teal, #2a8a9b);
  outline-offset: 2px;
}
.todo-empty-mic:active {
  transform: scale(0.96);
}
.todo-empty-mic.listening {
  animation: pulse-listening 0.8s ease-in-out infinite;
}
.todo-empty p { margin: 0; }
.todo-empty strong { color: var(--ink); font-weight: 600; }
.todo-empty em { color: var(--ink); font-style: italic; font-weight: 500; }
.todo-list:not(:empty) + .todo-empty { display: none; }
@media (prefers-reduced-motion: reduce) {
  .todo-empty-mic.listening { animation: none; }
  .todo-empty-mic:active { transform: none; }
}

/* ------- Phone-width polish (480 px) ------- */

@media (max-width: 480px) {
  .shell {
    width: calc(100% - 16px);
    padding: 12px 0 24px;
  }
  .hero {
    padding: 32px 22px 24px;
    border-radius: 14px;
  }
  .hero h1 {
    font-size: clamp(1.85rem, 8vw, 2.4rem);
    line-height: 1.1;
  }
  .grid.cards {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .card {
    padding: 16px 18px;
  }
  .card-big {
    font-size: 26px;
  }
  .tiles {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .tile {
    padding: 16px;
    min-height: 96px;
  }
  .tile-icon { width: 24px; height: 24px; }

  .todo {
    padding: 18px 20px;
  }
  .todo-title { font-size: 22px; }
  .todo-row {
    grid-template-columns: 32px 1fr auto;
    column-gap: 10px;
    row-gap: 4px;
    padding: 14px 0;
  }
  .todo-age {
    grid-column: 2 / 3;
    grid-row: 2;
    font-size: 12px;
    margin-top: -2px;
  }
  .todo-delete {
    grid-column: 3;
    grid-row: 1;
    opacity: 1; /* iOS has no hover; show always at phone widths */
    color: var(--stone);
  }

  .assistant-panel { padding: 20px 18px 16px; }
  .chat-input-row { grid-template-columns: 1fr; gap: 8px; }
  #voice-button, #send-button { padding: 14px; }

  .foot {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  /* ------- Touch-target audit (≥ 44 × 44 px floor) ------- */
  .todo-check {
    width: 44px;
    height: 44px;
    margin: -6px;
    padding: 10px;
  }
  .todo-delete {
    width: 44px;
    height: 44px;
    margin: -8px -8px -8px 0;
    padding: 13px;
  }
  .about-close {
    width: 44px;
    height: 44px;
    top: -6px;
    right: -8px;
    font-size: 1.7rem;
  }
  .foot-inline-link {
    padding: 6px 0;
    min-height: 32px;
    display: inline-flex;
    align-items: center;
  }
  #voice-button, #send-button {
    min-height: 48px;
  }
}

/* ------- Phone-width tightening (360 px / iPhone SE) ------- */

@media (max-width: 360px) {
  .shell {
    width: calc(100% - 12px);
  }
  .hero {
    padding: 28px 18px 22px;
  }
  .hero h1 {
    font-size: clamp(1.65rem, 9vw, 2rem);
  }
  .card-big { font-size: 22px; }
  .tile {
    padding: 14px;
    min-height: 88px;
  }
  .tile-title { font-size: 15px; }
  .tile-sub   { font-size: 13px; }
  .prompt-chips button { padding: 8px 12px; font-size: 13px; }

  .about-inner { padding: 22px 22px 22px; }
  .about-header h2 { font-size: 26px; }
}

/* ------- Print: never. Dad won't print, but no surprises. ------- */
@media print { body { background: white; } .assistant-panel, .chat-log { display: none; } }

/* ------- Reduced motion ------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
