/* =============================================================================
   5IVESAW — design system
   Hand-written (no runtime Tailwind) for speed. All colours come from tokens so
   every component follows the active theme ([data-tone] on <html>).
   ============================================================================= */

/* ---------- 1. THEMES ---------------------------------------------------- */
:root, [data-tone="latte"] {
  --bg: #B2A999; --surface: #A59B8B; --elevated: #BEB5A6;
  --glass: rgba(190, 181, 166, .82);
  --line: rgba(32, 24, 22, .14); --line-strong: #942929;
  --hi: rgba(255, 248, 236, .26);
  --ink: #1A1514; --muted: #423836; --faint: #635653;
  --accent: #942929; --accent-2: #B54842; --on-accent: #fff;
  --spot: rgba(148, 41, 41, .10); --wave: #C4BCAE;
  --shadow: 0 14px 32px -14px rgba(0, 0, 0, .25);
  color-scheme: light;
}
[data-tone="cream"] {
  --bg: #CBC3B5; --surface: #BFB6A6; --elevated: #D7D0C3;
  --glass: rgba(215, 208, 195, .82);
  --line: rgba(42, 30, 30, .14); --line-strong: #A62929;
  --hi: rgba(255, 250, 242, .4);
  --ink: #1D1818; --muted: #524646; --faint: #7A6B6B;
  --accent: #A62929; --accent-2: #C2504A; --on-accent: #fff;
  --spot: rgba(166, 41, 41, .1); --wave: #DDD6C8;
  color-scheme: light;
}
[data-tone="readme"] {
  --bg: #170f0f; --surface: #110a0a; --elevated: #211515;
  --glass: rgba(33, 21, 21, .8);
  --line: #3a2626; --line-strong: #A62929;
  --hi: rgba(194, 80, 74, .14);
  --ink: #F2E6E6; --muted: #C4A8A8; --faint: #876868;
  --accent: #C2504A; --accent-2: #A62929; --on-accent: #fff;
  --spot: rgba(166, 41, 41, .16); --wave: #3a2626;
  --shadow: 0 14px 32px -14px rgba(0, 0, 0, .6);
  color-scheme: dark;
}
[data-tone="chainsaw"] {
  --bg: #0D0A0B; --surface: #070506; --elevated: #171113;
  --glass: rgba(23, 17, 19, .82);
  --line: #3D1A20; --line-strong: #FF3B14;
  --hi: rgba(255, 199, 0, .16);
  --ink: #FFF5EB; --muted: #F2A68D; --faint: #9E5246;
  --accent: #FF3B14; --accent-2: #FFC700; --on-accent: #0D0A0B;
  --spot: rgba(255, 59, 20, .18); --wave: #FF3B14;
  --shadow: 0 16px 38px -12px rgba(255, 59, 20, .18);
  color-scheme: dark;
}
[data-tone="ostania"] {
  --bg: #0F1C18; --surface: #0A1310; --elevated: #162923;
  --glass: rgba(22, 41, 35, .82);
  --line: #26473C; --line-strong: #D4AF6A;
  --hi: rgba(212, 175, 106, .14);
  --ink: #E6F4EE; --muted: #9CC2B3; --faint: #5B8273;
  --accent: #D4AF6A; --accent-2: #34D399; --on-accent: #0F1C18;
  --spot: rgba(52, 211, 153, .12); --wave: #1F3D33;
  --shadow: 0 14px 32px -14px rgba(0, 0, 0, .6);
  color-scheme: dark;
}
[data-tone="cyber"] {
  --bg: #0D1322; --surface: #080C17; --elevated: #151E34;
  --glass: rgba(21, 30, 52, .82);
  --line: #253559; --line-strong: #38BDF8;
  --hi: rgba(56, 189, 248, .14);
  --ink: #E8F1FF; --muted: #94B0DA; --faint: #57739E;
  --accent: #38BDF8; --accent-2: #818CF8; --on-accent: #0D1322;
  --spot: rgba(56, 189, 248, .13); --wave: #1E2E52;
  --shadow: 0 14px 32px -14px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

:root {
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-serif: "Instrument Serif", Georgia, serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --font-display: "Orbitron", "JetBrains Mono", monospace;
  --r-sm: 10px; --r: 16px; --r-lg: 22px; --r-full: 999px;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --dur: .32s;
  --dock-h: 0px; /* set by JS when music dock is visible */
}

/* ---------- 2. BASE ------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 16px; }
body {
  margin: 0; min-height: 100dvh;
  background-color: var(--bg);
  background-image: radial-gradient(var(--line) 1px, transparent 0);
  background-size: 24px 24px;
  color: var(--ink);
  font: 400 14px/1.55 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  padding-bottom: calc(var(--dock-h) + 24px);
  transition: background-color .5s var(--ease), color .4s var(--ease);
}
img, svg, canvas, video { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--accent); color: var(--on-accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 8px; border: 2px solid var(--bg); }
* { scrollbar-color: var(--line-strong) transparent; scrollbar-width: thin; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.15; }
p { margin: 0; }
kbd {
  font: 500 10.5px var(--font-mono); padding: 1px 6px; border-radius: 6px;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  box-shadow: inset 0 -1px 0 var(--line);
}

/* ---------- 3. UTILITIES ------------------------------------------------- */
.mono { font-family: var(--font-mono); }
.serif { font-family: var(--font-serif); font-weight: 400; }
.display { font-family: var(--font-display); }
.muted { color: var(--muted); } .faint { color: var(--faint); } .accent { color: var(--accent); }
.xs { font-size: 11px; } .sm { font-size: 12.5px; } .lg { font-size: 16px; }
.upper { text-transform: uppercase; letter-spacing: .14em; }
.center { text-align: center; }
.hidden { display: none !important; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; } .row.between { justify-content: space-between; } .row.center { justify-content: center; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grow { flex: 1 1 auto; min-width: 0; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 190px), 1fr)); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.dot.pulse { animation: pulse 2.6s ease-in-out infinite; }
.divider { height: 1px; background: var(--line); border: 0; margin: 0; }

/* Layout & Utility Helpers */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-row { flex-direction: row; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.relative { position: relative; }
.absolute { position: absolute; }
.inset-0 { inset: 0; }
.w-full { width: 100%; }
.h-full { height: 100%; }
.w-4 { width: 16px; } .h-4 { height: 16px; }
.w-6 { width: 24px; } .h-6 { height: 24px; }
.w-7 { width: 28px; } .h-7 { height: 28px; }
.w-10 { width: 40px; } .h-10 { height: 40px; }
.rounded { border-radius: var(--r-sm); }
.rounded-xl { border-radius: var(--r); }
.rounded-full { border-radius: 9999px; }
.object-contain { object-fit: contain; }
.object-cover { object-fit: cover; }
.max-w-2xl { max-width: 672px; }
.max-w-5xl { max-width: 1024px; }
.mx-auto { margin-left: auto; margin-right: auto; }
.px-4 { padding-left: 16px; padding-right: 16px; }
.pb-24 { padding-bottom: 96px; }
.p-2 { padding: 8px; } .p-3 { padding: 12px; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; } .gap-6 { gap: 24px; }
.text-center { text-align: center; }
.shrink-0 { flex-shrink: 0; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.font-extrabold { font-weight: 800; }
.tracking-wider { letter-spacing: 0.05em; }
.overflow-hidden { overflow: hidden; }
.pointer-events-none { pointer-events: none; }
.opacity-40 { opacity: 0.4; }
.select-none { user-select: none; }

.dot-swatch {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
  border: 1px solid rgba(0,0,0,0.25);
  transition: transform 0.25s var(--ease);
}

.btn svg, [data-icon] svg, .dock-content svg, .nav-pill svg {
  width: 16px;
  height: 16px;
  display: block;
}
.btn.sm svg { width: 14px; height: 14px; }

/* ---------- 4. SURFACES -------------------------------------------------- */
.card {
  position: relative; isolation: isolate;
  background: var(--elevated);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow), inset 0 1px 0 var(--hi);
  transition: border-color .3s ease, background-color .5s var(--ease), box-shadow .35s ease;
}
.card.pad { padding: clamp(18px, 3.2vw, 32px); }
.card.spot::before { /* cursor spotlight, driven by --mx/--my from JS */
  content: ""; position: absolute; inset: 0; border-radius: inherit; z-index: -1; pointer-events: none;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), var(--spot), transparent 45%);
  opacity: 0; transition: opacity .4s ease;
}
.card.spot:hover::before { opacity: 1; }
.card.spot:hover { border-color: var(--line-strong); }

