/* =========================================================
   JournalScope — light, LinkedIn-style design system
   Layout: warm grey page, white "feed" cards, left input panel + results column.
   Motion: one easing curve everywhere; everything respects prefers-reduced-motion.
   ========================================================= */
:root {
  /* surfaces */
  --bg: #f4f2ee;
  --surface: #ffffff;
  --surface-2: #f9f8f6;
  --surface-hover: #f3f2ef;
  --border: #e0dfdc;
  --border-strong: #c9c7c1;

  /* text */
  --text: rgba(0, 0, 0, .9);
  --text-dim: rgba(0, 0, 0, .62);
  --text-faint: #6b6b6b;

  /* brand + states (LinkedIn palette) */
  --blue: #0a66c2;
  --blue-dark: #004182;
  --blue-soft: #e8f3ff;
  --blue-line: #b9d4ee;
  --green: #01754f;
  --green-soft: #e6f4ee;
  --amber: #915907;
  --amber-soft: #fcf3dd;
  --amber-line: #ecd596;
  --red: #b3261e;
  --red-soft: #fdecea;
  --red-line: #f1b8b3;

  --r-sm: 6px;
  --r: 8px;
  --r-lg: 8px;
  --pill: 999px;
  --shadow-1: 0 0 0 1px rgba(0, 0, 0, .08), 0 1px 2px rgba(0, 0, 0, .05);
  --shadow-2: 0 0 0 1px rgba(0, 0, 0, .1), 0 8px 24px -8px rgba(0, 0, 0, .18);
  --font: -apple-system, system-ui, "Segoe UI", Roboto, "Helvetica Neue", "Fira Sans", Ubuntu, Oxygen, "Oxygen Sans", Cantarell, "Droid Sans", "Apple Color Emoji", "Segoe UI Emoji", Helvetica, Arial, sans-serif;
  --ease: cubic-bezier(.22, .8, .24, 1);   /* decelerating, used for every transition */
  --t: .28s;
  color-scheme: light;
  interpolate-size: allow-keywords;        /* lets <details> animate its height */
}

@property --p { syntax: "<number>"; inherits: false; initial-value: 0; }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-decoration: none; transition: color var(--t) var(--ease); }
a:hover { color: var(--blue-dark); text-decoration: underline; }
svg { width: 1.1em; height: 1.1em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--text-dim); font-weight: 400; }
.small { font-size: .82rem; }
b { font-weight: 600; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 4px; }
.bg-orbs { display: none; }

/* ---------- surfaces ---------- */
.glass { background: var(--surface); box-shadow: var(--shadow-1); border: 0; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: stretch; gap: 20px;
  padding: 0 clamp(16px, 4vw, 48px);
  min-height: 56px;
  background: var(--surface);
  box-shadow: 0 1px 0 var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: 1.12rem; font-weight: 400; letter-spacing: -.01em; padding: 8px 0; }
.brand:hover { text-decoration: none; color: var(--text); }
.brand b { color: var(--blue); font-weight: 700; }
.brand-mark { width: 30px; height: 30px; transition: transform .5s var(--ease); }
.brand:hover .brand-mark { transform: rotate(-12deg) scale(1.06); }

.tabs { position: relative; display: flex; gap: 2px; margin-left: auto; align-items: stretch; }
.tabs::after {                       /* sliding indicator, positioned from app.js */
  content: ""; position: absolute; left: 0; bottom: 0; height: 3px; border-radius: 3px 3px 0 0;
  width: var(--ind-w, 0px); transform: translateX(var(--ind-x, 0px));
  background: var(--blue);
  transition: transform .5s var(--ease), width .5s var(--ease);
}
.tab {
  background: none; border: 0; color: var(--text-dim); font: 600 .92rem var(--font);
  padding: 0 16px; cursor: pointer; transition: color var(--t) var(--ease), background var(--t) var(--ease);
  display: inline-flex; align-items: center; gap: 6px; border-radius: 0;
}
.tab:hover { color: var(--text); background: var(--surface-hover); }
.tab.active { color: var(--text); }
.icon-btn {
  align-self: center; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%;
  background: transparent; border: 0; color: var(--text-dim); cursor: pointer;
  transition: background var(--t) var(--ease), color var(--t) var(--ease), transform .5s var(--ease);
}
.icon-btn:hover { color: var(--text); background: var(--surface-hover); transform: rotate(60deg); }
.icon-btn svg { width: 20px; height: 20px; }
.pill {
  display: inline-block; font-size: .7rem; font-weight: 700; padding: 1px 8px; border-radius: var(--pill);
  background: var(--blue); color: #fff; vertical-align: middle; transition: background var(--t) var(--ease);
}
.tab:not(.active) .pill { background: var(--text-faint); }

