:root {
  --bg: #0c0e14;
  --panel: #141824;
  --panel-2: #1a1f2e;
  --line: rgba(120, 160, 220, 0.14);
  --text: #e8ecf4;
  --muted: #8b93a7;
  --accent: #5b9fd4;
  --accent-2: #7dd3a0;
  --warn: #e0a85c;
  --danger: #e07070;
  --gain: #e07070;
  --loss: #7dd3a0;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --sans: "IBM Plex Sans", system-ui, sans-serif;
  --radius: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(91, 159, 212, 0.12), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(125, 211, 160, 0.06), transparent 50%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.45;
}

a { color: var(--accent); }

.top {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 20px 8px;
}
.brand {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}
.back {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  margin-top: 10px;
  white-space: nowrap;
}
.back:hover { color: var(--text); border-color: var(--accent); }
.brand-titles {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}
.tag {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0;
}
h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.wordmark {
  display: flex;
  align-items: center;
  gap: 0;
  margin: 0;
  line-height: 1;
}
.wordmark-banner {
  display: block;
  height: 86px; /* ~20% larger than 72px */
  width: auto;
  max-width: min(500px, 85vw);
  object-fit: contain;
  object-position: left center;
  background: transparent;
}
@media (max-width: 520px) {
  .wordmark-banner { height: 67px; }
}
.wordmark-img {
  display: block;
  height: 32px;
  width: auto;
}
.wordmark-text {
  display: none;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.wordmark-text .tau {
  background: linear-gradient(135deg, #5b9fd4, #7dd3a0);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.tagline {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
}
#coach-meta.quota-hit {
  color: var(--warn, #e0a85c);
  font-weight: 500;
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px 20px 48px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
@media (max-width: 1000px) {
  .stats { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 700px) {
  .stats { grid-template-columns: 1fr 1fr; }
}

.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.stat.accent {
  border-color: rgba(91, 159, 212, 0.35);
  background: linear-gradient(160deg, rgba(91, 159, 212, 0.12), var(--panel));
}
.stat-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.stat-value {
  font-family: var(--mono);
  font-size: 26px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.stat-value.loss { color: var(--loss); }
.stat-value.gain { color: var(--gain); }
.stat-value.bmi-under, .stat-value.bf-underfat, .stat-value.waist-low { color: var(--accent); }
.stat-value.bmi-normal, .stat-value.bf-healthy, .stat-value.waist-healthy { color: var(--loss); }
.stat-value.bmi-over, .stat-value.bf-overfat, .stat-value.waist-increased { color: var(--warn); }
.stat-value.bmi-obese, .stat-value.bf-obese, .stat-value.waist-high { color: var(--danger); }
.stat-sub {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.range-bar {
  position: relative;
  display: flex;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 10px;
  border: 1px solid var(--line);
}
.range-seg { flex: 1; }
.range-seg.under { background: #5b9fd4; }
.range-seg.normal { background: #7dd3a0; }
.range-seg.over { background: #e0a85c; }
.range-seg.obese { background: #e07070; }
.range-marker {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 3px;
  margin-left: -1.5px;
  background: #fff;
  border-radius: 2px;
  box-shadow: 0 0 6px rgba(255,255,255,0.7);
  left: 0%;
  transition: left 0.5s cubic-bezier(0.34, 1.2, 0.64, 1);
}

.height-row { margin-top: 4px; }
.height-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}
.height-inputs {
  display: flex;
  gap: 10px;
}
.height-inputs label {
  min-width: 0;
  flex: 1;
}

/* View tabs */
.view-tabs {
  display: flex;
  gap: 6px;
  margin: 14px 0 0;
}
.view-tab {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
}
.view-tab:hover { color: var(--text); }
.view-tab.active {
  color: #0a1018;
  background: var(--accent);
  border-color: var(--accent);
}

.pill {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: var(--panel-2);
}
.pill.up {
  color: var(--loss);
  border-color: rgba(125, 211, 160, 0.4);
  background: rgba(125, 211, 160, 0.08);
}
.pill.down {
  color: var(--danger);
  border-color: rgba(224, 112, 112, 0.35);
}

.photo-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}
.photo-form label.grow { flex: 1; min-width: 180px; }
.photo-form label.check {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  min-width: auto;
}
.photo-preview {
  margin-top: 12px;
  max-width: 280px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.photo-preview img {
  display: block;
  width: 100%;
  height: auto;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}
.gal-card {
  display: block;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--panel-2);
  cursor: pointer;
  text-align: left;
  color: inherit;
}
.gal-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 20px rgba(91, 159, 212, 0.15);
}
.gal-card img {
  display: block;
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  background: #0a1018;
}
.gal-meta { padding: 8px 10px 10px; }
.gal-date {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}
.gal-scores {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
}

#photo-dialog {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  padding: 0;
  max-width: min(980px, calc(100vw - 16px));
  width: 100%;
  max-height: calc(100dvh - 16px);
  overflow: auto;
}
#photo-dialog::backdrop { background: rgba(0, 0, 0, 0.65); }
.photo-dialog-body {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 1fr);
  gap: 0;
  /* Dialog itself scrolls — don't trap projection/ratings in a clipped pane */
  max-height: none;
}
@media (max-width: 820px) {
  .photo-dialog-body { grid-template-columns: 1fr; }
}
.pd-images {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  background: #05070c;
  max-height: none;
  overflow: visible;
}
/* Stack Now / At-goal so both images stay visible (esp. mobile).
   Side-by-side only on wide desktops where the left pane is roomy. */
.pd-images.has-projection {
  grid-template-columns: 1fr;
}
@media (min-width: 1100px) {
  #photo-dialog { max-width: min(1200px, calc(100vw - 24px)); }
  .pd-images.has-projection {
    grid-template-columns: 1fr 1fr;
  }
}
.pd-images figure {
  margin: 0;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
/* Mobile Safari sometimes still paints a broken-image glyph if only [hidden] is set */
.pd-images figure[hidden],
#pd-proj-wrap[hidden] {
  display: none !important;
}
.pd-images figure + figure {
  border-top: 1px solid var(--line);
}
@media (min-width: 1100px) {
  .pd-images.has-projection figure + figure {
    border-top: none;
    border-left: 1px solid var(--line);
  }
}
.pd-images figcaption {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 8px 10px 0;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.pd-zoom-hint {
  letter-spacing: 0.04em;
  text-transform: none;
  opacity: 0.65;
  font-size: 10px;
}
.pd-images img {
  width: 100%;
  max-height: min(52dvh, 560px);
  object-fit: contain;
  background: #05070c;
}
.pd-images.has-projection img {
  max-height: min(40dvh, 420px);
}
.pd-images img.pd-zoomable {
  cursor: zoom-in;
}
.pd-images img.pd-zoomable:hover {
  outline: 1px solid rgba(91, 159, 212, 0.45);
}

/* Full-screen zoom for Now / At-goal thumbs.
   Must be a <dialog showModal()> so it stacks above #photo-dialog's top layer. */
.photo-lightbox {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 48px 16px 24px;
  border: none;
  border-radius: 0;
  background: rgba(0, 0, 0, 0.92);
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: zoom-out;
  box-sizing: border-box;
}
.photo-lightbox:not([open]) {
  display: none;
}
.photo-lightbox::backdrop {
  background: rgba(0, 0, 0, 0.85);
}
.photo-lightbox img {
  max-width: min(96vw, 1400px);
  max-height: min(88dvh, 1200px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.55);
  cursor: default;
}
.photo-lightbox-cap {
  margin: 0;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #c5cad6;
}
.photo-lightbox-close {
  position: absolute;
  top: 12px;
  right: 14px;
  z-index: 1;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(120, 160, 220, 0.35);
  border-radius: 8px;
  background: rgba(20, 24, 36, 0.95);
  color: var(--text);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  pointer-events: auto;
}
.photo-lightbox-close:hover {
  border-color: var(--accent);
  color: #fff;
}
.photo-dialog-meta {
  padding: 18px;
  overflow: visible;
  min-width: 0;
}
.photo-dialog-meta h3 { margin: 0 0 12px; }
.pd-compare-scores {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 12px;
}
/* Always stack Now vs At-goal ratings — side-by-side crushes the 3 score tiles */
.pd-compare-scores.has-goal {
  grid-template-columns: 1fr;
  gap: 14px;
}
.pd-score-col + .pd-score-col {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.pd-col-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}
.pd-scores {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}
.pd-scores > div {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  min-width: 0;
}
.pd-scores strong {
  display: block;
  font-size: 13px;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.pd-scores .muted {
  display: block;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.pd-just {
  font-size: 14px;
  color: var(--text);
  line-height: 1.45;
}
.pd-obs {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  white-space: pre-wrap;
  background: var(--panel-2);
  border-radius: 8px;
  padding: 10px;
  border: 1px solid var(--line);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px 18px;
  margin-bottom: 14px;
}
.panel h2 {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.panel-head h2 { margin-bottom: 0; }

.log-form, .settings-form, .edit-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
}
.log-form label, .settings-form label, .edit-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
  min-width: 120px;
}
.log-form label.grow { flex: 1; min-width: 180px; }
.settings-form { flex-direction: column; align-items: stretch; }
.settings-form label { min-width: 0; }

input[type="date"],
input[type="datetime-local"],
input[type="number"],
input[type="text"],
textarea,
select {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  outline: none;
}
textarea {
  resize: vertical;
  min-height: 56px;
  line-height: 1.35;
  width: 100%;
  box-sizing: border-box;
}
select {
  min-height: 38px;
}
input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(91, 159, 212, 0.15);
}

.btn {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 8px;
  padding: 9px 14px;
  cursor: pointer;
}
.btn:hover { border-color: var(--accent); }
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #0a1018;
}
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.danger {
  background: transparent;
  border-color: rgba(224, 112, 112, 0.4);
  color: var(--danger);
}
.btn.danger:hover { background: rgba(224, 112, 112, 0.12); }

.hint, .field-hint {
  font-size: 12px;
  color: var(--muted);
  margin: 10px 0 0;
}
.field-hint { margin: 2px 0 0; display: block; }
.hint.ok { color: var(--loss); }
.hint.err { color: var(--danger); }
.muted { color: var(--muted); font-style: normal; font-weight: 400; }

.range-tabs { display: flex; gap: 4px; }
.tab {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
}
.tab:hover { color: var(--text); }
.tab.active {
  color: var(--text);
  border-color: var(--line);
  background: var(--panel-2);
}

.head-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Only present while a chart is actually zoomed — see chart_zoom.js */
.zoom-reset {
  border-color: var(--line);
  background: var(--panel-2);
}
.zoom-reset:hover { color: var(--text); border-color: var(--accent); }
.zoom-reset[hidden] { display: none; }

.zoom-hint { color: var(--muted); }

.chart-wrap {
  position: relative;
  height: 320px;
  margin-top: 8px;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 14px;
}
@media (max-width: 900px) {
  .two-col { grid-template-columns: 1fr; }
}

.math-box {
  margin-top: 16px;
  padding: 12px;
  background: var(--panel-2);
  border-radius: 8px;
  border: 1px dashed var(--line);
  font-size: 12px;
  color: var(--muted);
}
.math-box strong {
  display: block;
  color: var(--text);
  margin-bottom: 8px;
  font-size: 12px;
}
.math-box code {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent-2);
  margin: 4px 0;
}

.table-wrap {
  overflow-x: auto;
  max-height: 420px;
  overflow-y: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 12px;
}
th {
  text-align: left;
  color: var(--muted);
  font-weight: 500;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--panel);
}
td {
  padding: 7px 8px;
  border-bottom: 1px solid rgba(120, 160, 220, 0.06);
  font-variant-numeric: tabular-nums;
}
tr:hover td { background: rgba(91, 159, 212, 0.05); }
td.num { text-align: right; }
button.linkish {
  background: none;
  border: none;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 11px;
  cursor: pointer;
  padding: 0;
}
button.linkish:hover { text-decoration: underline; }

footer {
  text-align: center;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 8px 20px 32px;
  opacity: 0.7;
}

dialog {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  padding: 0;
  max-width: 400px;
  width: calc(100% - 32px);
}
dialog::backdrop { background: rgba(0, 0, 0, 0.55); }
.edit-form {
  padding: 18px;
  flex-direction: column;
  align-items: stretch;
}
.edit-form h3 { margin: 0 0 8px; }
.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}
.dialog-actions .grow {
  flex: 1 1 40px;
  min-width: 12px;
}
.grow { flex: 1; }

.empty {
  color: var(--muted);
  font-size: 13px;
  padding: 12px 0;
}

/* ========== Motivational coach ========== */
#fx-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1000;
  overflow: hidden;
}

.coach {
  display: grid;
  grid-template-columns: minmax(200px, 280px) 1fr;
  gap: 20px;
  align-items: stretch;
  overflow: hidden;
  position: relative;
  border-color: rgba(91, 159, 212, 0.28);
  background:
    linear-gradient(135deg, rgba(91, 159, 212, 0.08), transparent 45%),
    var(--panel);
}
@media (max-width: 720px) {
  .coach { grid-template-columns: 1fr; }
  .coach-art { max-width: 280px; margin: 0 auto; }
}

.coach-art {
  position: relative;
}
.mood-frame {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #0a1018;
  aspect-ratio: 1;
  box-shadow:
    0 0 0 1px rgba(91, 159, 212, 0.08),
    0 12px 40px rgba(0, 0, 0, 0.35);
}
.mood-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.35s ease, transform 0.6s cubic-bezier(0.34, 1.2, 0.64, 1);
}
.mood-frame.swap .mood-img {
  opacity: 0.35;
  transform: scale(1.03);
}
.mood-glow {
  pointer-events: none;
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 80%, rgba(91, 159, 212, 0.18), transparent 55%);
  mix-blend-mode: screen;
  transition: background 0.5s ease;
}
.coach[data-mood="crushing"] .mood-glow {
  background: radial-gradient(circle at 50% 70%, rgba(125, 211, 160, 0.28), transparent 60%);
  animation: glow-pulse 1.6s ease-in-out infinite;
}
.coach[data-mood="losing"] .mood-glow {
  background: radial-gradient(circle at 50% 75%, rgba(91, 159, 212, 0.22), transparent 55%);
}
.coach[data-mood="gaining"] .mood-glow {
  background: radial-gradient(circle at 50% 70%, rgba(224, 168, 92, 0.2), transparent 55%);
}
.coach[data-mood="goal"] .mood-glow {
  background: radial-gradient(circle at 50% 40%, rgba(224, 168, 92, 0.35), transparent 60%);
  animation: glow-pulse 1.2s ease-in-out infinite;
}
.coach[data-mood="crushing"] .mood-img,
.coach[data-mood="goal"] .mood-img {
  animation: mood-bob 2.4s ease-in-out infinite;
}
@keyframes mood-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}
@keyframes glow-pulse {
  0%, 100% { opacity: 0.85; }
  50% { opacity: 1; }
}
.progress-chip {
  position: absolute;
  left: 10px;
  bottom: 10px;
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-family: var(--mono);
  background: rgba(10, 14, 22, 0.78);
  border: 1px solid rgba(125, 211, 160, 0.35);
  color: var(--text);
  padding: 6px 10px;
  border-radius: 999px;
  backdrop-filter: blur(6px);
}
.progress-chip #progress-chip-pct {
  font-size: 14px;
  font-weight: 600;
  color: var(--loss);
}
.progress-chip .chip-label {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.coach-copy { min-width: 0; }
.coach-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.mood-badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: var(--panel-2);
}
.kobold-pill {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: var(--panel-2);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.kobold-pill.up {
  color: var(--loss);
  border-color: rgba(125, 211, 160, 0.4);
  background: rgba(125, 211, 160, 0.08);
}
.kobold-pill.down {
  color: var(--danger);
  border-color: rgba(224, 112, 112, 0.35);
}
.coach-meta {
  margin: -6px 0 12px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}
.ai-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px;
}
.style-tabs {
  display: flex;
  gap: 2px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 2px;
}
.style-tabs .tab {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  background: transparent;
  border: none;
  border-radius: 6px;
  padding: 5px 9px;
  cursor: pointer;
}
.style-tabs .tab:hover { color: var(--text); }
.style-tabs .tab.active {
  color: var(--text);
  background: rgba(91, 159, 212, 0.2);
}
.auto-pep {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.auto-pep input { accent-color: var(--accent); }
#btn-pep.busy {
  opacity: 0.75;
  pointer-events: none;
}
#btn-pep.busy #btn-pep-label::after {
  content: "…";
  animation: dots 1s steps(3, end) infinite;
}
@keyframes dots {
  0%, 20% { content: ""; }
  40% { content: "."; }
  60% { content: ".."; }
  80%, 100% { content: "..."; }
}
.coach-msg.ai-sourced {
  color: var(--text);
  border-left: 2px solid var(--accent);
  padding-left: 10px;
}
.coach[data-mood="crushing"] .mood-badge {
  color: #0a1018;
  background: var(--loss);
  border-color: var(--loss);
  box-shadow: 0 0 18px rgba(125, 211, 160, 0.35);
}
.coach[data-mood="losing"] .mood-badge {
  color: var(--loss);
  border-color: rgba(125, 211, 160, 0.45);
  background: rgba(125, 211, 160, 0.1);
}
.coach[data-mood="steady"] .mood-badge {
  color: var(--accent);
  border-color: rgba(91, 159, 212, 0.45);
}
.coach[data-mood="gaining"] .mood-badge {
  color: var(--warn);
  border-color: rgba(224, 168, 92, 0.45);
  background: rgba(224, 168, 92, 0.08);
}
.coach[data-mood="goal"] .mood-badge {
  color: #0a1018;
  background: var(--warn);
  border-color: var(--warn);
  box-shadow: 0 0 20px rgba(224, 168, 92, 0.4);
  animation: pulse-badge 1.2s ease-in-out infinite;
}
@keyframes pulse-badge {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

.coach-title {
  margin: 0 0 6px !important;
  font-size: 22px !important;
  font-weight: 700 !important;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.coach-msg {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 14px;
  max-width: 46ch;
}

.coach-meters {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
}
.meter-head {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 6px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.meter-head span:last-child { color: var(--text); }
.meter-track {
  position: relative;
  height: 12px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  overflow: hidden;
}
.meter-fill {
  height: 100%;
  border-radius: 999px;
  width: 0%;
  transition: width 0.8s cubic-bezier(0.34, 1.2, 0.64, 1);
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 12px rgba(125, 211, 160, 0.35);
}
.meter-marker {
  position: absolute;
  top: -3px;
  width: 4px;
  height: 16px;
  margin-left: -2px;
  background: #fff;
  border-radius: 2px;
  box-shadow: 0 0 6px rgba(255,255,255,0.5);
  transition: left 0.8s cubic-bezier(0.34, 1.2, 0.64, 1);
  opacity: 0.85;
}
.meter-foot {
  display: flex;
  justify-content: space-between;
  margin-top: 5px;
  font-size: 11px;
  color: var(--muted);
  font-family: var(--mono);
}

/* Throttle gauge */
.throttle {
  position: relative;
  height: 28px;
  border-radius: 8px;
  /* LEFT = surplus/store (cool) → RIGHT = deficit/burn (hot red) */
  background: linear-gradient(90deg,
    #3d7ab0 0%,
    #5b9fd4 20%,
    #c9c9c9 50%,
    #e07070 80%,
    #c43c3c 100%);
  border: 1px solid var(--line);
  overflow: hidden;
}
.throttle-ticks {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: space-between;
  padding: 0 4px;
  align-items: stretch;
  pointer-events: none;
}
.throttle-ticks span {
  width: 1px;
  background: rgba(0,0,0,0.25);
}
.throttle-needle {
  position: absolute;
  top: 2px;
  bottom: 2px;
  width: 4px;
  /* left is set in JS as % of the bar; margin centers the 4px needle on that point */
  left: 50%;
  margin-left: -2px;
  background: #fff;
  border-radius: 2px;
  box-shadow: 0 0 8px rgba(255,255,255,0.6);
  transition: left 0.7s cubic-bezier(0.34, 1.2, 0.64, 1);
  z-index: 2;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 11px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
}
.badge .ico { font-size: 13px; line-height: 1; }
.badge.on {
  border-color: rgba(125, 211, 160, 0.45);
  background: rgba(125, 211, 160, 0.1);
  color: var(--loss);
}
.badge.hot {
  border-color: rgba(224, 168, 92, 0.5);
  background: rgba(224, 168, 92, 0.12);
  color: var(--warn);
}
.badge.dim { opacity: 0.45; }

.btn-spark {
  display: inline-block;
  margin-right: 2px;
  animation: sparkle 1.6s ease-in-out infinite;
}
@keyframes sparkle {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.25); }
}

/* confetti bits */
.fx-bit {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  animation: confetti-fall 1.2s ease-out forwards;
  opacity: 0.95;
}
@keyframes confetti-fall {
  0% { transform: translate(0, 0) rotate(0deg) scale(1); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)) scale(0.4); opacity: 0; }
}

