@import "./tokens.css";

/* ═══════════════════════════════════════════════════════════════════════════
   Limpid Home · Quiet Glass aesthetic.
   Glass blur ONLY on accents (orb, action card, AI panels). Surfaces calm.
   Mobile-first: respects safe areas, touch-friendly, no horizontal overflow.
   ═══════════════════════════════════════════════════════════════════════════ */

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  overflow-x: hidden;
  /* Soft tap highlight kills the iOS blue flash on every button */
  -webkit-tap-highlight-color: transparent;
  /* Honor iOS notch / home indicator at the page edges */
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
}

button, a, [role="button"] {
  /* Disables 300ms tap delay + double-tap-to-zoom on interactive surfaces */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: 2px solid var(--accent-edge);
  outline-offset: 3px;
  border-radius: 4px;
}

a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }

/* ── Global background · ambient gradients + neutral grain ──────────────── */

.bg-layer {
  position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none;
  background: var(--bg);
}
.bg-amb-1 {
  position: absolute; top: -25%; left: -15%; width: 60vw; height: 60vw;
  border-radius: 50%; filter: blur(60px);
  background: radial-gradient(circle, var(--ambient-1), transparent 60%);
}
.bg-amb-2 {
  position: absolute; bottom: -30%; right: -10%; width: 55vw; height: 55vw;
  border-radius: 50%; filter: blur(80px);
  background: radial-gradient(circle, var(--ambient-2), transparent 60%);
}
.bg-grain {
  position: absolute; inset: 0;
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 0 0.5 0 0 0 0.6 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/></svg>");
  opacity: 0.10;
  mix-blend-mode: overlay;
}

/* ── Header ──────────────────────────────────────────────────────────────── */

header.app-header {
  position: relative; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 32px;
  gap: 14px;
}
.app-header .left  { display: flex; align-items: center; gap: 14px; }
.app-header .right { display: flex; align-items: center; gap: 8px; }

.mark {
  display: flex; align-items: center; gap: 10px;
  color: var(--ink); text-decoration: none;
}
.mark svg { color: var(--ink); }
.mark .word {
  font-family: var(--display);
  font-size: 17px; font-weight: 500; letter-spacing: -0.02em;
}
.mark .word .dot { color: var(--accent); font-weight: 400; }

.divider {
  width: 1px; height: 16px; background: var(--glass-edge-2); margin: 0 2px;
}
.crumb {
  font-size: 13px; color: var(--ink-3); letter-spacing: 0.02em;
}

.pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  background: var(--glass-bg);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid var(--glass-edge);
  border-radius: var(--r-pill);
  box-shadow: var(--sh-glass);
}
.pill .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
}
.pill .label {
  font-size: 11.5px; color: var(--ink-2);
  font-family: var(--mono); letter-spacing: 0.02em;
}

button.icon-btn {
  /* 44pt minimum touch target — visual size 34, hit area expanded via padding */
  min-width: 44px; min-height: 44px;
  width: 44px; height: 44px;
  padding: 5px;
  border-radius: 12px;
  background: transparent; border: 1px solid transparent; color: var(--ink-3);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .25s var(--ease), border-color .25s var(--ease), color .25s var(--ease);
}
@media (hover: hover) {
  button.icon-btn:hover {
    background: var(--glass-bg);
    border-color: var(--glass-edge);
    color: var(--ink);
  }
}
button.icon-btn:active {
  background: var(--glass-bg);
  color: var(--ink);
  transform: scale(0.94);
}

.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-soft), var(--glass-bg-2));
  border: 1px solid var(--glass-edge-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 500; color: var(--ink-2);
  font-family: var(--mono); letter-spacing: 0.04em;
  margin-left: 8px;
}

/* ── Hero — 2 column: orb + content ──────────────────────────────────────── */

.hero {
  position: relative; z-index: 1;
  max-width: 1240px; margin: 0 auto;
  padding: 60px 32px 40px;
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  gap: clamp(36px, 6vw, 80px);
  align-items: center;
}

/* Orb column */
.orb-col {
  display: flex; flex-direction: column; align-items: center; gap: 24px;
}

.orb-frame {
  position: relative;
  width: 300px; height: 300px;
  display: flex; align-items: center; justify-content: center;
  perspective: 800px;
}

