:root {
 --bg: #0e0d0b;
 --panel: #161512;
 --line: #2a2824;
 --text: #e8e6e1;
 --muted: #8a8680;
 --gold: #c4a574;
 --good: #45d483;
 --bad: #ff5e66;
 --safe-top: env(safe-area-inset-top, 0px);
 --safe-bottom: env(safe-area-inset-bottom, 0px);
 --safe-x: max(16px, env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px));
}
* { box-sizing: border-box; }
html {
 -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-bottom: var(--safe-bottom);
}
.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: calc(12px + var(--safe-top)) max(16px, env(safe-area-inset-right, 0px)) 12px max(16px, env(safe-area-inset-left, 0px));
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(14, 13, 11, 0.94);
  backdrop-filter: blur(10px);
 -webkit-backdrop-filter: blur(10px);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  min-width: 0;
}
.brand img {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}
.brand-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.15;
}
.brand-text strong { font-size: 1.05rem; }
.brand-text .by {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.tagline {
  margin: 0 0 10px;
  font-size: 1.05rem;
  color: var(--gold);
  font-weight: 600;
}
.foot a { color: var(--gold); }
nav {
  display: flex;
  gap: 10px 14px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  font-size: 0.9rem;
  max-width: 100%;
}
nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 6px 2px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
nav a:hover { color: var(--gold); }
.muted { color: var(--muted); font-size: 0.88rem; }
#user-line {
  max-width: 42vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wrap {
  width: min(720px, calc(100% - 2 * var(--safe-x)));
  margin: 0 auto;
  padding: 22px 0 40px;
}
.hero { margin-bottom: 20px; }

/* Feedback dock - same card as Frankey, fixed bottom when signed in */
body.has-feedback-dock {
  padding-bottom: calc(72px + var(--safe-bottom));
}
.app-feedback-dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  width: min(720px, 100%);
  margin: 0 auto;
  border: 1px solid rgba(196, 165, 116, 0.28);
  border-bottom: none;
  border-radius: 14px 14px 0 0;
  background: rgba(14, 13, 11, 0.96);
  backdrop-filter: blur(10px);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  padding-bottom: var(--safe-bottom);
}
.app-feedback-dock[hidden] { display: none !important; }
.app-feedback-dock.is-attention {
  border-color: rgba(196, 165, 116, 0.55);
  box-shadow:
    0 0 0 2px rgba(196, 165, 116, 0.35),
    0 -10px 32px rgba(0, 0, 0, 0.45);
  animation: feedback-attention 1.4s ease-in-out 3;
}
.app-feedback-dock.is-attention .app-feedback-dock-label {
  color: #e0c48a;
}
@keyframes feedback-attention {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}
.app-feedback-dock-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  border: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  text-align: left;
}
.app-feedback-dock-toggle:hover {
  background: rgba(255, 255, 255, 0.03);
}
.app-feedback-dock-label {
  font-family: ui-monospace, monospace;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
}
.app-feedback-dock-hint {
  flex: 1;
  font-size: 0.88rem;
  color: var(--muted);
  font-weight: 600;
}
.app-feedback-dock-chevron {
  color: var(--muted);
  font-size: 0.85rem;
}
.app-feedback-dock.is-collapsed .beta-feedback-card-dock {
  display: none;
}
.app-feedback-dock .beta-feedback-card-dock {
  max-height: min(42vh, 420px);
  overflow-y: auto;
}
.beta-feedback-card {
  margin: 0;
  padding: 16px 18px;
  border-top: 1px solid rgba(196, 165, 116, 0.2);
  text-align: left;
}
.beta-feedback-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}
.beta-feedback-kicker {
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
}
.beta-feedback-skip {
  border: none;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 6px;
}
.beta-feedback-skip:hover { color: var(--text); }
.beta-feedback-title {
  margin: 0 0 14px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}
