/* PadKit Web — DualSense-white theme (ported from padkit-native Theme). */
:root {
  --bg: #E9ECF2;
  --panel: #FBFCFF;
  --panel-2: #F2F4F9;
  --line: #DBE0EC;
  --ink: #1A2233;
  --muted: #69718A;
  --accent: #2667D6;
  --glow: #3F86F0;
  --good: #0FA97E;
  --scope: #10141F;
  --cross: #2E6DE0;
  --circle: #EF3F4F;
  --square: #C43FC9;
  --triangle: #0FA97E;
  --disp: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background:
    radial-gradient(900px 500px at 50% -8%, rgba(255,255,255,0.9), transparent),
    var(--bg);
  color: var(--ink);
  font-family: var(--disp);
  display: flex; flex-direction: column; min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ---- App bar ---- */
.app-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px;
}
.brand { font-family: var(--mono); font-size: 12px; letter-spacing: 6px; color: var(--accent); font-weight: 700; }
.brand b { font-weight: 800; }
.brand em { font-style: normal; color: var(--muted); letter-spacing: 3px; }
.bar-right { display: flex; align-items: center; gap: 16px; }
.tour-btn {
  font-family: var(--mono); font-size: 10px; letter-spacing: 1.5px; font-weight: 700;
  color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, white);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line)); border-radius: 8px;
  padding: 7px 12px; cursor: pointer;
}
.tour-btn:hover { background: color-mix(in srgb, var(--accent) 16%, white); }
.app-status { font-family: var(--mono); font-size: 11px; letter-spacing: 1.5px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.app-status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); opacity: 0.5; }
.app-status.live .dot { background: var(--good); opacity: 1; }

/* ---- Deck grid ---- */
.decks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 6px 16px 8px;
  max-width: 1500px; width: 100%; margin: 0 auto;
}
@media (max-width: 900px) { .decks { grid-template-columns: 1fr; } }

.deck {
  --accent: #2667D6;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 10px 26px rgba(26,34,51,0.08);
  padding: 12px 16px;
  display: flex; flex-direction: column; gap: 10px;
  transition: opacity .2s;
}
.deck.offline { opacity: 0.55; }

/* ---- Deck header ---- */
.dk-head { display: flex; align-items: center; gap: 12px; }
.badge {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  display: grid; place-items: center;
  font-family: var(--mono); font-weight: 800; font-size: 13px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 15%, white);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
}
.title-wrap { flex: 1; min-width: 0; position: relative; }
.kit-title { font-size: 30px; line-height: 1; color: var(--ink); white-space: nowrap;
  background: none; border: none; padding: 0; cursor: pointer; font-family: var(--disp); display: inline-flex; align-items: baseline; gap: 4px; }
.kit-title b { font-weight: 700; }
.kit-title span { font-weight: 200; }
.kit-title .caret { font-style: normal; font-size: 14px; color: var(--muted); transform: translateY(-4px); }
.kit-title:hover .caret { color: var(--accent); }

/* Kit picker dropdown */
.kit-menu { display: none; position: absolute; top: 40px; left: 0; z-index: 20;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 16px 40px rgba(26,34,51,0.18); padding: 6px; min-width: 220px; }
.kit-menu.open { display: block; }
.kit-menu button { display: flex; flex-direction: column; align-items: flex-start; gap: 1px;
  width: 100%; text-align: left; background: none; border: none; cursor: pointer;
  padding: 8px 10px; border-radius: 8px; color: var(--ink); }
