/* =====================================================================
   InputSync · Twitch extension styles
   1. Theme tokens      6. Search & tools     11. Moderation & queue
   2. Base & scrollbars 7. Categories         12. Notices & toast
   3. Icons             8. Items list         13. Component (draggable key)
   4. Header & status   9. Voice              14. Config page
   5. Tabs             10. Coins & Bits       15. Animations
   Twitch sets data-theme (light/dark) on <body>; both are designed.
   ===================================================================== */

/* 1. Theme tokens ------------------------------------------------------ */
:root {
  --bg: #f7f7f8; --panel: #ffffff; --fg: #0e0e10; --muted: #5c5c66; --faint: #8b8b95; --line: #e3e3e8; --card: #f3f3f6; --card-h: #ebebf0;
  --accent: #ea580c; --accent-2: #f97316; --accent-wash: rgba(234, 88, 12, .1); --accent-ink: #fff;
  --bits: #7c3aed; --bits-wash: rgba(124, 58, 237, .1);
  --ok: #15803d; --bad: #b91c1c; --warn: #b45309; --live: #16a34a;
  --scroll: rgba(0, 0, 0, .18); --scroll-h: rgba(0, 0, 0, .32);
  --shadow: 0 10px 30px rgba(15, 15, 20, .14); --shadow-s: 0 3px 10px rgba(15, 15, 20, .1);
  --r: 12px; --ease: cubic-bezier(.2, .9, .3, 1); --spring: cubic-bezier(.3, 1.4, .5, 1);
}
body[data-theme="dark"] {
  --bg: #0e0e10; --panel: #18181b; --fg: #efeff1; --muted: #a3a3ad; --faint: #6f6f78; --line: #2c2c32; --card: #1f1f24; --card-h: #29292f;
  --accent: #fb923c; --accent-2: #fdba74; --accent-wash: rgba(251, 146, 60, .13); --accent-ink: #1c0a02;
  --bits: #bf94ff; --bits-wash: rgba(191, 148, 255, .12);
  --ok: #22c55e; --bad: #f87171; --warn: #fbbf24; --live: #4ade80;
  --scroll: rgba(255, 255, 255, .16); --scroll-h: rgba(255, 255, 255, .3);
  --shadow: 0 12px 34px rgba(0, 0, 0, .55); --shadow-s: 0 3px 10px rgba(0, 0, 0, .35);
}

