/* AI Writing Detector — web edition. Colour tokens are the apps' palettes (Theme.swift / App.xaml). */
:root {
  --background: #E8ECF3; --panel: #FFFFFF; --inset: #F5F7FB; --stroke: #D8DDE8; --control: #EEF1F6;
  --control-stroke: #CBD2DF; --text: #131722; --text-muted: #5B6377; --accent: #0B8FD0; --on-accent: #FFFFFF;
  --orange: #D98200; --track: #DCE1EA; --chip: #EEF1F6;
  --human: #2E9E5B; --mixed: #D99A1E; --ai: #D94F4F; --neutral: #8A8A8A; --mild: #9BB53A;
  --hl-phrase: rgba(224, 79, 79, .44); --hl-hedge: rgba(224, 168, 32, .44);
  --hl-transition: rgba(60, 140, 230, .44); --hl-template: rgba(255, 138, 92, .44);
  --brand: linear-gradient(90deg, #3E6FF1, #8B4CF0);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --background: #090B11; --panel: #12151E; --inset: #0B0E15; --stroke: #222838; --control: #1B2030;
  --control-stroke: #2C3348; --text: #E9EBF2; --text-muted: #8B92A7; --accent: #3AB3EE; --on-accent: #04131D;
  --orange: #F6A623; --track: #232939; --chip: #171B27;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --background: #090B11; --panel: #12151E; --inset: #0B0E15; --stroke: #222838; --control: #1B2030;
    --control-stroke: #2C3348; --text: #E9EBF2; --text-muted: #8B92A7; --accent: #3AB3EE; --on-accent: #04131D;
    --orange: #F6A623; --track: #232939; --chip: #171B27;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0; display: flex; flex-direction: column; min-height: 100vh;
  background: var(--background); color: var(--text);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
svg.icon { width: 1em; height: 1em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.125em; }
.spacer { flex: 1; }
.muted { color: var(--text-muted); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
[hidden] { display: none !important; }

.section-label { font-size: 11px; font-weight: 600; letter-spacing: 1.6px; text-transform: uppercase; color: var(--text-muted); }

/* Header */
.topbar {
  display: flex; align-items: center; gap: 10px; padding: 8px 18px;
  background: var(--panel); border-bottom: 1px solid var(--stroke);
  position: sticky; top: 0; z-index: 20;   /* stays in view, with the credits badge */
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand img { border-radius: 5px; }
.brand-name { font-size: 18px; white-space: nowrap; }
.grad { background: var(--brand); -webkit-background-clip: text; background-clip: text; color: transparent; font-weight: 700; }
.divider { width: 1px; height: 18px; background: var(--stroke); margin: 0 4px; }
.top-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.round {
  width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--stroke); background: var(--chip);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; font-size: 15px; padding: 0;
}
.round:hover { border-color: var(--control-stroke); }
.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: 40px; z-index: 20; min-width: 240px; padding: 6px;
  background: var(--panel); border: 1px solid var(--stroke); border-radius: 10px; box-shadow: 0 8px 30px rgba(0,0,0,.18);
}
.menu a, .menu button { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 6px; color: var(--text); text-decoration: none; background: none; border: 0; cursor: pointer; }
.menu a:hover, .menu button:hover { background: var(--control); }
.menu .menu-note { padding: 8px 10px; color: var(--text-muted); font-size: 12px; border-top: 1px solid var(--stroke); margin-top: 4px; }

/* Layout */
.decks { flex: none; height: max(620px, calc(100vh - 88px)); display: grid; grid-template-columns: minmax(340px, 1fr) minmax(420px, 1fr); gap: 16px; padding: 16px; min-height: 0; }
.deck {
  position: relative; display: flex; flex-direction: column; gap: 12px; padding: 16px; min-width: 0; min-height: 560px;
  background: var(--panel); border: 1px solid var(--stroke); border-radius: 12px;
}
.compact-switch { display: none; }

/* Input deck */
.deck-header { display: flex; align-items: center; gap: 12px; }
.badge {
  width: 40px; height: 40px; border-radius: 9px; background: var(--brand); color: #fff; flex: none;
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.deck-title { min-width: 0; }
.prompt { font-size: 15px; font-weight: 600; }
.count-chip {
  margin-left: auto; white-space: nowrap; font: 500 11px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--text-muted); background: var(--chip); border: 1px solid var(--stroke); border-radius: 6px; padding: 5px 10px;
}
.count-chip .need { color: var(--mixed); }
.actions, .footer-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.deck-button {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 6px; cursor: pointer;
  font-size: 12px; font-weight: 600; letter-spacing: .8px; text-transform: uppercase;
  background: var(--control); border: 1px solid var(--control-stroke); color: var(--text);
}
.deck-button:hover:not(:disabled) { filter: brightness(.97); }
.deck-button:active:not(:disabled) { opacity: .75; }
.deck-button:disabled { opacity: .45; cursor: default; }
.deck-button.prominent { background: var(--accent); border-color: transparent; color: var(--on-accent); padding: 8px 18px; }
.deck-button.danger { color: var(--ai); }
.deck-button.icon-only { padding: 7px 9px; }
.editor-wrap { position: relative; flex: 1; min-height: 260px; background: var(--inset); border: 1px solid var(--stroke); border-radius: 8px; }
#input {
  position: absolute; inset: 0; width: 100%; height: 100%; resize: none; border: 0; outline: none; background: transparent;
  padding: 12px 13px; font-size: 14px; line-height: 1.6; color: var(--text); border-radius: 8px;
}
#input:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.placeholder { position: absolute; inset: 0; padding: 12px 13px; color: var(--text-muted); pointer-events: none; font-size: 14px; }
.placeholder p { margin: 0 0 8px; }
.placeholder .samples { pointer-events: auto; font-size: 13px; }
.link { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.notice {
  position: absolute; left: 10px; right: 10px; top: 10px; display: flex; gap: 10px; padding: 12px; pointer-events: none;
  background: color-mix(in srgb, var(--mixed) 12%, transparent); border: 1px solid color-mix(in srgb, var(--mixed) 35%, transparent);
  border-radius: 8px; font-weight: 500;
}
.notice .icon { color: var(--mixed); margin-top: 2px; }
.busy-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column; gap: 12px; align-items: center; justify-content: center;
  text-align: center; padding: 20px; border-radius: 8px; font-weight: 600;
  background: color-mix(in srgb, var(--inset) 94%, transparent);
}
.methods {
  display: flex; gap: 14px; padding: 8px 12px; font-size: 12px; font-weight: 600;
  background: var(--inset); border: 1px solid var(--stroke); border-radius: 8px;
}
.method { display: inline-flex; align-items: center; gap: 6px; }
.method input { accent-color: var(--accent); margin: 0; }
.method.off { opacity: .5; }
.drop-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column; gap: 8px; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--panel) 94%, transparent); border: 2px dashed var(--accent); border-radius: 12px; z-index: 5;
}
.drop-icon { font-size: 34px; color: var(--accent); }