/* Outer halo ring — only when removed (live state) */
.orb-halo, .orb-halo-2 {
  position: absolute; border-radius: 50%; pointer-events: none;
  opacity: 0; transition: opacity .35s var(--ease), transform .15s var(--ease);
}
.orb-halo {
  width: 240px; height: 240px;
  background: radial-gradient(circle, var(--live-soft), transparent 65%);
}
.orb-halo-2 {
  width: 280px; height: 280px;
  background: radial-gradient(circle, var(--live-soft), transparent 70%);
}
body[data-state="paused"] .orb-halo   { opacity: 0.55; transform: scale(1.0); animation: haloPulse 1.6s var(--ease) infinite; }
body[data-state="paused"] .orb-halo-2 { opacity: 0.30; transform: scale(1.2); animation: haloPulse 1.6s var(--ease) infinite reverse; }

@keyframes haloPulse {
  0%, 100% { transform: scale(1.0); opacity: 0.4; }
  50%      { transform: scale(1.1); opacity: 0.7; }
}

/* The pearl */
.orb {
  position: relative;
  width: 220px; height: 220px;
  border-radius: 50%; border: 0; cursor: pointer; padding: 0;
  background: radial-gradient(circle at 30% 25%,
              var(--orb-1), var(--orb-2) 35%, var(--orb-3) 70%, var(--orb-4));
  box-shadow:
    0 1px 0 var(--orb-hi) inset,
    0 -10px 20px var(--orb-shadow-in) inset,
    0 30px 60px var(--orb-shadow-out),
    0 12px 30px var(--orb-shadow-out-2);
  transform-style: preserve-3d;
  transition: transform .35s var(--ease);
  overflow: hidden;
  animation: orbBreath 4.6s ease-in-out infinite;
}

@keyframes orbBreath {
  0%, 100% { transform: scale(1.0); }
  50%      { transform: scale(1.04); }
}

.orb-refract {
  position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 220deg,
              transparent, var(--orb-refract-1) 12%,
              transparent 25%, var(--orb-refract-2) 50%,
              transparent 60%);
  mix-blend-mode: screen;
  pointer-events: none;
  animation: refractRotate 22s linear infinite;
}
@keyframes refractRotate {
  to { transform: rotate(360deg); }
}

.orb-aurora {
  position: absolute; inset: 15%; border-radius: 50%;
  filter: blur(20px);
  opacity: 0.55;
  background: radial-gradient(circle at 50% 40%,
              var(--aurora-1), var(--aurora-2) 40%, var(--aurora-3) 80%);
  transition: background .8s var(--ease);
  pointer-events: none;
}

body[data-state="paused"] .orb-aurora {
  background: radial-gradient(circle at 50% 50%,
              var(--live), oklch(0.78 0.12 28) 30%, transparent 70%);
}

body[data-state="met"] .orb-aurora {
  opacity: 0.75;
}

.orb-spec {
  position: absolute; top: 8%; left: 10%;
  width: 60%; height: 40%; border-radius: 50%;
  background: radial-gradient(ellipse, rgba(255,255,255,0.95), rgba(255,255,255,0) 60%);
  filter: blur(2px);
  pointer-events: none;
  transition: transform .35s var(--ease);
}

.orb-glyph {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
  pointer-events: none;
}
.orb-glyph svg { opacity: 0.85; }

.orb-status {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--mono); font-size: 12px;
  color: var(--ink-3);
  letter-spacing: 0.02em;
}
.orb-status .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 8px var(--accent);
}
body[data-state="paused"] .orb-status .dot {
  background: var(--live); box-shadow: 0 0 8px var(--live);
}
body[data-state="paused"] .orb-status { color: var(--live); }
body[data-state="met"] .orb-status .dot {
  background: var(--accent-2);
}

.orb-status .label-inserted,
.orb-status .label-paused,
.orb-status .label-met { display: none; }
body[data-state="inserted"] .orb-status .label-inserted { display: inline; }
body[data-state="paused"]   .orb-status .label-paused   { display: inline; }
body[data-state="met"]      .orb-status .label-met      { display: inline; }

/* Hero text column */
.hero-text { max-width: 620px; }

.eyebrow {
  margin: 0 0 14px;
  font-family: var(--mono);
  font-size: 11px; color: var(--ink-3);
  letter-spacing: 0.10em; text-transform: uppercase;
}