/* 2. Base & scrollbars ------------------------------------------------- */
* { box-sizing: border-box; }
html, body { margin: 0; }
html { overflow-x: hidden; }   /* nothing may scroll the extension sideways (a stray tooltip, an animation) */
body { font: 13px/1.4 Inter, 'Segoe UI', Roboto, system-ui, sans-serif; background: var(--bg); color: var(--fg); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Thin rounded scrollbars everywhere (Chromium/Safari). */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scroll); border-radius: 99px; border: 3px solid transparent; background-clip: padding-box; min-height: 40px; }
::-webkit-scrollbar-thumb:hover { background: var(--scroll-h); border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-corner { background: transparent; }
/* Firefox has no ::-webkit-scrollbar; give it the standard thin one. */
@supports not selector(::-webkit-scrollbar) { * { scrollbar-width: thin; scrollbar-color: var(--scroll) transparent; } }

/* 3. Icons ------------------------------------------------------------- */
.i { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; display: block; }
.iw { display: inline-grid; place-items: center; flex: none; line-height: 0; }
.coin, .gem { width: 1.15em; height: 1.15em; flex: none; display: block; }

/* 4. Header & status --------------------------------------------------- */
#app { position: relative; }
.top { display: flex; align-items: center; gap: 8px; padding: 12px; }
.brand { display: flex; align-items: center; gap: 7px; font-weight: 800; font-size: 14.5px; letter-spacing: -.01em; }
.brand svg { width: 26px; height: 26px; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .25)); }
.brand i, .foot i, .cfg h1 i { font-style: normal; color: var(--accent); }
.role { font-size: 10px; font-weight: 800; padding: 3px 8px; border-radius: 99px; text-transform: uppercase; letter-spacing: .05em; }
.role.mod { background: rgba(22, 163, 74, .14); color: var(--live); }
.role.caster { background: rgba(239, 68, 68, .14); color: #ef4444; }
.wallet { margin-left: auto; display: flex; align-items: center; gap: 6px; padding: 5px 11px 5px 7px; border: 0; border-radius: 99px; cursor: pointer;
  background: var(--accent-wash); color: var(--accent); font-weight: 800; white-space: nowrap; transition: background .2s, transform .2s var(--spring); }
.wallet:hover { background: color-mix(in srgb, var(--accent) 20%, transparent); }
.wallet .n { font-size: 15px; font-variant-numeric: tabular-nums; }
.wallet .coin { width: 18px; height: 18px; }
.body { display: flex; flex-direction: column; gap: 10px; padding: 0 12px 12px; }
.status { display: flex; flex-wrap: wrap; gap: 5px; }
.pill { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; padding: 3px 9px; border-radius: 99px; background: var(--card); border: 1px solid var(--line);
  color: var(--muted); font-size: 11px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill .iw { font-size: 11px; }
.pill span:last-child { overflow: hidden; text-overflow: ellipsis; }
.pill.live { color: var(--live); } .pill.live .iw { animation: live 2s ease-in-out infinite; }
.pill.warn { color: var(--warn); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; }
.sec { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 10px; font-size: 11px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.sec .live { font-size: 11px; font-weight: 700; letter-spacing: 0; text-transform: none; color: var(--live); }
.hint { margin: 8px 0 0; color: var(--muted); font-size: 11.5px; }
.hint.note, .pane > .hint { display: flex; gap: 7px; align-items: flex-start; }
.hint .i { margin-top: 1px; font-size: 13px; color: var(--faint); }
.foot { text-align: center; color: var(--faint); font-size: 11px; padding: 2px 0 4px; }
.login { display: grid; gap: 10px; background: linear-gradient(135deg, var(--accent-wash), transparent 70%), var(--panel); }
.login-t { display: flex; gap: 10px; align-items: flex-start; }
.login-t .big { font-size: 22px; color: var(--accent); margin-top: 2px; }
.login-t b { display: block; font-size: 13.5px; } .login-t span { color: var(--muted); font-size: 12px; }
.btn-main { display: inline-flex; align-items: center; justify-content: center; gap: 7px; width: 100%; border: 0; border-radius: 10px; padding: 10px 14px; font-weight: 800; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); transition: filter .15s, transform .12s, opacity .15s; }
.btn-main:hover:not(:disabled) { filter: brightness(1.08); } .btn-main:active:not(:disabled) { transform: translateY(1px) scale(.99); }
.btn-main:disabled { opacity: .45; cursor: not-allowed; }
.btn-main.busy { pointer-events: none; opacity: .7; }

/* 5. Tabs -------------------------------------------------------------- */
.tabs { position: sticky; top: 0; z-index: 3; display: flex; gap: 2px; padding: 4px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); }
.tab-ind { position: absolute; left: 0; top: 4px; bottom: 4px; width: 0; border-radius: 9px; background: var(--panel); box-shadow: var(--shadow-s); transition: transform .32s var(--ease), width .32s var(--ease); z-index: 0; }
.tab { position: relative; z-index: 1; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; padding: 6px 2px 5px; border: 0; border-radius: 9px; background: none; cursor: pointer;
  color: var(--muted); font-weight: 700; font-size: 10.5px; transition: color .2s; }
.tab .ti { font-size: 16px; transition: transform .25s var(--spring); }
.tab .tc { position: absolute; top: 3px; right: 5px; font-size: 9px; font-weight: 800; color: var(--faint); }
.tab:hover { color: var(--fg); } .tab:hover .ti { transform: translateY(-1px); }
.tab.on { color: var(--accent); } .tab.on .ti { transform: scale(1.1); }
.pane { display: flex; flex-direction: column; gap: 8px; padding-top: 10px; }
.pane.enter { animation: paneIn .28s var(--ease); }

/* 6. Search & tools ---------------------------------------------------- */
.search { display: flex; align-items: center; gap: 7px; padding: 0 6px 0 10px; height: 38px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); transition: border-color .2s, box-shadow .2s; }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
.search .si { color: var(--faint); font-size: 15px; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; }
.search input::placeholder { color: var(--faint); }
.search input::-webkit-search-cancel-button { display: none; }
.clear { display: grid; place-items: center; width: 24px; height: 24px; border: 0; border-radius: 99px; background: var(--card); color: var(--muted); cursor: pointer; font-size: 12px; transition: background .15s, color .15s; }
.clear:hover { background: var(--card-h); color: var(--fg); }
.toolbar { display: flex; align-items: center; gap: 6px; }
.sortw { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 4px 0 9px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel); color: var(--faint); transition: border-color .2s; }
.sortw:hover, .sortw:focus-within { border-color: var(--accent); }
.sort { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: none; color: var(--fg); font-weight: 600; cursor: pointer; }
.sort option { background: var(--panel); color: var(--fg); }
.toggle { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 10px 0 6px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel); color: var(--muted);
  font-size: 12px; font-weight: 700; white-space: nowrap; cursor: pointer; transition: border-color .2s, color .2s, background .2s; }