.kit-menu button:hover { background: var(--panel-2); }
.kit-menu button.cur { background: color-mix(in srgb, var(--accent) 12%, white); }
.kit-menu button.sel { background: color-mix(in srgb, var(--accent) 22%, white); outline: 2px solid var(--accent); outline-offset: -2px; }
.kit-menu button b { font-family: var(--disp); font-weight: 700; font-size: 14px; }
.kit-menu button span { font-family: var(--mono); font-size: 9px; letter-spacing: 1px; color: var(--muted); text-transform: uppercase; }
.kit-sub { font-family: var(--mono); font-size: 10px; letter-spacing: 1.5px; color: var(--muted); margin-top: 3px; }
.kit-sub.scale-pulse { animation: scalePulse 0.6s ease-out; }
@keyframes scalePulse { 0% { color: var(--accent); transform: scale(1.12); transform-origin: left; } 100% { color: var(--muted); transform: scale(1); } }
.kit-nav { display: flex; gap: 6px; }
.kit-nav button {
  width: 26px; height: 26px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--muted);
  font-size: 13px; line-height: 1; display: grid; place-items: center;
}
.kit-nav button:hover { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.conn { font-family: var(--mono); font-size: 9px; letter-spacing: 1.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.conn .dot { width: 7px; height: 10px; border-radius: 2px; background: var(--muted); opacity: 0.5; }
.conn.on { color: var(--good); }
.conn.on .dot { background: var(--good); opacity: 1; }

/* ---- Trigger row ---- */
.triggers { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.trig {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 8px 10px; display: flex; flex-direction: column; gap: 4px;
  box-shadow: 0 4px 10px rgba(26,34,51,0.05);
}
.trig .meter { height: 6px; border-radius: 6px; background: var(--bg); overflow: hidden; }
.trig .meter > i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 6px; transition: width .09s ease-out; }
.trig .k { font-family: var(--mono); font-size: 9px; letter-spacing: 2px; color: var(--muted); }
.trig .l { font-family: var(--mono); font-size: 10px; letter-spacing: 0.5px; color: var(--ink); text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trig.hit .l { color: var(--accent); }
.trig.hit .meter > i { width: 100% !important; }

/* ---- Pad area ---- */
.pad-area { display: flex; gap: 12px; align-items: center; flex: 1; }

.feed {
  flex: 0 0 26%; min-width: 0; align-self: stretch;
  border: 1px solid var(--line); border-radius: 12px; background: var(--panel);
  padding: 8px 9px; display: flex; flex-direction: column; gap: 5px; overflow: hidden;
}
.feed .cap { font-family: var(--mono); font-size: 8px; letter-spacing: 2px; color: var(--muted); }
.feed .row { display: flex; align-items: center; gap: 6px; }
.feed .g { font-family: var(--mono); font-size: 10px; font-weight: 700; width: 22px; height: 22px; flex: none;
  display: grid; place-items: center; border-radius: 5px; background: var(--bg); }
.feed .nm { font-family: var(--mono); font-size: 9px; letter-spacing: 0.5px; color: var(--ink);
  text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.feed .vb { height: 6px; border-radius: 6px; flex: 0 0 26px; }
.feed .empty { font-family: var(--mono); font-size: 8px; letter-spacing: 1px; color: var(--muted); opacity: 0.6; }

.clusters { flex: 1; display: flex; align-items: center; justify-content: space-around; gap: 8px; min-height: 0; }

.cluster { display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); gap: 6px; aspect-ratio: 1; }
.cluster.dpad { width: 33%; max-width: 130px; }
.cluster.face { width: 52%; max-width: 210px; }
.cell { display: grid; place-items: center; }
.cell.c-up { grid-area: 1 / 2; }
.cell.c-left { grid-area: 2 / 1; }
.cell.c-right { grid-area: 2 / 3; }
.cell.c-down { grid-area: 3 / 2; }

.pad {
  width: 100%; height: 100%; border-radius: 999px;
  background: var(--panel); border: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  box-shadow: 0 5px 12px rgba(26,34,51,0.10);
  transition: transform .12s ease-out, box-shadow .12s, border-color .12s;
}
.pad.dpad { border-radius: 10px; }
.pad .glyph { font-weight: 800; font-size: 22px; line-height: 1; }
.pad.dpad .glyph { font-size: 14px; color: var(--ink); }
.pad .plabel { font-family: var(--mono); font-size: 7px; letter-spacing: 0.5px; color: var(--muted); text-transform: uppercase; }
.pad.inert { opacity: 0.4; box-shadow: none; }
.pad.lit { transform: scale(0.9); }

/* Peek mode — hold Create/Share: reveal each pad's sound name. */
.deck.peek .pad { border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent), 0 4px 10px rgba(26,34,51,0.10); }
.deck.peek .pad .glyph { opacity: 0.4; }
.deck.peek .pad .plabel { color: var(--ink); font-weight: 700; font-size: 8px; }
.deck.peek .pad.inert { opacity: 0.55; }

/* ---- Loop strip ---- */
.loop { display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.loop .rec, .loop .clr {
  font-family: var(--mono); font-size: 9px; letter-spacing: 1.5px; font-weight: 700;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--muted);
  border-radius: 8px; padding: 6px 10px; cursor: pointer; flex: none;
}
.loop .rec:hover { border-color: var(--circle); color: var(--circle); }
.loop .clr:hover { border-color: var(--accent); color: var(--accent); }
.loop .rec.on {
  background: var(--circle); color: #fff; border-color: var(--circle);
  animation: recpulse 0.7s ease-in-out infinite alternate;
}
@keyframes recpulse { from { opacity: 1; } to { opacity: 0.55; } }
.loop .bar { position: relative; flex: 1; height: 22px; border-radius: 8px;
  background: linear-gradient(90deg, #E3E7F1, #EDF0F6); overflow: hidden; border: 1px solid var(--line); }
.loop .steps { position: absolute; inset: 0; display: flex; align-items: center; }
.loop .steps .st { flex: 1; height: 6px; margin: 0 auto; border-radius: 50%;
  width: 4px; max-width: 4px; background: color-mix(in srgb, var(--ink) 18%, transparent); }
.loop .steps .st.beat { background: color-mix(in srgb, var(--ink) 34%, transparent); }
.loop .steps .st.on { background: var(--accent); width: 7px; max-width: 7px; height: 7px; }
.loop .steps .st.play { box-shadow: 0 0 8px var(--accent); }
.loop .head { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--accent);
  opacity: 0.7; transform: translateX(-1px); }
.loop .bpm { font-family: var(--mono); font-size: 9px; letter-spacing: 1px; color: var(--muted); flex: none; }

/* ---- Shared loop bar (global) ---- */
.loopbar {
  display: flex; align-items: center; gap: 14px;
  max-width: 1500px; width: 100%; margin: 0 auto;
  padding: 12px 18px; margin-top: 2px;
}
.loopbar .lb-label { font-family: var(--mono); font-size: 10px; letter-spacing: 2px; line-height: 1.25;
  color: var(--muted); font-weight: 700; flex: none; }
.loopbar .rec, .loopbar .clr {
  font-family: var(--mono); font-size: 11px; letter-spacing: 2px; font-weight: 700;
  border: 1px solid var(--line); background: var(--panel); color: var(--muted);
  border-radius: 9px; padding: 9px 16px; cursor: pointer; flex: none;
  box-shadow: 0 4px 10px rgba(26,34,51,0.05);
}
.loopbar .rec:hover { border-color: var(--circle); color: var(--circle); }
.loopbar .clr:hover { border-color: var(--accent); color: var(--accent); }
.loopbar .rec.on { background: var(--circle); color: #fff; border-color: var(--circle);
  animation: recpulse 0.7s ease-in-out infinite alternate; }
@keyframes recpulse { from { opacity: 1; } to { opacity: 0.55; } }
.loopbar .bar { position: relative; flex: 1; height: 34px; border-radius: 10px;
  background: linear-gradient(90deg, #E3E7F1, #EDF0F6); overflow: hidden; border: 1px solid var(--line);
  box-shadow: inset 0 1px 3px rgba(26,34,51,0.06); }
.loopbar .steps { position: absolute; inset: 0; display: flex; align-items: center; }
.loopbar .steps .st { flex: 1; margin: 0 auto; border-radius: 50%;
  width: 5px; max-width: 5px; height: 5px; background: color-mix(in srgb, var(--ink) 16%, transparent); }
.loopbar .steps .st.beat { background: color-mix(in srgb, var(--ink) 32%, transparent); width: 6px; max-width: 6px; height: 6px; }
.loopbar .steps .st.on { width: 11px; max-width: 11px; height: 11px; }
.loopbar .steps .st.play { box-shadow: 0 0 10px currentColor; outline: 2px solid rgba(255,255,255,0.6); }
.loopbar .head { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--accent); opacity: 0.75; }
.loopbar .lb-bpm { font-family: var(--mono); font-size: 10px; letter-spacing: 1px; color: var(--muted); flex: none; }

/* ---- Loop dock (all 4 loops together, bottom) ---- */
.loopdock {
  max-width: 1500px; width: 100%; margin: 2px auto 0; padding: 12px 16px 4px;
}
.ld-head { font-family: var(--mono); font-size: 10px; letter-spacing: 2px; color: var(--ink);
  font-weight: 700; margin-bottom: 8px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.lp-play { font-family: var(--mono); font-size: 10px; letter-spacing: 1.5px; font-weight: 700;
  border: 1px solid var(--accent); background: color-mix(in srgb, var(--accent) 12%, white); color: var(--accent);
  border-radius: 8px; padding: 6px 12px; cursor: pointer; flex: none; }
.lp-play:hover { background: var(--accent); color: #fff; }
.lp-play.paused { border-color: var(--good); background: color-mix(in srgb, var(--good) 14%, white); color: var(--good); }
.lp-play.paused:hover { background: var(--good); color: #fff; }
.lp-mini { font-family: var(--mono); font-size: 10px; letter-spacing: 1px; font-weight: 700;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--muted);
  border-radius: 8px; padding: 6px 10px; cursor: pointer; flex: none; }
.lp-mini:hover:not(:disabled) { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.lp-mini:disabled { opacity: 0.4; cursor: default; }
.lp-mini.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.lp-mini.on:hover { filter: brightness(1.06); color: #fff; }
.lp-bpm { display: inline-flex; align-items: center; gap: 7px; }
.lp-bpm input[type=range] { -webkit-appearance: none; appearance: none; width: 96px; height: 4px; border-radius: 4px;
  background: var(--line); cursor: pointer; }
.lp-bpm input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 13px; height: 13px; border-radius: 50%;
  background: var(--accent); cursor: pointer; border: 2px solid #fff; box-shadow: 0 1px 3px rgba(26,34,51,0.3); }
.lp-bpm input[type=range]::-moz-range-thumb { width: 13px; height: 13px; border-radius: 50%; background: var(--accent); border: 2px solid #fff; cursor: pointer; }
.lp-bpm b { color: var(--accent); font-variant-numeric: tabular-nums; min-width: 24px; text-align: right; display: inline-block; }
.ld-head span { color: var(--muted); font-weight: 400; letter-spacing: 1px; }
.ld-rows { display: flex; flex-direction: column; gap: 8px; }
.ld-row {
  --accent: #2667D6;
  display: flex; align-items: center; gap: 10px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 7px 10px; box-shadow: 0 4px 10px rgba(26,34,51,0.05);
}
.ld-badge { width: 30px; height: 26px; border-radius: 7px; flex: none; display: grid; place-items: center;
  font-family: var(--mono); font-weight: 800; font-size: 11px; color: var(--accent);
  background: color-mix(in srgb, var(--accent) 15%, white); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); }
.ld-row .rec, .ld-row .clr {
  font-family: var(--mono); font-size: 10px; letter-spacing: 1.5px; font-weight: 700;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--muted);
  border-radius: 8px; padding: 7px 12px; cursor: pointer; flex: none;
}
.ld-row .rec:hover { border-color: var(--circle); color: var(--circle); }
.ld-row .clr:hover { border-color: var(--accent); color: var(--accent); }
.ld-row .rec.on { background: var(--circle); color: #fff; border-color: var(--circle);
  animation: recpulse 0.7s ease-in-out infinite alternate; }
@keyframes recpulse { from { opacity: 1; } to { opacity: 0.55; } }
.ld-row .bar { position: relative; flex: 1; height: 26px; border-radius: 9px;
  background: linear-gradient(90deg, #E3E7F1, #EDF0F6); overflow: hidden; border: 1px solid var(--line);
  box-shadow: inset 0 1px 3px rgba(26,34,51,0.06); }
.ld-row .steps { position: absolute; inset: 0; display: flex; align-items: center; }
.ld-row .steps .st { flex: 1; margin: 0 auto; border-radius: 50%; width: 5px; max-width: 5px; height: 5px;
  background: color-mix(in srgb, var(--ink) 16%, transparent); }
.ld-row .steps .st.beat { background: color-mix(in srgb, var(--ink) 30%, transparent); width: 6px; max-width: 6px; height: 6px; }
.ld-row .steps .st.on { background: var(--accent); width: 10px; max-width: 10px; height: 10px; }
.ld-row .steps .st.play { box-shadow: 0 0 9px var(--accent); outline: 2px solid rgba(255,255,255,0.6); }
.ld-row .head { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--accent); opacity: 0.75; }

/* ---- Deck footer ---- */
.dk-foot { font-family: var(--mono); font-size: 9px; letter-spacing: 1px; color: var(--muted); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dk-foot .cx { color: var(--cross); } .dk-foot .ci { color: var(--circle); }
.dk-foot .sq { color: var(--square); } .dk-foot .tr { color: var(--triangle); }

.app-foot { padding: 10px 20px; text-align: center; font-family: var(--mono); font-size: 10px; letter-spacing: 1px; color: var(--muted); }
.app-foot kbd { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; }

/* ---- Overlay ---- */
.overlay { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(233,236,242,0.82); backdrop-filter: blur(6px); z-index: 10; }
.overlay.hidden { display: none; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 22px; padding: 34px 40px; text-align: center; max-width: 500px; box-shadow: 0 20px 50px rgba(26,34,51,0.16); }
.card .brand { justify-content: center; margin-bottom: 4px; }
.card .big { font-family: var(--disp); font-size: 40px; margin: 6px 0 2px; }
.card .big b { font-weight: 700; } .card .big span { font-weight: 200; }
.card p { color: var(--muted); line-height: 1.55; font-size: 14px; }
.start { margin: 14px 0 12px; padding: 13px 28px; font-size: 16px; font-weight: 700; border-radius: 12px; border: none; cursor: pointer; background: var(--accent); color: white; box-shadow: 0 8px 20px rgba(38,103,214,0.35); }
.start:hover { filter: brightness(1.06); }
.start:disabled { opacity: 0.7; cursor: default; }
.card small { color: var(--muted); display: block; font-family: var(--mono); font-size: 10px; letter-spacing: 1px; }

/* ---- Walkthrough / tour ---- */
.tour-root { position: fixed; inset: 0; z-index: 50; display: none; pointer-events: none; }
.tour-root.on { display: block; }
.tour-backdrop { position: fixed; inset: 0; background: rgba(10,15,25,0.5); pointer-events: auto; }
.tour-ring {
  position: fixed; border: 2px solid var(--accent); border-radius: 12px;
  box-shadow: 0 0 0 9999px rgba(10,15,25,0.5), 0 0 22px color-mix(in srgb, var(--accent) 70%, transparent);
  pointer-events: none;
  /* No position transition: the huge box-shadow + transition stalls mid-move and
     freezes the spotlight on the previous step's target. Snap instantly instead. */
}
.tour-card {
  position: fixed; width: 340px; max-width: calc(100vw - 20px);
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 20px 50px rgba(26,34,51,0.22); padding: 18px 20px; z-index: 51; pointer-events: auto;
}
.tour-step { font-family: var(--mono); font-size: 9px; letter-spacing: 2px; color: var(--accent); font-weight: 700; }
.tour-title { font-family: var(--disp); font-size: 19px; font-weight: 700; color: var(--ink); margin: 4px 0 8px; }
.tour-text { font-size: 13.5px; line-height: 1.55; color: var(--muted); }
.tour-nav { display: flex; align-items: center; gap: 8px; margin-top: 16px; }
.tour-spacer { flex: 1; }
.tour-nav button {
  font-family: var(--mono); font-size: 11px; letter-spacing: 1px; font-weight: 700;
  border-radius: 9px; padding: 8px 14px; cursor: pointer; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--muted);
}
.tour-nav .tour-next { background: var(--accent); color: #fff; border-color: var(--accent); }
.tour-nav .tour-next:hover { filter: brightness(1.06); }
.tour-nav .tour-next.ghost { background: var(--panel-2); color: var(--muted); border-color: var(--line); }
.tour-nav .tour-next.ghost:hover { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); filter: none; }
.tour-nav .tour-back:hover, .tour-nav .tour-skip:hover { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }

/* ---- Share modal + Leaderboard ---- */
.pk-modal { position: fixed; inset: 0; z-index: 60; display: none; place-items: center;
  background: rgba(10,15,25,0.5); backdrop-filter: blur(4px); }
.pk-modal.on { display: grid; }
.pk-card { background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: 0 24px 60px rgba(26,34,51,0.24); padding: 22px 24px; width: 440px; max-width: calc(100vw - 24px); }
.pk-h { font-family: var(--disp); font-size: 20px; font-weight: 800; color: var(--ink); }
.pk-sub { color: var(--muted); font-size: 13px; line-height: 1.5; margin: 6px 0 14px; }
.pk-l { display: block; font-family: var(--mono); font-size: 10px; letter-spacing: 1.5px; color: var(--muted); margin: 10px 0 5px; }
.pk-in { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel-2); color: var(--ink); font-size: 14px; font-family: var(--disp); }
.pk-in:focus { outline: none; border-color: var(--accent); }
.pk-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.pk-btn { font-family: var(--mono); font-size: 11px; letter-spacing: 1px; font-weight: 700;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--muted);
  border-radius: 9px; padding: 9px 15px; cursor: pointer; }
.pk-btn:hover { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.pk-btn.pk-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.pk-btn.pk-primary:hover { filter: brightness(1.06); color: #fff; }
.pk-btn:disabled { opacity: .6; cursor: default; }

.pk-board { width: 640px; max-height: 82vh; display: flex; flex-direction: column; }
.pk-board-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.pk-board-tools { display: flex; gap: 8px; }
.pk-list { overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding-right: 4px; }
.pk-empty { color: var(--muted); font-size: 13px; text-align: center; padding: 30px 10px; }
.pk-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); }
.pk-rank { font-family: var(--mono); font-weight: 800; color: var(--accent); font-size: 13px; width: 34px; flex: none; }
.pk-meta { flex: 1; min-width: 0; }
.pk-name { font-family: var(--disp); font-weight: 700; font-size: 15px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pk-by { font-family: var(--mono); font-size: 10px; letter-spacing: 1px; color: var(--muted); text-transform: uppercase; }
.pk-vote { display: flex; align-items: center; gap: 6px; flex: none; }
.pk-vote button { width: 30px; height: 30px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel); color: var(--muted); font-size: 13px; }
.pk-vote .pk-up:hover, .pk-vote .pk-up.on { color: var(--good); border-color: var(--good); }
.pk-vote .pk-down:hover, .pk-vote .pk-down.on { color: var(--circle); border-color: var(--circle); }
.pk-count { font-family: var(--mono); font-weight: 700; font-size: 13px; color: var(--ink); min-width: 30px; text-align: center; font-variant-numeric: tabular-nums; }
.pk-play { font-family: var(--mono); font-size: 11px; letter-spacing: 1px; font-weight: 700; flex: none;
  border: 1px solid var(--accent); background: color-mix(in srgb, var(--accent) 10%, white); color: var(--accent);
  border-radius: 9px; padding: 9px 14px; cursor: pointer; }
.pk-play:hover { background: var(--accent); color: #fff; }

/* ---- Assistant chatbot ---- */
.as-bubble {
  position: fixed; right: 20px; bottom: 18px; z-index: 80;
  display: flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 12px; letter-spacing: 1px; font-weight: 700;
  color: #fff; background: var(--accent); border: none; border-radius: 999px;
  padding: 11px 18px; cursor: pointer; box-shadow: 0 10px 28px rgba(38,103,214,0.4);
}
.as-bubble span { font-size: 15px; }
.as-bubble:hover { filter: brightness(1.07); }
.as-panel {
  position: fixed; right: 20px; bottom: 74px; z-index: 81; width: 370px; max-width: calc(100vw - 32px);
  height: 520px; max-height: calc(100vh - 110px); display: none; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 24px 60px rgba(26,34,51,0.28); overflow: hidden;
}
.as-panel.on { display: flex; }
.as-head { display: flex; align-items: center; justify-content: space-between;
  padding: 13px 16px; border-bottom: 1px solid var(--line);
  font-family: var(--disp); font-weight: 700; font-size: 14px; color: var(--ink);
  background: color-mix(in srgb, var(--accent) 8%, var(--panel)); }
.as-head-btns { display: flex; align-items: center; gap: 6px; }
.as-head .as-close { border: none; background: none; color: var(--muted); cursor: pointer; font-size: 14px; }
.as-head .as-close:hover { color: var(--ink); }
.as-head .as-clear { font-family: var(--mono); font-size: 10px; letter-spacing: 1px; color: var(--muted);
  border: 1px solid var(--line); background: var(--panel); border-radius: 7px; padding: 4px 9px; cursor: pointer; }
.as-head .as-clear:hover { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.as-list { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.as-msg { max-width: 85%; padding: 9px 12px; border-radius: 12px; font-size: 13.5px; line-height: 1.5; }
.as-msg.user { white-space: pre-wrap; }
.as-msg ul, .as-msg ol { margin: 6px 0; padding-left: 20px; }
.as-msg li { margin: 3px 0; }
.as-msg strong { font-weight: 700; }
.as-msg em { font-style: italic; }
.as-msg code { font-family: var(--mono); font-size: 12px; background: var(--bg); padding: 1px 5px; border-radius: 4px; }
.as-msg div { margin: 3px 0; }
.as-msg div:empty { display: none; }
.as-msg > :first-child { margin-top: 0; }
.as-msg > :last-child { margin-bottom: 0; }
.as-msg.assistant { align-self: flex-start; background: var(--panel-2); color: var(--ink); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.as-msg.user { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.as-msg.err { background: color-mix(in srgb, var(--circle) 12%, white); color: var(--circle); border-color: color-mix(in srgb, var(--circle) 30%, transparent); }
.as-suggest { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 10px; }
.as-suggest button { font-family: var(--mono); font-size: 10px; letter-spacing: .3px; color: var(--accent);
  background: color-mix(in srgb, var(--accent) 9%, white); border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
  border-radius: 999px; padding: 6px 10px; cursor: pointer; }
.as-suggest button:hover { background: color-mix(in srgb, var(--accent) 18%, white); }
.as-input { display: flex; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--line); }
.as-input input { flex: 1; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel-2); color: var(--ink); font-size: 13.5px; font-family: var(--disp); }
.as-input input:focus { outline: none; border-color: var(--accent); }
.as-input button { border: none; background: var(--accent); color: #fff; border-radius: 10px;
  padding: 0 16px; font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: 1px; cursor: pointer; }
.as-input button:disabled { opacity: .6; cursor: default; }

/* ---- Recorder (record & download WAV) ---- */
.rec-card { width: 460px; }
.rec-idle .pk-sub { margin-bottom: 16px; }
.rec-live[hidden], .rec-idle[hidden], .rec-review[hidden] { display: none; }
.rec-live { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 10px 0 4px; }
.rec-live-row { display: flex; align-items: center; gap: 10px; font-family: var(--mono); font-size: 26px; color: var(--ink); font-variant-numeric: tabular-nums; }
.rec-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--circle);
  animation: recpulse 0.7s ease-in-out infinite alternate; }
.rec-wave-wrap { position: relative; height: 72px; border-radius: 10px; overflow: hidden;
  background: var(--scope); border: 1px solid var(--line); margin-top: 6px; }
.rec-wave { display: block; width: 100%; height: 100%; }
.rec-mask { position: absolute; top: 0; bottom: 0; background: rgba(10,15,25,0.62); pointer-events: none; }
.rec-mask-l { left: 0; } .rec-mask-r { right: 0; }
.rec-window { position: absolute; top: 0; bottom: 0; border-top: 2px solid var(--accent); border-bottom: 2px solid var(--accent); pointer-events: none; }
.rec-handle { position: absolute; top: 0; bottom: 0; width: 10px; margin-left: -5px; cursor: ew-resize; }
.rec-handle::after { content: ''; position: absolute; top: 0; bottom: 0; left: 4px; width: 2px; background: var(--accent); }
.rec-handle::before { content: ''; position: absolute; top: 50%; left: 1px; width: 8px; height: 22px; margin-top: -11px;
  border-radius: 4px; background: var(--accent); box-shadow: 0 1px 4px rgba(0,0,0,0.3); }
.rec-times { text-align: center; font-family: var(--mono); font-size: 11px; letter-spacing: 0.5px; color: var(--muted); margin-top: 10px; }
.rec-actions { display: flex; justify-content: center; gap: 8px; margin-top: 16px; }
#download-btn.rec-active { background: var(--circle); color: #fff; border-color: var(--circle);
  animation: recpulse 0.7s ease-in-out infinite alternate; }

/* Toast */
.pk-toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; font-family: var(--mono); font-size: 12px; letter-spacing: .5px;
  padding: 11px 18px; border-radius: 12px; box-shadow: 0 12px 30px rgba(26,34,51,0.3);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 70; max-width: 90vw; }
.pk-toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