/* Hero title — huge wear number is the answer; "din 22h · aproape" the context */
h1.hero-title {
  margin: 0 0 16px;
  display: flex; flex-direction: column; gap: 6px;
  font-family: var(--display);
  color: var(--ink);
  text-wrap: balance;
}
h1.hero-title .big {
  font-weight: 300;
  font-size: clamp(56px, 7vw, 92px);
  line-height: 0.95;
  letter-spacing: -0.045em;
  font-feature-settings: "tnum" 1, "ss01" 1;
}
h1.hero-title .of {
  font-weight: 400;
  font-size: clamp(15px, 1.5vw, 18px);
  letter-spacing: -0.005em;
  color: var(--ink-3);
}
h1.hero-title .em { font-weight: 500; color: var(--accent-2); }

.hero-lede {
  margin: 0 0 22px;
  max-width: 460px;
  font-size: 15.5px; line-height: 1.5;
  color: var(--ink-3);
  text-wrap: pretty;
}

/* Inline meta line — replaces the 3-row glass card. Tight, scannable. */
.meta-line {
  list-style: none;
  display: flex; flex-wrap: wrap;
  gap: 6px 16px;
  padding: 0; margin: 0 0 28px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--ink-3);
  letter-spacing: 0.02em;
}
.meta-line li {
  display: inline-flex; align-items: center;
}
.meta-line li + li {
  padding-left: 16px;
  border-left: 1px solid var(--glass-edge-2);
}
.meta-line strong {
  color: var(--ink-2);
  font-weight: 500;
  margin: 0 4px 0 6px;
  font-feature-settings: "tnum" 1;
}

/* CTA row — primary pill + ghost link */
.cta-row {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 8px;
}

button.cta-pill {
  display: inline-flex; align-items: center; justify-content: space-between;
  gap: 14px;
  height: 52px; padding: 0 22px 0 24px;
  background: var(--ink); color: var(--paper);
  border: 0; cursor: pointer;
  border-radius: var(--r-pill);
  font-family: var(--sans); font-size: 15px; font-weight: 500;
  letter-spacing: -0.005em;
  transition: filter .2s var(--ease), transform .2s var(--ease);
  box-shadow: var(--sh-1);
}
@media (hover: hover) {
  button.cta-pill:hover { filter: brightness(1.08); transform: translateY(-1px); }
}
button.cta-pill:active { transform: scale(0.98); filter: brightness(1.04); }

button.cta-pill .label-inserted,
button.cta-pill .label-paused,
button.cta-pill .label-met { display: none; }
body[data-state="inserted"] button.cta-pill .label-inserted { display: inline; }
body[data-state="paused"]   button.cta-pill .label-paused   { display: inline; }
body[data-state="met"]      button.cta-pill .label-met      { display: inline; }

button.cta-link {
  display: inline-flex; align-items: baseline; gap: 8px;
  height: 52px; padding: 0 18px;
  background: transparent;
  border: 0; cursor: pointer;
  border-radius: var(--r-pill);
  color: var(--ink-2); font-family: var(--sans); font-size: 14px;
  transition: color .2s var(--ease), background .2s var(--ease);
}
@media (hover: hover) {
  button.cta-link:hover { color: var(--ink); background: var(--glass-bg); }
}
button.cta-link:active { color: var(--ink); background: var(--glass-bg); }
button.cta-link .link-meta {
  font-family: var(--mono); font-size: 11px;
  color: var(--ink-4); letter-spacing: 0.06em; text-transform: uppercase;
}

/* ── Two-column section row ──────────────────────────────────────────────── */

.section-row {
  position: relative; z-index: 1;
  max-width: 1240px; margin: 0 auto;
  padding: 0 32px 80px;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 32px;
}

@media (max-width: 880px) {
  .section-row { grid-template-columns: 1fr; }
  .hero { grid-template-columns: 1fr; padding-top: 40px; }
}

/* ── Panel — quiet glass card primitive ──────────────────────────────────── */

.panel {
  padding: 26px;
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  border: 1px solid var(--glass-edge);
  border-radius: var(--r-3);
  box-shadow: var(--sh-1), var(--sh-glass);
}
.panel.bare { padding: 0; overflow: hidden; }