/* ---------- page + hero ---------- */
main { padding: 0 clamp(16px, 4vw, 48px) 40px; max-width: 1480px; margin: 0 auto; }
.view { display: none; }
.view.active { display: block; animation: viewIn .55s var(--ease) both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.hero {
  background: var(--surface); box-shadow: var(--shadow-1); border-radius: var(--r);
  padding: 26px clamp(18px, 3vw, 32px); margin: 20px 0 20px; position: relative; overflow: hidden;
}
.hero::before {                       /* LinkedIn-style cover strip */
  content: ""; position: absolute; inset: 0 0 auto 0; height: 6px;
  background: linear-gradient(90deg, #0a66c2, #378fe9 55%, #70b5f9);
}
.hero.compact { padding: 24px clamp(18px, 3vw, 32px); }
h1, .h1-like { font-weight: 600; letter-spacing: -.015em; font-size: clamp(1.55rem, 3vw, 2.15rem); line-height: 1.2; margin: 6px 0 10px; }
h1 em { font-style: normal; color: var(--blue); }
.lede { color: var(--text-dim); font-size: 1rem; margin: 0; max-width: 760px; }
.lede b { color: var(--text); }
.data-status {
  margin: 16px 0 0; display: inline-flex; align-items: center; gap: 8px; max-width: 100%;
  padding: 6px 14px; border-radius: var(--pill); font-size: .82rem; color: var(--text-dim);
  background: var(--surface-2); border: 1px solid var(--border);
  transition: background var(--t) var(--ease), color var(--t) var(--ease), border-color var(--t) var(--ease);
}
.data-status.ready { color: var(--green); background: var(--green-soft); border-color: #b7dccb; animation: pop .5s var(--ease); }
.data-status.error { color: var(--red); background: var(--red-soft); border-color: var(--red-line); }
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--border); border-top-color: var(--blue); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pop { 0% { transform: scale(.96); opacity: .4; } 60% { transform: scale(1.02); } 100% { transform: none; opacity: 1; } }

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: minmax(320px, 400px) 1fr; gap: 20px; align-items: start; }
@media (max-width: 980px) { .layout { grid-template-columns: 1fr; } .tabs { margin-left: 0; } .topbar { flex-wrap: wrap; gap: 0 16px; } .tabs { order: 3; width: 100%; overflow-x: auto; } }
.panel { border-radius: var(--r); padding: 20px; }
.input-panel { position: sticky; top: 72px; max-height: calc(100vh - 88px); overflow: auto; }
.input-panel::-webkit-scrollbar { width: 6px; }
.input-panel::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }

