

/* ---- toggle, dark themes (massive-dodo-67): a sunken pill, a raised knob, and a red ring that fades when you switch on ---- */
:root:root .switch { width: 60px; height: 30px; }
:root:root .switch i { background: color-mix(in srgb, var(--bg-0) 82%, #3a3950); border: 1px solid color-mix(in srgb, var(--border-focus) 75%, transparent); border-radius: 165px; box-sizing: border-box; box-shadow: inset 0 4px 8px rgba(0,0,0,.65), 0 3px 6px -2px rgba(255,255,255,.14); transition: background .35s; }
:root:root .switch i::before { content: ""; position: absolute; top: 50%; right: 9px; width: 13px; height: 13px; box-sizing: border-box; border: 2.5px solid var(--red, #ef565f); border-radius: 50%; transform: translateY(-50%); transition: opacity .3s, transform .3s; }
:root:root .switch i::after, :root:root .switch input:checked + i::after { width: 22px; height: 22px; left: 3px; right: auto; top: 3px; border: 0; border-radius: 50%; background: linear-gradient(#3b3a4e, #272733); box-shadow: inset 0 3px 2px rgba(255,255,255,.14), 0 4px 10px rgba(0,0,0,.6); transition: transform .3s ease-in, box-shadow .3s; }
:root:root .switch i::after { transform: none; }
:root:root .switch input:checked + i { background: color-mix(in srgb, var(--accent) 24%, #17161d); }
:root:root .switch input:checked + i::before { opacity: 0; transform: translateY(-50%) scale(0); }
:root:root .switch input:checked + i::after { transform: translateX(30px); box-shadow: inset 0 3px 2px rgba(255,255,255,.14), 0 4px 10px rgba(0,0,0,.6), 0 0 0 2px color-mix(in srgb, var(--accent) 75%, transparent), 0 0 14px var(--accent); }
:root:root[dir="rtl"] .switch i::before { right: auto; left: 9px; }
:root:root[dir="rtl"] .switch i::after, :root:root[dir="rtl"] .switch input:checked + i::after { left: auto; right: 3px; }
:root:root[dir="rtl"] .switch input:checked + i::after { transform: translateX(-30px); }
:root:root .switch input:focus-visible + i { outline: 2px solid var(--accent-hi, var(--accent)); outline-offset: 3px; }
/* light theme (slimy-treefrog-92): a soft white 3D switch, the knob fills with the accent when on */
:root:root[data-theme="light"] .switch i { background: #fff; border: 0; box-shadow: inset 5px 5px 10px #c1c1c1, inset -5px -5px 10px #fff; }
:root:root[data-theme="light"] .switch i::before { display: none; }
:root:root[data-theme="light"] .switch i::after, :root:root[data-theme="light"] .switch input:checked + i::after { top: 2px; left: 2px; width: 26px; height: 26px; background: #fff; box-shadow: 2px 2px 5px #c1c1c1, -2px -2px 5px #fff; }
:root:root[data-theme="light"] .switch input:checked + i { background: color-mix(in srgb, var(--accent) 16%, #fff); }
:root:root[data-theme="light"] .switch input:checked + i::after { transform: translateX(30px); background: var(--accent); box-shadow: 2px 2px 5px #c1c1c1, -2px -2px 5px #fff; }

/* ---- checkbox (stale-treefrog-11): a white badge that turns accent with a glass dot and a check, with one soft pulse ---- */
input[type="checkbox"]:not(.sr-only):not(.switch input):not([type="hidden"]) { -webkit-appearance: none; appearance: none; flex: none; position: relative; width: 22px; height: 22px; margin: 3px; cursor: pointer; vertical-align: middle; border-radius: 50%; border: 1px solid rgba(255,255,255,.3); background: #fff; transition: background-color .3s ease; }
input[type="checkbox"]:not(.sr-only):not(.switch input)::before { content: ""; position: absolute; top: 50%; left: 50%; width: 14px; height: 14px; border-radius: 50%; background: rgba(255,255,255,.2); transform: translate(-50%,-50%) scale(0); transition: transform .3s ease; }
input[type="checkbox"]:not(.sr-only):not(.switch input)::after { content: ""; position: absolute; top: 50%; left: 50%; display: none; width: 5px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0; transform: translate(-50%,-50%) rotate(45deg); }
input[type="checkbox"]:not(.sr-only):not(.switch input):checked { background: var(--accent); animation: uv-ping .5s ease-out; }
input[type="checkbox"]:not(.sr-only):not(.switch input):checked::before { transform: translate(-50%,-50%) scale(1); }
input[type="checkbox"]:not(.sr-only):not(.switch input):checked::after { display: block; }
input[type="checkbox"]:not(.sr-only):not(.switch input):focus-visible { outline: 2px solid var(--accent-hi, var(--accent)); outline-offset: 3px; }
input[type="checkbox"]:disabled { opacity: .45; cursor: not-allowed; }
.switch input[type="checkbox"]:disabled { opacity: 0; }
/* light theme: keep the empty checkbox and radio visible on a white page */
:root[data-theme="light"] input[type="checkbox"]:not(.sr-only):not(.switch input):not(:checked) { border: 1.5px solid #b4b8c2; box-shadow: inset 0 1px 3px rgba(0,0,0,.12); }
:root[data-theme="light"] input[type="radio"]:not(:checked) { background: #fff; border: 1.5px solid #b4b8c2; box-shadow: inset 0 1px 3px rgba(0,0,0,.12); }
:root[data-theme="light"] input[type="radio"]::before { box-shadow: 0 0 8px var(--accent); }
@keyframes uv-ping { from { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent); } to { box-shadow: 0 0 0 9px transparent; } }

/* ---- radio (foolish-donkey-86): a sunken socket with a dot that spins in and glows ---- */
input[type="radio"] { -webkit-appearance: none; appearance: none; flex: none; position: relative; width: 22px; height: 22px; margin: 4px; cursor: pointer; border-radius: 50%; background: var(--bg-0); box-shadow: inset 2px 4px 8px rgba(0,0,0,.7); border: 1px solid transparent; transition: .4s ease-in-out; }
.mc-opt > input[type="radio"], .vv-r > input[type="radio"] { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none; box-shadow: none; }   /* the round picture is the <i> next to it: the shared radio look must not give this hidden one its own 30px column */
input[type="radio"]:hover { scale: 1.15; box-shadow: none; border-color: var(--border-focus); }
input[type="radio"]::before { content: ""; position: absolute; inset: 0; margin: auto; width: 9px; height: 9px; border-radius: 10px; background: var(--accent-hi, var(--accent)); box-shadow: 0 0 10px var(--accent), 0 0 3px #fff; scale: 0; transition: .4s ease-in-out; }
input[type="radio"]:checked { box-shadow: 0 0 12px -2px var(--accent); border: 1px solid var(--accent); }
input[type="radio"]:checked::before { transform: rotate(360deg); scale: 1; }
input[type="radio"]:focus-visible { outline: 2px solid var(--accent-hi, var(--accent)); outline-offset: 3px; }

/* ---- inputs: dark themes (weak-wombat-42) get a raised 3D field that presses in on focus; the light theme (modern-tiger-48) gets a white pill in a soft gradient frame ---- */
.system-input, .auth-input, #chat-search-input { border: 2px solid transparent; border-radius: 10px; box-shadow: 2px 2px 5px #000, inset 2px 2px 5px rgba(75,72,72,.75), -1px -1px 18px rgba(70,67,67,.55); transition: box-shadow .3s; }
.system-input:focus, .auth-input:focus, #chat-search-input:focus { outline: none; box-shadow: 2px 2px 5px #000, inset 2px 2px 6px #000, -1px -1px 5px rgba(80,78,78,.75), inset -1px -1px 5px rgba(80,78,78,.8), 0 0 0 2px color-mix(in srgb, var(--accent) 55%, transparent); }
:root[data-theme="light"] .system-input, :root[data-theme="light"] .auth-input, :root[data-theme="light"] #chat-search-input { border: 5px solid transparent; border-radius: 30px; background: linear-gradient(#fff, #fff) padding-box, linear-gradient(to bottom, rgb(227,213,255), rgb(255,231,231)) border-box; color: #131313; caret-color: var(--accent); box-shadow: 2px 2px 10px rgba(0,0,0,.08); }
:root[data-theme="light"] .system-input:focus, :root[data-theme="light"] .auth-input:focus, :root[data-theme="light"] #chat-search-input:focus { box-shadow: 2px 2px 10px rgba(0,0,0,.08), 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }

/* ---- loaders ---- */
/* boot screen (lovely-rabbit-61): a pulsing ring around a spinning arc */
.boot-spinner { position: relative; width: 64px; height: 64px; border: 0; border-radius: 0; background: none; animation: none; }
.boot-spinner::before, .boot-spinner::after { content: ""; position: absolute; inset: 0; box-sizing: border-box; border-radius: 50%; border: 5px solid var(--accent); }
.boot-spinner::before { animation: uv-pulse 1s ease-in-out infinite; }
.boot-spinner::after { border-color: transparent; border-top-color: var(--accent-hi, var(--accent)); animation: uv-spin 2s linear infinite; }
@keyframes uv-pulse { 0% { transform: scale(.6); opacity: 1; } 50% { transform: scale(1.2); opacity: 0; } 100% { transform: scale(.6); opacity: 1; } }
@keyframes uv-spin { to { transform: rotate(360deg); } }
/* "Loading..." panels (angry-dragonfly-63): a glowing ring that turns */
.uv-wait::before { content: ""; display: block; margin: 0 auto 10px; width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(45deg, transparent, transparent 40%, var(--accent-hi, var(--accent))); -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px)); mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px)); filter: drop-shadow(0 0 6px var(--accent)); animation: uv-spin 1.4s linear infinite; }
/* stream connecting (odd-insect-77): a glowing cube that opens up and turns */
.uv-cube { position: relative; width: 34px; height: 34px; margin: 0 auto 18px; transform-style: preserve-3d; animation: uv-cube-spin 3s infinite cubic-bezier(.16,.61,.49,.91); }
.uv-cube i { position: absolute; inset: 0; border: 1.5px solid #fff; border-radius: 3px; background: color-mix(in srgb, var(--accent) 80%, #fff 20%); box-shadow: 0 0 8px rgba(255,255,255,.8); }
.uv-cube i:nth-child(1) { transform: translateZ(17px); animation: uv-s-front 3s infinite ease-out; }
.uv-cube i:nth-child(2) { transform: rotateY(-180deg) translateZ(17px); animation: uv-s-back 3s infinite ease-out; }
.uv-cube i:nth-child(3) { transform: rotateY(90deg) translateZ(17px); animation: uv-s-right 3s infinite ease-out; }
.uv-cube i:nth-child(4) { transform: rotateY(-90deg) translateZ(17px); animation: uv-s-left 3s infinite ease-out; }
.uv-cube i:nth-child(5) { transform: rotateX(90deg) translateZ(17px); animation: uv-s-top 3s infinite ease-out; }
.uv-cube i:nth-child(6) { transform: rotateX(-90deg) translateZ(17px); animation: uv-s-bottom 3s infinite ease-out; }
@keyframes uv-cube-spin { 33%, 100% { transform: rotateX(-36deg) rotateY(-405deg); } }
@keyframes uv-s-top { 33%, 75% { transform: rotateX(90deg) translateZ(17px); } 50%, 60% { transform: rotateX(90deg) translateZ(34px); } }
@keyframes uv-s-bottom { 33%, 75% { transform: rotateX(-90deg) translateZ(17px); } 50%, 60% { transform: rotateX(-90deg) translateZ(34px); } }
@keyframes uv-s-right { 33%, 75% { transform: rotateY(90deg) translateZ(17px); } 50%, 60% { transform: rotateY(90deg) translateZ(34px); } }
@keyframes uv-s-left { 33%, 75% { transform: rotateY(-90deg) translateZ(17px); } 50%, 60% { transform: rotateY(-90deg) translateZ(34px); } }
@keyframes uv-s-front { 33%, 75% { transform: translateZ(17px); } 50%, 60% { transform: translateZ(34px); } }
@keyframes uv-s-back { 33%, 75% { transform: rotateY(-180deg) translateZ(17px); } 50%, 60% { transform: rotateY(-180deg) translateZ(34px); } }
.stream-connecting { flex-direction: column; }
@media (prefers-reduced-motion: reduce) { .boot-spinner::before, .boot-spinner::after, .uv-wait::before, .uv-cube, .uv-cube i { animation: none; } }

/* ---- header toolbar (ordinary-owl-54): each icon grows to show its name while you point at it ---- */
.main-header .icon-btn:not(#btn-hamburger) { overflow: hidden; white-space: nowrap; gap: 0; transition: background-color .3s linear .2s; }
/* the growing label is for a pointer that can hover. On a touch screen a tap leaves the button "hovered" (sticky), so the icon grew, pushed its neighbours along and the whole header wobbled under the finger */
.main-header .icon-btn:not(#btn-hamburger):focus-visible { gap: 6px; padding-inline-end: 10px; background-color: color-mix(in srgb, var(--accent) 22%, transparent); transition: background-color .1s linear; }
@media (hover: hover) { .main-header .icon-btn:not(#btn-hamburger):hover { gap: 6px; padding-inline-end: 10px; background-color: color-mix(in srgb, var(--accent) 22%, transparent); transition: background-color .1s linear; } }
.uv-lbl { color: var(--bright); max-width: 0; opacity: 0; overflow: hidden; font-size: 13px; font-weight: 600; transition: max-width .3s ease-in-out, opacity .2s; }
.main-header .icon-btn:focus-visible .uv-lbl { max-width: 150px; opacity: 1; }
@media (hover: hover) { .main-header .icon-btn:hover .uv-lbl { max-width: 150px; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .uv-lbl { transition: none; } }