.well {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, .14);
}
.tile { /* clickable sub-card */
  display: flex; flex-direction: column; gap: 10px;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--r);
  padding: 16px; box-shadow: inset 0 1px 0 var(--hi);
  transition: transform .3s var(--ease), border-color .25s ease, box-shadow .3s ease, background-color .5s ease;
}
.tile.hover:hover, a.tile:hover, button.tile:hover {
  transform: translateY(-3px); border-color: var(--line-strong);
  box-shadow: 0 14px 28px -12px rgba(0, 0, 0, .3), inset 0 1px 0 var(--hi);
  will-change: transform;
}
.tile:active { transform: translateY(-1px) scale(.99); }

.section-head { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; margin-bottom: 22px; }
.section-head h2 { font-family: var(--font-serif); font-weight: 400; font-size: clamp(26px, 4vw, 36px); letter-spacing: -.01em; }
.eyebrow { font: 600 11px var(--font-mono); letter-spacing: .16em; text-transform: uppercase; color: var(--accent); }

/* ---------- 5. CONTROLS -------------------------------------------------- */
.btn {
  --h: 34px;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: var(--h); padding: 0 14px; border-radius: var(--r-full);
  font: 500 12px var(--font-mono); white-space: nowrap; user-select: none;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 var(--hi);
  transition: transform .15s var(--ease), background-color .2s ease, border-color .2s ease, color .2s ease, opacity .2s;
}
.btn:hover { border-color: var(--line-strong); }
.btn:active { transform: scale(.96); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.btn.primary { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--muted); }
.btn.ghost:hover { color: var(--ink); background: var(--surface); }
.btn.sm { --h: 28px; padding: 0 10px; font-size: 11px; }
.btn.lg { --h: 42px; padding: 0 20px; font-size: 13px; }
.btn.icon { width: var(--h); padding: 0; }
.btn svg { width: 15px; height: 15px; flex-shrink: 0; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 11px; border-radius: var(--r-full);
  font: 500 11px var(--font-mono); color: var(--muted);
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, .12);
}
.chip strong { color: var(--ink); font-weight: 600; }
.badge { font: 700 9.5px var(--font-mono); letter-spacing: .06em; padding: 2px 6px; border-radius: 6px; background: var(--accent); color: var(--on-accent); text-transform: uppercase; }

/* segmented control — set aria-pressed="true" / .on on the active button */
.seg {
  position: relative; display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px;
  border-radius: var(--r-full); background: var(--surface); border: 1px solid var(--line);
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, .14);
}
.seg > button {
  height: 28px; padding: 0 12px; border-radius: var(--r-full);
  font: 500 11.5px var(--font-mono); color: var(--muted);
  transition: color .2s ease, background-color .25s var(--ease), box-shadow .25s ease;
}
.seg > button:hover { color: var(--ink); }
.seg > button.on, .seg > button[aria-pressed="true"] {
  background: var(--elevated); color: var(--ink);
  box-shadow: 0 2px 6px -2px rgba(0, 0, 0, .25), inset 0 1px 0 var(--hi);
}

.input, .select, .textarea {
  width: 100%; min-height: 34px; padding: 7px 14px;
  border-radius: var(--r-full); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink);
  font: 400 12.5px var(--font-mono);
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, .12);
  transition: border-color .2s ease, box-shadow .2s ease;
}
.textarea { border-radius: var(--r); min-height: 120px; resize: vertical; line-height: 1.5; }
.select { appearance: none; padding-right: 30px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 16px) 52%, calc(100% - 11px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--line-strong); box-shadow: inset 0 2px 5px rgba(0,0,0,.12), 0 0 0 3px var(--spot); }
label.field { display: flex; flex-direction: column; gap: 5px; font: 500 11px var(--font-mono); color: var(--muted); }
label.field > span.val { color: var(--ink); }

/* range slider */
input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 18px; background: transparent; cursor: pointer;
  --p: 50%;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 4px; border-radius: 4px;
  background: linear-gradient(to right, var(--accent) var(--p), var(--line) var(--p));
}
input[type="range"]::-moz-range-track { height: 4px; border-radius: 4px; background: var(--line); }
input[type="range"]::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--accent); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px; margin-top: -5px; border-radius: 50%;
  background: var(--ink); border: 2px solid var(--elevated); box-shadow: 0 1px 4px rgba(0,0,0,.35);
  transition: transform .15s var(--ease);
}
input[type="range"]::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--ink); border: 2px solid var(--elevated); }
input[type="range"]:hover::-webkit-slider-thumb { transform: scale(1.25); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 15px; height: 15px; }

/* switch: <button class="switch" role="switch" aria-checked="true"> */
.switch { position: relative; width: 34px; height: 20px; border-radius: 20px; background: var(--line); border: 1px solid var(--line); transition: background-color .25s ease; flex-shrink: 0; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--elevated); box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .3s var(--ease-spring); }
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"]::after { transform: translateX(14px); }

/* file dropzone: <label class="dropzone"><input type="file" hidden> ... </label> */
.dropzone {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  min-height: 180px; padding: 24px; text-align: center; cursor: pointer;
  border: 1.5px dashed var(--line-strong); border-radius: var(--r-lg);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  color: var(--muted); font: 500 12.5px var(--font-mono);
  transition: background-color .25s ease, transform .3s var(--ease), border-color .2s;
}
.dropzone:hover { background: var(--surface); }
.dropzone.drag { background: var(--spot); transform: scale(1.01); border-style: solid; }
.dropzone .big { font-size: 28px; color: var(--accent); transition: transform .4s var(--ease-spring); }
.dropzone:hover .big, .dropzone.drag .big { transform: translateY(-4px) scale(1.1); }

.progress { height: 6px; border-radius: 6px; background: var(--line); overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .2s ease; }
.progress.indeterminate > i { width: 35%; animation: indet 1.2s var(--ease) infinite; }

.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent); animation: spin .7s linear infinite; }

/* skeleton shimmer */
.skel { background: linear-gradient(90deg, var(--surface) 0%, var(--elevated) 50%, var(--surface) 100%); background-size: 200% 100%; animation: shimmer 1.4s ease-in-out infinite; border-radius: var(--r-sm); }

