/* Crate assistant (ai.js). Same ink-black canvas + gold accent; mobile-first full-screen panel, docked on desktop. */
.ai-fab { position: fixed; z-index: 32; right: calc(14px + var(--safe-r)); bottom: calc(var(--bottom-chrome) + 6px); height: 46px; padding: 0 18px 0 14px; display: inline-flex; align-items: center; gap: 8px;
  border-radius: 999px; font: 600 14px var(--sans); color: #17120a; background: var(--accent); box-shadow: 0 8px 26px rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,.12) inset; transition: transform .2s var(--ease), opacity .2s; }
.ai-fab .ic { width: 20px; height: 20px; stroke-width: 1.9; }
.ai-fab:active { transform: scale(.94); }
.ai-fab.hide, body.ai-open .ai-fab { opacity: 0; pointer-events: none; transform: translateY(8px) scale(.9); }
@media (min-width: 900px) { .ai-fab { right: 24px; bottom: 96px; } body.ai-open .main { margin-right: min(440px, 34vw); } }
.xprev, .xjobs { transition: bottom .2s var(--ease); }
body.ai-open .xprev { z-index: 58; bottom: calc(var(--ai-comp-h, 84px) + var(--safe-b) + 6px); }
@media (min-width: 900px) { body.ai-open .xprev { left: auto; right: 8px; width: min(424px, 33vw); } }

.aip { position: fixed; z-index: 56; inset: 0; display: flex; flex-direction: column; background: var(--bg); transform: translateY(102%); transition: transform .34s var(--ease); height: var(--vvh, 100dvh); overscroll-behavior: contain; visibility: hidden; }
.aip.show { transform: none; visibility: visible; }
@media (min-width: 900px) { .aip { left: auto; width: min(440px, 34vw); min-width: 380px; transform: translateX(102%); box-shadow: -1px 0 0 var(--line), -24px 0 60px rgba(0,0,0,.45); height: 100dvh; } .aip.show { transform: none; } }
.aip-top { flex: none; display: flex; align-items: center; gap: 6px; padding: calc(var(--safe-t) + 8px) 8px 8px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, rgba(231,182,109,.07), transparent); }
.aip-title { flex: 1; min-width: 0; display: grid; text-align: center; }
.aip-title b { font: 600 17px var(--serif); letter-spacing: -.01em; }
.aip-sub { font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.aip-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 14px 14px 10px; }
.aip-msgs { display: flex; flex-direction: column; gap: 16px; max-width: 720px; margin: 0 auto; }
.aip-foot { flex: none; padding: 8px 12px calc(var(--safe-b) + 10px); background: linear-gradient(180deg, transparent, var(--bg) 14px); border-top: 1px solid var(--line); }
.aip-ctx, .aip-short { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -12px 8px; padding: 0 12px; }
.aip-ctx::-webkit-scrollbar, .aip-short::-webkit-scrollbar { display: none; }
.aip-short[hidden] { display: none; }
.aichip { flex: none; display: inline-flex; align-items: center; gap: 6px; max-width: 62vw; height: 30px; padding: 0 11px; border-radius: 999px; font-size: 12.5px; color: var(--text-2); background: var(--bg-2); box-shadow: inset 0 0 0 1px var(--line); }
.aichip.on { color: var(--text); background: color-mix(in srgb, var(--accent) 16%, var(--bg-2)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent); }
.aichip.add { color: var(--accent); background: none; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent); }
.aichip .ic { color: var(--accent); }
.aichip button { display: grid; place-items: center; width: 18px; height: 18px; margin-right: -5px; border-radius: 99px; background: rgba(255,255,255,.1); }
.aip-short button, .ai-sug button { flex: none; height: 34px; padding: 0 14px; border-radius: 999px; font-size: 13.5px; font-weight: 500; color: var(--text); background: var(--bg-2); box-shadow: inset 0 0 0 1px var(--line-2); white-space: nowrap; transition: background .15s, transform .15s var(--ease); }
.aip-short button:active, .ai-sug button:active { transform: scale(.96); background: var(--bg-3); }
.aip-comp { display: flex; align-items: flex-end; gap: 8px; padding: 6px 6px 6px 16px; border-radius: 24px; background: var(--bg-2); box-shadow: inset 0 0 0 1px var(--line-2); }
.aip-comp:focus-within { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 60%, transparent); }
.aip-comp textarea { flex: 1; min-width: 0; resize: none; border: 0; outline: 0; background: none; color: var(--text); font-size: 16px; line-height: 1.35; padding: 8px 0; max-height: 130px; }
.aip-comp textarea::placeholder { color: var(--text-3); }
.aip-send { flex: none; width: 40px; height: 40px; border-radius: 99px; display: grid; place-items: center; color: #17120a; background: var(--accent); transition: transform .15s var(--ease), opacity .2s; }
.aip-send:active { transform: scale(.9); }
.aip-send .ic { width: 20px; height: 20px; }
.aip-comp textarea:placeholder-shown + .aip-send:not(:active) { opacity: .5; }

/* messages */
.aim { display: flex; gap: 10px; animation: aiIn .28s var(--ease) both; }
@keyframes aiIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.aim.user { justify-content: flex-end; }
.aim.user .bub { max-width: 84%; padding: 9px 14px; border-radius: 18px 18px 5px 18px; background: color-mix(in srgb, var(--accent) 20%, var(--bg-2)); color: var(--text); font-size: 15px; line-height: 1.4; overflow-wrap: anywhere; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 28%, transparent); }
.aim.bot .av { flex: none; width: 28px; height: 28px; border-radius: 99px; display: grid; place-items: center; margin-top: 1px; color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--bg-1)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent); }
.aim.bot .body { flex: 1; min-width: 0; display: grid; gap: 8px; }
.aitxt { font-size: 15px; line-height: 1.5; color: var(--text); overflow-wrap: anywhere; }
.aitxt p { margin: 0 0 8px; } .aitxt p:last-child { margin: 0; }
.aitxt ul { margin: 2px 0 8px; padding-left: 18px; } .aitxt li { margin: 2px 0; }
.aitxt b { font-weight: 600; } .aitxt code { font-size: 13px; background: var(--bg-2); padding: 1px 5px; border-radius: 4px; }
.aitools { display: flex; flex-wrap: wrap; gap: 5px; }
.aitool { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 99px; font-size: 11.5px; color: var(--text-3); background: var(--bg-1); box-shadow: inset 0 0 0 1px var(--line); }
.aitool em { font-style: normal; color: var(--text-3); opacity: .8; font-variant-numeric: tabular-nums; }
.aitool.ok .ic { color: var(--ok); } .aitool.err .ic { color: var(--danger); }
.aitool .dot { width: 7px; height: 7px; border-radius: 9px; background: var(--accent); animation: aiPulse 1s ease-in-out infinite; }
@keyframes aiPulse { 50% { opacity: .25; transform: scale(.7); } }
.aityping { display: inline-flex; gap: 4px; padding: 8px 0; } .aityping i { width: 7px; height: 7px; border-radius: 9px; background: var(--text-3); animation: aiPulse 1.1s ease-in-out infinite; } .aityping i:nth-child(2) { animation-delay: .15s; } .aityping i:nth-child(3) { animation-delay: .3s; }
.aimeta { font-size: 10.5px; color: var(--text-3); letter-spacing: .02em; }
.aierr { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px; border-radius: var(--r); background: rgba(255,107,94,.08); color: #ffa79e; font-size: 13.5px; }
.aierr span { flex: 1 1 140px; } .aierr .ic { flex: none; }

/* empty state */
.ai-empty { padding: 8vh 6px 0; text-align: center; max-width: 440px; margin: 0 auto; }
.ai-orb { width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 99px; display: grid; place-items: center; color: var(--accent); background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--accent) 30%, transparent), transparent 70%), var(--bg-1); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent), 0 0 40px color-mix(in srgb, var(--accent) 18%, transparent); }
.ai-empty h2 { font: 600 24px/1.15 var(--serif); letter-spacing: -.02em; margin: 0 0 8px; }
.ai-empty p { margin: 0 auto 18px; color: var(--text-2); font-size: 14px; line-height: 1.5; text-wrap: pretty; }
.ai-sug { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.ai-sug button { white-space: normal; height: auto; min-height: 36px; padding: 8px 14px; text-align: left; }

/* proposal card */
.aic { border-radius: 16px; background: var(--bg-1); box-shadow: inset 0 0 0 1px var(--line-2), 0 10px 30px rgba(0,0,0,.35); overflow: hidden; }
.aic-hd { display: flex; align-items: center; gap: 8px; padding: 11px 14px; font-size: 14px; border-bottom: 1px solid var(--line); background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 10%, transparent), transparent); }
.aic-hd .ic { color: var(--accent); flex: none; } .aic-hd b { flex: 1; min-width: 0; font-weight: 600; } .aic-hd span { font-size: 12px; flex: none; }
.aic-list { max-height: min(46vh, 420px); overflow-y: auto; overscroll-behavior: contain; }
.aic-row { position: relative; display: flex; align-items: center; gap: 10px; min-height: 58px; padding: 7px 10px 7px 12px; cursor: pointer; -webkit-user-select: none; user-select: none; transition: background .15s, opacity .2s; }
.aic-row + .aic-row::before { content: ""; position: absolute; left: 12px; right: 0; top: 0; height: 1px; background: var(--line); }
.aic-row:active { background: rgba(255,255,255,.04); }
.aic-ck { flex: none; width: 22px; height: 22px; border-radius: 99px; display: grid; place-items: center; color: transparent; box-shadow: inset 0 0 0 1.5px var(--line-2); transition: background .15s, color .15s; }
.aic-row:not(.off) .aic-ck { background: var(--accent); color: #17120a; box-shadow: none; }
.aic-row.off { opacity: .45; } .aic-row.off .aic-tx { text-decoration: line-through; text-decoration-color: rgba(255,255,255,.25); }
.aic-row.done { pointer-events: none; }
.aic-row img { flex: none; width: 42px; height: 42px; border-radius: 6px; object-fit: cover; background: var(--bg-2); }
.aic-ico { flex: none; width: 42px; height: 42px; border-radius: 8px; display: grid; place-items: center; color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--bg-2)); }
.aic-pair { flex: none; display: flex; align-items: center; gap: 2px; } .aic-pair img { width: 34px; height: 34px; } .aic-pair img.old { opacity: .5; filter: grayscale(.8); } .aic-pair i { color: var(--text-3); display: grid; }
.aic-tx { flex: 1; min-width: 0; display: grid; gap: 1px; }
.aic-t { font-size: 14.5px; line-height: 1.25; } .aic-t b { font-weight: 600; } .aic-t .by { color: var(--text-2); font-weight: 400; }
.aic-s { font-size: 12px; color: var(--text-3); } .aic-s s { opacity: .7; }
.aic-k { display: inline-flex; align-items: center; gap: 3px; margin-right: 3px; font-weight: 700; font-size: 10px; letter-spacing: .07em; text-transform: uppercase; color: var(--accent); vertical-align: 1px; }
.k-remove .aic-k { color: var(--danger); } .k-fetch .aic-k { color: var(--ok); }
.aic-pv { flex: none; width: 36px; height: 36px; border-radius: 99px; display: grid; place-items: center; background: var(--bg-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }
.aic-pv .ic { width: 15px; height: 15px; } .aic-pv:active { background: var(--bg-3); }
.aic-note { padding: 8px 14px; font-size: 12px; color: var(--text-3); border-top: 1px solid var(--line); }
.aic-foot { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); background: var(--bg-1); }
.aic-foot .grow { flex: 1; }
.aic-foot.done { justify-content: space-between; color: var(--ok); font-size: 13.5px; } .aic-foot.done .ic { vertical-align: -3px; }
.aic-all { font-size: 13px; color: var(--text-2); padding: 6px 4px; }
.btn.pri { background: var(--accent); color: #17120a; font-weight: 600; } .btn.pri:disabled { opacity: .4; }
.btn.pri .xspin { width: 14px; height: 14px; border-color: rgba(0,0,0,.25); border-top-color: #17120a; margin-right: 6px; }

/* song picker */
.pk-search { padding: 0 16px 8px; } .pk-search input { width: 100%; height: 42px; border-radius: 12px; border: 0; padding: 0 14px; background: var(--bg-2); color: var(--text); font-size: 16px; outline: 0; }
.pk-list { max-height: 48vh; overflow-y: auto; padding: 0 8px; }
.pk-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 7px 8px; border-radius: 10px; text-align: left; }
.pk-row img { width: 42px; height: 42px; border-radius: 6px; object-fit: cover; flex: none; } .pk-row .tx { display: grid; min-width: 0; flex: 1; font-size: 12.5px; color: var(--text-3); } .pk-row .tx b { color: var(--text); font-weight: 500; font-size: 14.5px; }
.pk-ck { flex: none; width: 22px; height: 22px; border-radius: 99px; display: grid; place-items: center; color: transparent; box-shadow: inset 0 0 0 1.5px var(--line-2); } .pk-row.on .pk-ck { background: var(--accent); color: #17120a; box-shadow: none; } .pk-row.on { background: rgba(255,255,255,.05); }
.pk-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 12px 16px calc(var(--safe-b) + 12px); }

/* selection bar + entry points */
.selbar .ai-sel { color: var(--accent); font-weight: 600; } .selbar .ai-sel .ic { stroke-width: 1.9; }
.ai-qa { color: var(--accent) !important; }
.xtool.ai-tool { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 40%, transparent); background: color-mix(in srgb, var(--accent) 8%, var(--bg-1)); }
.ai-explain { margin: 0 0 6px; color: var(--accent); }
.about h5 { font: 600 14px var(--sans); letter-spacing: .02em; color: var(--text-2); margin: 16px 0 4px; }
.about .sfact { border-left: 2px solid color-mix(in srgb, var(--accent) 50%, transparent); padding-left: 10px; color: var(--text-2); }
.story-facts { margin-top: 14px; }

