/* ==========================================================================
   MacIndex — styles.css
   Dark, quiet, utilitarian. Tokens live in tokens.css.
   ========================================================================== */

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--ix-2); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button { font: inherit; color: inherit; }
h1, h2, h3, h4, p { margin: 0; }
:focus-visible { outline: 2px solid var(--ix-2); outline-offset: 2px; }

.skip-link { position: absolute; left: -999px; top: 8px; z-index: 200; background: var(--surface-2); padding: 8px 12px; border-radius: 8px; }
.skip-link:focus { left: 8px; }
.noscript { padding: 24px; text-align: center; color: var(--text-2); }

kbd {
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1;
  color: var(--text-2);
  background: rgba(255, 255, 255, .06);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 3px 6px;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px; white-space: nowrap;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text); font-size: 14px; font-weight: 500;
  cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn:hover { border-color: var(--border-strong); background: #20252f; text-decoration: none; }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface); color: var(--text); }
.btn-primary { background: var(--ix-solid); border-color: transparent; color: #fff; }
.btn-primary:hover { background: #4f57e6; border-color: transparent; }
.btn-danger { color: var(--err); }
.btn-small { height: 30px; padding: 0 10px; white-space: nowrap; font-size: 13px; border-radius: 6px; }

.icon-btn {
  display: inline-grid; place-items: center; flex: none;
  width: 32px; height: 32px;
  background: rgba(255, 255, 255, .06); border: 0; border-radius: 6px;
  color: var(--text-2); cursor: pointer;
  transition: background-color .15s, color .15s;
}
.icon-btn:hover { background: rgba(255, 255, 255, .12); color: var(--text); }

/* ---------- Header ----------
   One grid, two layouts. Home: a 640px column. Results: a 760px column that lines up with the results. */

.topbar { position: relative; z-index: 50; }

.bar {
  max-width: 680px;
  margin: 0 auto;
  padding: clamp(72px, 23vh, 200px) 20px 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "brand mascot" "tagline mascot" "seg seg" "search search" "all all" "line line" "suggest suggest" "music music";
}

.brand { grid-area: brand; justify-self: start; display: inline-flex; align-items: center; gap: 14px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-logo { width: 52px; height: 52px; flex: none; }
.brand-name { font-family: var(--serif); font-size: 68px; font-weight: 400; line-height: 1; letter-spacing: -0.035em; white-space: nowrap; }
.brand-name b { font-family: var(--mono); font-weight: 500; font-size: .74em; letter-spacing: -0.07em; color: var(--ix-2); margin-left: .04em; }
.tagline { grid-area: tagline; margin-top: 16px; text-wrap: balance; font-size: 16px; line-height: 1.5; color: var(--text-2); }

.support-btn {
  position: absolute; top: 14px; right: 56px;
  height: auto; padding: 6px 0; background: none; border: 0; border-radius: 0;
  border-bottom: 1px solid rgba(125, 176, 238, .5);
  border-bottom-color: rgba(125, 176, 238, .85);
  color: #fff; font-size: 14px; font-weight: 600; letter-spacing: .01em;
  border-bottom-width: 2px; border-bottom-color: var(--ix-2);
}
.support-btn:hover { background: none; border-color: var(--ix-2); color: #fff; }

/* Software / Games: two text tabs and one underline that slides between them. */
.seg { grid-area: seg; margin-top: 44px; position: relative; display: flex; gap: 30px; border-bottom: 1px solid var(--border); }
.seg button {
  display: inline-flex; align-items: baseline; gap: 8px;
  padding: 0 0 12px; background: none; border: 0;
  color: var(--text-2); font-size: 15px; font-weight: 400; cursor: pointer;
  transition: color .15s;
}
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { color: var(--text); font-weight: 500; }
.seg button kbd { padding: 0; font-size: 10px; background: none; border: 0; color: var(--text-3); }
.seg-thumb {
  position: absolute; bottom: -1px; left: var(--thumb-x, 0); width: var(--thumb-w, 0); height: 2px;
  background: var(--ix); pointer-events: none;
}
.seg.placed .seg-thumb { transition: left .25s cubic-bezier(.22, 1, .36, 1), width .25s cubic-bezier(.22, 1, .36, 1); }

/* The search field is a ruled line, not a box. */
.searchbar {
  grid-area: search; margin-top: 26px; position: relative;
  display: flex; align-items: center; gap: 14px;
  padding: 0 0 12px;
  border-bottom: 1.5px solid rgba(255, 255, 255, .2);
  transition: border-color .2s, box-shadow .2s;
}
.searchbar:focus-within { border-color: var(--ix); box-shadow: 0 1px 0 0 var(--ix), 0 16px 22px -18px rgba(74, 144, 226, .75); }
.prompt { flex: none; font: 500 24px/1 var(--mono); color: var(--ix-2); }
.searchbar input {
  flex: 1; min-width: 0; height: 36px;
  background: none; border: 0; outline: 0; padding: 0;
  color: var(--text); font: inherit; font-size: 26px;
}
.searchbar input::placeholder { color: #6E7482; }
.searchbar input { text-overflow: ellipsis; }
/* Animated placeholder: an overlay on the empty input; long messages slide left under a soft fade instead of clipping. */
.qfield { position: relative; flex: 1; min-width: 0; display: flex; align-items: center; }
.qfield input { width: 100%; }
.ph { display: none; position: absolute; inset: 0; align-items: center; overflow: hidden; pointer-events: none; white-space: nowrap;
  font: 400 18px/1 var(--mono-ph); letter-spacing: -.01em; color: #7E8594;
}
.ph #phText { display: inline-block; flex: none; will-change: transform; }
.ph-caret { flex: none; width: 1.5px; height: 20px; margin-left: 2px; background: var(--ix-2); animation: ph-blink 1s steps(1) infinite; }
@keyframes ph-blink { 50% { opacity: 0; } }
.qfield.is-typing .ph { display: flex; }
.qfield.is-typing input::placeholder { color: transparent; }
@media (max-width: 600px) { .ph { font-size: 15px; } }
@media (max-width: 340px) { .ph { font-size: 14px; } }
@media (prefers-reduced-motion: reduce) { .ph-caret { animation: none; } }
#fx { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
body.has-results #fx { display: none; }
.topbar, main, .footer { position: relative; z-index: 1; }
.kbd-group { display: inline-flex; flex: none; }
.searchbar:focus-within .kbd-group, .searchbar.has-text .kbd-group { display: none; }

/* Status line: a readout of what the page is doing. Fixed height, so it never shifts the layout. */
.statusline {
  grid-area: line; margin-top: 12px; min-height: 18px;
  display: flex; align-items: center; gap: 9px; overflow: hidden;
  font: 500 12px/1.4 var(--mono); color: var(--text-3);
}
.statusline .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex: none; }
.statusline .sep { color: #4C5160; }
#statusLineText { display: inline-flex; align-items: center; gap: 0 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
@media (max-width: 520px) { .status-long { display: none; } }
.statusline[data-tone="busy"] .dot { background: var(--ix-2); animation: pulse 1.1s ease-in-out infinite; }
.statusline[data-tone="warn"] .dot { background: var(--warn); }
.statusline[data-tone="err"] .dot { background: var(--err); }
@keyframes pulse { 50% { opacity: .3; } }

/* Quick refinements (results only): square-cornered tags */
.chips { grid-area: chips; display: none; align-items: center; flex-wrap: wrap; gap: 8px; min-width: 0; }
.chips-label { margin-right: 4px; color: var(--text-3); font: 500 10px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; white-space: nowrap; }
.chip {
  display: inline-flex; align-items: center; height: 28px; padding: 0 10px;
  background: transparent; border: 1px solid var(--border-strong); border-radius: 4px;
  color: #C9CCD6; font-size: 13px; white-space: nowrap; cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s;
}
.chip::before { content: "+ "; color: var(--text-3); white-space: pre; }
.chip:hover { background: var(--surface-2); color: var(--text); }
.chip[aria-pressed="true"] { background: rgba(74, 144, 226, .14); border-color: rgba(125, 176, 238, .7); color: var(--text); }
.chip[aria-pressed="true"]::before { content: "✓ "; color: var(--ix-2); }

/* Example searches (home only): plain underlined words */
.suggest { grid-area: suggest; margin-top: 44px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; }
.suggest::before { content: "Try"; color: var(--text-3); font: 500 10px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; }
.suggest button {
  padding: 0 0 2px; background: none; border: 0; border-bottom: 1px solid rgba(255, 255, 255, .2);
  color: #C9CCD6; font-size: 14px; cursor: pointer; transition: border-color .15s, color .15s;
}
.suggest button:hover { color: var(--text); border-color: var(--ix-2); }

/* Results layout: the same header, compact, in the results' own 760px column */
body.has-results .bar {
  max-width: 800px;
  padding: 22px 20px 0;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas: "brand support" "search search" "all all" "line line" "seg chips";
  align-items: end;
}
body.has-results .brand { gap: 10px; }
body.has-results .brand-logo { width: 28px; height: 28px; }
body.has-results .brand-name { font-size: 24px; }
body.has-results .tagline, body.has-results .suggest { display: none; }
body.has-results .support-btn { position: static; grid-area: support; justify-self: end; align-self: center; }
body.has-results .searchbar { margin-top: 22px; padding-bottom: 10px; }
body.has-results .prompt { font-size: 17px; }
body.has-results .searchbar input { font-size: 17px; height: 28px; }
body.has-results .seg { margin-top: 18px; align-self: stretch; align-items: flex-end; }
body.has-results .chips[hidden] { display: none; }
body.has-results .bar:has(.chips[hidden]) .seg { grid-column: 1 / -1; border-bottom: 1px solid var(--border); }
body.has-results .chips:not([hidden]) { display: flex; margin-top: 18px; padding: 0 0 10px; justify-content: flex-end; align-self: stretch; align-items: center; border-bottom: 1px solid var(--border); }

/* ---------- Results ---------- */

main { width: 100%; max-width: 800px; margin: 0 auto; padding: 0 20px 40px; flex: 1; }
.results { padding-top: 0; scroll-margin-top: 16px; }
.results-head { margin: 28px 0 14px; }
.results-title { font-family: var(--serif); font-size: 28px; font-weight: 400; line-height: 1.2; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.results-meta { margin-top: 6px; font: 500 11px/1.4 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); }

.frame-wrap { position: relative; min-width: 0; }
.engine-frame { display: block; width: 100%; height: 0; border: 0; background: transparent; color-scheme: dark; }
/* While loading, the frame stays rendered (so Google can lay out at full width and be measured) but sits
   out of the page flow, so it takes no space and can't show up as a thin line. */
.engine-frame.is-pending { position: absolute; top: 0; left: 0; height: 1px !important; opacity: 0; pointer-events: none; }

.status {
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-2);
  font-size: 14px;
}
.status strong { display: block; margin-bottom: 6px; color: var(--text); font: 400 20px/1.3 var(--serif); }
.status .row { margin-top: 14px; }
/* No results: big, centred and highlighted so it can't be mistaken for an empty box. */
.status.is-empty { padding: 40px 20px 34px; text-align: center; background: linear-gradient(180deg, rgba(74, 144, 226, .10), rgba(74, 144, 226, .03)); border: 1px solid rgba(125, 176, 238, .55); box-shadow: 0 0 0 4px rgba(74, 144, 226, .08), 0 18px 40px -22px rgba(74, 144, 226, .6); }
.status.is-empty strong { margin-bottom: 14px; font-size: 28px; line-height: 1.25; text-wrap: balance; overflow-wrap: anywhere; }
.status.is-empty p { margin: 0 auto 8px; max-width: 34em; font-size: 16px; line-height: 1.5; color: var(--text-2); text-wrap: balance; overflow-wrap: anywhere; }
.status.is-empty .empty-q { display: block; font: 500 15px/1.4 var(--mono); color: var(--ix-2); }
.status.is-empty .empty-face { margin-top: 12px; font-size: 32px; line-height: 1.2; color: var(--text); }
.status.is-empty .row { justify-content: center; margin-top: 20px; }
@media (max-width: 600px) { .status.is-empty { padding: 32px 16px 28px; } .status.is-empty strong { font-size: 24px; } }
.status.is-loading { padding: 0; background: none; border: 0; display: grid; gap: 12px; }
.skel { height: 104px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); position: relative; overflow: hidden; }
.skel::before, .skel::after { content: ""; position: absolute; left: 18px; height: 10px; border-radius: 6px; background: rgba(255, 255, 255, .07); }
.skel::before { top: 22px; width: 42%; height: 14px; }
.skel::after { top: 56px; width: calc(100% - 36px); box-shadow: 0 20px 0 -0px rgba(255, 255, 255, .05); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }


/* ---------- Dialogs ---------- */

dialog {
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 0;
  box-shadow: 0 24px 64px rgba(0, 0, 0, .55);
}
dialog::backdrop { background: rgba(5, 6, 8, .65); }

.modal { width: min(680px, calc(100vw - 24px)); max-height: min(84vh, 780px); }
.modal-inner, .drawer-inner { display: flex; flex-direction: column; max-height: inherit; height: 100%; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.modal-head h2 { font: 400 22px/1.2 var(--serif); letter-spacing: -0.01em; }
.modal-body { padding: 18px 20px 22px; overflow-y: auto; }

.note { font-size: 13.5px; color: var(--text-2); margin-bottom: 18px; }
.note code, .hint code { font-family: var(--mono); font-size: 12px; background: rgba(255, 255, 255, .06); padding: 1px 5px; border-radius: 5px; }


/* Source Manager drawer */
.drawer {
  margin: 0 0 0 auto;
  width: min(660px, 100vw);
  height: 100vh; height: 100dvh;
  max-height: none;
  border-radius: 10px 0 0 10px;
  border-right: 0;
}
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 20px 24px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-content: start; }
.drawer-foot { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 20px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); }
.drawer-foot .btn-danger { margin-left: auto; }

.card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.card h3 { font-size: 14px; font-weight: 600; margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card h4 { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); margin: 16px 0 8px; }
.hint { font-size: 12.5px; color: var(--text-3); margin-top: 8px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }

.field {
  width: 100%; min-width: 0; height: 36px; padding: 0 11px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 9px;
  color: var(--text); font: inherit; font-size: 14px; outline: 0;
}
textarea.field { height: auto; min-height: 96px; padding: 9px 11px; resize: vertical; line-height: 1.5; }
.field:focus { border-color: rgba(96, 165, 250, .65); box-shadow: 0 0 0 3px rgba(59, 130, 246, .16); }
.field.mono { font-family: var(--mono); font-size: 12.5px; }
select.field { appearance: none; padding-right: 28px; background-image: linear-gradient(45deg, transparent 50%, #9CA3AF 50%), linear-gradient(135deg, #9CA3AF 50%, transparent 50%); background-position: calc(100% - 15px) 15px, calc(100% - 10px) 15px; background-size: 5px 5px; background-repeat: no-repeat; }

.src-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; padding: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.src-row-top { display: grid; grid-template-columns: minmax(90px, 150px) minmax(0, 1fr); gap: 6px; }
.src-row-bot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.src-row-bot .field { flex: 1 1 140px; width: auto; min-width: 0; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); cursor: pointer; user-select: none; }
.check input { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; }
.mini { display: inline-grid; place-items: center; width: 30px; height: 30px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; color: var(--text-2); cursor: pointer; }
.mini:hover { color: var(--text); border-color: var(--border-strong); }
.mini:disabled { opacity: .35; cursor: default; }
.mini.del:hover { color: var(--err); }
.conv-result { font-family: var(--mono); font-size: 12px; word-break: break-all; padding: 10px 11px; background: var(--surface); border: 1px dashed var(--border-strong); border-radius: 9px; color: var(--accent-2); }
.conv-result.err { color: var(--err); }

/* ---------- Toasts ---------- */

.toasts { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 1000; display: grid; gap: 8px; justify-items: center; width: min(520px, calc(100vw - 24px)); pointer-events: none; }
.toast {
  display: inline-flex; align-items: center; gap: 10px; max-width: 100%;
  padding: 10px 14px;
  background: #1d222b; border: 1px solid var(--border-strong); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
  font-size: 14px;
  opacity: 0; transition: opacity .18s ease;
}
.toast.in { opacity: 1; }
.toast-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.toast.err .toast-dot { background: var(--err); }
.toast span:last-child { overflow-wrap: anywhere; }

/* ---------- Responsive ---------- */

@media (max-width: 700px) {
  body.has-results .bar {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "brand support" "search search" "all all" "line line" "seg seg" "chips chips";
  }
  body.has-results .seg { border-bottom: 1px solid var(--border); }
  body.has-results .chips:not([hidden]) { margin-top: 14px; padding: 0; border-bottom: 0; justify-content: flex-start; }
}

@media (max-width: 600px) {
  .bar { padding-left: 16px; padding-right: 16px; padding-top: clamp(72px, 15vh, 140px); }
  .brand { gap: 12px; }
  .brand-logo { width: 42px; height: 42px; }
  .brand-name { font-size: 50px; }
  .tagline { margin-top: 14px; font-size: 15px; }
  .seg { margin-top: 36px; }
  .searchbar { margin-top: 22px; }
  .prompt { font-size: 20px; }
  .searchbar input { font-size: 20px; height: 32px; }
  .suggest { margin-top: 36px; }
  .support-btn { right: 16px; }
  .kbd-group { display: none; }
  body.has-results .bar { padding: 14px 16px 0; }
  body.has-results .brand-name { font-size: 21px; }
  body.has-results .brand-logo { width: 24px; height: 24px; }
  body.has-results .searchbar { margin-top: 16px; }
  body.has-results .searchbar input { font-size: 16px; height: 26px; }
  body.has-results .prompt { font-size: 16px; }
  body.has-results .seg { margin-top: 16px; }
  .results-title { font-size: 24px; }
  main { padding-left: 16px; padding-right: 16px; }
  .drawer { border-radius: 0; }
  .src-row-top { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .001ms !important; animation-duration: .001ms !important; }
}

/* ---------- Support Me dialog ---------- */
.support-intro { font-size: 14px; line-height: 1.6; color: var(--text-2); margin-bottom: 14px; }
.support-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.support-list li { font-size: 14px; line-height: 1.6; color: var(--text-2); min-width: 0; }
.support-list strong { font-weight: 600; color: var(--text); }
.support-list a { color: var(--ix-2); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(125, 176, 238,.45); }
.support-list a:hover { text-decoration-color: currentColor; }
.addr-copy { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; width: 100%; margin-top: 8px; padding: 10px 12px; text-align: left; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; cursor: pointer; }
.addr-copy:hover { border-color: var(--ix-2); }
.addr-copy:focus-visible { outline: 2px solid var(--ix-2); outline-offset: 2px; }
.addr-copy code { font-family: var(--mono); font-size: 12.5px; color: var(--ix-2); overflow-wrap: anywhere; word-break: break-all; }
.addr-hint { font: 500 11px/1.4 var(--mono); color: var(--text-3); }
.addr-copy.is-copied { border-color: var(--ix-2); }
.addr-copy.is-copied .addr-hint { color: var(--ix-2); }

/* ---------- DMCA ---------- */
.footer-mid { display: inline-flex; align-items: center; gap: 22px; }
.modal.modal-sm { width: min(440px, calc(100vw - 24px)); }
.dmca-text { font-size: 14px; line-height: 1.65; color: var(--text-2); }
.footer-link { background: none; border: 0; padding: 8px 0; font: inherit; color: var(--text-2); cursor: pointer; }
.footer-link:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.footer-link:focus-visible { outline: 2px solid var(--ix-2); outline-offset: 2px; }

.footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 56px; min-height: 44px; border-top: 1px solid var(--border); font: 500 11px/1.4 var(--mono); color: #6E7482; }
.footer kbd { padding: 0; background: none; border: 0; color: var(--text-2); font-size: 11px; }
@media (min-width: 601px) {
  .footer { display: grid; grid-template-columns: 1fr auto 1fr; }
  .footer .footer-mid { grid-column: 2; justify-self: center; }
  .footer .footer-link { letter-spacing: .04em; font-size: 12px; }
  .footer .footer-keys { grid-column: 3; justify-self: end; }
}
.footer-keys { display: inline-flex; gap: 6px; align-items: baseline; flex-wrap: wrap; justify-content: flex-end; }
body.has-results .footer { display: none; }
@media (max-width: 600px) { .footer { padding: 0 16px; } .footer-keys { display: none; } }
.support-addr .btn { min-width: 72px; flex: none; }



/* ---------- Installable app (PWA) ---------- */
.footer .footer-link.footer-install { grid-column: 1; grid-row: 1; justify-self: start; letter-spacing: .02em; }
@media (max-width: 600px) { .footer-install { margin-left: auto; } }
.install-steps { margin: 0 0 12px; padding-left: 20px; display: grid; gap: 8px; font-size: 14px; line-height: 1.6; color: var(--text-2); }
.install-steps strong { font-weight: 600; color: var(--text); }
.install-note { font-size: 13px; line-height: 1.5; color: var(--text-3); }
@media (display-mode: standalone), (display-mode: window-controls-overlay) {
  html { overscroll-behavior-y: none; -webkit-tap-highlight-color: transparent; }
  body { padding-top: env(safe-area-inset-top); padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
  .footer { padding-bottom: env(safe-area-inset-bottom); min-height: calc(44px + env(safe-area-inset-bottom)); }
}

/* ---------- "Search both categories" switch ---------- */
.allrow { grid-area: all; position: relative; display: flex; flex-wrap: wrap; align-items: center; margin-top: 10px; min-width: 0; }
.switch { display: inline-flex; align-items: center; gap: 10px; padding: 8px 0; background: none; border: 0; color: var(--text-2); font-size: 13px; cursor: pointer; }
.switch:hover { color: var(--text); }
.switch-track { position: relative; flex: none; width: 30px; height: 18px; border-radius: 999px; border: 1px solid var(--border-strong); transition: background .18s, border-color .18s; }
.switch-knob { position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: #8B93A1; transition: transform .18s, background .18s; }
.switch[aria-checked="true"] { color: var(--text); }
.switch[aria-checked="true"] .switch-track { background: rgba(74, 144, 226, .22); border-color: var(--ix); }
.switch[aria-checked="true"] .switch-knob { transform: translateX(12px); background: var(--ix-2); }
.info-btn { flex: none; width: 28px; height: 28px; margin: 0 0 0 -2px; padding: 0; display: grid; place-items: center; border: 0; background: none; color: var(--text-3); cursor: pointer; }
.info-dot { width: 12px; height: 12px; display: grid; place-items: center; border-radius: 50%; border: 1px solid currentColor; font: 600 8px/1 var(--mono); }
.info-btn:hover, .info-btn[aria-expanded="true"] { color: var(--ix-2); }
.tip { position: absolute; left: 0; top: 100%; z-index: 30; width: max-content; max-width: min(320px, 100%); margin-top: 4px; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: 8px; font-size: 13px; line-height: 1.5; color: var(--text-2); box-shadow: 0 12px 30px -12px rgba(0, 0, 0, .7); }
.tip[hidden] { display: none; }
.switch-cute { margin-left: auto; }
.seg.is-all .seg-thumb { opacity: 0; }
@media (prefers-reduced-motion: reduce) { .switch-track, .switch-knob { transition: none; } }

/* ---------- Suggest / request form ---------- */
.fb { display: flex; flex-direction: column; gap: 6px; }
.fb-l { margin-top: 8px; font: 500 12px/1.4 var(--mono); color: var(--text-2); }
.fb-opt { color: var(--text-3); }
.fb-in { width: 100%; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); color: var(--text); font: 400 16px/1.4 var(--sans, inherit); }
.fb-ta { resize: vertical; min-height: 110px; }
.fb-in:focus-visible { outline: 2px solid var(--ix-2); outline-offset: 1px; }
.fb-trap { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.fb-send { margin-top: 12px; padding: 11px 16px; border: 0; border-radius: 10px; background: var(--ix); color: #fff; font: 600 14px/1 var(--mono); cursor: pointer; }
.fb-send:hover { background: var(--ix-2); color: #0B0D10; }
.fb-send:disabled { opacity: .6; cursor: default; }
.fb-out { min-height: 1.4em; font-size: 13px; color: var(--text-2); }
.fb-out.is-ok { color: var(--ix-2); }
.fb-out.is-bad { color: #FF8A8A; }

/* ---------- Recent searches / shortcut names ---------- */
.sug { position: absolute; z-index: 60; left: 0; right: 0; top: calc(100% + 6px); padding: 6px; border: 1px solid var(--border-strong); border-radius: 12px; background: #12151B; box-shadow: 0 18px 40px -12px rgba(0, 0, 0, .7); }
.sug[hidden] { display: none; }
.sug-item { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 8px 10px; border-radius: 8px; color: var(--text); font-size: 15px; cursor: pointer; }
.sug-item:hover, .sug-item.is-active { background: rgba(74, 144, 226, .14); }
.sug-ic { flex: none; width: 16px; text-align: center; color: var(--text-3); font-size: 14px; }
.sug-t { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sug-tag { flex: none; padding: 1px 8px; border: 1px solid var(--border-strong); border-radius: 999px; font: 500 11px/1.6 var(--mono); color: var(--text-3); }

/* ---------- Small touches of motion (all off for people who ask for less motion) ---------- */
@keyframes mx-slide { from { opacity: 0; transform: translateX(-22px); } to { opacity: 1; transform: none; } }
@keyframes mx-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes mx-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes mx-shimmer { 0% { background-position: -240px 0; } 100% { background-position: 240px 0; } }
@media (prefers-reduced-motion: no-preference) {
  .brand { animation: mx-slide .45s cubic-bezier(.2, .8, .2, 1) both; }
  .tagline { animation: mx-rise .4s ease-out .1s both; }
  .seg { animation: mx-rise .4s ease-out .16s both; }
  .searchbar { animation: mx-rise .4s ease-out .22s both; }
  .allrow { animation: mx-fade .4s ease-out .3s both; }
  .support-btn { animation: mx-fade .5s ease-out .35s both; }
  .status:not([hidden]) { animation: mx-fade .2s ease-out both; }
  body.has-results #engineFrame:not(.is-pending) { animation: mx-fade .25s ease-out both; }
  .sug:not([hidden]) { animation: mx-fade .12s ease-out both; }
  .skel { background-image: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .045) 50%, transparent 70%); background-size: 240px 100%; background-repeat: no-repeat; animation: mx-shimmer 1.2s linear infinite; }
}

/* ---------- Polish pass: quieter, more native ---------- */
:root { --brand: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif; }
.brand-name { font-family: var(--brand); font-size: 54px; font-weight: 700; letter-spacing: -0.035em; color: #fff; }
.brand-name b { font-family: var(--brand); font-weight: 400; font-size: 1em; letter-spacing: -0.035em; color: var(--text-2); margin-left: 0; }
.brand-logo { width: 46px; height: 46px; }
.seg button kbd { display: none; }
.searchbar { padding: 0 12px; height: 48px; gap: 10px; border: 1px solid var(--border-strong); border-radius: 8px; background: rgba(255, 255, 255, .035); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .5); }
.searchbar:focus-within { border-color: var(--ix); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .5), 0 0 0 3px rgba(74, 144, 226, .28); }
.prompt { font-size: 18px; color: var(--text-3); }
.searchbar input { height: 30px; }
.statusline[data-tone="idle"] { visibility: hidden; }
.statusline[data-tone="ok"] .dot, .statusline[data-tone="idle"] .dot { display: none; }
.statusline[data-tone="busy"] .dot { background: var(--text-3); animation: none; opacity: .8; }
.suggest::before { content: "Try:"; font: 400 13px/1 var(--font); letter-spacing: 0; text-transform: none; color: var(--text-3); }
.suggest { gap: 8px 16px; }
.suggest button { padding: 0; border: 0; font-size: 14px; color: var(--ix-2); }
.suggest button:hover { color: #fff; border: 0; text-decoration: underline; text-underline-offset: 3px; }
.footer .footer-link, .footer-link { color: var(--text-3); }
.footer .footer-link.footer-install { border: 1px solid var(--border-strong); border-radius: 6px; padding: 5px 12px; background: rgba(255, 255, 255, .03); color: var(--text-2); }
.footer .footer-link.footer-install:hover { text-decoration: none; background: rgba(255, 255, 255, .07); color: var(--text); border-color: rgba(255, 255, 255, .28); }
.status.is-empty { box-shadow: none; border-color: rgba(125, 176, 238, .4); }
@media (max-width: 360px) { .brand-name { font-size: 46px; } .brand-logo { width: 40px; height: 40px; } }

/* The search field keeps its text and clear button centred on the results page too. */
body.has-results .searchbar { padding: 0 12px; }
.brand-name b { color: var(--ix-2); }

/* What you type, and the placeholder, use the same font and size as the animated lines. */
.searchbar input, body.has-results .searchbar input { font-family: var(--mono-ph); font-size: 18px; letter-spacing: -.01em; }
@media (max-width: 600px) { .searchbar input, body.has-results .searchbar input { font-size: 15px; } }
@media (max-width: 340px) { .searchbar input, body.has-results .searchbar input { font-size: 14px; } }

/* ---------- Cutify (html[data-theme="cute"]) ----------
   Same layout, same logo shape: only colours, the background effect (petals, see fx.js) and the emote badges change.
   Tokens are in tokens.css; this block covers the few literal colours. */
.mascot { display: none; }
html[data-theme="cute"] body:not(.has-results) .mascot {
  display: block; grid-area: mascot; align-self: center; justify-self: end;
  width: 84px; height: 84px; margin-left: 12px; border-radius: 50%;
  background: #241420 url("icons/emote-wave.png") center / cover no-repeat;
  border: 2px solid var(--ix); box-shadow: 0 10px 26px -12px rgba(255, 107, 139, .55);
  pointer-events: none; user-select: none;
}
@media (prefers-reduced-motion: no-preference) {
  html[data-theme="cute"] body:not(.has-results) .mascot { animation: mx-bob 3.6s ease-in-out infinite; }
  @keyframes mx-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
}
@media (max-width: 600px) {
  /* narrow: the wordmark needs the full width, so the badge sits beside the tagline only */
  html[data-theme="cute"] body:not(.has-results) .bar { grid-template-areas: "brand brand" "tagline mascot" "seg seg" "search search" "all all" "line line" "suggest suggest" "music music"; }
  html[data-theme="cute"] body:not(.has-results) .mascot { width: 60px; height: 60px; margin-top: 14px; align-self: start; }
}
html[data-theme="cute"] .brand-logo rect:nth-child(1) { fill: #241420; stroke: #FF6B8B; }
html[data-theme="cute"] .brand-logo circle { stroke: #FFB3C2; }
html[data-theme="cute"] .brand-logo rect:nth-child(3) { fill: #FF6B8B; }
html[data-theme="cute"] .brand-logo rect:nth-child(4) { fill: #FFE1E8; }
html[data-theme="cute"] .brand-logo path { stroke: #FFB3C2; }
html[data-theme="cute"] .btn:hover { background: #2E1A28; }
html[data-theme="cute"] .btn-primary:hover { background: #FF8AA3; }
html[data-theme="cute"] .support-btn { border-bottom-color: var(--ix-2); }
html[data-theme="cute"] .searchbar input::placeholder { color: #9A7A86; }
html[data-theme="cute"] .qfield.is-typing input::placeholder { color: transparent; }
html[data-theme="cute"] .searchbar:focus-within { border-color: var(--ix); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .5), 0 0 0 3px rgba(255, 107, 139, .26); }
html[data-theme="cute"] .chip[aria-pressed="true"],
html[data-theme="cute"] .sug-item:hover, html[data-theme="cute"] .sug-item.is-active { background: rgba(255, 107, 139, .14); border-color: rgba(255, 179, 194, .7); }
html[data-theme="cute"] .switch[aria-checked="true"] .switch-track { background: rgba(255, 107, 139, .24); border-color: var(--ix); }
html[data-theme="cute"] .switch-knob { background: #B08F9B; }
html[data-theme="cute"] .switch[aria-checked="true"] .switch-knob { background: var(--ix-2); }
html[data-theme="cute"] .field:focus { border-color: rgba(255, 107, 139, .7); box-shadow: 0 0 0 3px rgba(255, 107, 139, .18); }
html[data-theme="cute"] .fb-send:hover { color: #14090F; }
html[data-theme="cute"] .sug, html[data-theme="cute"] .toast { background: #241420; }
html[data-theme="cute"] .support-list a { text-decoration-color: rgba(255, 179, 194, .45); }
html[data-theme="cute"] .status.is-empty { background: linear-gradient(180deg, rgba(255, 107, 139, .10), rgba(255, 107, 139, .03)); border-color: rgba(255, 179, 194, .45); }
/* state panels get a round emote on top: sad = nothing found, sleepy = offline, grumpy = error */
html[data-theme="cute"] .status.is-empty::before, html[data-theme="cute"] .status.is-offline::before, html[data-theme="cute"] .status.is-error::before {
  content: ""; display: block; width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 50%;
  background: #241420 center / cover no-repeat; border: 2px solid var(--ix);
}
html[data-theme="cute"] .status.is-empty::before { background-image: url("icons/emote-cry.png"); }
html[data-theme="cute"] .status.is-offline::before { background-image: url("icons/emote-sleep.png"); }
html[data-theme="cute"] .status.is-error::before { background-image: url("icons/emote-angry.png"); }
html[data-theme="cute"] .status.is-offline, html[data-theme="cute"] .status.is-error { text-align: center; }

/* ---------- Easter-egg toast, effects, music ---------- */
.toast.egg { position: relative; align-items: center; gap: 9px; max-width: min(250px, calc(100vw - 32px)); padding: 8px 30px 8px 10px; border-radius: 9px; font-size: 12.5px; pointer-events: auto; }
.egg-emoji { flex: none; font-size: 17px; line-height: 1; }
.egg-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; line-height: 1.3; }
.egg-text strong { color: var(--text); font-weight: 600; font-size: 12.5px; }
.egg-name { color: var(--ix-2); font-size: 12.5px; overflow-wrap: anywhere; }
.egg-x { position: absolute; top: 3px; right: 3px; width: 24px; height: 24px; display: grid; place-items: center; padding: 0; background: none; border: 0; border-radius: 6px; color: var(--text-3); font: 400 18px/1 var(--font); cursor: pointer; }
.egg-x:hover { color: var(--text); background: rgba(255, 255, 255, .08); }
.egg-canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 90; pointer-events: none; }
.egg-ball { position: fixed; left: 50%; top: 50%; z-index: 90; transform: translate(-50%, -50%); display: flex; align-items: center; gap: 12px; padding: 14px 18px; max-width: calc(100vw - 32px); background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: 12px; color: var(--text); font-size: 14px; box-shadow: 0 18px 50px -12px rgba(0, 0, 0, .8); pointer-events: none; }
.egg-wheel { flex: none; width: 28px; height: 28px; border-radius: 50%; background: conic-gradient(#ff3b30, #ff9500, #ffcc00, #34c759, #5ac8fa, #5856d6, #ff2d55, #ff3b30); -webkit-mask: radial-gradient(circle, transparent 5px, #000 6px); mask: radial-gradient(circle, transparent 5px, #000 6px); }
@media (prefers-reduced-motion: no-preference) {
  .egg-wheel { animation: mx-spin .9s linear infinite; }
  @keyframes mx-spin { to { transform: rotate(360deg); } }
  html.egg-roll body { animation: mx-roll 1.2s ease-in-out; }
  @keyframes mx-roll { to { transform: rotate(360deg); } }
  html.egg-askew { overflow: hidden; }
  html.egg-askew body { transform: rotate(-2.5deg); transition: transform .5s ease; }
  html:not(.egg-askew) body { transition: transform .5s ease; }
  html.egg-rainbow .brand-name { animation: mx-hue 1.2s linear infinite; }
  @keyframes mx-hue { from { filter: hue-rotate(0); } to { filter: hue-rotate(360deg); } }
}

/* Music row: switch + (i) on the left, volume slider on the right edge (lines up with "Cutify" above). Start page only. */
.musicrow { grid-area: music; position: relative; margin-top: 8px; display: flex; align-items: center; min-width: 0; }
body.has-results .musicrow { display: none; }
.vol { -webkit-appearance: none; appearance: none; flex: 0 1 140px; width: 140px; min-width: 70px; height: 28px; margin: 0 0 0 auto; padding: 0; background: transparent; cursor: pointer; --p: 37%; }
.vol::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--ix) var(--p), var(--border-strong) var(--p)); }
.vol::-moz-range-track { height: 4px; border-radius: 4px; background: var(--border-strong); }
.vol::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--ix); }
.vol::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; margin-top: -6px; border-radius: 50%; background: var(--ix-2); border: 0; box-shadow: 0 0 0 4px rgba(255, 255, 255, .06); }
.vol::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--ix-2); border: 0; }
.vol:focus-visible { outline: 2px solid var(--ix-2); outline-offset: 3px; border-radius: 6px; }
.vol:disabled { opacity: .35; cursor: default; }