/* tooltip: data-tip="text" */
[data-tip] { position: relative; }
[data-tip]::after {
  content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 8px);
  transform: translate(-50%, 4px); pointer-events: none; opacity: 0; z-index: 80;
  padding: 4px 8px; border-radius: 8px; white-space: nowrap;
  font: 500 10.5px var(--font-mono); color: var(--bg); background: var(--ink);
  transition: opacity .18s ease, transform .25s var(--ease);
}
[data-tip]:hover::after, [data-tip]:focus-visible::after { opacity: 1; transform: translate(-50%, 0); transition-delay: .35s; }
[data-tip-pos="bottom"]::after { bottom: auto; top: calc(100% + 8px); transform: translate(-50%, -4px); }

/* ---------- 6. TOOL / DEMO LAYOUT --------------------------------------- */
.view-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.view-head h1 { font-family: var(--font-serif); font-weight: 400; font-size: clamp(28px, 4.5vw, 42px); letter-spacing: -.01em; }
.crumbs { display: flex; align-items: center; gap: 6px; font: 500 11.5px var(--font-mono); color: var(--faint); }
.crumbs a:hover { color: var(--accent); }
.workbench { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr) 300px; align-items: start; }
@media (max-width: 900px) { .workbench { grid-template-columns: 1fr; } }
.panel { display: flex; flex-direction: column; gap: 14px; padding: 18px; }
.panel h3 { font: 600 11px var(--font-mono); text-transform: uppercase; letter-spacing: .14em; color: var(--accent); }
.stage {
  position: relative; display: grid; place-items: center; min-height: 320px; overflow: hidden;
  border-radius: var(--r); background: var(--surface);
  background-image: linear-gradient(45deg, var(--line) 25%, transparent 25%), linear-gradient(-45deg, var(--line) 25%, transparent 25%), linear-gradient(45deg, transparent 75%, var(--line) 75%), linear-gradient(-45deg, transparent 75%, var(--line) 75%);
  background-size: 18px 18px; background-position: 0 0, 0 9px, 9px -9px, -9px 0;
}
.stage.plain { background-image: none; }
.stage canvas, .stage video, .stage img { max-height: 70vh; object-fit: contain; }

/* ---------- 7. OVERLAYS -------------------------------------------------- */
.modal {
  position: fixed; inset: 0; z-index: 100000; display: grid; place-items: center; padding: 16px;
  background: rgba(0, 0, 0, .6); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  opacity: 0; visibility: hidden; transition: opacity .25s ease, visibility 0s linear .25s;
}
.modal.open { opacity: 1; visibility: visible; transition: opacity .25s ease; }
.modal > .card { width: min(100%, 560px); max-height: calc(100dvh - 32px); overflow: auto; transform: translateY(14px) scale(.97); opacity: 0; transition: transform .4s var(--ease), opacity .3s ease; }
.modal.open > .card { transform: none; opacity: 1; }
.modal.top { place-items: start center; padding-top: 12vh; }

.toast-host { position: fixed; left: 50%; bottom: calc(var(--dock-h) + 20px); transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: var(--r-full);
  background: var(--ink); color: var(--bg);
  font: 500 12px var(--font-mono); box-shadow: 0 10px 30px -8px rgba(0,0,0,.45);
  animation: toastIn .4s var(--ease-spring) both;
}
.toast.out { animation: toastOut .3s var(--ease) both; }
.toast .t-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

/* ---------- 8. MOTION ---------------------------------------------------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s var(--ease), transform .8s var(--ease); transition-delay: calc(var(--i, 0) * 45ms); }
.reveal.in { opacity: 1; transform: none; }
.pop-in { animation: popIn .3s var(--ease) backwards; animation-delay: calc(min(var(--i, 0), 8) * 20ms); }
.view-enter { animation: viewIn .45s var(--ease) both; }

@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .35; transform: scale(.85); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes indet { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }
@keyframes popIn { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes viewIn { from { opacity: 0; transform: translateY(10px); filter: blur(4px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px) scale(.95); } }
@keyframes eq { 0%, 100% { transform: scaleY(.3); } 50% { transform: scaleY(1); } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes musicNod {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-2.5px) scale(1.02); }
}

.music-vibing {
  animation: musicNod var(--music-beat-dur, 0.48s) cubic-bezier(0.25, 1, 0.5, 1) 4 !important;
  will-change: transform;
}

/* Theme switch: circular reveal via View Transitions API */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-new(root) { clip-path: circle(0 at var(--vt-x, 50%) var(--vt-y, 0)); animation: vtReveal .65s var(--ease) forwards; }
@keyframes vtReveal { to { clip-path: circle(var(--vt-r, 150vmax) at var(--vt-x, 50%) var(--vt-y, 0)); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}
html.reduce-motion *, html.reduce-motion *::before, html.reduce-motion *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
html.reduce-motion .reveal { opacity: 1; transform: none; }

/* Repository Workspace Page & Markdown */
.repo-page-wrap {
  animation: enter 0.28s var(--ease-spring);
}

.repo-header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
}

.repo-header-main {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  flex: 1 1 480px;
  min-width: 0;
}

.repo-avatar-box {
  width: 54px;
  height: 54px;
  min-width: 54px;
  max-width: 54px;
  min-height: 54px;
  max-height: 54px;
  border-radius: 12px;
  background: var(--surface);
  border: 1.5px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.repo-avatar-box img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.repo-avatar-box svg {
  width: 28px;
  height: 28px;
}

.repo-header-text {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1 1 0;
  min-width: 0;
}

.repo-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.repo-title {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: clamp(20px, 3vw, 26px);
  color: var(--ink);
  letter-spacing: -0.03em;
  margin: 0;
  line-height: 1.2;
}

.repo-desc {
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.5;
  margin: 2px 0 4px;
  max-width: 65ch;
}

.repo-meta-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}

.repo-header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.repo-demo-banner {
  margin-top: 18px;
  background: var(--elevated);
  border: 1.5px solid var(--accent);
  border-radius: var(--r);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  padding: 14px 18px;
  box-shadow: 0 4px 16px -4px rgba(0,0,0,0.15);
}

#appMain {
  padding-bottom: 120px !important;
}