/* Spinner */
.spinner { width: 16px; height: 16px; border: 2px solid var(--track); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
.spinner.large { width: 30px; height: 30px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }

/* Results deck */
.results-header { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 6px; cursor: pointer;
  font-size: 12px; font-weight: 600; letter-spacing: .8px; text-transform: uppercase;
  background: var(--control); border: 1px solid var(--control-stroke); color: var(--text);
}
.tab[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.tab-body { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 12px; padding-bottom: 8px; }
.tab-body > * { flex-shrink: 0; }
.history-list { display: flex; flex-direction: column; gap: 8px; }
.history-list.empty { flex: 1; }

.card { background: var(--inset); border: 1px solid var(--stroke); border-radius: 10px; padding: 16px; }
.banner {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: 8px;
  background: color-mix(in srgb, var(--c) 12%, transparent); border: 1px solid color-mix(in srgb, var(--c) 35%, transparent);
}
.banner.warning { --c: var(--mixed); } .banner.error { --c: var(--ai); } .banner.info { --c: var(--accent); }
.banner > .icon { color: var(--c); margin-top: 2px; }
.banner .b-title { font-weight: 600; }
.banner .b-body { flex: 1; white-space: pre-line; font-size: 13.5px; }
.banner .close { background: none; border: 0; color: var(--text-muted); cursor: pointer; padding: 0 2px; }

.combined { position: relative; overflow: hidden; padding: 18px; }
.combined::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--brand); }
.sides { display: flex; gap: 16px; margin: 10px 0; }
.side { flex: 1; }
.side.dim { opacity: .55; }
.side-label { display: flex; align-items: center; gap: 6px; }
.dotc { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.big-pct { font-size: 52px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.split { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--track); }
.split .ai { background: var(--ai); } .split .human { background: var(--human); flex: 1; }
.verdict { font-size: 20px; font-weight: 600; margin-top: 10px; }
.detail { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

.method-card { display: flex; flex-direction: column; gap: 10px; }
.mc-head { display: flex; align-items: center; gap: 10px; }
.letter { width: 30px; height: 30px; border-radius: 7px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px; flex: none; }
.letter.h { background: var(--accent); color: var(--on-accent); }
.mc-score { display: flex; align-items: baseline; gap: 10px; min-height: 40px; }
.mid-pct { font-size: 34px; font-weight: 700; font-variant-numeric: tabular-nums; }
.bar { height: 6px; border-radius: 3px; background: var(--track); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 3px; }
.mc-verdict { font-size: 15px; font-weight: 600; }
.mc-detail { font-size: 12.5px; color: var(--text-muted); }

/* Signals */
.signals-summary { display: flex; gap: 28px; align-items: center; padding: 18px; }
.donut { width: 200px; height: 200px; flex: none; position: relative; }
.donut svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.donut-center .mid-pct { line-height: 1; }
.legend { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.legend-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.legend-row .lvl { font-size: 12px; font-weight: 500; }
.legend-row .pts { font: 12px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--text-muted); min-width: 62px; text-align: right; }
.signal-card { padding: 14px; }
.signal-card.na { opacity: .6; }
.signal-head { display: flex; align-items: center; gap: 12px; width: 100%; background: none; border: 0; padding: 0; cursor: pointer; text-align: left; color: var(--text); }
.signal-head .name { font-size: 14px; font-weight: 600; }
.signal-head .finding { font-size: 12.5px; color: var(--text-muted); }
.pill { font-size: 10px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; padding: 3px 8px; border-radius: 999px; border: 1px solid currentColor; white-space: nowrap; }
.chev { color: var(--text-muted); transition: transform .15s; }
.signal-card.open .chev { transform: rotate(180deg); }
.signal-more { display: none; padding: 10px 0 0 22px; font-size: 12.5px; color: var(--text-muted); }
.signal-card.open .signal-more { display: flex; flex-direction: column; gap: 8px; }
.signal-more b { color: var(--text); font-weight: 600; }
.signal-more .bar-row { display: flex; align-items: center; gap: 10px; }
.signal-more .bar { flex: 1; }

/* Highlights */
.hl-legend { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; font-size: 12px; }
.chip-swatch { width: 14px; height: 14px; border-radius: 3px; display: inline-block; vertical-align: -2px; margin-right: 6px; }
.hl-text { white-space: pre-wrap; word-wrap: break-word; font-size: 14px; line-height: 1.75; padding: 14px; }
.hl-aiPhrase { background: var(--hl-phrase); border-radius: 2px; }
.hl-hedge { background: var(--hl-hedge); border-radius: 2px; }
.hl-transition { background: var(--hl-transition); border-radius: 2px; }
.hl-template { background: var(--hl-template); border-radius: 2px; }
.sw-aiPhrase { background: var(--hl-phrase); } .sw-hedge { background: var(--hl-hedge); }
.sw-transition { background: var(--hl-transition); } .sw-template { background: var(--hl-template); }

/* History */
.history-tools { display: flex; gap: 8px; }
.search { flex: 1; display: flex; align-items: center; gap: 6px; padding: 7px 10px; background: var(--inset); border: 1px solid var(--stroke); border-radius: 7px; }
.search input { flex: 1; border: 0; outline: none; background: transparent; }
.history-row { display: flex; gap: 14px; padding: 12px; cursor: default; }
.hist-score { width: 64px; height: 56px; border-radius: 8px; flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: 700; }
.hist-score .n { font-size: 20px; line-height: 1.1; }
.hist-score .k { font-size: 9px; letter-spacing: 1px; }
.hist-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.hist-top { display: flex; gap: 8px; align-items: baseline; }
.hist-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.hist-meta, .hist-snippet { font-size: 12px; color: var(--text-muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.hist-meta b { color: var(--text); }
.hist-actions { display: flex; gap: 8px; margin-top: 4px; }
.empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--text-muted); text-align: center; padding: 40px 10px; }
.empty .icon { font-size: 30px; }


/* Status bar */
.statusbar {
  display: flex; align-items: center; gap: 8px; padding: 7px 18px; font-size: 12.5px;
  background: var(--panel); border-top: 1px solid var(--stroke); position: sticky; bottom: 0; z-index: 10; margin-top: auto;
}
.statusbar .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--human); flex: none; }
.statusbar .dot.busy { background: var(--mixed); }
#status { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Dialog */
dialog { border: 1px solid var(--stroke); border-radius: 12px; background: var(--panel); color: var(--text); padding: 0; width: min(420px, 92vw); }
dialog::backdrop { background: rgba(0,0,0,.35); }
.dialog-body { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.dialog-body h2 { margin: 0; font-size: 18px; }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; background: var(--inset); border: 1px solid var(--stroke); border-radius: 8px; }
.setting select { background: var(--control); border: 1px solid var(--control-stroke); border-radius: 6px; padding: 4px 8px; }
.setting input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); }
.dialog-actions { display: flex; justify-content: flex-end; }
.noscript { padding: 20px; text-align: center; }