.panel-head {
  display: flex; justify-content: space-between; align-items: flex-end;
  margin-bottom: 14px;
}
.panel-eyebrow {
  font-family: var(--mono); font-size: 10.5px;
  color: var(--ink-3);
  letter-spacing: 0.10em; text-transform: uppercase;
}
.panel-title {
  margin: 6px 0 0;
  font-family: var(--display);
  font-weight: 300;
  font-size: 22px;
  letter-spacing: -0.025em;
  color: var(--ink);
}
.panel-action {
  background: transparent; border: 0; cursor: pointer;
  color: var(--ink-2); font-size: 12.5px;
  padding: 4px 10px;
  border-bottom: 1px solid var(--glass-edge-2);
  border-radius: 0;
  font-family: var(--sans);
}
.panel-action:hover { color: var(--ink); }

/* ── Activity · single-line tight rows ─────────────────────────────────── */

.act-list { list-style: none; padding: 0; margin: 0; }

.act-row {
  display: grid; grid-template-columns: 60px 1fr auto;
  align-items: baseline;
  gap: 16px;
  padding: 14px 4px;
  border-bottom: 1px solid var(--glass-edge);
  transition: background .2s var(--ease);
}
.act-row:last-child { border-bottom: 0; }
@media (hover: hover) {
  .act-row:hover { background: var(--glass-bg); border-radius: var(--r-1); }
}
.act-row:active { background: var(--glass-bg); border-radius: var(--r-1); }

.act-time {
  font-family: var(--mono);
  font-size: 12.5px; color: var(--ink-3);
  letter-spacing: 0.02em;
  font-feature-settings: "tnum" 1;
}
.act-what {
  font-size: 14.5px; color: var(--ink); font-weight: 400;
}
.act-len {
  font-family: var(--mono); font-size: 13px;
  color: var(--ink-2);
  font-feature-settings: "tnum" 1;
}
.act-len.long { color: var(--live); font-weight: 500; }

/* Confidence ring (compact) — re-used for streak/tray progress */
.mini-ring {
  position: relative; width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
}
.mini-ring .num {
  position: absolute;
  font-family: var(--mono); font-size: 9px;
  color: var(--ink-2); font-weight: 500;
}

/* ── Send-to-dentist panel (NEW Limpid feature) ──────────────────────────── */

.dentist-card {
  display: flex; flex-direction: column; gap: 18px;
}
.dentist-head {
  display: flex; align-items: center; gap: 14px;
}
.dentist-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-soft), var(--glass-bg-2));
  border: 1px solid var(--accent-edge);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 500; color: var(--accent-2);
  font-family: var(--mono); letter-spacing: 0.04em;
}
.dentist-info { display: flex; flex-direction: column; gap: 2px; }
.dentist-name { font-size: 15px; font-weight: 500; color: var(--ink); }
.dentist-role {
  font-family: var(--mono); font-size: 11px;
  color: var(--ink-3); letter-spacing: 0.06em; text-transform: uppercase;
}

.dentist-status-row {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--glass-edge);
  border-radius: var(--r-2);
  overflow: hidden;
}
.dentist-status-cell {
  background: var(--glass-bg-2);
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 4px;
}
.dentist-status-cell .lab {
  font-family: var(--mono); font-size: 10px;
  color: var(--ink-3); letter-spacing: 0.10em; text-transform: uppercase;
}
.dentist-status-cell .val {
  font-size: 14px; color: var(--ink); font-weight: 500;
}
.dentist-status-cell .val .mono { font-family: var(--mono); font-weight: 400; color: var(--ink-2); }

.dentist-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-soft {
  padding: 9px 16px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-edge);
  border-radius: var(--r-pill);
  color: var(--accent-2);
  font-size: 13px; font-weight: 500; font-family: var(--sans);
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  transition: all .2s var(--ease);
}
.btn-soft:hover { filter: brightness(0.97); }
.btn-ghost {
  padding: 9px 16px;
  background: transparent;
  border: 1px solid var(--glass-edge);
  border-radius: var(--r-pill);
  color: var(--ink-2);
  font-size: 13px; font-family: var(--sans);
  cursor: pointer;
  transition: all .2s var(--ease);
}
.btn-ghost:hover { color: var(--ink); border-color: var(--glass-edge-2); }

/* ── Stats row (4 tiles with sparklines) ─────────────────────────────────── */

.stats-row {
  position: relative; z-index: 1;
  max-width: 1240px; margin: 0 auto;
  padding: 0 32px 100px;
}
.stats-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 24px;
}
.stats-head h2 {
  margin: 6px 0 0;
  font-family: var(--display); font-weight: 300;
  font-size: 30px; line-height: 1.1; letter-spacing: -0.03em;
  color: var(--ink);
}