/* ---------- form ---------- */
.field { display: block; margin-bottom: 16px; }
.label { display: flex; justify-content: space-between; font-size: .8rem; font-weight: 600; color: var(--text-dim); margin-bottom: 6px; }
.label .muted { color: var(--text-faint); }
input[type=text], input[type=password], input[type=search], textarea, select {
  width: 100%; font: 400 .95rem var(--font); color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  padding: 10px 12px; outline: none;
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease), background var(--t) var(--ease);
}
input:hover, textarea:hover, select:hover { border-color: #8f8d87; }
textarea { resize: vertical; min-height: 180px; line-height: 1.55; }
input:focus, textarea:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue); }
::placeholder { color: #8a8a8a; }

.filters { border-top: 1px solid var(--border); padding-top: 14px; margin-top: 6px; }
.filters summary { cursor: pointer; font-weight: 600; color: var(--text); margin-bottom: 14px; list-style: none; display: flex; align-items: center; gap: 8px; }
.filters summary::-webkit-details-marker { display: none; }
.filters summary::before { content: "▸"; transition: transform var(--t) var(--ease); color: var(--text-dim); }
.filters[open] summary::before { transform: rotate(90deg); }
.chip-group { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 5px 14px;
  border-radius: var(--pill); border: 1px solid var(--text-dim); background: var(--surface); color: var(--text-dim);
  font-size: .86rem; font-weight: 600; cursor: pointer; user-select: none;
  transition: background var(--t) var(--ease), color var(--t) var(--ease), border-color var(--t) var(--ease), transform .15s var(--ease);
}
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip:hover { background: var(--surface-hover); border-color: var(--text); color: var(--text); }
.chip:active { transform: scale(.96); }
.chip:has(input:checked) { background: var(--green); border-color: var(--green); color: #fff; }
.chip:has(input:focus-visible) { outline: 2px solid var(--blue); outline-offset: 2px; }
.slider-row { display: flex; align-items: center; gap: 10px; font-size: .8rem; }
input[type=range] { flex: 1; accent-color: var(--blue); }
.toggles { display: grid; gap: 10px; margin-top: 4px; }
.toggle { display: flex; align-items: center; gap: 10px; font-size: .9rem; cursor: pointer; color: var(--text-dim); transition: color var(--t) var(--ease); }
.toggle input { display: none; }
.toggle span { width: 38px; height: 22px; border-radius: var(--pill); background: #c8c6c0; position: relative; transition: background var(--t) var(--ease); flex: none; }
.toggle span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.3); transition: transform .35s var(--ease); }
.toggle input:checked + span { background: var(--green); }
.toggle input:checked + span::after { transform: translateX(16px); }
.toggle:has(input:checked) { color: var(--text); }

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.actions.center { justify-content: flex-start; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; font: 600 .95rem var(--font);
  padding: 8px 18px; border-radius: var(--pill); cursor: pointer;
  background: var(--surface); color: var(--blue); border: 1px solid var(--blue);
  transition: background var(--t) var(--ease), box-shadow var(--t) var(--ease), color var(--t) var(--ease), transform .15s var(--ease), border-color var(--t) var(--ease);
}
.btn:hover:not(:disabled) { background: var(--blue-soft); box-shadow: inset 0 0 0 1px var(--blue); }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; flex: 1; justify-content: center; }
.btn.primary:hover:not(:disabled) { background: var(--blue-dark); border-color: var(--blue-dark); box-shadow: none; }
.btn.danger { color: var(--red); border-color: var(--red); }
.btn.danger:hover:not(:disabled) { background: var(--red-soft); box-shadow: inset 0 0 0 1px var(--red); }
.btn.small { padding: 4px 14px; font-size: .84rem; }
.btn.ai { color: var(--amber); border-color: var(--amber); }
.btn.ai:hover:not(:disabled) { background: var(--amber-soft); box-shadow: inset 0 0 0 1px var(--amber); }

/* ---------- empty state ---------- */
.empty-state { text-align: left; padding: 30px clamp(18px, 3vw, 32px); border-radius: var(--r); background: var(--surface); box-shadow: var(--shadow-1); animation: viewIn .6s var(--ease) both; }
.empty-illus { position: relative; width: 88px; height: 88px; margin: 0 0 14px; display: grid; place-items: center; }
.empty-illus svg { width: 34px; height: 34px; color: var(--blue); }
.ring { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--blue-line); animation: pulse 3.2s var(--ease) infinite; }
.ring.r2 { animation-delay: 1s; } .ring.r3 { animation-delay: 2s; }
@keyframes pulse { 0% { transform: scale(.45); opacity: 1; } 100% { transform: scale(1.2); opacity: 0; } }
.empty-state h2 { font-weight: 600; margin: 0 0 12px; font-size: 1.25rem; }
.how { text-align: left; max-width: 640px; margin: 0; color: var(--text-dim); display: grid; gap: 10px; padding-left: 20px; }
.how b { color: var(--text); }