/* Core Utility Classes */
.w-full { width: 100%; }
.h-full { height: 100%; }
.w-4 { width: 16px; }
.h-4 { height: 16px; }
.w-8 { width: 32px; }
.h-8 { height: 32px; }
.w-10 { width: 40px; }
.h-10 { height: 40px; }
.w-12 { width: 48px; }
.h-12 { height: 48px; }
.w-16 { width: 64px; }
.h-16 { height: 64px; }
.flex-1 { flex: 1 1 0%; }
.min-w-0 { min-width: 0; }
.max-w-md { max-width: 28rem; }
.max-w-lg { max-width: 32rem; }
.max-w-xl { max-width: 36rem; }
.items-start { align-items: flex-start; }
.items-center { align-items: center; }
.items-end { align-items: flex-end; }
.justify-start { justify-content: flex-start; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.justify-between { justify-content: space-between; }
.text-2xl { font-size: 1.5rem; line-height: 2rem; }
.text-xl { font-size: 1.25rem; line-height: 1.75rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.text-base { font-size: 1rem; line-height: 1.5rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-xs { font-size: 0.75rem; line-height: 1rem; }
.text-paper-ink { color: var(--ink); }
.text-paper-muted { color: var(--muted); }
.bg-paper-surface { background-color: var(--surface); }
.bg-paper-elevated { background-color: var(--elevated); }
.border-paper-line { border-color: var(--line); }
.rounded-sm { border-radius: var(--r-sm); }
.rounded-md { border-radius: var(--r); }
.rounded-lg { border-radius: var(--r-lg); }
.rounded-full { border-radius: 9999px; }
.terminal-bar {
  font-family: var(--font-mono);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}
.readme-body {
  line-height: 1.65;
  color: var(--ink);
  overflow-wrap: break-word;
}
.readme-body h1, .readme-body h2, .readme-body h3, .readme-body h4 {
  font-family: var(--font-serif);
  color: var(--ink);
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  line-height: 1.25;
}
.readme-body h1 { font-size: 26px; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.readme-body h2 { font-size: 21px; border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.readme-body h3 { font-size: 18px; }
.readme-body p { margin: 0.8em 0; font-size: 14px; }
.readme-body ul, .readme-body ol { margin: 0.8em 0; padding-left: 24px; }
.readme-body li { margin: 0.3em 0; font-size: 13.5px; }
.readme-body blockquote {
  border-left: 3px solid var(--accent);
  padding: 4px 14px;
  margin: 1em 0;
  color: var(--muted);
  background: var(--surface);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  font-style: italic;
}
.readme-body code.mono-inline {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--accent);
}
.code-block {
  position: relative;
  background: #111116;
  color: #ECECF1;
  padding: 14px 16px;
  border-radius: var(--r);
  border: 1px solid var(--line-strong);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.5;
  margin: 1em 0;
}
.code-block::before {
  content: attr(data-lang);
  position: absolute;
  top: 6px;
  right: 12px;
  font-size: 10px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ---------------- 5Tube Multiplayer Theater ---------------- */
.fivetube-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 1280px;
  margin: 0 auto;
  padding-bottom: 40px;
  animation: enter 0.28s var(--ease-spring);
}

.fivetube-header {
  padding: 8px 14px;
  background: var(--elevated);
  border: 1px solid var(--line);
  border-radius: var(--r-full);
  box-shadow: 0 4px 14px -4px rgba(0,0,0,0.12), inset 0 1px 0 var(--hi);
}

.fivetube-badge-red {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  background: #FF0000;
  color: #FFFFFF;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 13px;
  box-shadow: 0 2px 8px rgba(255,0,0,0.4);
}

.party-pill {
  padding: 3px 10px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-full);
  gap: 6px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10B981;
  box-shadow: 0 0 8px #10B981;
}

.fivetube-stage-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
  align-items: start;
}

@media (max-width: 960px) {
  .fivetube-stage-layout {
    grid-template-columns: 1fr;
  }
}

.fivetube-player-column {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.fivetube-theater-box {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000000;
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: 0 12px 36px -8px rgba(0,0,0,0.35);
  transition: all 0.35s var(--ease-spring);
}

.fivetube-player-mount {
  width: 100%;
  height: 100%;
}

.fivetube-player-mount iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.fivetube-cursor-canvas {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

.fivetube-floating-chat {
  position: absolute;
  top: 50px;
  left: 14px;
  max-width: 290px;
  width: calc(100% - 28px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  z-index: 100005;
}

.floating-chat-bubble {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(12, 14, 18, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-left: 3px solid var(--bubble-color, #FF3B14);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 11.5px;
  line-height: 1.4;
  font-family: var(--font-mono);
  color: #F8FAFC;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45), 0 2px 6px rgba(0, 0, 0, 0.3);
  animation: discordSlideIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  pointer-events: auto;
  max-width: 100%;
  word-break: break-word;
  transition: opacity 0.25s ease, transform 0.25s ease, border-color 0.2s ease, background 0.2s ease;
}

.floating-chat-bubble:hover,
.floating-chat-bubble:focus-within {
  background: rgba(12, 14, 18, 0.94);
  border-color: rgba(255, 255, 255, 0.24);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
}

.floating-chat-header {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  width: 100%;
}

.floating-chat-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 5px;
  background: var(--bubble-color, #FF3B14);
  box-shadow: 0 0 6px var(--bubble-color, #FF3B14);
}

.floating-chat-body {
  min-width: 0;
  flex: 1;
}

.floating-chat-user {
  color: #FFFFFF;
  font-weight: 700;
  margin-right: 5px;
}

.floating-chat-text {
  color: #E2E8F0;
}

/* Micro Quick-Reply Form */
.theater-quick-reply-form {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  padding: 2px 4px 2px 8px;
  height: 27px;
  width: 100%;
  transition: all 0.18s ease;
  pointer-events: auto;
}

.theater-quick-reply-form:focus-within {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--accent, #FF3B14);
  box-shadow: 0 0 0 1px var(--accent, #FF3B14);
}

.theater-quick-reply-input {
  background: transparent !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin: 0 !important;
  font-family: var(--font-mono) !important;
  font-size: 11px !important;
  color: #FFFFFF !important;
  flex: 1 !important;
  min-width: 0 !important;
  height: 100% !important;
  line-height: normal !important;
}

.theater-quick-reply-input::placeholder {
  color: rgba(255, 255, 255, 0.42);
  font-size: 10.5px;
}

.theater-quick-reply-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  min-width: 20px;
  border-radius: 4px;
  border: none;
  background: var(--accent, #FF3B14);
  color: #FFFFFF;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.theater-quick-reply-btn:hover {
  filter: brightness(1.15);
  transform: scale(1.06);
}

.theater-quick-reply-btn:active {
  transform: scale(0.95);
}

.theater-quick-reply-btn svg {
  width: 11px !important;
  height: 11px !important;
  stroke-width: 2 !important;
  pointer-events: none;
}

.floating-chat-bubble.fading-out {
  animation: discordSlideOut 0.28s ease forwards;
}

@keyframes discordSlideIn {
  from {
    opacity: 0;
    transform: translateX(-14px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes discordSlideOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(-10px) scale(0.95);
  }
}

/* Floating Theater Controls Mini HUD */
.theater-controls-hud {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 100020;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  background: rgba(14, 16, 20, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 9999px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.theater-controls-hud.hud-active,
.theater-controls-hud:hover,
.theater-controls-hud:focus-within {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* Top and Edge Hover Sensors for Theater Mode (Stops iframe from swallowing pointer events) */
.theater-top-sensor {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 68px;
  z-index: 100008;
  pointer-events: auto;
  background: transparent;
}

body.theater-mode .theater-top-sensor {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  height: 68px !important;
  z-index: 100008 !important;
}

.theater-side-sensor-left,
.theater-side-sensor-right {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 18px;
  z-index: 100008;
  pointer-events: auto;
  background: transparent;
}
.theater-side-sensor-left { left: 0; }
.theater-side-sensor-right { right: 0; }

body.theater-mode .theater-side-sensor-left,
body.theater-mode .theater-side-sensor-right {
  position: fixed !important;
  top: 0 !important;
  bottom: 0 !important;
  width: 20px !important;
  z-index: 100008 !important;
}

/* Persistent Micro-Hint Badge (Always accessible, breaks iframe focus trap) */
.hud-persistent-hint {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100009;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  background: rgba(12, 14, 18, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 9999px;
  color: rgba(255, 255, 255, 0.65);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.3px;
  cursor: pointer;
  user-select: none;
  opacity: 0.4;
  transition: opacity 0.25s ease, transform 0.25s ease, background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
  pointer-events: auto;
}

body.theater-mode .hud-persistent-hint {
  position: fixed !important;
  top: 12px !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
}

.hud-persistent-hint:hover,
.hud-persistent-hint:focus,
.hud-persistent-hint.is-active {
  opacity: 0.95 !important;
  background: rgba(12, 14, 18, 0.88) !important;
  border-color: rgba(255, 255, 255, 0.28) !important;
  color: #FFFFFF !important;
  transform: translateX(-50%) scale(1.02) !important;
}

.hint-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent, #FF3B14);
  box-shadow: 0 0 6px var(--accent, #FF3B14);
  flex-shrink: 0;
}

.hud-micro-btn {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: #FFFFFF;
  cursor: pointer;
  padding: 0;
  transition: background 0.18s ease, transform 0.18s ease, opacity 0.18s ease;
}

.hud-micro-btn svg {
  width: 14px;
  height: 14px;
}

.hud-micro-btn:hover {
  background: rgba(255, 255, 255, 0.24);
  transform: scale(1.08);
}

.hud-micro-btn.hud-exit-accent:hover {
  background: rgba(255, 59, 20, 0.88);
  color: #FFFFFF;
}

.hud-micro-btn.is-muted {
  opacity: 0.42;
  background: rgba(255, 255, 255, 0.04);
}

.hud-micro-btn.is-muted svg {
  stroke-dasharray: 2 2;
}

.hud-exit-btn {
  display: none;
}

.resync-pill {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 30;
  background: rgba(239, 68, 68, 0.9);
  color: #FFFFFF;
  padding: 4px 10px;
  border-radius: var(--r-full);
  font-size: 11px;
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

/* Sidebar & Chat */
.fivetube-sidebar {
  display: flex;
  flex-direction: column;
  height: 540px;
  max-height: 75vh;
  border-radius: var(--r);
  overflow: hidden;
}

.fivetube-tabs {
  background: var(--surface);
}

.fivetube-tab {
  padding: 10px 8px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.fivetube-tab:hover {
  color: var(--ink);
}

.fivetube-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: var(--elevated);
}

.tube-chat-log {
  padding: 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tube-chat-msg {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
}

.chat-badge {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font-mono);
  flex-shrink: 0;
}

/* Theater Mode Styles: Topbar disappears, distractions vanish! */
body.theater-mode #topbar,
body.theater-mode footer,
body.theater-mode .fivetube-header,
body.theater-mode .view-head,
body.theater-mode #musicDock {
  display: none !important;
}

body.theater-mode main,
body.theater-mode #subViewContainer,
body.theater-mode #subViewMount {
  animation: none !important;
  transform: none !important;
  filter: none !important;
  contain: none !important;
  max-width: 100vw !important;
  padding: 0 !important;
  margin: 0 !important;
}

body.theater-mode .fivetube-container {
  max-width: 100vw !important;
  margin: 0 !important;
  padding: 0 !important;
}

body.theater-mode .fivetube-theater-box.theater-fullscreen {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 100000 !important;
  aspect-ratio: auto !important;
  border-radius: 0 !important;
  border: none !important;
  background: #000000 !important;
}

body.theater-mode .theater-controls-hud {
  z-index: 100020 !important;
  top: 18px !important;
  right: 18px !important;
}

body.theater-mode .fivetube-cursor-canvas {
  z-index: 100002 !important;
}

body.theater-mode .fivetube-floating-chat {
  z-index: 100005 !important;
}

/* ---------------- 5Tube Comments System ---------------- */
.tube-comments-wrap {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.tube-sync-scroll-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 11px;
  gap: 8px;
}

.sync-scroll-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 9999px;
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--elevated);
  color: var(--ink);
  transition: all 0.2s ease;
}

.sync-scroll-pill.active {
  background: #10B981;
  color: #FFFFFF;
  border-color: #10B981;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}

.sync-scroll-pill svg {
  width: 12px;
  height: 12px;
}

.tube-comments-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

.comment-card {
  padding: 9px 12px;
  background: var(--elevated);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: background 0.15s, border-color 0.15s;
}

.comment-card:hover {
  border-color: var(--hi);
}

.comment-card.is-synced {
  border-left: 3px solid #10B981;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.08) 0%, var(--elevated) 100%);
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.08);
}

.comment-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 11px;
}

.comment-author-box {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.comment-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 10px;
  color: #FFFFFF;
  flex-shrink: 0;
}

.comment-synced-badge {
  font-size: 9px;
  font-family: var(--font-mono);
  padding: 1px 6px;
  border-radius: 9999px;
  background: rgba(16, 185, 129, 0.18);
  color: #10B981;
  border: 1px solid rgba(16, 185, 129, 0.45);
  font-weight: 700;
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.comment-text {
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink);
  word-break: break-word;
  user-select: text !important;
  -webkit-user-select: text !important;
}

.comment-reactions-bar {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
  flex-wrap: wrap;
}

.reaction-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 10.5px;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: all 0.15s ease;
}

.reaction-btn:hover {
  background: var(--elevated);
  color: var(--ink);
  border-color: var(--hi);
  transform: translateY(-1px);
}

.reaction-btn svg {
  width: 12px;
  height: 12px;
}

.reaction-btn.reacted {
  background: rgba(255, 59, 20, 0.14);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
}

.reaction-btn.bounce {
  animation: reactionBounce 0.3s ease;
}

@keyframes reactionBounce {
  0% { transform: scale(1); }
  50% { transform: scale(1.25); }
  100% { transform: scale(1); }
}

.fake-comment-form {
  padding: 10px;
  border-top: 1px solid var(--line);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ---------------- Synced Doomscroll Mode ---------------- */
body.doomscroll-active #topbar,
body.doomscroll-active #mobileHeader,
body.doomscroll-active #mobileBottomNav,
body.doomscroll-active footer,
body.doomscroll-active #musicDock {
  display: none !important;
}

body.doomscroll-active main,
body.doomscroll-active #subViewContainer,
body.doomscroll-active #subViewMount {
  animation: none !important;
  transform: none !important;
  filter: none !important;
  contain: none !important;
  padding: 0 !important;
  margin: 0 !important;
  max-width: 100vw !important;
}

body.in-fivetube #musicDock {
  display: none !important;
}

.fivetube-doomscroll-overlay {
  position: fixed;
  inset: 0;
  z-index: 100020;
  background: #000000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  animation: enter 0.2s ease-out;
}

.doomscroll-stage-wrap {
  position: relative;
  width: 100%;
  max-width: 440px;
  height: 100%;
  max-height: 880px;
  aspect-ratio: 9 / 16;
  background: #08090C;
  display: flex;
  flex-direction: column;
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.9);
}

.doomscroll-player-mount {
  width: 100%;
  height: 100%;
  position: relative;
}

.doomscroll-player-mount iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.doomscroll-side-rail {
  position: absolute;
  right: 12px;
  bottom: 84px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  z-index: 100030;
}

.doomscroll-rail-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(18, 20, 26, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
  padding: 0;
}

.doomscroll-rail-btn:hover {
  transform: scale(1.1);
  background: rgba(255, 59, 20, 0.85);
}

.doomscroll-rail-btn svg {
  width: 18px;
  height: 18px;
}

.doomscroll-top-bar {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 100030;
  pointer-events: none;
}

.doomscroll-top-bar > * {
  pointer-events: auto;
}

.doomscroll-bottom-info {
  position: absolute;
  left: 14px;
  bottom: 22px;
  right: 64px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 4px;
  pointer-events: none;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.85);
}

.floating-reaction-particle {
  position: absolute;
  bottom: 110px;
  right: 22px;
  pointer-events: none;
  z-index: 35;
  animation: floatUpBurst 1.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.floating-reaction-particle svg {
  width: 26px;
  height: 26px;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.6));
}

@keyframes floatUpBurst {
  0% {
    opacity: 1;
    transform: translateY(0) scale(0.6) rotate(0deg);
  }
  50% {
    transform: translateY(-90px) scale(1.25) rotate(18deg);
  }
  100% {
    opacity: 0;
    transform: translateY(-180px) scale(0.9) rotate(-18deg);
  }
}

/* Doomscroll Top Sensor & Hint */
#doomscrollTopSensor {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 68px;
  z-index: 100028;
  pointer-events: auto;
  background: transparent;
}

#doomscrollPersistentHint {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100029;
}

/* Shorts Niche Launcher & Search Modal */
#doomscrollNicheModal {
  z-index: 100050 !important;
}

.doomscroll-niche-card {
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
  border: 1px solid var(--line-strong);
}

.search-icon-svg,
.search-box svg {
  width: 14px !important;
  height: 14px !important;
  max-width: 14px !important;
  max-height: 14px !important;
  min-width: 14px !important;
  min-height: 14px !important;
  flex-shrink: 0 !important;
  display: block;
}

.shorts-search-btn {
  height: 32px !important;
  padding: 0 12px !important;
  font-size: 11.5px !important;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  flex-shrink: 0;
  white-space: nowrap;
  border-radius: var(--r-sm);
  transition: all 0.18s ease;
}
.shorts-search-btn svg {
  width: 14px;
  height: 14px;
}
@media (max-width: 480px) {
  .shorts-search-btn {
    padding: 0 8px !important;
    font-size: 11px !important;
    gap: 4px;
  }
}

.doomscroll-niche-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
@media (max-width: 480px) {
  .doomscroll-niche-grid {
    grid-template-columns: 1fr;
  }
}

.niche-card-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  cursor: pointer;
  text-align: left;
  transition: all 0.18s ease;
  width: 100%;
}
.niche-card-btn:hover {
  background: var(--elevated);
  border-color: var(--accent);
  transform: translateY(-1px);
}
.niche-card-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 59, 20, 0.1);
  color: var(--accent);
  flex-shrink: 0;
  transition: background 0.18s ease, color 0.18s ease;
}
.niche-card-btn:hover .niche-card-icon {
  background: var(--accent);
  color: #FFFFFF;
}
.niche-card-icon svg {
  width: 16px;
  height: 16px;
}
.niche-card-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.niche-card-title {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 12px;
  color: var(--ink);
}
.niche-card-desc {
  font-size: 10.5px;
  color: var(--faint);
  line-height: 1.25;
  margin-top: 2px;
}

