/* Second Opinion - styles (merged from the two original <style> blocks) */
  /* Second Opinion – styles
    Layout: centered title, then one large checker card with a tool rail on its left.
    Results appear in a single column under the card.
    Variables keep the same names as before; only the values changed. Edit --brand to recolor everything. */
  :root {
    --bg: #FFF8EF;
    --surface: #FFFDF9;
    --ink: #3A1A0E;
    --muted: #75503E;
    --faint: #86614E;
    --line: #F0D9C2;
    --hover: #FFEEDD;
    --brand: #C8400F;
    --brand-ink: #FFFFFF;
    --brand-soft: #FFE1CB;
    --user-bg: #FFEEDD;
    --scam: #B3141C;
    --scam-bg: #FDE6E1;
    --warn: #7A4B00;
    --warn-bg: #FFF1CC;
    --ok: #1D6636;
    --ok-bg: #E5F1E2;
    --mark: #FFD79A;
    --shadow: 0 2px 4px rgba(120,50,10,.05), 0 12px 40px rgba(120,50,10,.10);
    --font: "Atkinson Hyperlegible", "Segoe UI", system-ui, -apple-system, sans-serif;
  }
  /* Default theme = Scampy's colours (cream, orange fur, dark brown). Other colour themes are chosen in the Accessibility tab. */
  :root[data-theme="night"] {
    --bg: #0E0A0B; --surface: #1A1214; --ink: #F6EDEE; --muted: #C9B5B8; --faint: #A28A8E;
    --line: #3A2427; --hover: #2A181B; --brand: #FF5A68; --brand-ink: #1A0508; --brand-soft: #3A1519;
    --user-bg: #2A181B; --scam: #FF8A93; --scam-bg: #3A1418; --warn: #F2C35C; --warn-bg: #3B3116;
    --ok: #86D6A0; --ok-bg: #1E3326; --mark: #7A2A32;
    --shadow: 0 2px 4px rgba(0,0,0,.4), 0 12px 40px rgba(0,0,0,.5);
    color-scheme: dark;
  }

  html { font-size: 19px; }
  * { box-sizing: border-box; }
  body { margin: 0; background: var(--bg); color: var(--ink); font: 400 1rem/1.55 var(--font); padding-inline: 16px; }
  button, textarea { font: inherit; color: inherit; }
  button { cursor: pointer; }
  :focus-visible { outline: 3px solid var(--brand); outline-offset: 3px; border-radius: 10px; }
  .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  svg { flex: none; }

  /* ---------- Header ---------- */
  .masthead { max-width: 60rem; margin-inline: auto; padding-block: 14px 28px; text-align: center; }
  .topline { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 28px; }
  .brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.05rem; white-space: nowrap; }
  .brand svg { width: 1.6rem; height: 1.6rem; color: var(--brand); }
  .masthead h1 { margin: 0 0 10px; font-size: clamp(1.6rem, 4.5vw, 2.3rem); line-height: 1.2; font-weight: 700; letter-spacing: -.01em; text-wrap: balance; }
  .masthead .sub { margin: 0 auto; max-width: 36rem; font-size: 1.1rem; color: var(--muted); text-wrap: pretty; }

  /* ---------- Tool: rail + card ---------- */
  .stage { max-width: 60rem; margin-inline: auto; padding-bottom: 48px; }
  body:not([data-mode="chat"]) .chat-only, body:not([data-mode="call"]) .call-only, body:not([data-mode="guide"]) .guide-only, body:not([data-mode="access"]) .access-only { display: none !important; }

  .tool { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); gap: 14px; align-items: start; }
  .rail { display: flex; flex-direction: column; gap: 6px; padding-top: 6px; }
  .rail button {
    display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
    border: 0; background: transparent; padding: 12px 6px; border-radius: 14px;
    font-size: .78rem; font-weight: 700; line-height: 1.2; color: var(--muted);
  }
  .rail button svg { width: 1.7rem; height: 1.7rem; }
  .rail button:hover { background: var(--hover); color: var(--ink); }
  .rail button[aria-pressed="true"] { background: var(--brand-soft); color: var(--brand); }
  .rail button[data-mode="call"] svg { color: var(--scam); }

  .card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); min-width: 0; }
  .card textarea {
    display: block; width: 100%; min-height: 12rem; resize: vertical;
    border: 0; outline: none; background: transparent; padding: 26px 28px; line-height: 1.6; border-radius: 20px 20px 0 0;
  }
  .card textarea::placeholder { color: var(--faint); opacity: 1; }
  .card:focus-within { border-color: var(--brand); }

  .attach { display: none; align-items: center; gap: 12px; margin: 0 28px 12px; padding: 8px; border-radius: 14px; background: var(--user-bg); }
  .attach.on { display: flex; }
  .attach img { width: 3.2rem; height: 3.2rem; object-fit: cover; border-radius: 10px; }
  .attach span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; }
  .attach button { border: 0; background: transparent; color: var(--brand); font-weight: 700; min-height: 44px; padding: 0 12px; }

  .card-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; padding: 16px 22px 20px; border-top: 1px solid var(--line); }
  .send {
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    min-height: 56px; min-width: 14rem; padding: 0 28px; border: 0; border-radius: 12px;
    background: var(--brand); color: var(--brand-ink); font-size: 1.1rem; font-weight: 700;
  }
  .send:hover { filter: brightness(1.1); }
  .send svg { width: 1.4rem; height: 1.4rem; }
  .link-btn {
    display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 10px;
    border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-weight: 700;
  }
  .link-btn:hover { background: var(--hover); color: var(--ink); }
  .link-btn svg { width: 1.3rem; height: 1.3rem; }
  .count { margin-left: auto; font-size: .85rem; color: var(--faint); font-variant-numeric: tabular-nums; white-space: nowrap; }
  .count.near { color: var(--warn); font-weight: 700; }
  .card.busy .send { opacity: .6; pointer-events: none; }

  .hint { display: flex; justify-content: center; align-items: center; gap: 8px; margin: 14px 0 0; padding-left: 7.4rem; font-size: .85rem; color: var(--faint); min-height: 1.3em; }
  .hint svg { width: 1rem; height: 1rem; }
  .hint.err { color: var(--scam); font-weight: 700; }

  /* ---------- Results ---------- */
  .results { margin: 28px 0 0 7.4rem; display: grid; gap: 16px; }
  .results:empty { display: none; }
  .thinking { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 28px; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 20px; }
  .dots { display: inline-flex; gap: 5px; }
  .dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--brand); animation: bob 1.1s infinite ease-in-out; }
  .dots i:nth-child(2) { animation-delay: .15s; }
  .dots i:nth-child(3) { animation-delay: .3s; }
  @keyframes bob { 0%, 80%, 100% { transform: translateY(0); opacity: .45; } 40% { transform: translateY(-5px); opacity: 1; } }

  .result { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; box-shadow: var(--shadow); }
  .result > section, .result > details, .result > .actions, .result > .note { padding: 20px 26px; border-top: 1px solid var(--line); }
  .verdict { display: flex; gap: 16px; align-items: flex-start; padding: 24px 26px; background: var(--v-bg); color: var(--v-fg); }
  .verdict svg { width: 2.8rem; height: 2.8rem; }
  .v-label { margin: 0; font-size: 1.6rem; font-weight: 700; line-height: 1.2; }
  .v-sub { margin: 6px 0 0; color: var(--ink); }
  .v-sure { margin: 8px 0 0; font-size: .85rem; color: var(--muted); }
  .v-scam { --v-bg: var(--scam-bg); --v-fg: var(--scam); }
  .v-sus { --v-bg: var(--warn-bg); --v-fg: var(--warn); }
  .v-ok { --v-bg: var(--ok-bg); --v-fg: var(--ok); }
  .result h3 { margin: 0 0 12px; font-size: .8rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
  .do ol { margin: 0; padding: 0; list-style: none; display: grid; gap: 12px; counter-reset: s; }
  .do li { counter-increment: s; display: grid; grid-template-columns: 2rem 1fr; gap: 12px; font-weight: 700; font-size: 1.05rem; }
  .do li::before { content: counter(s); width: 2rem; height: 2rem; border-radius: 50%; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-size: .9rem; }
  .reasons { margin: 0; padding: 0; list-style: none; display: grid; gap: 14px; }
  .reasons q { display: block; quotes: none; background: var(--mark); color: var(--ink); padding: 2px 8px; border-radius: 6px; font-weight: 700; width: fit-content; max-width: 100%; overflow-wrap: anywhere; margin-bottom: 4px; }
  .reasons span { display: block; }
  .no-reasons { margin: 0; color: var(--muted); }
  details summary { cursor: pointer; font-weight: 700; color: var(--brand); min-height: 44px; display: flex; align-items: center; }
  .marked { margin-top: 8px; padding: 12px 14px; border: 1px dashed var(--line); border-radius: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
  .marked mark { background: var(--mark); color: var(--ink); border-radius: 4px; padding: 0 2px; }
  .note { background: var(--warn-bg); font-size: .9rem; border-top: 0 !important; }
  .actions { display: flex; flex-wrap: wrap; gap: 10px; }
  .ghost {
    display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 6px 16px;
    border: 1px solid var(--line); border-radius: 12px; background: var(--surface); font-weight: 700;
  }
  .ghost:hover { background: var(--hover); }
  .ghost svg { width: 1.2rem; height: 1.2rem; }
  .report { padding: 14px 26px 18px; border-top: 1px solid var(--line); font-size: .9rem; color: var(--muted); }
  .report a { color: var(--brand); font-weight: 700; }
  .error-card { background: var(--surface); border: 1px solid var(--scam); border-radius: 20px; padding: 20px 26px; }
  .error-card b { display: block; color: var(--scam); font-size: 1.15rem; margin-bottom: 4px; }
  .error-card p { margin: 0 0 12px; }
  .badge { display: inline-flex; padding: 2px 10px; border-radius: 999px; font-size: .75rem; font-weight: 700; background: var(--warn-bg); color: var(--warn); }

  /* ---------- Call checklist ---------- */
  .call-view { padding: 26px 28px; }
  .call-view h2 { margin: 0 0 6px; font-size: 1.5rem; line-height: 1.2; }
  .call-view > p { margin: 0 0 18px; color: var(--muted); }
  .checks { display: grid; gap: 10px; margin-bottom: 16px; }
  .checks label { display: flex; gap: 14px; align-items: center; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; cursor: pointer; min-height: 60px; }
  .checks label:hover { background: var(--hover); }
  .checks label:has(input:checked) { border-color: var(--scam); background: var(--scam-bg); }
  .checks input { width: 1.5rem; height: 1.5rem; margin: 0; accent-color: var(--scam); }
  .call-result { padding: 18px 20px; border-radius: 14px; background: var(--hover); }
  .call-result.stop { background: var(--scam-bg); }
  .call-result b { display: block; font-size: 1.3rem; line-height: 1.2; margin-bottom: 6px; }
  .call-result.stop b { color: var(--scam); }
  .call-result p { margin: 0; }

  .drop { position: fixed; inset: 0; z-index: 30; display: none; place-items: center; background: color-mix(in srgb, var(--bg) 90%, transparent); border: 4px dashed var(--brand); font-size: 1.5rem; font-weight: 700; color: var(--brand); text-align: center; padding: 24px; }
  .drop.on { display: grid; }
  .toast { position: fixed; left: 50%; bottom: 2rem; transform: translateX(-50%); z-index: 50; background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-weight: 700; opacity: 0; pointer-events: none; transition: opacity .2s; max-width: 90%; text-align: center; }
  .toast.on { opacity: 1; }

  /* ---------- Phones / narrow screens ---------- */
  @media (max-width: 720px) {
    .tool { grid-template-columns: minmax(0, 1fr); }
    .rail { flex-direction: row; padding: 4px; background: var(--hover); border-radius: 999px; }
    .rail button { flex: 1; flex-direction: row; justify-content: center; padding: 10px; border-radius: 999px; font-size: .9rem; }
    .rail button svg { width: 1.2rem; height: 1.2rem; }
    .rail button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
    .hint { padding-left: 0; }
    .results { margin-left: 0; }
    .card textarea { min-height: 9rem; padding: 20px; }
    .card-foot { padding: 14px 16px 16px; }
    .send { width: 100%; min-width: 0; }
    .count { margin-left: 0; }
    .result > section, .result > details, .result > .actions, .result > .note, .verdict, .report { padding-inline: 18px; }
  }
  @media (prefers-reduced-motion: reduce) {
    .dots i { animation: none; opacity: 1; }
    .toast { transition: none; }
  }

  /* Fixes */
  [hidden] { display: none !important; }
  .topline { flex-wrap: wrap; }
  @media (max-width: 720px) {
    .rail button svg { display: none; }
    .rail button span { white-space: nowrap; }
    .brand { font-size: .95rem; }
    .masthead .sub { font-size: 1rem; }
  }

/* ---------- Scampy / theme / results layout overrides ---------- */
:root{--display:"Fraunces",Georgia,serif}
:root[data-font="lexend"]{--font:"Lexend","Segoe UI",system-ui,sans-serif}
:root[data-font="serif"]{--font:Georgia,"Times New Roman",serif}
:root[data-theme="ocean"]{--bg:#F7F9FA;--surface:#fff;--ink:#18242C;--muted:#55636C;--faint:#66747C;--line:#E1E7EA;--hover:#EEF3F5;--brand:#17607F;--brand-soft:#E3EFF4;--user-bg:#EEF3F5;--shadow:0 2px 4px rgba(24,36,44,.04),0 12px 40px rgba(24,36,44,.08)}
:root[data-theme="contrast"]{--bg:#fff;--surface:#fff;--ink:#000;--muted:#000;--faint:#222;--line:#000;--hover:#eee;--brand:#A0001A;--brand-soft:#fde3e6;--scam:#8A0010;--scam-bg:#fff;--warn:#4a2e00;--warn-bg:#fff;--ok:#0b4a22;--ok-bg:#fff}
:root[data-theme="contrast"] .card,:root[data-theme="contrast"] .rc{border-width:2px}
html.rm *,html.rm *::before{animation:none!important;transition:none!important}
img{image-rendering:pixelated}
/* greeting inside the check box */
.field{position:relative}
.greet{position:absolute;left:22px;bottom:8px;display:flex;align-items:flex-end;gap:10px;pointer-events:none;transition:opacity .2s}
.field:has(textarea:not(:placeholder-shown)) .greet{opacity:0}
.greet img{display:block}
.bubble{margin:0 0 30px;max-width:17rem;padding:10px 14px;border-radius:16px 16px 16px 4px;background:var(--brand-soft);color:var(--ink);font-size:.9rem;line-height:1.35;font-weight:700}
/* rail extras + other views */
.access-view,.guide-view{padding:26px 28px}
.access-view h2,.guide-view h2{margin:0 0 6px;font-size:1.5rem;line-height:1.2}
.access-view>p,.guide-view>p{margin:0 0 18px;color:var(--muted)}
.opt{margin-bottom:20px}.opt h3{margin:0 0 8px;font-size:1rem}
.opt .row{display:flex;flex-wrap:wrap;gap:8px}
.opt button{min-height:52px;padding:8px 16px;border:2px solid var(--line);border-radius:12px;background:var(--surface);font-weight:700}
.opt button:hover{background:var(--hover)}
.opt button[aria-pressed="true"]{border-color:var(--brand);background:var(--brand-soft);color:var(--brand)}
.opt .sw{display:inline-flex;align-items:center;gap:8px}
.opt .sw::after{content:"Off";font-size:.8rem}.opt .sw[aria-pressed="true"]::after{content:"On"}
.chips{display:inline-flex}.chips u{width:1.1rem;height:1.1rem;border-radius:50%;border:1px solid #0004;margin-left:-3px}.chips u:first-child{margin-left:0}
.guide{list-style:none;margin:0;padding:0;display:grid;gap:18px;counter-reset:g}
.guide li{counter-increment:g;display:grid;grid-template-columns:11rem 1fr;gap:18px;align-items:center}
.guide h3{margin:0 0 4px;font-size:1.15rem}.guide h3::before{content:counter(g) ". "}.guide p{margin:0;color:var(--muted)}
.gimg{border:1px solid var(--line);border-radius:16px;background:var(--hover);padding:6px}.gimg svg{display:block;width:100%;height:auto}
.g-s{fill:var(--surface);stroke:var(--line);stroke-width:2}.g-a{fill:var(--brand-soft);stroke:var(--brand);stroke-width:2}.g-b{fill:var(--brand)}
.g-l{fill:none;stroke:var(--brand);stroke-width:3;stroke-linecap:round;stroke-linejoin:round}.g-w{fill:none;stroke:#fff;stroke-width:3;stroke-linecap:round;stroke-linejoin:round}
.g-r{fill:var(--scam-bg);stroke:var(--scam);stroke-width:2}.g-lr{fill:none;stroke:var(--scam);stroke-width:4;stroke-linecap:round}.g-bar{fill:var(--line)}.g-bf{fill:var(--scam)}
/* results, Base44 layout */
.result{background:none;border:0;box-shadow:none;overflow:visible;border-radius:0;display:grid;gap:16px}
.result>.rc{padding:22px 26px;border:1px solid var(--line);border-radius:20px;background:var(--surface)}
.rc h3{margin:0 0 14px;font:600 1.3rem/1.2 var(--display);text-transform:none;letter-spacing:0;color:var(--ink)}
.result>.rc.summary{display:flex;align-items:center;gap:16px;background:var(--v-bg);border-color:color-mix(in srgb,var(--v-fg) 25%,transparent);padding:26px 28px}
.sum-main{flex:1;min-width:0}
.sum-title{margin:0 0 8px;display:flex;align-items:center;gap:12px;font:600 clamp(1.8rem,5vw,2.4rem)/1.1 var(--display);color:var(--v-fg)}
.sum-title svg{width:2.2rem;height:2.2rem}
.sum-text{margin:0 0 22px;font-size:1.1rem;max-width:40rem}
.lk-row{display:flex;justify-content:space-between;align-items:baseline;color:var(--muted);margin-bottom:6px}
.lk-row b{font:600 2.2rem/1 var(--display);color:var(--v-fg)}
.bar{height:14px;border-radius:99px;background:color-mix(in srgb,var(--v-fg) 16%,transparent);overflow:hidden}.bar i{display:block;height:100%;border-radius:99px;background:var(--v-fg)}
.lk-type{margin:12px 0 0;font-size:.9rem;color:var(--muted)}.lk-type b{color:var(--ink)}
.vmasc{flex:none;align-self:center;width:11.5rem;height:11.5rem;display:grid;place-items:center;border-radius:50%;background:#FFE6D0}.vmasc img{display:block}
.pair{display:grid;grid-template-columns:1fr 1fr;gap:16px}.pair>.rc{padding:22px 26px;border:1px solid var(--line);border-radius:20px;background:var(--surface)}
.ilist{list-style:none;margin:0;padding:0;display:grid;gap:14px}
.ilist li{display:grid;grid-template-columns:1.5rem 1fr;gap:12px}.ilist li>svg{width:1.4rem;height:1.4rem;margin-top:2px}
.ilist .w>svg{color:var(--muted)}.ilist .k>svg{color:var(--ok)}
.ilist q{display:inline;quotes:none;background:var(--mark);padding:1px 6px;border-radius:6px;font-weight:700;overflow-wrap:anywhere}
.sigs{display:grid;grid-template-columns:1fr 1fr;gap:16px 36px}
.sig-row{display:flex;justify-content:space-between;font-size:.9rem;margin-bottom:6px}
.sbar{height:6px;border-radius:9px;background:var(--line);overflow:hidden}.sbar i{display:block;height:100%;background:var(--ink)}
.tags{display:flex;flex-wrap:wrap;gap:8px;margin-top:18px}.tags span{padding:6px 14px;border-radius:99px;background:var(--hover);font-size:.9rem}
.result>.rc.tip{background:var(--warn-bg);font-size:.9rem}
/* loading: silhouette only */
.thinking{position:relative;overflow:hidden;justify-content:flex-start;min-height:190px;padding:28px 28px 0;align-items:center}
.sil{background:var(--brand);-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}
.thinking .sil.main{margin-left:auto;align-self:flex-end}
.thinking .sil.run{position:absolute;left:0;bottom:6px;opacity:.85;animation:dash 1.8s linear infinite}
@keyframes dash{from{transform:translateX(-200px)}to{transform:translateX(100vw)}}
@media(max-width:720px){
.rail{display:grid;grid-template-columns:1fr 1fr;border-radius:20px}
.rail button{border-radius:16px}
.guide li{grid-template-columns:1fr}.gimg{max-width:15rem}
.pair,.sigs{grid-template-columns:1fr}
.result>.rc{padding:18px}.result>.rc.summary{padding:20px 18px;flex-wrap:wrap}
.access-view,.guide-view{padding:20px}.greet{left:14px}.bubble{max-width:11rem;font-size:.8rem}
.vmasc{width:8.5rem;height:8.5rem;margin-inline:auto}}
.brand svg.logo{width:2.4rem;height:2.4rem}
/* Scampy size limits (our GIFs are bigger than the original sprites) */
.greet img { width: 6.5rem; height: auto; }
.vmasc img { width: auto !important; height: auto; max-width: 8rem; max-height: 8rem; }
.sil { -webkit-mask-size: contain !important; mask-size: contain !important;
       -webkit-mask-position: center; mask-position: center; }
.thinking .sil.run { width: 4.5rem !important; height: 3rem !important; }
@media (max-width: 720px) {
  .greet img { width: 4.5rem; }
  .vmasc img { max-width: 6rem; max-height: 6rem; }
}