/* ---------- results header ---------- */
.results-head { border-radius: var(--r); padding: 20px 22px; margin-bottom: 14px; animation: viewIn .5s var(--ease) both; }
.results-head h2 { margin: 0 0 2px; font-size: 1.2rem; font-weight: 600; }
.results-head .row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.topic-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.topic-chip {
  font-size: .8rem; font-weight: 600; padding: 4px 12px; border-radius: var(--pill); border: 1px solid var(--blue-line);
  background: var(--blue-soft); color: var(--blue-dark); display: inline-flex; gap: 8px; align-items: center;
  transition: transform var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
.topic-chip:hover { transform: translateY(-1px); box-shadow: 0 3px 8px -3px rgba(10, 102, 194, .35); }
.topic-chip i { font-style: normal; color: var(--text-dim); font-weight: 400; font-size: .72rem; }
.topic-chip .bar { width: 34px; height: 4px; border-radius: 4px; background: #cfe0f1; overflow: hidden; }
.topic-chip .bar span { display: block; height: 100%; background: var(--blue); border-radius: 4px; animation: grow 1s var(--ease) both; }

.ladder { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 16px; }
@media (max-width: 700px) { .ladder { grid-template-columns: 1fr; } }
.ladder-col { border-radius: var(--r); padding: 12px 14px; border: 1px solid var(--border); background: var(--surface-2); transition: transform var(--t) var(--ease), box-shadow var(--t) var(--ease); }
.ladder-col:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.ladder-col h4 { margin: 0 0 6px; font-size: .74rem; text-transform: uppercase; letter-spacing: .07em; }
.ladder-col.reach { background: var(--amber-soft); border-color: var(--amber-line); } .ladder-col.reach h4 { color: var(--amber); }
.ladder-col.target { background: var(--blue-soft); border-color: var(--blue-line); } .ladder-col.target h4 { color: var(--blue); }
.ladder-col.safe { background: var(--green-soft); border-color: #b7dccb; } .ladder-col.safe h4 { color: var(--green); }
.ladder-col ul { margin: 0; padding-left: 16px; font-size: .86rem; color: var(--text-dim); }
.ladder-col li { margin: 4px 0; }
.ladder-col a { color: var(--text); font-weight: 600; }
.ladder-col a:hover { color: var(--blue); }

.ai-summary { margin-top: 16px; padding: 14px 16px; border-radius: var(--r); background: #eef3f8; border: 1px solid var(--blue-line); font-size: .92rem; }
.ai-summary h4 { margin: 0 0 6px; font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; color: var(--blue-dark); }

/* ---------- journal card ---------- */
.cards { display: grid; gap: 12px; }
.card {
  border-radius: var(--r); padding: 18px 20px; position: relative;
  transition: transform .35s var(--ease), box-shadow .35s var(--ease);
  animation: cardIn .6s var(--ease) both;
}
.card:hover { box-shadow: var(--shadow-2); transform: translateY(-2px); }
@keyframes cardIn { from { opacity: 0; transform: translateY(18px) scale(.985); } }
.card-top { display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: start; }
.rank { font-size: 1.35rem; font-weight: 700; color: var(--text-faint); min-width: 30px; line-height: 1.2; }
.card h3 { margin: 0; font-size: 1.08rem; font-weight: 600; line-height: 1.35; }
.card h3 a { color: var(--text); }
.card h3 a:hover { color: var(--blue); text-decoration: underline; }
.card .pub { color: var(--text-dim); font-size: .84rem; margin-top: 2px; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: .74rem; font-weight: 600;
  padding: 2px 10px; border-radius: var(--pill); border: 1px solid var(--border); background: var(--surface-2); color: var(--text-dim);
  white-space: nowrap; transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
.badge:hover { transform: translateY(-1px); box-shadow: 0 2px 6px -2px rgba(0, 0, 0, .25); }
.badge b { color: var(--text); font-weight: 700; }
.badge.abdc-As { background: var(--amber-soft); border-color: var(--amber-line); color: var(--amber); }
.badge.abdc-A { background: var(--blue-soft); border-color: var(--blue-line); color: var(--blue-dark); }
.badge.abdc-B { background: #e3f3f3; border-color: #aedada; color: #0b5f66; }
.badge.abdc-C { background: #eeeeec; border-color: #d4d2cd; color: #555; }
.badge.abdc-X { background: var(--red-soft); border-color: var(--red-line); color: var(--red); }
.badge.abdc-As b, .badge.abdc-A b, .badge.abdc-B b, .badge.abdc-C b, .badge.abdc-X b { color: inherit; }
.badge.q1 { color: var(--green); border-color: #b7dccb; background: var(--green-soft); }
.badge.q2 { color: #4d6b0e; border-color: #cfdc9f; background: #f1f6e1; }
.badge.q3 { color: var(--amber); border-color: var(--amber-line); background: var(--amber-soft); }
.badge.q4 { color: #a1470b; border-color: #f0c7a4; background: #fdf0e4; }
.badge.q1 b, .badge.q2 b, .badge.q3 b, .badge.q4 b { color: inherit; }
.badge.scopus { color: #8a3d12; background: #fdf1e8; border-color: #f0cfb6; }
.badge.oa { color: #8a6d00; background: #fdf7d9; border-color: #ecdc8d; }
.badge.warn { color: var(--red); background: var(--red-soft); border-color: var(--red-line); }
.badge.tier { text-transform: uppercase; letter-spacing: .05em; font-size: .68rem; }
.badge.tier-reach { color: var(--amber); background: var(--amber-soft); border-color: var(--amber-line); }
.badge.tier-target { color: var(--blue-dark); background: var(--blue-soft); border-color: var(--blue-line); }
.badge.tier-safe { color: var(--green); background: var(--green-soft); border-color: #b7dccb; }

.score { text-align: center; }
.ring-score {
  --p: 0; width: 62px; height: 62px; border-radius: 50%; display: grid; place-items: center; position: relative;
  background: conic-gradient(from 0deg, var(--blue) calc(var(--p) * 1%), #e4e1da 0);
  animation: ringFill 1.1s var(--ease) both;
}
@keyframes ringFill { from { --p: 0; } }
.ring-score::after { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: var(--surface); }
.ring-score span { position: relative; z-index: 1; font-weight: 700; font-size: 1.02rem; }
.score small { display: block; color: var(--text-faint); font-size: .66rem; margin-top: 4px; text-transform: uppercase; letter-spacing: .05em; }

.why { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 12px; }
.why-summary { font-size: .92rem; color: var(--text-dim); }
.why-summary strong { color: var(--text); font-weight: 600; }
.why details { margin-top: 10px; }
.why details summary { cursor: pointer; font-size: .86rem; font-weight: 600; color: var(--blue); list-style: none; display: inline-flex; align-items: center; gap: 6px; transition: color var(--t) var(--ease); }
.why details summary:hover { color: var(--blue-dark); }
.why details summary::-webkit-details-marker { display: none; }
.why details summary::after { content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-2px) rotate(45deg); transition: transform .4s var(--ease); }
.why details[open] summary::after { transform: translateY(1px) rotate(-135deg); }
.why details::details-content { block-size: 0; overflow: hidden; transition: block-size .45s var(--ease), content-visibility .45s allow-discrete; }
.why details[open]::details-content { block-size: auto; }
.why-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
@media (max-width: 760px) { .why-grid { grid-template-columns: 1fr; } }
.why-block { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r); padding: 12px 14px; font-size: .87rem; }
.why-block h5 { margin: 0 0 8px; font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--text-faint); }
.why-block p { margin: 0 0 6px; color: var(--text-dim); }
.why-block p:last-child { margin-bottom: 0; }
.why-block.full { grid-column: 1 / -1; }
.topic-bars { display: grid; gap: 7px; }
.tb { display: grid; grid-template-columns: 1fr 70px 40px; gap: 10px; align-items: center; font-size: .82rem; }
.tb .name { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb .name.hit::before { content: "● "; color: var(--blue); }
.tb .track { height: 6px; background: #e4e1da; border-radius: 6px; overflow: hidden; }
.tb .track span { display: block; height: 100%; background: var(--blue); border-radius: 6px; animation: grow .9s var(--ease) both; }
@keyframes grow { from { width: 0; } }
.tb .pct { color: var(--text-faint); text-align: right; font-variant-numeric: tabular-nums; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: .84rem; margin: 0; }
.kv dt { color: var(--text-faint); }
.kv dd { margin: 0; color: var(--text); font-variant-numeric: tabular-nums; }
.why-block .verify { margin: 12px 0 0; line-height: 1.65; }
.why-block .verify a { font-weight: 600; }
.cautions { margin: 0; padding-left: 18px; color: var(--red); font-size: .85rem; }
.terms { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.term { font-size: .74rem; font-weight: 600; padding: 2px 9px; border-radius: var(--pill); background: var(--blue-soft); color: var(--blue-dark); border: 1px solid var(--blue-line); }
.ai-note { margin-top: 10px; padding: 10px 12px; border-radius: var(--r); background: #eef3f8; border: 1px solid var(--blue-line); font-size: .87rem; color: var(--text); }
.ai-note b { color: var(--blue-dark); }

.card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; align-items: center; }
.link-row { display: flex; flex-wrap: wrap; gap: 14px; font-size: .82rem; font-weight: 600; margin-left: auto; }
.star {
  background: var(--surface); border: 1px solid var(--text-dim); color: var(--text-dim); border-radius: var(--pill);
  padding: 4px 14px; cursor: pointer; font: 600 .82rem var(--font); display: inline-flex; gap: 6px; align-items: center;
  transition: background var(--t) var(--ease), color var(--t) var(--ease), border-color var(--t) var(--ease), transform .15s var(--ease);
}
.star:hover { background: var(--surface-hover); color: var(--text); border-color: var(--text); }
.star:active { transform: scale(.96); }
.star.on { color: var(--amber); border-color: var(--amber); background: var(--amber-soft); }
.star.on svg { fill: #e0a100; stroke: var(--amber); animation: starPop .45s var(--ease); }
@keyframes starPop { 0% { transform: scale(.6) rotate(-20deg); } 60% { transform: scale(1.25) rotate(8deg); } 100% { transform: none; } }

.more { display: flex; justify-content: center; margin-top: 16px; }

/* ---------- lookup ---------- */
.search-box { display: flex; align-items: center; gap: 10px; padding: 4px 16px; border-radius: var(--pill); margin: 18px 0 0; max-width: 680px; background: var(--surface-hover); box-shadow: inset 0 0 0 1px var(--border-strong); transition: box-shadow var(--t) var(--ease), background var(--t) var(--ease); }
.search-box:focus-within { background: var(--surface); box-shadow: inset 0 0 0 2px var(--blue); }
.search-box svg { color: var(--text-dim); width: 20px; height: 20px; flex: none; }
.search-box input { background: transparent; border: 0; box-shadow: none !important; font-size: 1rem; padding: 10px 0; }
.lookup-results { display: grid; gap: 12px; max-width: 1000px; margin: 0; }
.no-results { color: var(--text-dim); padding: 30px 0; }

/* ---------- footer / modal / toast ---------- */
.footer { border-top: 1px solid var(--border); background: var(--surface); padding: 22px clamp(16px, 4vw, 48px); color: var(--text-dim); font-size: .85rem; text-align: center; }
.footer p { max-width: 900px; margin: 8px auto 0; }
.modal { border: 0; border-radius: var(--r); padding: 26px; max-width: 520px; width: calc(100% - 32px); color: var(--text); background: var(--surface); box-shadow: 0 24px 60px -12px rgba(0, 0, 0, .35); }
.modal[open] { animation: modalIn .4s var(--ease) both; }
@keyframes modalIn { from { opacity: 0; transform: translateY(16px) scale(.97); } }
.modal::backdrop { background: rgba(0, 0, 0, .45); backdrop-filter: blur(3px); animation: fade .3s var(--ease) both; }
@keyframes fade { from { opacity: 0; } }
.modal h3 { margin: 0 0 8px; font-weight: 600; font-size: 1.3rem; }
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 30px); opacity: 0; pointer-events: none;
  background: #1f1f1f; color: #fff; padding: 10px 20px; border-radius: var(--pill);
  box-shadow: var(--shadow-2); transition: opacity .35s var(--ease), transform .35s var(--ease); font-size: .9rem; font-weight: 600; z-index: 50;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.skeleton { height: 150px; border-radius: var(--r); background: linear-gradient(90deg, #eceae5 0%, #f6f4f0 50%, #eceae5 100%); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- print ---------- */
@media print {
  body { background: #fff; color: #000; }
  .topbar, .input-panel, .footer, .actions, .card-actions, .tabs, .hero .lede { display: none !important; }
  .glass, .card { background: #fff; box-shadow: none; border: 1px solid #ccc; }
  .card { break-inside: avoid; color: #000; animation: none; transform: none; }
  .card h3 a, .why-summary strong, .kv dd, .tb .name { color: #000; }
  .why details > *:not(summary) { display: block; }
  .why details::details-content { block-size: auto; }
  .view { display: none !important; } .view.printing { display: block !important; }
}