/* Mobile & Tablet Responsive Adjustments */
@media (max-width: 640px) {
  .fivetube-header {
    padding: 8px 10px;
    border-radius: var(--r-md);
    gap: 8px;
  }
  .fivetube-header .search-box {
    width: 100%;
    margin: 4px 0;
  }
  #theaterBtnText, #doomscrollToggleBtn .mono, #downloadModalBtn .mono {
    display: none !important;
  }
  #doomscrollToggleBtn, #theaterToggleBtn, #downloadModalBtn {
    padding: 0 8px;
    height: 30px;
  }
  .theater-controls-hud {
    top: 10px !important;
    right: 10px !important;
    padding: 3px 5px;
    gap: 4px;
  }
  .hud-micro-btn {
    width: 36px;
    height: 36px;
  }
  .hud-micro-btn svg {
    width: 16px;
    height: 16px;
  }
  .fivetube-floating-chat {
    top: 48px;
    left: 8px;
    max-width: 240px;
    width: calc(100% - 16px);
  }
  .floating-chat-bubble {
    font-size: 10.5px;
    padding: 6px 8px;
    gap: 5px;
  }
  .theater-quick-reply-form {
    height: 25px;
    padding: 2px 4px 2px 6px;
  }
  .theater-quick-reply-input {
    font-size: 10px !important;
  }
  .theater-quick-reply-input::placeholder {
    font-size: 9.5px;
  }
  .theater-quick-reply-btn {
    width: 18px;
    height: 18px;
    min-width: 18px;
  }
  .theater-quick-reply-btn svg {
    width: 10px !important;
    height: 10px !important;
  }
  .doomscroll-stage-wrap {
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
  }
  .doomscroll-side-rail {
    right: 10px;
    bottom: 74px;
    gap: 10px;
  }
  .doomscroll-rail-btn {
    width: 44px;
    height: 44px;
  }
}