.beta-feedback-form fieldset {
  border: none;
  margin: 0 0 14px;
  padding: 0;
}
.beta-q { margin: 0 0 14px; }
.beta-q legend,
.beta-q > label:first-child {
  display: block;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 8px;
  text-transform: none;
  letter-spacing: 0;
}
.beta-choice {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 12px 6px 0;
  font-size: 0.88rem;
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
}
.beta-choice input {
  width: auto;
  margin: 0;
  accent-color: var(--gold);
}
.beta-q textarea {
  width: 100%;
  min-height: 64px;
  margin-top: 4px;
  resize: vertical;
}
.field-hint {
  font-weight: 500;
  color: var(--muted);
  font-size: 0.8rem;
}
.beta-feedback-actions { margin-top: 4px; }
.beta-feedback-msg {
  margin: 10px 0 0;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--good);
}
.beta-feedback-card.is-done {
  border-color: rgba(69, 212, 131, 0.35);
}
.beta-q-amount {
  padding: 12px 12px 4px;
  border-radius: 10px;
  border: 1px dashed rgba(196, 165, 116, 0.4);
  background: rgba(196, 165, 116, 0.06);
}
.beta-q-amount[hidden],
.beta-q-pay[hidden] { display: none !important; }
.btn-sm {
  min-height: 40px;
  padding: 0 14px;
  font-size: 0.85rem;
}
.toast {
  position: fixed;
  bottom: calc(88px + var(--safe-bottom));
  right: 20px;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  font-size: 0.9rem;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 50;
}
.toast.show { opacity: 1; }
.eyebrow {
  font-family: ui-monospace, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--gold);
  text-transform: uppercase;
  line-height: 1.4;
}
h1 {
  font-size: clamp(1.45rem, 5vw, 1.75rem);
  margin: 8px 0 10px;
  letter-spacing: -0.02em;
}
.lead {
  color: var(--muted);
  margin: 0;
  max-width: 52ch;
  font-size: 0.98rem;
}
.lead a { color: var(--gold); }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 16px 18px;
  margin-bottom: 16px;
}
.card h2 { margin: 0 0 8px; font-size: 1.1rem; }
label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-top: 12px;
}
label.block { margin-top: 0; }
label.inline {
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
  min-height: 44px;
}
/* 16px+ avoids iOS zoom-on-focus */
input, textarea {
  width: 100%;
  margin-top: 6px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #0e0d0b;
  color: var(--text);
  font: 16px/1.45 ui-monospace, Menlo, monospace;
  max-width: 100%;
}
input[type="number"] {
  width: 4.5rem;
  margin-top: 0;
  min-height: 44px;
}
textarea {
  resize: vertical;
  min-height: 8rem;
}
#output {
  min-height: 12rem;
}
.row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 14px;
}
.btn {
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #1f1d1a;
  color: var(--text);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 12px 16px;
  min-height: 48px;
  cursor: pointer;
  touch-action: manipulation;
 -webkit-tap-highlight-color: transparent;
}
.btn.primary {
  background: var(--gold);
  border-color: var(--gold);
  color: #12110f;
}
.btn:disabled { opacity: 0.55; cursor: wait; }
.err { color: var(--bad); font-size: 0.88rem; margin: 10px 0 0; word-break: break-word; }
.status { color: var(--good); font-size: 0.9rem; margin: 12px 0 0; }
.hint { font-size: 0.85rem; color: var(--muted); }
.hint a { color: var(--gold); }
.scores {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 16px;
}
.score-box {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 8px;
  text-align: center;
  min-width: 0;
}
.score-box span {
  display: block;
  font-size: 0.65rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.score-box strong {
  font-size: clamp(1.15rem, 4.5vw, 1.5rem);
  color: var(--gold);
  word-break: break-word;
}
.score-box strong.score-honest {
  color: var(--text);
}
.score-box strong.score-honest::after {
  content: " honest";
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 4px;
}
#out-wrap { margin-top: 18px; }
details { margin-top: 14px; color: var(--muted); font-size: 0.9rem; }
summary {
  cursor: pointer;
  padding: 8px 0;
  min-height: 44px;
  display: flex;
  align-items: center;
}
pre {
  white-space: pre-wrap;
  word-break: break-word;
  overflow-x: auto;
  background: #0e0d0b;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  font-size: 0.8rem;
  color: var(--text);
  max-width: 100%;
}
.foot {
  text-align: center;
  padding: 20px max(16px, env(safe-area-inset-right, 0px)) calc(20px + var(--safe-bottom));
  font-size: 0.78rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
  line-height: 1.55;
}
.foot code { color: var(--gold); font-size: 0.85em; }
.health {
  margin: 12px 0 0;
  font-family: ui-monospace, monospace;
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.02em;
  word-break: break-word;
  white-space: pre-line;
  line-height: 1.45;
  font-weight: 600;
}
#frank-quota-line {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
  font-size: 0.9rem;
}
.download-card {
  margin-top: 16px;
}
.download-card h2 {
  margin: 0 0 8px;
  font-size: 1.1rem;
}
.linkish {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  padding: 6px 0;
  min-height: 44px;
  text-decoration: underline;
  touch-action: manipulation;
}
.linkish:hover { color: var(--gold); }
.pipe {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
}
.pipe-step {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
}
.pipe-step.active {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(196, 165, 116, 0.1);
}
.pipe-step.done {
  border-color: rgba(69, 212, 131, 0.4);
  color: var(--good);
}
.pipe-step.skipped {
  border-color: var(--line);
  color: var(--muted);
  opacity: 0.55;
  text-decoration: line-through;
}
.pipe-note {
  margin: 8px 0 0;
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.45;
}
.pipe-log {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.5;
}
.pipe-log li {
  padding: 6px 0;
  border-bottom: 1px solid rgba(42, 40, 36, 0.6);
  word-break: break-word;
}
.pipe-log strong { color: var(--text); }
.cache-pill {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--good);
  border: 1px solid rgba(69, 212, 131, 0.4);
  border-radius: 999px;
  padding: 8px 10px;
}

