:root {
  --bg: #1b0a3c;
  --pink: #ff3fa4;
  --pink-soft: #ffa6d5;
  --pink-pale: #fff0f8;
  --teal: #2ef2e0;
  --panel: rgba(20, 6, 52, 0.74);
  --line: rgba(46, 242, 224, 0.5);
  --danger: #ff5a6e;
  --ok: #7dffc0;
  --mono: "Courier New", ui-monospace, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--pink-pale);
  font-family: var(--mono);
  overflow-x: hidden;
}
.shade {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(13, 5, 38, 0) 35%, rgba(13, 5, 38, 0.55) 100%);
}
main {
  position: relative; z-index: 2; min-height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px;
  padding-block: 24px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
h1 {
  margin: 0; font-size: clamp(1.4rem, 4vw, 2.2rem); letter-spacing: 0.18em; text-transform: uppercase;
  text-align: center; color: var(--pink); text-shadow: 0 0 12px var(--pink), 0 0 32px rgba(255, 63, 164, 0.6), 3px 3px 0 rgba(46, 242, 224, 0.55);
}
.sub { margin: 0; color: var(--pink-soft); font-size: 0.85rem; text-align: center; text-shadow: 0 1px 6px rgba(13, 5, 38, 0.95), 0 0 14px rgba(13, 5, 38, 0.8); }
.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 0 24px rgba(255, 63, 164, 0.3), inset 0 0 0 1px rgba(255, 63, 164, 0.18);
}