/* Global Text Selection Shield */
*, *::before, *::after {
  user-select: none;
  -webkit-user-select: none;
}

input, textarea, [contenteditable="true"],
.select-text, .readme-body, .readme-body *,
pre, code, .code-block, .code-block *,
.terminal-bar, .terminal-bar *,
.tube-chat-msg, .tm-screen, .tm-screen * {
  user-select: text !important;
  -webkit-user-select: text !important;
}

/* Custom Context Menu — Instant 0ms response */
.context-menu {
  position: fixed;
  z-index: 100000;
  width: 220px;
  background: var(--elevated);
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  padding: 6px;
  box-shadow: 0 10px 28px -4px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.context-menu.hidden {
  display: none !important;
}

.context-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.context-menu-item:hover {
  background: var(--surface);
  color: var(--accent);
}

.context-icon {
  width: 16px;
  text-align: center;
  font-size: 13px;
  flex-shrink: 0;
}

.context-kbd {
  margin-left: auto;
  font-size: 9.5px;
  color: var(--faint);
  background: var(--surface);
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid var(--line);
}

.context-menu-divider {
  height: 1px;
  background: var(--line);
  margin: 3px 0;
}

/* Responsive Topbar & Mobile Polish */
@media (max-width: 860px) {
  #topbar {
    padding: 0 8px;
    margin: 8px auto 14px;
    top: 6px;
  }
  .topbar-bar {
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
  }
  #overviewCard {
    display: none !important;
  }
}

/* Desktop Only Elements */
@media (min-width: 641px) {
  .mobile-topbar { display: none !important; }
  #mobileBottomNav { display: none !important; }
  #mobileDrawerModal { display: none !important; }
}