.stats-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px;
}
@media (max-width: 880px) { .stats-grid { grid-template-columns: 1fr; } }

.big-unit {
  font-size: 0.55em; color: var(--ink-3); margin-left: 2px;
  font-weight: 300;
}

.stat-tile {
  position: relative; overflow: hidden;
  padding: 22px;
  background: var(--glass-bg-2);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid var(--glass-edge);
  border-radius: var(--r-3);
  box-shadow: var(--sh-1), var(--sh-glass);
}
.stat-tile.aurora::before {
  content: ""; position: absolute; inset: -2px; z-index: 0;
  opacity: 0.35; pointer-events: none; filter: blur(20px);
  background:
    radial-gradient(circle at 80% 0%, var(--aurora-1), transparent 50%),
    radial-gradient(circle at 0% 100%, var(--aurora-3), transparent 60%);
}
.stat-tile > * { position: relative; z-index: 1; }

.stat-delta {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--mono); font-size: 10.5px; color: var(--accent-2);
  padding: 3px 8px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-edge);
  border-radius: var(--r-pill);
}
.stat-delta.warn { color: var(--live); background: var(--live-soft); border-color: var(--live-edge); }

.stat-big-wrap {
  display: flex; flex-direction: column; gap: 4px; margin-top: 18px;
}
.stat-big {
  font-family: var(--display); font-weight: 300;
  font-size: 40px; line-height: 1; color: var(--ink);
  letter-spacing: -0.035em;
}
.stat-sub { font-size: 12.5px; color: var(--ink-3); }

.spark { width: 100%; height: 36px; margin-top: 12px; display: block; }

/* ── Photos ──────────────────────────────────────────────────────────────── */

.photos-row {
  position: relative; z-index: 1;
  max-width: 1240px; margin: 0 auto;
  padding: 0 32px 100px;
}
.photo-strip {
  list-style: none; padding: 0; margin: 0;
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px;
}
@media (max-width: 880px) { .photo-strip { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 520px) { .photo-strip { grid-template-columns: repeat(2, 1fr); } }

.ph {
  aspect-ratio: 3 / 4;
  border: 1px solid var(--glass-edge);
  border-radius: var(--r-2);
  background: linear-gradient(135deg, var(--accent-soft), var(--glass-bg-2));
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 12px;
  cursor: pointer;
  transition: all .25s var(--ease);
}
@media (hover: hover) {
  .ph:hover {
    transform: translateY(-2px);
    border-color: var(--accent-edge);
    box-shadow: var(--sh-1);
  }
}
.ph:active {
  transform: scale(0.97);
  border-color: var(--accent-edge);
}
.ph .wk {
  font-family: var(--mono); font-size: 11px;
  color: var(--ink-2);
  letter-spacing: 0.08em;
  font-feature-settings: "tnum" 1;
  font-weight: 500;
}
.ph time {
  font-size: 10.5px; color: var(--ink-3);
  font-family: var(--mono);
  letter-spacing: 0.04em;
}
.ph:first-child {
  border-color: var(--accent-edge);
  background: linear-gradient(135deg, var(--accent-soft), var(--paper));
}
.ph:first-child .wk { color: var(--accent-2); }

/* ── Footer ──────────────────────────────────────────────────────────────── */

.app-footer {
  position: relative; z-index: 1;
  max-width: 1240px; margin: 0 auto;
  padding: 0 32px 48px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  font-size: 12px; color: var(--ink-3);
}
.app-footer .privacy { color: var(--ink-3); }
.app-footer .stack {
  font-family: var(--mono); letter-spacing: 0.04em;
  color: var(--ink-4);
}

/* ── Tweaks panel · compact, just swatches + state pills ─────────────── */

.tweaks {
  position: fixed; right: 20px; bottom: 20px; z-index: 50;
  background: var(--glass-bg-2);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  border: 1px solid var(--glass-edge);
  border-radius: var(--r-pill);
  box-shadow: var(--sh-2), var(--sh-glass);
  padding: 8px;
  display: flex; align-items: center; gap: 12px;
}

.tweaks-themes {
  display: flex; gap: 4px;
}
.tweaks-theme {
  width: 28px; height: 28px; padding: 0;
  background: transparent; border: 0; cursor: pointer;
  border-radius: 50%;
  display: grid; place-items: center;
  transition: transform .2s var(--ease);
}
@media (hover: hover) {
  .tweaks-theme:hover { transform: scale(1.1); }
}
.tweaks-theme:active { transform: scale(0.94); }
.tweaks-theme .swatch {
  width: 20px; height: 20px; border-radius: 50%;
  border: 1px solid var(--glass-edge-2);
  box-shadow: 0 0 0 0px var(--accent-edge);
  transition: box-shadow .2s var(--ease);
}
.tweaks-theme.active .swatch {
  box-shadow: 0 0 0 2px var(--accent), 0 0 0 4px var(--paper);
}
.tweaks-theme .name { display: none; } /* compact mode hides text labels */

.tweaks-divider {
  width: 1px; height: 18px; background: var(--glass-edge-2);
}

.tweaks-states {
  display: flex; gap: 2px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-edge);
  border-radius: var(--r-pill);
  padding: 2px;
}
.tweaks-state {
  background: transparent; border: 0;
  border-radius: var(--r-pill);
  font-size: 11px; padding: 5px 10px;
  color: var(--ink-3); cursor: pointer;
  font-family: var(--mono); letter-spacing: 0.04em;
  transition: all .2s var(--ease);
}
@media (hover: hover) {
  .tweaks-state:hover { color: var(--ink-2); }
}
.tweaks-state:active { color: var(--ink); background: var(--glass-bg); }
.tweaks-state.active {
  background: var(--paper);
  color: var(--ink);
  box-shadow: var(--sh-1);
}