/* issue reporter */
.rp { padding: 0 16px calc(var(--safe-b) + 14px); display: grid; gap: 12px; }
.rp-cats { display: flex; gap: 6px; flex-wrap: wrap; } .rp-cats button { height: 32px; padding: 0 13px; border-radius: 99px; font-size: 13px; color: var(--text-2); background: var(--bg-2); box-shadow: inset 0 0 0 1px var(--line); } .rp-cats button.on { color: #17120a; background: var(--accent); box-shadow: none; font-weight: 600; }
.rp textarea { width: 100%; border: 0; outline: 0; border-radius: 12px; padding: 12px 14px; background: var(--bg-2); color: var(--text); font-size: 16px; line-height: 1.4; resize: vertical; min-height: 96px; box-shadow: inset 0 0 0 1px var(--line); } .rp textarea:focus { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 60%, transparent); }
.rp-ctx { font-size: 12px; color: var(--text-3); } .rp-ctx summary { cursor: pointer; padding: 4px 0; } .rp-ctx pre { margin: 6px 0 0; padding: 10px; border-radius: 8px; background: var(--bg-1); overflow: auto; max-height: 150px; font-size: 11px; white-space: pre-wrap; word-break: break-word; }
.rp-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
@media (prefers-reduced-motion: reduce) { .aip, .ai-fab, .aim { transition: none; animation: none; } }

body.ai-open:has(.xprev.show) .aip-scroll { padding-bottom: 86px; }