/* ---------- phones ---------- */
@media (max-width: 640px) {
  .top {
    align-items: flex-start;
  }
  nav {
    width: 100%;
    justify-content: flex-start;
    gap: 8px 12px;
    padding-top: 2px;
    border-top: 1px solid var(--line);
    margin-top: 2px;
    padding-top: 10px;
  }
  nav a {
    font-size: 0.85rem;
  }
  #user-line {
    max-width: 100%;
    order: 10;
    flex: 1 1 100%;
  }
  .wrap {
    width: calc(100% - 28px);
    padding: 18px 0 32px;
  }
  .card {
    padding: 14px;
    border-radius: 12px;
  }
  .row {
    flex-direction: column;
    align-items: stretch;
  }
  .row .btn,
  .row label.inline {
    width: 100%;
    justify-content: space-between;
  }
  .row .btn {
    text-align: center;
    justify-content: center;
  }
  .row input[type="number"] {
    width: 5rem;
  }
  #auth-card .btn.primary {
    width: 100%;
    margin-top: 14px;
  }
  .scores {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .score-box {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    text-align: left;
    gap: 8px;
    padding: 12px 14px;
  }
  .score-box span {
    margin: 0;
  }
  .score-box strong {
    font-size: 1.35rem;
  }
  .score-box strong.score-honest::after {
    display: inline;
    margin-left: 6px;
  }
  .pipe-step {
    flex: 1 1 auto;
    text-align: center;
  }
  textarea {
    font-size: 16px;
  }
}

/* very small phones */
@media (max-width: 380px) {
  nav a:nth-child(2) { /* hide Product link to save space if needed - keep all for now */
  }
  .brand-text .by { display: none; }
}

/* landscape phones: don't force full-width buttons so scores stay compact */
@media (max-width: 640px) and (orientation: landscape) {
  .scores {
    grid-template-columns: repeat(3, 1fr);
  }
  .score-box {
    display: block;
    text-align: center;
  }
}