/* Dedicated Mobile App Experience (<= 640px) */
@media (max-width: 640px) {
  /* Dedicated Mobile Topbar */
  .desktop-topbar { display: none !important; }
  #overviewCard { display: none !important; }

  #topbar {
    padding: 0 10px;
    margin: 6px auto 10px;
    top: 4px;
    width: 100%;
  }

  .mobile-topbar {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 44px;
    background: var(--elevated);
    border: 1px solid var(--line);
    border-radius: var(--r-full);
    padding: 0 14px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.18);
  }

  .mobile-logo-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent);
    display: inline-block;
  }

  /* Dedicated Mobile Bottom App Bar */
  #mobileBottomNav {
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--elevated);
    border-top: 1px solid var(--line);
    z-index: 9999;
    justify-content: space-around;
    align-items: center;
    padding-bottom: env(safe-area-inset-bottom, 0);
    box-shadow: 0 -4px 20px rgba(0,0,0,0.3);
  }

  .mob-tab-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    flex: 1;
    height: 100%;
    text-decoration: none;
    color: var(--faint);
    transition: color 0.15s ease, transform 0.15s ease;
  }
  .mob-tab-btn.active {
    color: var(--accent);
    font-weight: 700;
  }
  .mob-tab-btn:active {
    transform: scale(0.92);
  }
  .mob-tab-icon {
    width: 20px;
    height: 20px;
    display: block;
  }
  .mob-tab-label {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.4px;
    text-transform: uppercase;
  }

  /* Dedicated Mobile Mini-Player Music Dock (Pixel-Perfect Proportions) */
  #musicDock {
    position: fixed !important;
    bottom: 60px !important;
    left: 8px !important;
    right: 8px !important;
    width: auto !important;
    height: 48px !important;
    border-radius: var(--r-full) !important;
    padding: 0 10px !important;
    background: var(--elevated) !important;
    border: 1px solid var(--line-strong) !important;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5) !important;
    z-index: 9998 !important;
    display: flex !important;
    align-items: center !important;
  }

  #dockShuffleBtn, #dockStopBtn, #dockRepeatBtn, #dockVolSlider,
  #dockMuteBtn, #dockTimeCur, #dockTimeDur, #dockLiveAudioBtn, #dockTabAudioBtn, #dockPrevBtn {
    display: none !important;
  }

  #dockProgressTrack {
    position: absolute;
    top: 0;
    left: 16px;
    right: 16px;
    height: 2px;
    background: rgba(255,255,255,0.08);
    border-radius: 1px;
  }

  .dock-content {
    display: flex !important;
    width: 100% !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 8px !important;
  }

  .dock-thumb-box {
    width: 34px !important;
    height: 34px !important;
    border-radius: 50% !important;
    overflow: hidden !important;
    border: 1px solid var(--line) !important;
    flex-shrink: 0 !important;
  }

  #dockTitle {
    font-size: 11.5px !important;
    font-weight: 600 !important;
    color: var(--ink) !important;
    max-width: 120px !important;
    line-height: 1.2 !important;
  }
  #dockArtist {
    font-size: 10px !important;
    color: var(--faint) !important;
    max-width: 120px !important;
    margin-top: 1px !important;
  }

  #dockPlayBtn {
    width: 32px !important;
    height: 32px !important;
    border-radius: 50% !important;
    background: var(--accent) !important;
    color: var(--on-accent, #fff) !important;
    flex-shrink: 0 !important;
    padding: 0 !important;
  }
  #dockNextBtn, #dockQueueToggle {
    width: 28px !important;
    height: 28px !important;
    flex-shrink: 0 !important;
    padding: 0 !important;
  }

  #dockQueueDrawer {
    position: fixed !important;
    bottom: 116px !important;
    left: 8px !important;
    right: 8px !important;
    max-height: 52vh !important;
    border-radius: var(--r) !important;
    z-index: 9999 !important;
  }

  /* Dedicated Mobile Hero Card */
  #heroFieldCanvas {
    display: none !important; /* Save mobile battery & CPU */
  }

  .hero-avatar-box {
    width: 64px !important;
    height: 64px !important;
  }

  .display {
    font-size: 26px !important;
  }

  #appMain {
    padding-bottom: 120px !important; /* Space for mini player + bottom nav */
    padding-left: 10px !important;
    padding-right: 10px !important;
  }

  /* Hide verbose CLI clone string on small screens */
  .well.row.xs.mono {
    display: none !important;
  }

  /* Grids wrap to clean single column */
  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr !important;
  }

  .btn {
    white-space: normal;
    text-align: center;
    max-width: 100%;
    height: auto;
    min-height: 32px;
  }

  /* Full mobile touch cards */
  .card.pad {
    padding: 14px 12px !important;
  }

  /* Mobile Drawer Sheet */
  .mobile-drawer-sheet {
    max-width: 320px;
    width: 90%;
    margin: auto;
    border-radius: var(--r);
    background: var(--elevated);
    border: 1px solid var(--line-strong);
    padding: 16px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.55);
  }

  .mobile-drawer-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--r-sm);
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
    text-decoration: none;
    background: var(--surface);
    border: 1px solid var(--line);
    transition: background-color 0.15s ease, border-color 0.15s ease;
  }
  .mobile-drawer-link:hover, .mobile-drawer-link:active {
    background: var(--bg);
    border-color: var(--accent);
    color: var(--accent);
  }
}

/* Base button bounds */
.btn {
  max-width: 100%;
  box-sizing: border-box;
}

/* Off-screen rendering containment for silky smooth 60+ FPS scrolling */
#mediaGridContainer > *,
#demosDirectoryGrid > * {
  content-visibility: auto;
  contain-intrinsic-size: 0 160px;
}