/* body mood tint */
body.mood-crushing {
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(125, 211, 160, 0.14), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(91, 159, 212, 0.08), transparent 50%),
    var(--bg);
}
body.mood-goal {
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(224, 168, 92, 0.16), transparent 55%),
    radial-gradient(900px 500px at 100% 0%, rgba(125, 211, 160, 0.1), transparent 50%),
    var(--bg);
}
body.mood-gaining {
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(224, 112, 112, 0.08), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(224, 168, 92, 0.06), transparent 50%),
    var(--bg);
}

/* toast burst text */
.fx-toast {
  position: absolute;
  left: 50%;
  top: 28%;
  transform: translate(-50%, 0);
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 600;
  color: var(--loss);
  text-shadow: 0 0 20px rgba(125, 211, 160, 0.5);
  animation: toast-up 1.4s ease-out forwards;
  white-space: nowrap;
  pointer-events: none;
}
@keyframes toast-up {
  0% { opacity: 0; transform: translate(-50%, 12px) scale(0.9); }
  15% { opacity: 1; transform: translate(-50%, 0) scale(1.05); }
  100% { opacity: 0; transform: translate(-50%, -40px) scale(1); }
}

/* Waist-only entry form — a quieter sibling of the weight log form. */
.waist-form {
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}
.waist-form-hint {
  flex: 1 1 100%;
  margin-top: 2px;
}