/* Lobby */
#lobby { width: min(440px, 100%); padding: 22px; display: grid; gap: 14px; }
label { font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--pink-soft); display: grid; gap: 6px; }
input {
  font: inherit; color: var(--pink-pale); background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--line); border-radius: 4px; padding: 10px 12px; width: 100%;
}
input:focus-visible, button:focus-visible { outline: 2px solid var(--pink-soft); outline-offset: 2px; }
button {
  font: inherit; cursor: pointer; color: var(--pink-pale); background: rgba(255, 63, 164, 0.16);
  border: 1px solid var(--pink); border-radius: 4px; padding: 10px 14px;
  text-transform: uppercase; letter-spacing: 0.1em; font-size: 0.8rem;
}
@media (hover: hover) { button:hover { background: rgba(255, 63, 164, 0.35); box-shadow: 0 0 14px rgba(255, 63, 164, 0.5); } }
button:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }
button.primary { background: var(--pink); color: #1a000f; font-weight: 700; }
@media (hover: hover) { button.primary:hover { background: var(--pink-soft); } }
button.off { background: rgba(255, 90, 110, 0.25); border-color: var(--danger); }
button.hang { background: var(--danger); border-color: var(--danger); color: #1a000f; font-weight: 700; }
.or { text-align: center; color: var(--pink-soft); font-size: 0.75rem; letter-spacing: 0.2em; }
#status { min-height: 1.2em; font-size: 0.8rem; color: var(--pink-soft); text-align: center; margin: 0; }
#status.err { color: var(--danger); }
#status.ok { color: var(--ok); }

/* Call room */
#room { width: min(1100px, 100%); display: grid; gap: 14px; }
.stage { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 14px; }
.videos { position: relative; aspect-ratio: 16 / 9; max-width: 100%; overflow: hidden; background: #000; }
#remote { width: 100%; height: 100%; object-fit: cover; background: #000; }
#local {
  position: absolute; right: 12px; bottom: 12px; width: 26%; min-width: 110px; aspect-ratio: 4 / 3; max-width: 100%;
  object-fit: cover; border: 1px solid var(--teal); border-radius: 4px; background: #000;
  transform: scaleX(-1); box-shadow: 0 0 16px rgba(255, 63, 164, 0.5);
}
.waiting {
  position: absolute; inset: 0; display: grid; place-content: center; text-align: center; gap: 8px;
  padding: 16px; color: var(--pink-soft); background: rgba(20, 6, 52, 0.7);
}
.waiting strong { font-size: 1.6rem; letter-spacing: 0.3em; color: var(--pink); text-shadow: 0 0 12px var(--pink); }
.tag {
  position: absolute; left: 12px; top: 12px; font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase;
  background: rgba(20, 6, 52, 0.78); border: 1px solid var(--line); border-radius: 3px; padding: 4px 8px;
}
.chat { display: flex; flex-direction: column; min-height: 0; max-height: 520px; }
.chat h2 {
  margin: 0; padding: 10px 12px; font-size: 0.75rem; letter-spacing: 0.15em; text-transform: uppercase;
  border-bottom: 1px solid var(--line); color: var(--pink-soft);
}
#log { flex: 1; overflow-y: auto; padding: 10px 12px; display: grid; gap: 8px; align-content: start; font-size: 0.85rem; min-height: 160px; }
.msg { overflow-wrap: anywhere; }
.msg b { color: var(--pink); }
.msg.sys { color: var(--pink-soft); font-style: italic; }
#chatForm { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--line); }
#chatForm input { flex: 1; min-width: 0; }
.controls { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; padding: 12px; align-items: center; }
.code { font-size: 1.1rem; letter-spacing: 0.25em; color: var(--pink); }
[hidden] { display: none !important; }

@media (max-width: 820px) {
  .stage { grid-template-columns: minmax(0, 1fr); }
  .chat { max-height: 320px; }
}
@media (prefers-reduced-motion: reduce) {
  button:hover { box-shadow: none; }
}

/* Layout: app area fills the first screen, info content sits below it (SEO text) */
main { justify-content: flex-start; padding-block: 0; gap: 0; }
.app {
  min-height: 100vh; min-height: 100svh; width: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  padding-block: 24px;
}
.app header { display: grid; gap: 8px; }
.err { color: var(--danger); font-size: 0.85rem; margin: 0; }

.info {
  width: min(860px, 100%); margin: 0 0 24px; padding: 24px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  line-height: 1.6; font-size: 0.9rem;
}
.info h2 { margin: 24px 0 8px; font-size: 1.05rem; color: var(--pink); letter-spacing: 0.06em; }
.info h2:first-child { margin-top: 0; }
.info h3 { margin: 0 0 6px; font-size: 0.9rem; color: var(--pink-soft); }
.info p { margin: 0 0 10px; }
.info .grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin: 16px 0; }
.info article { border: 1px solid var(--line); border-radius: 4px; padding: 12px; background: rgba(0, 0, 0, 0.3); }
.info article p { margin: 0; }
.info details { border-top: 1px solid var(--line); padding: 10px 0; }
.info summary { cursor: pointer; color: var(--pink-soft); }
.info summary:focus-visible { outline: 2px solid var(--pink-soft); outline-offset: 2px; }
.info details p { margin: 8px 0 0; }
footer { padding: 8px 16px 32px; color: var(--pink-soft); font-size: 0.75rem; text-align: center; }
footer p { margin: 6px 0 0; }
footer nav a, .info a { color: var(--pink); text-decoration: underline; text-underline-offset: 2px; }
footer nav a:hover, .info a:hover { color: var(--pink-soft); }
.info h2 a { text-decoration: none; }
body.in-room .info, body.in-room footer { display: none; }

/* ---- Title / waiting-code effects ---- */
.waiting strong { animation: flick 3.2s steps(1) infinite; }
h1 { animation: glitch 6s steps(1) infinite; }
@keyframes flick { 0%, 94%, 100% { opacity: 1; } 95% { opacity: 0.3; } 97% { opacity: 0.9; } }
@keyframes glitch {
  0%, 93%, 100% { transform: none; }
  94% { transform: translateX(-3px); text-shadow: 3px 0 #2ef2e0, -3px 0 #ff3fa4; }
  96% { transform: translateX(3px); text-shadow: -3px 0 #2ef2e0, 3px 0 #ff3fa4; }
}

/* =====================  MIAMI SCENE  ===================== */
.miami { position: fixed; inset: 0; z-index: 0; overflow: hidden; background: #3a1470; }
.miami > * { position: absolute; }
body.in-room .miami { opacity: 0.8; }

/* sky: slowly drifts from magenta dusk to golden-hour orange and back */
.m-sky {
  left: 0; right: 0; top: 0; height: 66%;
  background: linear-gradient(180deg, #0b0420 0%, #240a52 12%, #5b1a8f 26%, #c42b94 40%, #ff4d8d 48%, #ff7a45 58%, #ffb347 76%, #ffd77a 100%);
  background-size: 100% 230%;
  animation: skyShift 40s ease-in-out infinite alternate;
}
@keyframes skyShift { from { background-position: 50% 0%; } to { background-position: 50% 60%; } }

.m-stars { left: 0; right: 0; top: 0; height: 55%; }
.m-stars i { position: absolute; border-radius: 50%; background: #fff; box-shadow: 0 0 6px #fff; opacity: 0.2; animation: twinkle 4s ease-in-out infinite; }
@keyframes twinkle { 0%, 100% { opacity: 0.15; } 50% { opacity: 0.95; } }

/* striped retro sun that sinks while the sky warms up */
.m-sun { left: 50%; bottom: 25%; width: min(52vw, 62vh); aspect-ratio: 1; transform: translateX(-50%); animation: sunSet 40s ease-in-out infinite alternate; }
.m-sun::before {
  content: ""; position: absolute; inset: -22%; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 120, 150, 0.65) 0%, rgba(255, 79, 176, 0.3) 40%, rgba(255, 79, 176, 0) 70%);
  animation: sunGlow 5s ease-in-out infinite;
}
.m-sun-disc {
  position: absolute; inset: 0; border-radius: 50%;
  background: linear-gradient(180deg, #fff27a 0%, #ffb347 38%, #ff4d8d 72%, #d62b9c 100%);
  -webkit-mask-image: linear-gradient(to bottom, #000 0, #000 40%, transparent 40%, transparent 43%, #000 43%, #000 50%, transparent 50%, transparent 54%, #000 54%, #000 60%, transparent 60%, transparent 66%, #000 66%, #000 71%, transparent 71%, transparent 78%, #000 78%, #000 82%, transparent 82%, transparent 90%, #000 90%);
  mask-image: linear-gradient(to bottom, #000 0, #000 40%, transparent 40%, transparent 43%, #000 43%, #000 50%, transparent 50%, transparent 54%, #000 54%, #000 60%, transparent 60%, transparent 66%, #000 66%, #000 71%, transparent 71%, transparent 78%, #000 78%, #000 82%, transparent 82%, transparent 90%, #000 90%);
}
@keyframes sunSet { from { transform: translate(-50%, 0); } to { transform: translate(-50%, 7vh); } }
@keyframes sunGlow { 50% { opacity: 0.65; transform: scale(1.06); } }

/* clouds */
.m-clouds { left: 0; right: 0; top: 0; height: 60%; }
.m-clouds i {
  position: absolute; left: 0; height: 4.5vh; border-radius: 50%; filter: blur(7px);
  background: radial-gradient(ellipse at center, rgba(255, 170, 205, 0.8), rgba(255, 120, 160, 0) 70%);
  animation: drift linear infinite;
}
.m-clouds i:nth-child(1) { top: 14%; width: 36vw; animation-duration: 140s; animation-delay: -30s; }
.m-clouds i:nth-child(2) { top: 26%; width: 26vw; animation-duration: 110s; animation-delay: -80s; opacity: 0.8; }
.m-clouds i:nth-child(3) { top: 38%; width: 44vw; animation-duration: 170s; animation-delay: -120s; }
.m-clouds i:nth-child(4) { top: 8%;  width: 22vw; animation-duration: 95s;  animation-delay: -10s; opacity: 0.7; }
.m-clouds i:nth-child(5) { top: 46%; width: 30vw; animation-duration: 130s; animation-delay: -60s; opacity: 0.85; }
@keyframes drift { from { transform: translateX(-50vw); } to { transform: translateX(110vw); } }

/* seagulls */
.m-birds { left: 0; right: 0; top: 0; height: 60%; }
.bird { position: absolute; left: 0; aspect-ratio: 30 / 12; animation: fly linear infinite; will-change: transform; }
.bird svg { width: 100%; height: 100%; overflow: visible; transform-origin: 50% 80%; animation: flap 0.9s ease-in-out infinite; }
@keyframes fly { from { transform: translateX(-10vw); } to { transform: translateX(110vw); } }
@keyframes flap { 50% { transform: scaleY(0.35); } }

/* skylines: right on the horizon (the sea starts at 36% from the bottom) */
.m-far, .m-city { left: 0; right: 0; bottom: 36%; height: 34vh; }
.m-far { opacity: 0.9; transform: translateY(-3vh); }
.m-far svg, .m-city svg { display: block; width: 100%; height: 100%; }
.tw { animation: twinkle 5s ease-in-out infinite; }
.neon { animation: neon 3.4s ease-in-out infinite; }
.beacon { animation: blink 1.6s steps(2) infinite; }
@keyframes neon { 0%, 100% { opacity: 1; } 46% { opacity: 0.85; } 48% { opacity: 0.3; } 50% { opacity: 0.95; } }
@keyframes blink { 50% { opacity: 0.1; } }

/* Ocean Drive road with a car */
.m-road {
  left: 0; right: 0; bottom: 35%; height: 1.6vh; min-height: 8px;
  background: linear-gradient(180deg, #2a0f55, #12052c);
  border-top: 2px solid rgba(255, 63, 164, 0.6);
}
.m-road::after {
  content: ""; position: absolute; left: 0; right: 0; top: 45%; height: 2px;
  background: repeating-linear-gradient(90deg, rgba(255, 240, 248, 0.7) 0 28px, transparent 28px 60px);
  animation: dashes 3s linear infinite;
}
@keyframes dashes { to { background-position: -60px 0; } }
.m-car { left: 0; bottom: 35.2%; width: clamp(60px, 9vw, 120px); animation: cruise 34s linear infinite; will-change: transform; }
.m-car svg { display: block; width: 100%; overflow: visible; }
@keyframes cruise { from { transform: translateX(-20vw); } to { transform: translateX(110vw); } }

/* sea */
.m-sea {
  left: 0; right: 0; bottom: 0; height: 35%; overflow: hidden;
  background: linear-gradient(180deg, #ff5a9a 0%, #b3269b 12%, #5a1c9b 38%, #1f0d5c 75%, #0d0530 100%);
}
.m-glint { position: absolute; left: 0; right: 0; top: 0; bottom: 0; }
.m-glint i {
  position: absolute; left: 50%; height: 3px; border-radius: 2px; transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, #ffe27a, #ff9ac8, transparent);
  animation: shimmer 3s ease-in-out infinite;
}
@keyframes shimmer { 0%, 100% { transform: translateX(-50%) scaleX(1); opacity: 0.9; } 50% { transform: translateX(-50%) scaleX(0.4); opacity: 0.35; } }
.m-waves { position: absolute; inset: 0; }
.wave { position: absolute; left: 0; width: 200%; height: 3.2vh; will-change: transform; }
.wave svg { display: block; width: 100%; height: 100%; }
.w1 { animation: waveMove 16s linear infinite; }
.w2 { animation: waveMove 11s linear infinite reverse; }
.w3 { animation: waveMove 8s linear infinite; }
.w4 { animation: waveMove 6s linear infinite reverse; }
@keyframes waveMove { to { transform: translateX(-50%); } }

/* palms in the foreground */
.m-palms { inset: 0; pointer-events: none; }
.palm { position: absolute; bottom: -2vh; height: min(78vh, 760px); aspect-ratio: 300 / 640; }
.palm svg { display: block; width: 100%; height: 100%; overflow: visible; }
.p-l  { left: -3vw; }
.p-r  { right: -3vw; height: min(66vh, 640px); }
.p-l2 { left: 9vw; height: min(44vh, 420px); opacity: 0.9; }
.palm.flip svg { transform: scaleX(-1); }
.trunk { animation: palmSway 8s ease-in-out infinite alternate; }
.fr { animation: frondSway 6s ease-in-out infinite alternate; }
@keyframes palmSway { from { transform: rotate(-1.4deg); } to { transform: rotate(1.4deg); } }
@keyframes frondSway { from { transform: rotate(-3deg); } to { transform: rotate(3deg); } }

@media (max-width: 700px) {
  .p-r { display: none; }
  .p-l { left: -14vw; }
  .m-sun { width: 78vw; }
}
@media (prefers-reduced-motion: reduce) {
  .miami *, .miami *::before, h1, .waiting strong { animation: none !important; }
  .m-stars i { opacity: 0.7; }
}

/* =====================  RANDOM CHAT (Omegle style)  ===================== */
label.age { display: flex; align-items: flex-start; gap: 10px; text-transform: none; letter-spacing: 0; font-size: 0.78rem; line-height: 1.4; cursor: pointer; }
label.age input { width: auto; flex: none; margin-top: 2px; accent-color: var(--pink); }
.online { margin: 0; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-size: 0.78rem; color: var(--pink-soft); }
.online i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }
#lobby .online { justify-self: center; }

/* which controls show in which mode */
.rnd-only { display: none; }
body.mode-random .rnd-only { display: inline-flex; }
body.mode-random .room-only { display: none; }
body.text-only .av-only, body.text-only .videos { display: none; }
body.text-only .stage { grid-template-columns: minmax(0, 1fr); }
body.text-only .chat { max-height: none; height: min(60vh, 520px); }
body.mode-random .videos { max-height: 70vh; }
.waiting strong.sm { font-size: 1.05rem; letter-spacing: 0.2em; }
.waiting .dots::after { content: ""; animation: dots 1.4s steps(4) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }
@media (max-width: 820px) {
  body.mode-random .stage { grid-template-columns: minmax(0, 1fr); }
  .controls button { flex: 1 1 auto; }
}
@media (prefers-reduced-motion: reduce) { .online i, .waiting .dots::after { animation: none !important; } }

/* =====================  FILE TRANSFER TAB  ===================== */
.tabs { display: flex; justify-content: center; gap: 8px; margin-top: 6px; }
.tabs button { background: var(--panel); border-color: var(--line); color: var(--pink-soft); }
.tabs button[aria-selected="true"] { background: var(--pink); border-color: var(--pink); color: #1a000f; font-weight: 700; box-shadow: 0 0 14px rgba(255, 63, 164, 0.5); }
body.in-room .tabs { display: none; }

#transfer { display: none; width: min(560px, 100%); padding: 22px; gap: 14px; }
body.tab-files #transfer { display: grid; }
body.tab-files #lobby { display: none; }

#transfer .trow { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
#transfer .tme { font-weight: 700; color: var(--pink); text-shadow: 0 0 10px rgba(255, 63, 164, 0.6); }
#transfer .tnote { font-size: 0.78rem; color: var(--pink-soft); }
#tStatus { margin: 0; font-size: 0.8rem; color: var(--pink-soft); }
#tStatus.ok { color: var(--ok); }
#tStatus.err { color: var(--danger); }
#transfer .troom { display: flex; flex-wrap: wrap; gap: 8px; }
#transfer .troom input { flex: 1 1 150px; width: auto; min-width: 0; text-transform: uppercase; }
#transfer .troom button { flex: 0 0 auto; }
#transfer #tScan { flex: 0 0 auto; padding: 6px 12px; font-size: 0.78rem; }

#transfer .radar-wrap { display: grid; justify-items: center; gap: 8px; }
#transfer #tRadar { display: block; max-width: 100%; border-radius: 50%; touch-action: manipulation; filter: drop-shadow(0 0 14px rgba(46, 242, 224, 0.25)); }
#transfer .radar-hud { font-size: 0.72rem; letter-spacing: 0.16em; color: var(--teal); text-shadow: 0 0 8px rgba(46, 242, 224, 0.6); }
#transfer .peers { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
#transfer .peers:empty { display: none; }
#transfer .peer {
  border: 2px dashed var(--line); border-radius: 6px; padding: 16px 10px; text-align: center; cursor: pointer;
  background: rgba(0, 0, 0, 0.3); transition: transform 0.15s, border-color 0.15s, background 0.15s;
}
#transfer .peer.over { transform: scale(1.04); border-color: var(--pink); background: rgba(255, 63, 164, 0.18); }
@media (hover: hover) { #transfer .peer:hover { transform: scale(1.04); border-color: var(--pink); background: rgba(255, 63, 164, 0.18); } }
#transfer .peer:focus-visible { outline: 2px solid var(--pink-soft); outline-offset: 2px; }
#transfer .peer b { display: block; font-size: 0.9rem; color: var(--pink-pale); }
#transfer .peer small { color: var(--pink-soft); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.1em; }
#transfer .tempty { margin: 0; font-size: 0.82rem; color: var(--pink-soft); line-height: 1.5; }

#tXfers { display: grid; gap: 10px; }
#tXfers:empty { display: none; }
.xfer { border: 1px solid var(--line); border-radius: 4px; padding: 12px; background: rgba(0, 0, 0, 0.35); display: grid; gap: 8px; }
.xfer .t { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 0.82rem; overflow-wrap: anywhere; }
.xfer .xtag { padding: 2px 8px; border-radius: 99px; font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; background: rgba(46, 242, 224, 0.15); border: 1px solid var(--teal); color: var(--teal); }
.xfer .xtag.relay { background: rgba(255, 166, 213, 0.15); border-color: var(--pink-soft); color: var(--pink-soft); }
.xfer .xbadges { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.xfer .xroute { padding: 2px 8px; border-radius: 99px; font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; background: rgba(46, 242, 224, 0.08); border: 1px dashed var(--teal); color: var(--teal); cursor: help; }
.xfer .xroute.relay { background: rgba(255, 166, 213, 0.1); border-color: var(--pink-soft); color: var(--pink-soft); }
.xfer .xroute[hidden] { display: none; }
.xfer .bar { height: 10px; border-radius: 6px; background: rgba(255, 255, 255, 0.14); overflow: hidden; }
.xfer .bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--teal), var(--pink)); transition: width 0.2s; }
.xfer .spd.ok { color: var(--ok); }
.xfer .spd.warn { color: var(--pink-soft); }
.xfer .acts { display: flex; gap: 8px; flex-wrap: wrap; }
.xfer .acts button { padding: 6px 12px; }
@media (prefers-reduced-motion: reduce) { #transfer .peer { transition: none; } #transfer .peer:hover, #transfer .peer.over { transform: none; } .xfer .bar i { transition: none; } }

.tdiag { font-size: 0.75rem; color: var(--pink-soft); }
.tdiag summary { cursor: pointer; }
.tdiag summary:focus-visible { outline: 2px solid var(--pink-soft); outline-offset: 2px; }
.tdiag pre { margin: 8px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; color: var(--pink-pale); }


/* =====================  UI ANIMATIONS (v3)  ===================== */
button, .peer, .xfer, input { -webkit-tap-highlight-color: transparent; }
button { touch-action: manipulation; transition: transform 0.12s ease, background 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease; position: relative; overflow: hidden; }
button:active:not(:disabled) { transform: scale(0.96); }
input { transition: border-color 0.2s ease, box-shadow 0.2s ease; }
input:focus { border-color: var(--pink); box-shadow: 0 0 0 3px rgba(255, 63, 164, 0.22), 0 0 16px rgba(255, 63, 164, 0.3); }

/* panels glide in whenever they appear (also restarts on every tab switch) */
@keyframes riseIn { from { opacity: 0; transform: translateY(16px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { 0% { opacity: 0; transform: scale(0.6) translateY(10px); } 70% { transform: scale(1.06); } 100% { opacity: 1; transform: none; } }
@keyframes slideIn { from { opacity: 0; transform: translateX(-18px); } to { opacity: 1; transform: none; } }
#lobby, #transfer, #room { animation: riseIn 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
header { animation: fadeIn 0.6s ease both; }
.info { animation: riseIn 0.6s 0.15s cubic-bezier(0.2, 0.8, 0.2, 1) both; }

/* tabs: glowing active pill + shine on the primary buttons */
.tabs button { transition: transform 0.15s ease, background 0.25s ease, color 0.25s ease, box-shadow 0.25s ease; }
.tabs button[aria-selected="true"] { animation: tabGlow 2.6s ease-in-out infinite; }
@keyframes tabGlow { 50% { box-shadow: 0 0 24px rgba(255, 63, 164, 0.85), 0 0 4px rgba(255, 255, 255, 0.4) inset; } }
button.primary::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: -60%; width: 40%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  transform: skewX(-20deg); animation: shine 3.8s ease-in-out infinite; pointer-events: none;
}
@keyframes shine { 0%, 55% { left: -60%; } 100% { left: 140%; } }

/* connection status chip */
#tStatus { transition: color 0.3s ease; }
#tStatus.ok::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); animation: pulse 2s ease-in-out infinite; }
#tStatus:not(.ok):not(.err):not(:empty)::after { content: ""; animation: dots 1.4s steps(4) infinite; }
#tMe { animation: slideIn 0.5s ease both; }

/* radar: soft expanding rings around the canvas */
#transfer .radar-wrap { position: relative; }
#transfer .radar-wrap::before, #transfer .radar-wrap::after {
  content: ""; position: absolute; top: 0; left: 50%; width: min(340px, 100%); aspect-ratio: 1; border-radius: 50%;
  border: 2px solid rgba(46, 242, 224, 0.5); transform: translateX(-50%) scale(1); opacity: 0; pointer-events: none;
  animation: ringOut 3.6s ease-out infinite;
}
#transfer .radar-wrap::after { animation-delay: 1.8s; }
@keyframes ringOut { 0% { opacity: 0.55; transform: translateX(-50%) scale(0.98); } 100% { opacity: 0; transform: translateX(-50%) scale(1.22); } }
#transfer .radar-hud { animation: hudBlink 2.4s ease-in-out infinite; }
@keyframes hudBlink { 50% { opacity: 0.65; } }

/* device cards: pop in one after another, float gently, avatar pulses */
#transfer .peer { animation: popIn 0.5s calc(var(--i, 0) * 90ms) cubic-bezier(0.2, 0.9, 0.3, 1.2) both; position: relative; }
#transfer .peer .ava {
  display: grid; place-items: center; width: 44px; height: 44px; margin: 0 auto 8px; border-radius: 50%;
  background: linear-gradient(135deg, var(--pink), #7a3cff); color: #fff; font-weight: 700; font-size: 1.1rem; text-transform: uppercase;
  box-shadow: 0 0 0 0 rgba(255, 63, 164, 0.6); animation: avaPulse 2.2s ease-out infinite;
}
@keyframes avaPulse { 0% { box-shadow: 0 0 0 0 rgba(255, 63, 164, 0.55); } 100% { box-shadow: 0 0 0 16px rgba(255, 63, 164, 0); } }
#transfer .peer:active { transform: scale(0.96); }
#transfer .peer.over { border-style: solid; animation: none; }

/* empty state + "not showing up" hint */
#transfer .tempty { animation: fadeIn 0.6s ease both; }
.tquick { animation: popIn 0.5s ease both; }

/* transfer cards: slide in, live stripes while sending, green flash when done */
.xfer { animation: slideIn 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) both; transition: border-color 0.4s ease, box-shadow 0.4s ease; }
.xfer .bar i { position: relative; transition: width 0.35s ease; }
.xfer.active .bar i::after {
  content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(120deg, rgba(255, 255, 255, 0.28) 0 10px, transparent 10px 20px); background-size: 28px 100%;
  animation: stripes 0.7s linear infinite;
}
@keyframes stripes { to { background-position: 28px 0; } }
.xfer.active { border-color: var(--teal); box-shadow: 0 0 16px rgba(46, 242, 224, 0.25); }
.xfer.done { border-color: var(--ok); animation: slideIn 0.4s both, doneFlash 1.2s ease 1; }
.xfer.done .xtag { background: rgba(125, 255, 192, 0.18); border-color: var(--ok); color: var(--ok); }
.xfer.done .xtag::before { content: "\2713  "; }
.xfer.fail { border-color: var(--danger); animation: slideIn 0.4s both, shake 0.4s ease 1; }
.xfer.fail .xtag { background: rgba(255, 90, 110, 0.18); border-color: var(--danger); color: var(--danger); }
@keyframes doneFlash { 0% { box-shadow: 0 0 0 0 rgba(125, 255, 192, 0.7); } 100% { box-shadow: 0 0 0 22px rgba(125, 255, 192, 0); } }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
.xfer .acts { animation: fadeIn 0.3s ease both; }

@media (prefers-reduced-motion: reduce) {
  #lobby, #transfer, #room, header, .info, #tMe, .peer, .xfer, .tquick, #transfer .tempty, #transfer .radar-wrap::before, #transfer .radar-wrap::after,
  #transfer .radar-hud, .tabs button[aria-selected="true"], button.primary::after, .ava, .xfer.active .bar i::after { animation: none !important; }
  button, .tabs button { transition: none; }
}

/* =====================  PHONES & TABLETS (v3)  ===================== */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { overscroll-behavior-y: none; }
@media (pointer: coarse) {
  button { min-height: 46px; }                                  /* comfortable thumb targets (Apple / Google guidelines: 44-48px) */
  .xfer .acts button { min-height: 42px; padding: 8px 16px; }
  #transfer #tScan { min-height: 42px; }
  summary { min-height: 40px; display: list-item; padding: 6px 0; }
  .peer { min-height: 96px; }
}
@media (max-width: 700px) {
  input { font-size: 16px; }                                    /* below 16px iOS Safari zooms the page on focus */
  .app { justify-content: flex-start; padding-top: max(16px, env(safe-area-inset-top, 0px)); padding-bottom: calc(86px + env(safe-area-inset-bottom, 0px)); gap: 12px; }
  header .sub { display: none; }
  h1 { font-size: 1.25rem; letter-spacing: 0.12em; }
  #lobby, #transfer { padding: 16px; width: 100%; }
  #transfer .troom { display: grid; grid-template-columns: 1fr 1fr; }
  #transfer .troom input { grid-column: 1 / -1; width: 100%; }
  #transfer .troom button { width: 100%; }
  #transfer .peers { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #transfer .trow { align-items: flex-start; }
  .tquick { width: 100%; }
  .info { margin-bottom: calc(86px + env(safe-area-inset-bottom, 0px)); padding: 18px; }
  .controls { position: sticky; bottom: max(8px, env(safe-area-inset-bottom, 0px)); z-index: 5; }

  /* bottom tab bar, the way a phone app does it: always under the thumb, never scrolls away */
  .tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; margin: 0; gap: 0;
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
    background: rgba(16, 4, 44, 0.92); border-top: 1px solid var(--line);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    animation: barUp 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  }
  .tabs button { flex: 1; min-height: 52px; border-radius: 10px; margin: 0 4px; font-size: 0.85rem; }
  .tabs button::before { display: block; font-size: 1.2rem; line-height: 1.2; letter-spacing: 0; }
  #tabChat::before { content: "\1F4F9"; }
  #tabFiles::before { content: "\1F4C1"; }
}
@keyframes barUp { from { transform: translateY(100%); } to { transform: none; } }
@media (max-width: 700px) and (prefers-reduced-motion: reduce) { .tabs { animation: none; } }
@media (max-width: 380px) { #transfer .peers { grid-template-columns: 1fr; } }
@media (max-height: 520px) and (orientation: landscape) { .app { padding-bottom: 72px; } #transfer .radar-wrap { transform: scale(0.8); transform-origin: top center; } }

.vlink { color: var(--teal); text-decoration: underline; text-underline-offset: 3px; }
.vlink:hover { color: var(--pink-soft); }

/* =====================  THIRD TAB: VIDEO EDITOR LINK (v4)  ===================== */
.tabs a.tab {
  font: inherit; display: inline-flex; align-items: center; justify-content: center; text-decoration: none;
  padding: 10px 14px; border: 1px solid var(--line); border-radius: 4px; background: var(--panel); color: var(--pink-soft);
  text-transform: uppercase; letter-spacing: 0.1em; font-size: 0.8rem; touch-action: manipulation;
  transition: transform 0.15s ease, background 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
}
.tabs a.tab:active { transform: scale(0.96); }
.tabs a.tab:focus-visible { outline: 2px solid var(--pink-soft); outline-offset: 2px; }
.tabs a.tab[aria-selected="true"] { background: var(--pink); border-color: var(--pink); color: #1a000f; font-weight: 700; box-shadow: 0 0 14px rgba(255, 63, 164, 0.5); animation: tabGlow 2.6s ease-in-out infinite; }
@media (hover: hover) { .tabs a.tab:hover { background: rgba(255, 63, 164, 0.35); box-shadow: 0 0 14px rgba(255, 63, 164, 0.5); } .tabs a.tab[aria-selected="true"]:hover { background: var(--pink-soft); } }
@media (pointer: coarse) { .tabs a.tab { min-height: 46px; } }
@media (max-width: 700px) {
  .tabs a.tab { flex: 1; flex-direction: column; min-height: 52px; border-radius: 10px; margin: 0 4px; font-size: 0.72rem; letter-spacing: 0.06em; padding: 6px 4px; text-align: center; }
  .tabs a.tab::before { display: block; font-size: 1.2rem; line-height: 1.2; letter-spacing: 0; content: "\1F3AC"; }
  .tabs button { font-size: 0.72rem; letter-spacing: 0.06em; padding-inline: 4px; }
}
@media (prefers-reduced-motion: reduce) { .tabs a.tab, .tabs a.tab[aria-selected="true"] { animation: none !important; transition: none; } }

/* Room pairing card: QR code + code, shown while in a room */
.tpair { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; padding: 14px; border: 1px solid var(--line); border-radius: 6px; background: rgba(0, 0, 0, 0.35); }
.tpair[hidden] { display: none; }
.tpair img { background: #fff; padding: 6px; border-radius: 4px; image-rendering: pixelated; }
.tpair-text { display: grid; gap: 6px; flex: 1 1 200px; min-width: 0; font-size: 0.78rem; color: var(--pink-soft); line-height: 1.5; }
.tpair-text small { letter-spacing: 0.12em; text-transform: uppercase; }
.tpair-text strong { font-size: 1.5rem; letter-spacing: 0.3em; color: var(--pink); text-shadow: 0 0 12px var(--pink); overflow-wrap: anywhere; }

/* keyword line inside the home <h1> */
h1 .kw { display: block; margin-top: 4px; font-size: 0.42em; letter-spacing: 0.16em; font-weight: 600; text-transform: uppercase; opacity: 0.85; }