/* Sawbyte uses its own Minecraft font and real block/item textures from GitHub. */
@font-face {
  font-family: MinecraftOfficial;
  src: url('../fonts/minecraft.ttf') format('truetype');
  font-display: swap;
}
.sawbyte-feature {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0 0 18px;
  padding: 16px;
  border: 4px solid #05080b;
  border-radius: 0;
  background-color: #151923;
  background-image: linear-gradient(90deg, rgba(8, 13, 19, .89), rgba(9, 16, 22, .76)),
    url('https://raw.githubusercontent.com/InventivetalentDev/minecraft-assets/1.21.4/assets/minecraft/textures/block/deepslate.png');
  background-size: auto, 32px 32px;
  box-shadow: inset 0 0 0 2px #56606e, 4px 5px 0 #090b0e;
  color: #fff;
  font-family: MinecraftOfficial, monospace;
  image-rendering: pixelated;
}
.sawbyte-mark {
  flex: 0 0 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border: 3px solid #080a0d;
  background: #20282d url('https://raw.githubusercontent.com/InventivetalentDev/minecraft-assets/1.21.4/assets/minecraft/textures/block/grass_block_side.png') center / 32px;
  box-shadow: inset 0 0 0 2px #748a70, 3px 3px 0 #050708;
}
.sawbyte-mark img { width: 44px; height: 44px; object-fit: contain; image-rendering: pixelated; filter: drop-shadow(2px 2px 0 #000); }
.sawbyte-copy { flex: 1; min-width: 0; }
.sawbyte-eyebrow { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; color: #a9e986; font-size: 10px; line-height: 1.4; text-shadow: 2px 2px #1a3b20; }
.sawbyte-eyebrow img, .sawbyte-enter img { width: 16px; height: 16px; object-fit: contain; image-rendering: pixelated; }
.sawbyte-copy h3 { margin: 3px 0 5px; color: #55ffff; font: 400 24px/1 MinecraftOfficial, monospace; text-shadow: 3px 3px #153f3f; }
.sawbyte-copy p { margin: 0; color: #eee; font: 400 12px/1.45 MinecraftOfficial, monospace; text-shadow: 2px 2px #222; }
.sawbyte-enter {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 45px;
  padding: 9px 12px;
  border: 3px solid #0a0d0d;
  border-radius: 0;
  background: #337045;
  box-shadow: inset 2px 2px #82bb7d, inset -2px -2px #164729, 3px 3px #050708;
  color: #fff;
  font: 400 12px MinecraftOfficial, monospace;
  text-shadow: 2px 2px #16351d;
  text-decoration: none;
  white-space: nowrap;
}
.sawbyte-enter:hover, .sawbyte-enter:focus-visible { background: #479557; color: #fff; outline: 2px solid #55ffff; outline-offset: 2px; }
.repo-compact-card { display: flex; flex-direction: column; gap: 7px; padding: 14px; min-width: 0; }
.repo-compact-top, .repo-compact-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.repo-compact-lang { display: inline-flex; align-items: center; gap: 5px; font: 11px var(--font-mono); color: var(--faint); }
.repo-compact-card h3 { margin: 0; color: var(--ink); font-size: 14px; overflow-wrap: anywhere; }
.repo-compact-card p { margin: 0; min-height: 32px; line-height: 1.4; }
.repo-compact-actions { margin-top: auto; padding-top: 8px; border-top: 1px solid var(--line); font: 11px var(--font-mono); }
.repo-compact-actions a { color: var(--accent); text-decoration: none; }
.repo-compact-actions a:hover, .repo-compact-actions a:focus-visible { text-decoration: underline; }
.repo-info-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; margin-top: 12px; }
.repo-info-grid > div { display: flex; flex-direction: column; gap: 2px; padding: 10px; border: 1px solid var(--line); border-radius: var(--r-sm); min-width: 0; }
.repo-info-grid span { font: 10px var(--font-mono); color: var(--faint); }
.repo-info-grid strong { font-size: 12px; overflow-wrap: anywhere; }
.repo-info-grid a { color: var(--accent); }
.repo-topic-row { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 12px; }
.repo-source-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.repo-source-bar p { margin: 4px 0 0; }
@media (max-width: 640px) {
  .sawbyte-feature { flex-wrap: wrap; gap: 12px; padding: 14px; }
  .sawbyte-copy { flex-basis: calc(100% - 76px); }
  .sawbyte-enter { width: 100%; text-align: center; }
  .repo-info-grid { grid-template-columns: 1fr; gap: 6px; }
  .repo-source-bar { flex-wrap: wrap; }
}

/* Sawbyte disc_maker, adapted to the portal's cards and music dock. */
.disc-maker-page { max-width: 1040px; margin: 0 auto 40px; }
.disc-maker-page h1 { margin: 2px 0 4px; font: 400 38px/1.2 var(--font-serif); }
.disc-maker-page h2 { margin: 2px 0 3px; font: 400 24px/1.2 var(--font-serif); }
.disc-maker-page p { margin: 0; }
.dm-stage { display: flex; align-items: center; gap: 16px; padding: 17px; border: 2px solid #151923; background: #111823; color: #f5f5ee; border-radius: 8px; }
.dm-stage .eyebrow { color: #83e0db; }
.dm-stage .badge { margin-left: 5px; color: #c7f48f; background: #25392d; }
.dm-stage h2 { color: #55ffff; font: 400 23px/1.1 MinecraftOfficial, monospace; text-shadow: 2px 2px #153f3f; }
.dm-stage p, .dm-stage small { color: #d9e4e9; font: 11px/1.5 MinecraftOfficial, monospace; }
.dm-stage-copy { flex: 1; min-width: 0; }
.dm-disc-button { flex: 0 0 70px; width: 70px; height: 70px; display: grid; place-items: center; padding: 8px; border: 3px solid #060708; border-radius: 0; cursor: pointer; background: #3d2c1f url('https://raw.githubusercontent.com/InventivetalentDev/minecraft-assets/1.21.4/assets/minecraft/textures/block/jukebox_top.png') center / cover; box-shadow: inset 2px 2px #946c42, 3px 3px #050708; }
.dm-disc-button img { width: 46px; height: 46px; image-rendering: pixelated; }
.disc-spinning { animation: dm-spin 3s linear infinite; }
@keyframes dm-spin { to { transform: rotate(360deg); } }
.dm-stage-actions { display: flex; flex-direction: column; gap: 5px; align-items: stretch; }
.dm-stage-actions .btn { min-height: 32px; justify-content: center; white-space: nowrap; }
.dm-icon { display: inline-block; width: 17px; height: 17px; object-fit: contain; vertical-align: middle; image-rendering: pixelated; }
.dm-controls-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 10px; margin: 15px 0 18px; }
.dm-control { display: flex; flex-direction: column; gap: 7px; padding: 11px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); min-width: 0; }
.dm-control > span { display: flex; justify-content: space-between; gap: 8px; color: var(--ink); font: 11px var(--font-mono); }
.dm-control output { color: var(--accent); white-space: nowrap; }
.dm-control .input { width: 100%; height: 32px; font-size: 11px; }
.dm-control input[type="range"] { width: 100%; accent-color: var(--accent); }
.dm-sequencer-head { display: flex; justify-content: space-between; align-items: end; gap: 10px; margin-bottom: 8px; }
.dm-sequencer-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); padding: 10px; }
#dm-sequencer-grid { min-width: 720px; display: grid; gap: 5px; }
.sequencer-row { display: grid; grid-template-columns: 165px repeat(16,minmax(0,1fr)); gap: 3px; align-items: center; }
.seq-track-label { display: flex; align-items: center; gap: 6px; min-width: 0; font: 10px var(--font-mono); color: var(--ink); cursor: pointer; }
.seq-track-label span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seq-track-label img { width: 18px; height: 18px; image-rendering: pixelated; }
.seq-cell { display: grid; place-items: center; min-width: 0; height: 28px; border: 1px solid var(--line-strong); border-radius: 3px; background: var(--elevated); color: #fff; font: 9px var(--font-mono); cursor: pointer; }
.seq-cell.beat-marker { border-color: var(--accent); }
.seq-cell.active-step { background: #256f6a; border-color: #55ffff; }
.seq-cell.track-bass.active-step { background: #584597; border-color: #aa89e4; }
.seq-cell.track-drums.active-step { background: #9a5330; border-color: #e5a05f; }
.seq-cell.track-fx.active-step { background: #7d427e; border-color: #d893df; }
.seq-cell.playhead-now { outline: 2px solid #e8c952; outline-offset: -2px; box-shadow: 0 0 8px #e8c952; }
.dm-export { display: flex; flex-direction: column; gap: 12px; }
.dm-export-controls { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; }
.dm-export-controls label { display: flex; flex-direction: column; gap: 3px; font: 10px var(--font-mono); color: var(--faint); }
.dm-export-controls .input { height: 34px; min-width: 110px; font-size: 11px; }
#dm-exported-preview-wrap { align-items: center; flex-wrap: wrap; gap: 10px; border-top: 1px solid var(--line); padding-top: 10px; font: 11px var(--font-mono); }
#dm-exported-audio-preview { min-width: 220px; max-width: 100%; height: 34px; }
#dockSourceSelect { width: 96px; flex: 0 0 auto; height: 30px; font: 10px var(--font-mono); }
@media (max-width: 900px) { .dm-controls-grid { grid-template-columns: repeat(2,minmax(0,1fr)); } .dm-stage { flex-wrap: wrap; } .dm-stage-actions { flex-direction: row; width: 100%; flex-wrap: wrap; } }
@media (max-width: 640px) { .dm-controls-grid { grid-template-columns: 1fr; } .dm-disc-button { flex-basis: 54px; width: 54px; height: 54px; } .dm-disc-button img { width: 36px; height: 36px; } .dm-stage-copy { flex-basis: calc(100% - 72px); } .dm-stage-actions .btn { flex: 1; } #dockSourceSelect { width: 76px; font-size: 9px; } }

.dock-source-btn img { width: 20px; height: 20px; image-rendering: pixelated; }
.disc-source #dockShuffleBtn, .disc-source #dockRepeatBtn { display: none; }