/* ═══════════════════════════════════════════════════════════════════════════
   Responsive · mobile-first refinements
   Breakpoints: 880 (tablet) · 640 (phone-l) · 480 (phone) · 380 (phone-s)
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Tablet portrait & smaller ──────────────────────────────────────────── */
@media (max-width: 880px) {
  header.app-header { padding: 16px 20px; }
  .hero { padding: 36px 20px 24px; gap: 32px; }
  .section-row { padding: 0 20px 56px; gap: 20px; }
  .stats-row, .photos-row { padding: 0 20px 64px; }
  .app-footer { padding: 0 20px 32px; }

  .orb-frame { width: 260px; height: 260px; }
  .orb { width: 200px; height: 200px; }
  .orb-halo  { width: 220px; height: 220px; }
  .orb-halo-2 { width: 260px; height: 260px; }

  h1.hero-title .big { font-size: clamp(48px, 11vw, 76px); }
  .stats-head h2 { font-size: 26px; }
  .panel-title { font-size: 20px; }

  /* Photos drop to 3 columns on tablet portrait — already in earlier rule */
}

/* ── Phone landscape & smaller ──────────────────────────────────────────── */
@media (max-width: 640px) {
  header.app-header {
    padding: 12px 16px;
    /* Honor iOS notch on landscape */
    padding-top: max(12px, env(safe-area-inset-top));
  }
  .hero {
    padding: 24px 16px 16px;
    gap: 24px;
    text-align: center;
  }
  .orb-col { gap: 16px; width: 100%; }
  .hero-text { max-width: 100%; }
  .meta-line { justify-content: center; }
  .cta-row { justify-content: center; }

  .section-row { padding: 0 16px 40px; gap: 16px; }
  .stats-row, .photos-row { padding: 0 16px 48px; }
  .app-footer {
    padding: 0 16px 32px;
    padding-bottom: max(32px, env(safe-area-inset-bottom));
  }

  .panel { padding: 20px; border-radius: var(--r-2); }

  /* Brand sub-divider + crumb take too much space */
  .app-header .left .divider,
  .app-header .left .crumb { display: none; }
  /* Hide the connection pill on small screens — info isn't needed at-glance */
  .pill { display: none; }
  /* Avatar still useful as an entry point but smaller */
  .avatar { width: 36px; height: 36px; font-size: 11px; }

  /* Hero title — clamp range tuned to phone widths */
  h1.hero-title { gap: 4px; }
  h1.hero-title .big {
    font-size: clamp(40px, 13vw, 60px);
    letter-spacing: -0.04em;
  }
  h1.hero-title .of { font-size: 14px; }
  .hero-lede { margin-bottom: 18px; font-size: 15px; }

  /* Meta line: drop the vertical separator (looks weird wrapped),
     use bullet character instead */
  .meta-line { gap: 4px 10px; font-size: 12px; }
  .meta-line li + li {
    padding-left: 0;
    border-left: 0;
  }
  .meta-line li + li::before {
    content: "·";
    color: var(--ink-4);
    margin-right: 10px;
  }

  /* CTA row — full-width primary on phone, link wraps below */
  .cta-row { flex-direction: column; align-items: stretch; gap: 6px; }
  button.cta-pill {
    width: 100%;
    height: 56px;
    justify-content: center;
    gap: 10px;
  }
  button.cta-link {
    width: 100%; justify-content: center;
    height: 44px;
  }

  /* Send-to-dentist grid stays 2-col but tighter */
  .dentist-status-cell { padding: 12px 14px; }
  .dentist-status-cell .val { font-size: 13.5px; }

  /* Stats grid — single column on phone with tighter padding */
  .stats-grid { gap: 10px; }
  .stat-tile { padding: 18px; border-radius: var(--r-2); }
  .stat-big { font-size: 36px; }

  /* Photo strip — 3 columns is right for 640px and below */
  .photo-strip { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .ph { padding: 10px; border-radius: var(--r-1); }
  .ph .wk { font-size: 10.5px; }
  .ph time { font-size: 10px; }

  /* Activity rows — slightly tighter */
  .act-row {
    grid-template-columns: 50px 1fr auto;
    gap: 12px;
    padding: 12px 4px;
  }
  .act-time, .act-len { font-size: 12px; }
  .act-what { font-size: 14px; }

  /* Tweaks pill — reposition bottom-center, full-width on small phones */
  .tweaks {
    right: 12px; left: 12px; bottom: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
    justify-content: center;
    padding: 6px 8px;
  }
  .tweaks-theme {
    min-width: 36px; min-height: 36px;
    width: 36px; height: 36px;
  }
  .tweaks-state {
    min-height: 36px;
    padding: 6px 12px;
    font-size: 12px;
  }
  .tweaks-states { padding: 3px; }

  /* Footer wraps better */
  .app-footer { flex-wrap: wrap; gap: 8px; font-size: 11.5px; }
}

/* ── Small phones (iPhone SE, older Androids) ──────────────────────────── */
@media (max-width: 480px) {
  header.app-header { gap: 8px; }
  .app-header .right { gap: 4px; }
  /* Hide print icon on smallest screens — moved to settings drawer in v1 */
  .app-header .right > button.icon-btn:nth-child(2) { display: none; }

  .orb-frame { width: 220px; height: 220px; }
  .orb { width: 170px; height: 170px; }
  .orb-halo  { width: 190px; height: 190px; }
  .orb-halo-2 { width: 220px; height: 220px; }

  h1.hero-title .big { font-size: clamp(36px, 14vw, 52px); }

  /* Stats: condense aurora bg cost — hide the radial overlay on small screens */
  .stat-tile.aurora::before { display: none; }

  /* Tweaks pill: reduce gap, allow shrink */
  .tweaks { gap: 8px; }
  .tweaks-themes { gap: 2px; }
  .tweaks-divider { display: none; }
}

/* ── Tiny phones (320px) ────────────────────────────────────────────────── */
@media (max-width: 380px) {
  .hero { padding: 20px 14px 12px; }
  .section-row, .stats-row, .photos-row { padding-left: 14px; padding-right: 14px; }

  .panel { padding: 16px; }
  .panel-title { font-size: 18px; }
  .panel-eyebrow { font-size: 10px; }

  h1.hero-title .big { font-size: 38px; }

  /* Photos: 2-col on very small */
  .photo-strip { grid-template-columns: repeat(2, 1fr); }

  /* Tweaks: stack themes into one tighter row */
  .tweaks-theme { width: 32px; height: 32px; min-width: 32px; min-height: 32px; }
  .tweaks-state { padding: 5px 8px; font-size: 11.5px; }
}

/* ── Landscape phones · prevent wasted vertical space ──────────────────── */
@media (max-height: 480px) and (orientation: landscape) {
  .hero { padding: 16px 20px; }
  .orb-frame { width: 200px; height: 200px; }
  .orb { width: 160px; height: 160px; }
}

/* ── Dark themes · backdrop-filter cost on low-end devices ─────────────── */
@media (prefers-reduced-transparency: reduce) {
  .panel, .stat-tile, .tweaks, .pill {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: var(--paper) !important;
  }
}

/* ── High-density displays · sharper hairlines ─────────────────────────── */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .field-divider, .meta-line li + li,
  .act-row, .activity-row {
    /* Browsers already render hairlines correctly — placeholder for future tuning */
  }
}