/* Narrow screens: one deck at a time (as on iPhone). */
@media (max-width: 900px) {
  .brand-sub, .divider { display: none; }
  .compact-switch { display: flex; justify-content: center; padding: 10px 12px 0; }
  .compact-switch .seg { border: 1px solid var(--control-stroke); background: var(--control); padding: 6px 22px; cursor: pointer; font-weight: 600; font-size: 13px; }
  .compact-switch .seg:first-child { border-radius: 7px 0 0 7px; } .compact-switch .seg:last-child { border-radius: 0 7px 7px 0; }
  .compact-switch .seg.selected { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
  .decks { grid-template-columns: 1fr; padding: 10px 12px; }
  body[data-view="input"] .results-deck, body[data-view="results"] .input-deck { display: none; }
  .deck { min-height: calc(100vh - 150px); padding: 12px; }
  .decks { height: auto; }
  .signals-summary { flex-direction: column; gap: 16px; align-items: stretch; }
  .donut { align-self: center; }
  .big-pct { font-size: 42px; }
  .results-header > .section-label { display: none; }
  .tabs { width: 100%; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; }
  .tab { justify-content: center; padding: 8px 2px; letter-spacing: 0; text-transform: none; font-size: 11.5px; min-width: 0; }
  .tab .icon { display: none; }
  .tab .label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
@media (max-width: 480px) {
  .tab { font-size: 10.5px; }
  .count-chip { display: none; }
}

/* Two method cards, phrase model */
.methods-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.letter.p { background: var(--orange); color: #1A1206; }
.phrase-card { display: flex; flex-direction: column; gap: 10px; }
.phrase-card .mc-head .mid-pct { font-size: 28px; }
.phrase-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.phrase-chip { font-size: 12.5px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--stroke); background: var(--panel); }

/* Header brand is the page's h1 */
h1.brand-name { margin: 0; font-weight: 400; line-height: 1.2; }

/* Account */
.free-chip { font: inherit; font-size: 12px; font-weight: 600; color: var(--text-muted); background: var(--chip); border: 1px solid var(--stroke); border-radius: 999px; padding: 4px 10px; white-space: nowrap; cursor: pointer; }
.free-chip:hover { border-color: var(--accent); color: var(--text); }
.free-chip.empty { color: var(--ai); }
.account-email { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-transform: none; letter-spacing: 0; }
.danger-text { color: var(--ai) !important; }
.deck-button.danger-fill { background: var(--ai); color: #fff; }
.deck-button.wide { width: 100%; justify-content: center; padding: 10px; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.dialog-head .close { background: none; border: 0; font-size: 22px; line-height: 1; color: var(--text-muted); cursor: pointer; padding: 0 4px; }
.dialog-body > p { margin: 0; }
.account-tabs { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--control-stroke); border-radius: 8px; overflow: hidden; }
.account-tabs button { border: 0; background: var(--control); padding: 8px; font-weight: 600; cursor: pointer; }
.account-tabs button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; }
.field input { font-weight: 400; padding: 9px 11px; border-radius: 7px; border: 1px solid var(--control-stroke); background: var(--inset); color: var(--text); }
.field input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.form-error { color: var(--ai); font-size: 13px; min-height: 1em; margin: 0; }

/* About (crawlable description below the app) */
.about { max-width: 920px; margin: 8px auto 28px; padding: 0 20px; color: var(--text-muted); font-size: 14.5px; line-height: 1.6; }
.about h2 { color: var(--text); font-size: 17px; margin: 22px 0 6px; }
.about strong { color: var(--text); }

@media (max-width: 900px) {
  .methods-row { grid-template-columns: 1fr; }
  .free-chip { padding: 4px 8px; font-size: 11.5px; }
  .account-email { max-width: 90px; }
}
@media (max-width: 480px) {
  .account-email { display: none; }
}

.top-actions .deck-button { white-space: nowrap; }
@media (max-width: 480px) {
  #themeToggle { display: none; }
  h1.brand-name { font-size: 16px; }
  .topbar { padding: 8px 12px; gap: 6px; }
}
@media (max-width: 420px) {
  .brand img { display: none; }
  h1.brand-name { font-size: 15px; white-space: normal; line-height: 1.15; }
  .top-actions { gap: 6px; }
  .top-actions .deck-button { padding: 7px 10px; }
}

/* Language model */
.letter.l { background: #8B6CFF; color: #fff; }
.methods-row { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.segmented { display: inline-flex; border: 1px solid var(--control-stroke); border-radius: 7px; overflow: hidden; }
.segmented button { border: 0; background: var(--control); padding: 5px 14px; font-size: 12.5px; cursor: pointer; color: var(--text); }
.segmented button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.hl-top10 { background: rgba(52, 184, 90, .44); } .hl-top100 { background: rgba(230, 194, 41, .44); }
.hl-top1000 { background: rgba(229, 91, 75, .44); } .hl-beyond { background: rgba(155, 89, 214, .5); }
.sw-top10 { background: rgba(52, 184, 90, .44); } .sw-top100 { background: rgba(230, 194, 41, .44); }
.sw-top1000 { background: rgba(229, 91, 75, .44); } .sw-beyond { background: rgba(155, 89, 214, .5); }

/* Perplexity tab */
.empty-note { padding: 24px 0; font-size: 13px; }
.ppl-signature { display: flex; gap: 18px; align-items: center; }
.ppl-signature-left { min-width: 130px; }
.ppl-signature-value { font-size: 38px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.ppl-signature-hint { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.ppl-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.ppl-tile { padding: 12px; min-height: 104px; display: flex; flex-direction: column; gap: 4px; }
.ppl-value { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ppl-sentence { padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.ppl-sentence-text { font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }
.ppl-sentence-bar { display: flex; align-items: center; gap: 10px; }
.ppl-sentence-bar .bar { flex: 1; height: 5px; }
.ppl-sentence-score { font-size: 11.5px; font-weight: 500; white-space: nowrap; }
@media (max-width: 760px) {
  .ppl-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ppl-signature { flex-direction: column; align-items: flex-start; gap: 8px; }
}

/* Paid plans */
.menu-info { padding: 8px 12px 6px; font-size: 12px; font-weight: 600; color: var(--text-muted); border-bottom: 1px solid var(--stroke); margin-bottom: 4px; }
#payDialog { width: min(460px, 94vw); }
.plans { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.plan { position: relative; display: flex; flex-direction: column; gap: 3px; padding: 14px 12px 12px; border: 1px solid var(--control-stroke);
  border-radius: 10px; background: var(--inset); cursor: pointer; }
.plan input { position: absolute; opacity: 0; pointer-events: none; }
.plan:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.plan:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.plan-name { font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.plan-badge { font-size: 10.5px; font-weight: 700; color: var(--on-accent); background: var(--accent); border-radius: 999px; padding: 2px 7px; }
.plan-price { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.plan-note { font-size: 11.5px; color: var(--text-muted); }
.plan-features { margin: 12px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 3px; }
.pay-summary { margin: 0 0 12px; font-size: 13px; font-weight: 600; }
#paymentElement { min-height: 40px; }
.pay-back { align-self: center; }
.pay-secure { text-align: center; margin: 0; }
.plans.three { grid-template-columns: repeat(3, 1fr); }
#payDialog:has(.plans.three) { width: min(560px, 94vw); }
@media (max-width: 520px) { .plans.three { grid-template-columns: 1fr; } .plans.three .plan { padding: 10px 12px; } }
@media (max-width: 420px) { .plans { grid-template-columns: 1fr; } }

/* Admin viewing the site as a user */
.impersonation-bar { position: sticky; top: 0; z-index: 21; display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap;
  padding: 7px 14px; font-size: 13px; font-weight: 600; background: var(--mixed, #E3A33C); color: #1b1300; text-align: center; }
.impersonation-bar a { color: inherit; text-decoration: underline; white-space: nowrap; }
body.impersonating .topbar { top: 34px; }
@media (max-width: 600px) { body.impersonating .topbar { top: 52px; } .impersonation-bar { font-size: 12px; } }
/* "Signup or Login" fits next to the name on phones */
@media (max-width: 480px) {
  #accountButton.prominent { padding: 7px 10px; font-size: 11px; letter-spacing: 0.04em; gap: 5px; }
}
@media (max-width: 360px) {
  #accountButton.prominent .icon { display: none; }
}