.toggle .knob { position: relative; width: 26px; height: 16px; border-radius: 99px; background: var(--card-h); transition: background .2s; }
.toggle .knob::after { content: ""; position: absolute; left: 2px; top: 2px; width: 12px; height: 12px; border-radius: 99px; background: var(--panel); box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .25s var(--spring); }
.toggle.on { color: var(--fg); border-color: var(--accent); }
.toggle.on .knob { background: var(--accent); } .toggle.on .knob::after { transform: translateX(10px); }

/* 7. Categories (wrap onto rows: every one is always visible) ----------- */
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { --c: var(--accent); display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 5px 0 9px; border-radius: 99px; border: 1px solid var(--line); background: var(--panel);
  font-size: 12px; font-weight: 700; cursor: pointer; transition: border-color .2s, background .2s, color .2s, transform .15s var(--spring); }
.chip .iw { color: var(--c); font-size: 13px; }
.chip .cn { min-width: 18px; padding: 1px 5px; border-radius: 99px; background: var(--card); color: var(--muted); font-size: 10px; font-weight: 800; text-align: center; transition: background .2s, color .2s; }
.chip:hover { border-color: var(--c); transform: translateY(-1px); }
.chip.on { background: var(--c); border-color: var(--c); color: #fff; }
.chip.on .iw { color: #fff; }
.chip.on .cn { background: rgba(0, 0, 0, .2); color: #fff; }
.recent { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.rl { display: inline-flex; align-items: center; gap: 4px; color: var(--faint); font-size: 11px; font-weight: 700; margin-right: 2px; }
.rc { --c: var(--accent); display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border: 1px dashed var(--line); border-radius: 99px; background: none; font-size: 11.5px; font-weight: 600; cursor: pointer; transition: border-color .2s, color .2s; }
.rc .iw { color: var(--c); font-size: 12px; }
.rc:hover { border-style: solid; border-color: var(--c); }

/* 8. Items list -------------------------------------------------------- */
.list { display: flex; flex-direction: column; gap: 6px; }
.group { --c: var(--accent); position: sticky; top: 58px; z-index: 2; display: flex; align-items: center; gap: 7px; margin: 6px 0 0; padding: 6px 2px 4px; background: var(--bg);
  color: var(--c); font-size: 11px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.group:first-child { margin-top: 0; }
.group::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, color-mix(in srgb, var(--c) 45%, transparent), transparent); }
.group .gn { order: 3; padding: 0 6px; border-radius: 99px; background: color-mix(in srgb, var(--c) 15%, transparent); font-size: 10px; letter-spacing: 0; }
.group .iw { font-size: 14px; }
.item { --c: var(--accent); position: relative; display: grid; grid-template-columns: 38px 1fr auto auto; align-items: center; gap: 9px; padding: 8px; border-radius: 11px;
  border: 1px solid var(--line); background: var(--panel); cursor: pointer; user-select: none; outline: 0;
  transition: transform .18s var(--ease), border-color .18s, background .18s, box-shadow .18s; }
.item::before { content: ""; position: absolute; left: -1px; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--c); opacity: 0; transition: opacity .2s; }
.item:hover, .item:focus-visible { border-color: color-mix(in srgb, var(--c) 55%, var(--line)); transform: translateY(-1px); box-shadow: var(--shadow-s); }
.item:hover::before, .item:focus-visible::before { opacity: 1; }
.item:active { transform: translateY(1px) scale(.995); box-shadow: none; }
.item .tile { width: 38px; height: 38px; border-radius: 10px; font-size: 18px; color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); transition: transform .25s var(--spring); }
.item:hover .tile { transform: rotate(-6deg) scale(1.06); }
.item .txt { min-width: 0; }
.item b { display: flex; align-items: center; gap: 6px; min-width: 0; font-weight: 700; font-size: 13px; }
.item .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item small { display: block; color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lock { display: inline-flex; align-items: center; gap: 3px; flex: none; padding: 1px 6px; border-radius: 99px; background: rgba(245, 158, 11, .15); color: var(--warn); font-size: 9.5px; font-weight: 800; }
.lock .iw { font-size: 9px; }
.star { display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 8px; background: none; color: var(--faint); cursor: pointer; font-size: 15px; opacity: .45;
  transition: opacity .2s, transform .25s var(--spring), color .2s, background .2s; }
.item:hover .star, .star:focus-visible, .star.on { opacity: 1; }
.star:hover { background: var(--card); transform: scale(1.15); }
.star.on { color: #f59e0b; } .star.on .i { fill: #f59e0b; }
.price { display: inline-flex; align-items: center; gap: 4px; padding: 4px 9px 4px 6px; border-radius: 99px; background: var(--accent-wash); color: var(--accent);
  font-weight: 800; font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; transition: background .2s, color .2s; }
.price .coin { width: 15px; height: 15px; }
.price.short { background: var(--card); color: var(--faint); }
.price.short .coin { filter: grayscale(1); opacity: .6; }
.price .pl { font-size: 10px; }
.item.armed { border-color: var(--c); background: color-mix(in srgb, var(--c) 9%, var(--panel)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 22%, transparent); }
.item.armed .price { background: var(--c); color: #fff; padding: 4px 11px 4px 8px; animation: armedPulse 1s ease-in-out infinite; }
.item.armed .price .iw { font-size: 12px; }
.item.busy { pointer-events: none; }
.item.busy .price { animation: pulse .8s ease-in-out infinite; }
.item.fired { animation: fired .7s var(--ease); }
.item.off { cursor: not-allowed; opacity: .5; }
.empty { display: grid; justify-items: center; gap: 6px; padding: 22px 12px; color: var(--muted); text-align: center; font-size: 12px; border: 1px dashed var(--line); border-radius: var(--r); }
.empty .iw { font-size: 20px; color: var(--faint); }

/* Happy hour (Promociones in the app): the strip with the countdown, and the old price struck out */
.happy { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 12px; color: #fff;
  background: linear-gradient(100deg, #ff3d81, #ff7a2e 55%, #ffc22e); box-shadow: 0 6px 18px rgba(255, 70, 120, .3); animation: happyIn .45s var(--spring); }
.happy .hf { font-size: 20px; flex: none; animation: live 1.6s ease-in-out infinite; }
.happy div { display: grid; min-width: 0; }
.happy b { font-size: 13px; font-weight: 900; letter-spacing: .04em; }
.happy em { font-style: normal; padding: 0 6px; margin-left: 2px; border-radius: 99px; background: rgba(0, 0, 0, .22); }
.happy span { font-size: 11px; opacity: .92; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.happy time { margin-left: auto; padding: 3px 9px; border-radius: 99px; background: rgba(0, 0, 0, .25); font-weight: 800; font-variant-numeric: tabular-nums; }
@keyframes happyIn { from { transform: translateY(-6px) scale(.97); opacity: 0; } }
.price.sale { background: linear-gradient(90deg, #ff3d81, #ff7a2e); color: #fff; }
.price .was { opacity: .75; font-weight: 600; font-size: 10.5px; text-decoration-thickness: 1.5px; }
.price.short.sale { background: var(--card); color: var(--faint); }

/* Mystery box: one card above the effects */
.boxslot { display: grid; }
.item.box { grid-template-columns: 38px 1fr auto; border-color: color-mix(in srgb, var(--c) 45%, var(--line));
  background: linear-gradient(110deg, color-mix(in srgb, var(--c) 12%, var(--panel)), var(--panel) 60%); }
.item.box .tile { animation: boxWiggle 3.2s ease-in-out infinite; }
@keyframes boxWiggle { 0%, 82%, 100% { transform: none; } 86% { transform: rotate(-10deg) scale(1.08); } 90% { transform: rotate(9deg) scale(1.08); } 94% { transform: rotate(-5deg); } }

/* 9. Voice ------------------------------------------------------------- */
.tts { display: flex; flex-direction: column; gap: 8px; }
.tts-h { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.tts-t { display: flex; gap: 9px; align-items: flex-start; }
.tts-t .acc { font-size: 20px; color: var(--accent); margin-top: 2px; }
.tts-t b { display: block; } .tts-t span { color: var(--muted); font-size: 11.5px; }
.tts textarea { width: 100%; resize: vertical; min-height: 88px; max-height: 220px; padding: 10px 11px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); outline: 0; line-height: 1.45; transition: border-color .2s, box-shadow .2s; }
.tts textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
.tts textarea::placeholder { color: var(--faint); }
.meter { height: 4px; border-radius: 99px; background: var(--card); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--accent-2), var(--accent)); transition: width .2s var(--ease), background .2s; }
.meter.over i { background: var(--bad); }
.tts-f { display: flex; align-items: center; gap: 10px; }
.tts-f .count { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.tts-f .count.over { color: var(--bad); font-weight: 800; }
.tts-f .btn-main { width: auto; margin-left: auto; }

/* 10. Coins & Bits ----------------------------------------------------- */
.bigbal { display: grid; justify-items: center; gap: 4px; text-align: center; padding: 18px 12px; background: radial-gradient(circle at 50% 0, var(--accent-wash), transparent 70%), var(--panel); }
.bigbal .lbl { color: var(--muted); font-size: 12px; font-weight: 600; }
.bigbal .amt { display: flex; align-items: center; gap: 8px; }
.bigbal .amt .coin { width: 30px; height: 30px; animation: coinSpin 6s ease-in-out infinite; }
.bigbal .amt b { font-size: 30px; font-weight: 900; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.bigbal .unit { color: var(--muted); font-weight: 700; }
.bigbal .btn-main { margin-top: 8px; }
.gh { display: inline-flex; align-items: center; gap: 6px; } .gh .gem { width: 15px; height: 15px; }
.bits-card { background: linear-gradient(135deg, var(--bits-wash), transparent 65%), var(--panel); }
.bits { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 6px; }
.bitb { display: grid; justify-items: center; gap: 2px; padding: 10px 6px; border-radius: 11px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; text-align: center;
  transition: border-color .2s, transform .2s var(--spring), box-shadow .2s; }
.bitb:hover { border-color: var(--bits); transform: translateY(-2px); box-shadow: var(--shadow-s); }
.bitb b { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; font-weight: 900; }
.bitb .bu { color: var(--muted); font-size: 11px; font-weight: 600; }
.bitb .bc { display: inline-flex; align-items: center; gap: 4px; margin-top: 4px; padding: 2px 8px; border-radius: 99px; background: var(--bits-wash); color: var(--bits); font-weight: 800; font-size: 11.5px; }
.bitb .gem { width: 13px; height: 13px; }
.erow { display: grid; grid-template-columns: 28px auto 1fr; gap: 8px; align-items: center; padding: 7px 0; border-top: 1px solid var(--line); font-size: 12px; }
.erow:first-of-type { border-top: 0; padding-top: 0; }
.erow .ei { width: 28px; height: 28px; border-radius: 8px; background: var(--accent-wash); color: var(--accent); font-size: 14px; }
.erow span:last-child { color: var(--muted); }

.item.pay { --c: var(--bits); }
.item.pay .price .gem { width: 14px; height: 14px; }
.price .gw { display: inline-flex; }

/* 11. Moderation & queue ----------------------------------------------- */
.modg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.modb { display: flex; align-items: center; gap: 8px; padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); font-weight: 700; cursor: pointer;
  transition: background .2s, border-color .2s, transform .15s var(--spring); }
.modb .iw { font-size: 15px; color: var(--muted); }
.modb:hover:not(:disabled) { background: var(--card-h); border-color: var(--faint); transform: translateY(-1px); }
.modb.danger { color: var(--bad); } .modb.danger .iw { color: var(--bad); }
.modb.danger:hover:not(:disabled) { border-color: var(--bad); background: rgba(220, 38, 38, .08); }
.modb:disabled { opacity: .5; } .modb.busy .iw { animation: pulse .8s ease-in-out infinite; }
.qrow { display: grid; grid-template-columns: 22px 1fr auto auto; gap: 8px; align-items: center; padding: 7px 0; border-top: 1px solid var(--line); font-size: 12px; }
.sec + .qrow { border-top: 0; }
.qrow .iw { color: var(--faint); } .qrow > span:not(.iw) { color: var(--muted); font-size: 11px; }
.qi { display: flex; flex-direction: column; min-width: 0; } .qi small { color: var(--muted); font-size: 11px; }
.qi q { color: var(--muted); font-style: italic; overflow-wrap: anywhere; }
.qx { display: grid; place-items: center; width: 24px; height: 24px; padding: 0; border: 1px solid var(--line); border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; }
.qx:hover { color: #ef4444; border-color: currentColor; } .qx .i { width: 14px; height: 14px; }
.qrow.now .iw, .qrow.now b { color: var(--live); } .qrow.now .iw { animation: live 1.6s ease-in-out infinite; }

.urows { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.urow { display: flex; gap: 6px; align-items: stretch; }
.urow .modb { flex: 1; justify-content: center; padding: 8px 10px; }
.mini { flex: none; height: 38px; padding: 0 8px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--fg); font-weight: 600; outline: 0; transition: border-color .2s; }
.mini:focus { border-color: var(--accent); }
.mini.num { width: 84px; }
.mini.grow { flex: 1; min-width: 0; }

/* 12. Notices, skeleton & toast ---------------------------------------- */
.notice { display: grid; justify-items: center; gap: 4px; text-align: center; padding: 18px 12px; border-radius: var(--r); background: var(--card); border: 1px dashed var(--line); animation: fadeUp .3s var(--ease); }
.notice .ni { font-size: 26px; color: var(--muted); margin-bottom: 4px; }
.notice span { color: var(--muted); font-size: 12px; }
.skel { display: flex; flex-direction: column; gap: 8px; }
.sk { height: 52px; border-radius: 11px; background: linear-gradient(90deg, var(--card) 25%, var(--card-h) 50%, var(--card) 75%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
.sk:first-child { height: 26px; width: 60%; }
.sk:nth-child(2) { height: 46px; border-radius: 12px; }
.toast { position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 30; display: flex; align-items: center; gap: 8px; padding: 10px 13px; border-radius: 11px; font-weight: 600;
  background: var(--fg); color: var(--bg); box-shadow: var(--shadow); transform: translateY(160%); opacity: 0; transition: transform .35s var(--spring), opacity .2s; pointer-events: none; }
.toast .i { font-size: 16px; }
.toast.show { transform: none; opacity: 1; }
.toast.ok { background: var(--ok); color: #fff; }
.toast.bad { background: var(--bad); color: #fff; }
/* Hover tooltip: an item's description, the stream delay explained. */
/* A card in the colour of the item's category (--c), with an arrow pointing at it (--ax). */
.tip { --c: var(--accent); position: fixed; top: 0; left: 0; z-index: 40; width: max-content; max-width: min(264px, calc(100vw - 16px)); padding: 11px 12px 11px; border-radius: 13px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--c) 12%, var(--panel)), var(--panel) 55%); color: var(--fg);
  border: 1px solid color-mix(in srgb, var(--c) 45%, var(--line));
  box-shadow: var(--shadow), 0 10px 28px -10px color-mix(in srgb, var(--c) 60%, transparent); pointer-events: none; opacity: 0; visibility: hidden; }
.tip::before { content: ''; position: absolute; left: 12px; right: 12px; top: -1px; height: 2px; border-radius: 2px; background: linear-gradient(90deg, transparent, var(--c), transparent); }
.tip::after { content: ''; position: absolute; left: var(--ax, 24px); bottom: -6px; width: 10px; height: 10px; margin-left: -5px; background: var(--panel);
  border-right: 1px solid color-mix(in srgb, var(--c) 45%, var(--line)); border-bottom: 1px solid color-mix(in srgb, var(--c) 45%, var(--line)); transform: rotate(45deg); }
.tip.below::after { bottom: auto; top: -6px; transform: rotate(225deg); background: color-mix(in srgb, var(--c) 10%, var(--panel)); }
.tip.show { opacity: 1; visibility: visible; animation: tip-in .22s var(--spring) both; transform-origin: var(--ax, 24px) 100%; }
.tip.below.show { transform-origin: var(--ax, 24px) 0; }
@keyframes tip-in { from { opacity: 0; transform: translateY(5px) scale(.94); } }
.tip.below.show { animation-name: tip-in-down; }
@keyframes tip-in-down { from { opacity: 0; transform: translateY(-5px) scale(.94); } }
.tip .th { display: flex; align-items: center; gap: 9px; }
.tip .tic { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; font-size: 16px; color: var(--c);
  background: color-mix(in srgb, var(--c) 18%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 30%, transparent); }
.tip .tt { min-width: 0; }
.tip .tt b { display: block; font-size: 13.5px; line-height: 1.25; }
.tip .tt small { display: block; margin-top: 1px; font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--c); }
.tip p { margin: 8px 0 0; font-size: 12px; line-height: 1.5; color: var(--muted); white-space: pre-line; }
.tip .tm { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.tip .tm > span { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px 2px 6px; border-radius: 99px; font-size: 11px; font-weight: 700; background: var(--card); border: 1px solid var(--line); }
.tip .tm .i { font-size: 12px; color: var(--muted); }
.tip .tm .coin { width: 13px; height: 13px; }
.tip .tw { display: flex; align-items: flex-start; gap: 6px; margin-top: 9px; padding: 6px 8px; border-radius: 8px; font-size: 11.5px; font-weight: 700; color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, transparent); }
.tip .tw .i { flex: none; margin-top: 1px; }
@media (prefers-reduced-motion: reduce) { .tip.show, .tip.below.show { animation: none; } }
/* Ruler for the tip's position (ui.js placeTip): where fixed 0,0 lands and at what scale. */
.tip-probe { position: fixed; left: 0; top: 0; width: 100px; height: 100px; visibility: hidden; pointer-events: none; }
.pill.delay { cursor: help; color: var(--accent); background: var(--accent-wash); border-color: var(--accent); font-weight: 700; }

/* 13. Component: a key over the video you can drag ---------------------- */
body.mode-component { background: transparent; }
.mode-component #app { position: fixed; inset: 0; overflow: hidden; }
.keybtn { position: absolute; left: 0; top: 0; width: 60px; height: 60px; padding: 0; border: 0; background: none; cursor: grab; touch-action: none; z-index: 10;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, .5)); transition: transform .18s var(--spring), filter .2s; animation: keyIn .6s var(--spring); }
.keybtn.snap { transition: left .45s var(--spring), top .45s var(--spring), transform .18s var(--spring), filter .2s; }
.keybtn svg { width: 100%; height: 100%; display: block; pointer-events: none; }
.keybtn::after { content: ""; position: absolute; inset: 6px 6px 4px; border-radius: 14px; box-shadow: 0 0 0 0 rgba(249, 115, 22, .55); animation: ring 2.6s ease-out infinite; pointer-events: none; }
.keybtn:hover { transform: translateY(-4px) rotate(-4deg) scale(1.05); filter: drop-shadow(0 14px 22px rgba(0, 0, 0, .55)) drop-shadow(0 0 14px rgba(249, 115, 22, .45)); }
.keybtn:active, .keybtn.pressed { transform: translateY(3px) scale(.95); }
.keybtn.pressed::after { animation: none; }
.keybtn.dragging { cursor: grabbing; transform: scale(1.1) rotate(4deg); filter: drop-shadow(0 16px 26px rgba(0, 0, 0, .6)); transition: transform .15s var(--ease); }
.keybtn.dragging::after { animation: none; }
.kbadge { position: absolute; top: -8px; right: -10px; min-width: 24px; padding: 2px 7px; border-radius: 99px; background: #111; color: #fdba74; border: 2px solid #fdba74;
  font: 800 11px/1.2 Inter, 'Segoe UI', system-ui, sans-serif; font-variant-numeric: tabular-nums; pointer-events: none; }
.kbadge.gain { background: #f97316; color: #111; border-color: #fdba74; animation: gainPop .5s var(--spring); }
.keybtn.hop { animation: keyHop .7s var(--spring); }
@keyframes gainPop { from { transform: scale(.5); } 60% { transform: scale(1.35); } to { transform: scale(1); } }
@keyframes keyHop { 0% { transform: translateY(0) scale(1); } 30% { transform: translateY(-14px) rotate(-6deg) scale(1.12); } 60% { transform: translateY(2px) scale(.96); } 100% { transform: translateY(0) scale(1); } }
.drawer { position: absolute; right: 14px; width: min(350px, calc(100% - 28px)); max-height: calc(100% - 100px); overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain;
  border-radius: 16px; background: var(--bg); border: 1px solid var(--line); box-shadow: var(--shadow); z-index: 9;
  transform: translateY(6px) scale(.55); opacity: 0; filter: blur(6px); pointer-events: none; transition: transform .18s ease-in, opacity .16s ease-in, filter .16s; }
.drawer.left { right: auto; left: 14px; }
.drawer.open { transform: none; opacity: 1; filter: none; pointer-events: auto; transition: transform .42s var(--spring), opacity .2s var(--ease), filter .25s var(--ease); }
.drawer .top { position: sticky; top: 0; z-index: 4; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.mode-component .tabs { top: 52px; }
.mode-component .group { top: 110px; }
.close { display: grid; place-items: center; width: 28px; height: 28px; flex: none; border: 0; border-radius: 99px; background: var(--card); color: var(--muted); cursor: pointer; font-size: 13px; transition: background .2s, color .2s, transform .2s var(--spring); }
.close:hover { color: var(--fg); background: var(--card-h); transform: rotate(90deg); }
.mode-component .toast { left: 14px; right: 14px; bottom: 14px; max-width: 350px; margin: 0 auto; }

/* 14. Config page (streamer) ------------------------------------------- */
.cfg { max-width: 640px; margin: 0 auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.cfg h1 { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 18px; }
.cfg h1 svg { width: 34px; height: 34px; }
.cfg .lead { margin: 0; color: var(--muted); }
.checks { display: flex; flex-direction: column; gap: 10px; }
.check { display: grid; grid-template-columns: 30px 1fr; gap: 10px; align-items: start; }
.check .st { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 99px; background: var(--card); color: var(--faint); font-size: 16px; }
.check .st .spin { animation: rot 1s linear infinite; }
.check.ok .st { background: rgba(34, 197, 94, .15); color: var(--ok); } .check.bad .st { background: rgba(248, 113, 113, .15); color: var(--bad); }
.check b { display: block; } .check span { color: var(--muted); font-size: 12px; }
.steps { margin: 0; padding-left: 18px; line-height: 1.75; }
.url { display: flex; gap: 6px; align-items: center; margin-top: 6px; }
.url code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 8px 10px; border-radius: 8px; background: var(--card); border: 1px solid var(--line); font: 12px Consolas, 'Cascadia Mono', monospace; }
.btn-sm { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--card); padding: 7px 10px; border-radius: 8px; font-weight: 700; cursor: pointer; transition: border-color .2s; }
.btn-sm:hover { border-color: var(--accent); }
.btn-sm .i { font-size: 13px; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 6px; }
.stat { --c: var(--accent); display: grid; justify-items: center; gap: 2px; padding: 10px; border-radius: 10px; background: var(--card); text-align: center; }
.stat .iw { font-size: 16px; color: var(--c); }
.stat b { font-size: 18px; } .stat span { color: var(--muted); font-size: 11.5px; }
.hint.first { margin-top: 0; }

/* 15. Animations ------------------------------------------------------- */
.item.in, .bitb.in { animation: itemIn .34s var(--ease) both; }
.wallet.bump { animation: bump .5s var(--spring); }
@keyframes itemIn { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes paneIn { from { opacity: 0; transform: translateY(6px); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } }
@keyframes pulse { 50% { opacity: .4; } }
@keyframes armedPulse { 50% { transform: scale(1.06); } }
@keyframes fired { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--c) 70%, transparent); } 100% { box-shadow: 0 0 0 14px transparent; } }
@keyframes bump { 40% { transform: scale(1.12); } }
@keyframes live { 50% { opacity: .45; } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes keyIn { from { opacity: 0; transform: translateY(24px) scale(.6); } }
@keyframes ring { 0% { box-shadow: 0 0 0 0 rgba(249, 115, 22, .5); } 70%, 100% { box-shadow: 0 0 0 14px rgba(249, 115, 22, 0); } }
@keyframes coinSpin { 0%, 70%, 100% { transform: rotateY(0); } 85% { transform: rotateY(180deg); } }
@keyframes rot { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }
