:root {
  --bg: #f7f8fb;
  --panel: #ffffff;
  --ink: #07091f;
  --muted: #59607b;
  --soft: #868ca7;
  --line: #e8ebf4;
  --primary: #5532f4;
  --primary-dark: #4322e7;
  --green: #1ab458;
  --blue: #1265ff;
  --orange: #fb7a18;
  --red: #f12839;
  --shadow: 0 18px 46px rgba(20, 27, 70, 0.07), 0 2px 10px rgba(20, 27, 70, 0.04);
  --soft-shadow: 0 12px 28px rgba(20, 27, 70, 0.06);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}
/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--line);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-dark);
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--primary) var(--line);
}

button,
input {
  font: inherit;
}

/* Remove up/down arrows (spin buttons) from number inputs */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type=number] {
  -moz-appearance: textfield;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

.icon-sprite {
  display: none;
}

svg {
  display: block;
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.page {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(760px, 1090px) minmax(140px, 1fr);
  gap: 24px;
  align-items: stretch;
  justify-content: center;
  max-width: 1600px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 16px 18px 22px;
}

.sidebar-shell {
  border: 1px solid #dfe3ee;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.55);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.ad-rail {
  position: sticky;
  top: 16px;
  align-self: start;
  height: calc(100vh - 38px);
  min-height: 520px;
  overflow: hidden;
}

.ad-slot {
  width: 100%;
  min-height: 280px;
}

.dashboard {
  display: flex;
  flex-direction: row;
  gap: 24px;
  width: 100%;
  max-width: 1090px;
  padding-top: 10px;
}

.dashboard-main {
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
  min-width: 0;
}

.panel {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.desktop-sidebar {
  display: flex;
  flex-direction: column;
  padding-top: 10px;
}

.desktop-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: sticky;
  top: 20px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 16px;
  box-shadow: 0 12px 36px rgba(20, 27, 70, 0.04);
  height: calc(100vh - 140px);
  overflow-y: auto;
}

.desktop-nav a {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  color: #4b5563;
  text-decoration: none;
  border-radius: 12px;
  font-weight: 650;
  font-size: 15px;
  transition: all 0.2s;
}

.desktop-nav a:hover {
  background: rgba(0, 0, 0, 0.04);
  color: #111827;
}

.desktop-nav a.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(85, 50, 244, 0.25);
  border: 1px solid var(--primary);
}

.desktop-nav a svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.desktop-nav a.active svg {
  fill: currentColor;
}

.mobile-header,
.mobile-actions,
.bottom-nav {
  display: none;
}

.room-panel {
  display: grid;
  grid-template-columns: 1fr minmax(300px, 420px);
  gap: 34px;
  align-items: center;
  min-height: 232px;
  padding: 40px 38px 36px 44px;
}

.room-main {
  min-width: 0;
}

.eyebrow {
  display: block;
  color: #202744;
  font-size: 15px;
  font-weight: 650;
  margin-bottom: 22px;
}

.room-code-row {
  display: flex;
  align-items: center;
  gap: 24px;
}

.room-code {
  color: var(--primary);
  font-size: clamp(3rem, 5vw, 4.25rem);
  font-weight: 800;
  line-height: 0.86;
  letter-spacing: 0;
}

.copy-button,
.icon-button {
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  background: #fff;
  color: #101735;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.copy-button {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  box-shadow: 0 8px 20px rgba(28, 32, 79, 0.05);
}

.copy-button svg {
  width: 23px;
  height: 23px;
}

.copy-button:hover,
.icon-button:hover,
.action-button:hover,
.sort-button:hover,
.add-files:hover {
  transform: translateY(-1px);
}

.status-line {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-top: 30px;
  color: #26304f;
  font-size: 15px;
  font-weight: 500;
}

.status-line span,
.device-card p span {
  display: inline-block;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--green);
}

.mobile-status-line {
  display: none !important;
}

.join-block {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 22px;
  align-items: center;
  min-height: 165px;
  padding-left: 22px;
  border-left: 1px solid var(--line);
}

.qr-card {
  display: grid;
  place-items: center;
  width: 160px;
  height: 160px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(22, 28, 72, 0.08);
}

.qr-code {
  display: grid;
  grid-template-columns: repeat(25, 1fr);
  grid-template-rows: repeat(25, 1fr);
  width: 128px;
  height: 128px;
  gap: 2px;
  background: #fff;
}

.qr-code span {
  min-width: 0;
  min-height: 0;
}

.qr-code i {
  display: block;
  width: 100%;
  height: 100%;
  background: #0a0a0a;
}

.join-copy {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: #14162a;
}

.join-copy strong {
  font-size: 16px;
  font-weight: 800;
}

.join-copy span {
  color: #303954;
  font-size: 15px;
  line-height: 1.45;
}

.action-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: #10142c;
  cursor: pointer;
  font-size: 15px;
  font-weight: 800;
  box-shadow: 0 10px 24px rgba(20, 27, 70, 0.06);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.action-button svg {
  width: 24px;
  height: 24px;
}

.action-button.primary {
  border-color: transparent;
  background: linear-gradient(180deg, #6442ff 0%, #4422ed 100%);
  color: #fff;
  box-shadow: 0 12px 26px rgba(83, 50, 244, 0.25);
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.section-heading h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.2;
}

.section-heading a {
  color: var(--primary-dark);
  font-size: 15px;
  font-weight: 800;
  white-space: nowrap;
}

.devices-panel {
  padding: 26px 28px 24px;
}

.devices-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 16px;
}

.device-card {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: center;
  min-height: 110px;
  padding: 14px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 10px 26px rgba(20, 27, 70, 0.045);
}

.you-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  min-width: 44px;
  padding: 6px 10px;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.device-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  margin-bottom: 10px;
  color: #111426;
}

.device-icon svg {
  width: 24px;
  height: 24px;
  stroke-width: 1.8;
}

.device-icon.purple,
.stat-icon.purple {
  background: #ede6ff;
  color: #5632f1;
}

.device-icon.green,
.stat-icon.green {
  background: #e5f8e8;
  color: #16ab50;
}

.device-icon.blue,
.stat-icon.blue {
  background: #e4f3ff;
  color: #116aff;
}

.device-icon.peach,
.stat-icon.orange {
  background: #fff0dd;
  color: #f47b19;
}

.device-card h3 {
  width: 100%;
  margin: 0 0 8px;
  overflow: hidden;
  color: #111111;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.device-card p {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0;
  color: #2d3655;
  font-size: 12px;
}

.device-card p span {
  width: 8px;
  height: 8px;
}

.mini-devices .device-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  min-height: auto;
  padding: 6px 12px;
  gap: 8px;
  background: rgba(255, 255, 255, 0.5);
}
html[data-theme="dark"] .mini-devices .device-card {
  background: var(--panel);
}
.mini-devices .device-card .device-icon {
  width: 24px;
  height: 24px;
  margin-bottom: 0;
}
.mini-devices .device-card .device-icon svg {
  width: 14px;
  height: 14px;
}
.mini-devices .device-card h3 {
  font-size: 13px;
  margin-bottom: 0;
  white-space: nowrap;
}
.mini-devices .device-card p {
  display: none;
}

.content-grid {
  display: block;
}

.transfers-panel {
  height: calc(100vh - 140px);
  min-height: 386px;
  padding: 14px 24px 0px;
  display: flex;
  flex-direction: column;
  margin-top: 10px;
  border-radius: 0;
}

.file-heading {
  align-items: center;
}

.file-tools {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 164px;
  height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: #293250;
  box-shadow: 0 8px 18px rgba(20, 27, 70, 0.04);
}

.search-box svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 13px;
}

.search-box input::placeholder {
  color: #3a4260;
}

.sort-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 42px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: #11162c;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(20, 27, 70, 0.04);
}

.sort-button svg {
  width: 16px;
  height: 16px;
}

.files-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px 12px;
}

.file-card {
  min-width: 0;
  min-height: 110px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 10px 22px rgba(20, 27, 70, 0.035);
}

.file-card h3 {
  margin: 9px 11px 5px;
  overflow: hidden;
  color: #101225;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-card p {
  margin: 0 11px 10px;
  color: #36405d;
  font-size: 12px;
  line-height: 1.1;
}

.thumb {
  position: relative;
  height: 88px;
  overflow: hidden;
  background-size: cover;
  background-position: center;
}

.thumb::before,
.thumb::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.thumb-one {
  background:
    radial-gradient(circle at 14% 82%, #fdc83a 0 8%, transparent 9%),
    linear-gradient(145deg, transparent 0 56%, rgba(13, 92, 53, 0.85) 57% 100%),
    linear-gradient(30deg, #283b53 0 28%, #f86a31 29% 43%, #813bd7 44% 60%, #179d68 61% 100%);
}

.thumb-one::before {
  inset: 58% 0 0;
  background: repeating-linear-gradient(90deg, #1b1f37 0 5px, transparent 5px 30px);
}

.thumb-one::after {
  left: 14px;
  bottom: 13px;
  width: 62px;
  height: 26px;
  border-bottom: 6px solid #00aa6a;
  border-left: 6px solid #f66b29;
  transform: skewX(-18deg);
}

.thumb-two {
  background:
    radial-gradient(circle at 70% 22%, #fff5a6 0 9%, transparent 10%),
    linear-gradient(145deg, transparent 0 58%, rgba(15, 139, 70, 0.85) 59% 100%),
    linear-gradient(35deg, #0e67b2 0 42%, #4fc3ff 43% 60%, #fe8f51 61% 100%);
}

.thumb-two::before {
  left: 22px;
  bottom: 18px;
  width: 38px;
  height: 38px;
  background: #eb4ba0;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.thumb-two::after {
  left: 58px;
  bottom: 16px;
  width: 30px;
  height: 42px;
  background: #3a2cc1;
  border-radius: 50% 50% 0 0;
}

.thumb-three {
  background:
    radial-gradient(circle at 64% 20%, #fff4a0 0 11%, transparent 12%),
    linear-gradient(155deg, transparent 0 55%, rgba(44, 124, 44, 0.9) 56% 100%),
    linear-gradient(35deg, #473319 0 30%, #766d21 31% 50%, #6dc65a 51% 100%);
}

.thumb-three::before {
  left: 14px;
  bottom: 17px;
  width: 78px;
  height: 10px;
  background: #c87626;
  transform: rotate(-14deg);
}

.thumb-three::after {
  left: 44px;
  top: 16px;
  width: 46px;
  height: 64px;
  border-left: 5px solid rgba(57, 45, 24, 0.8);
  border-top: 5px solid rgba(57, 45, 24, 0.8);
  transform: rotate(30deg);
}

.thumb-video {
  display: grid;
  place-items: center;
  background:
    linear-gradient(rgba(21, 13, 12, 0.42), rgba(21, 13, 12, 0.42)),
    radial-gradient(circle at 28% 38%, #f0bd8d 0 12%, transparent 13%),
    radial-gradient(circle at 76% 40%, #ffe0c3 0 13%, transparent 14%),
    linear-gradient(115deg, #6c341f 0 42%, #25181b 43% 100%);
}

.thumb-video span {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.42);
  color: #fff;
}

.thumb-video svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
  stroke: currentColor;
}

.file-icon,
.transfer-icon {
  position: relative;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 900;
  line-height: 1;
}

.file-icon {
  width: 46px;
  height: 58px;
  margin: 12px auto 15px;
  border-radius: 8px;
  font-size: 14px;
}

.file-icon::after,
.transfer-icon::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 15px;
  height: 15px;
  background: rgba(255, 255, 255, 0.35);
  clip-path: polygon(0 0, 100% 100%, 100% 0);
}

.file-icon.zip,
.transfer-icon.zip {
  background: linear-gradient(180deg, #6544ff, #421de7);
}

.file-icon.video,
.transfer-icon.video {
  background: linear-gradient(180deg, #ff8b20, #ff5a06);
}

.file-icon.doc {
  background: linear-gradient(180deg, #2177ff, #0950da);
}

.file-icon.pdf {
  background: linear-gradient(180deg, #ff3a4d, #d91628);
}

.file-icon svg {
  width: 19px;
  height: 19px;
  fill: currentColor;
  stroke: currentColor;
}

.view-files {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  margin-top: 22px;
  color: var(--primary-dark);
  font-size: 15px;
  font-weight: 800;
}



.transfer-list {
  display: flex;
  flex-direction: column;
  gap: 28px;
  flex: 1;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 12px;
}
.transfer-list::-webkit-scrollbar {
  width: 6px;
}
.transfer-list::-webkit-scrollbar-track {
  background: transparent;
}
.transfer-list::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 4px;
}
.transfer-list::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

.transfer-item {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 18px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 16px;
}

.transfer-icon {
  width: 50px;
  height: 58px;
  border-radius: 8px;
  font-size: 14px;
}

.transfer-icon svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
  stroke: currentColor;
}

.transfer-icon.image {
  background: linear-gradient(180deg, #6744ff, #4220e5);
}

.transfer-top,
.transfer-meta {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 14px;
}

.transfer-top h3 {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: #111223;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.transfer-top strong {
  color: #111223;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}

.transfer-meta {
  grid-template-columns: 1fr auto auto;
  margin-top: 10px;
  color: #38415f;
  font-size: 13px;
  line-height: 1.2;
}

.transfer-meta .complete {
  color: var(--green);
  font-weight: 800;
}

.progress {
  height: 5px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #dfe2ea;
}

.progress span {
  display: block;
  width: var(--value);
  height: 100%;
  border-radius: inherit;
  background: var(--bar);
}

.add-files {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  width: 100%;
  min-height: 46px;
  margin-top: 18px;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  color: var(--primary);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: transform 0.2s;
}

.add-files svg {
  width: 17px;
  height: 17px;
}

.stats-panel {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  gap: 0;
  min-height: 108px;
  padding: 24px 28px;
}

.stat-item {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 16px;
  align-items: center;
  min-width: 0;
  padding-right: 22px;
}

.stat-item + .stat-item {
  border-left: 1px solid var(--line);
  padding-left: 22px;
}

.stat-icon {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border-radius: 12px;
}

.stat-icon svg {
  width: 26px;
  height: 26px;
}

.stat-item small,
.stat-item em {
  display: block;
}

.stat-item small {
  color: #363f5d;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.2;
}

.stat-item strong {
  display: block;
  margin: 7px 0 4px;
  color: #111321;
  font-size: 19px;
  font-weight: 850;
  line-height: 1;
}

.stat-item em {
  color: #24314d;
  font-size: 12px;
  font-style: normal;
  line-height: 1.2;
}

.green-text {
  color: var(--green);
}

.blue-text {
  color: var(--blue) !important;
}

.orange-text {
  color: var(--orange) !important;
}

.stat-item:nth-child(1) em {
  color: var(--green);
}

.stat-item:nth-child(2) em {
  color: var(--blue);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 20;
  max-width: min(90vw, 360px);
  padding: 12px 18px;
  border-radius: 999px;
  background: #10142c;
  color: #fff;
  font-size: 14px;
  font-weight: 750;
  box-shadow: 0 14px 36px rgba(9, 12, 33, 0.24);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 14px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.js .panel,
.js .ad-rail,
.js .mobile-actions .action-button,
.js .desktop-actions .action-button,
.js .device-card,
.js .file-card,
.js .transfer-item,
.js .stat-item,
.reveal-target {
  --reveal-y: 34px;
  --reveal-x: 0;
  --reveal-scale: 1;
  transition:
    opacity 760ms ease,
    transform 880ms cubic-bezier(0.16, 0.84, 0.18, 1),
    filter 760ms ease;
  transition-delay: var(--reveal-delay, 0ms);
  will-change: opacity, transform, filter;
}

.js .panel:not(.is-visible),
.js .ad-rail:not(.is-visible),
.js .mobile-actions .action-button:not(.is-visible),
.js .desktop-actions .action-button:not(.is-visible),
.js .device-card:not(.is-visible),
.js .file-card:not(.is-visible),
.js .transfer-item:not(.is-visible),
.js .stat-item:not(.is-visible),
.reveal-target:not(.is-visible) {
  opacity: 0;
  transform: translate3d(var(--reveal-x), var(--reveal-y), 0) scale(var(--reveal-scale));
  filter: blur(14px);
}

.js .mobile-actions .action-button:not(.is-visible),
.js .desktop-actions .action-button:not(.is-visible),
.js .device-card:not(.is-visible),
.js .stat-item:not(.is-visible),
.reveal-target[data-reveal="pop"] {
  --reveal-y: 18px;
  --reveal-scale: 0.9;
}

.js .ad-rail-right:not(.is-visible),
.js .transfer-item:not(.is-visible),
.reveal-target[data-reveal="slide-left"] {
  --reveal-x: 42px;
  --reveal-y: 0;
}

.js .ad-rail-left:not(.is-visible),
.reveal-target[data-reveal="slide-right"] {
  --reveal-x: -42px;
  --reveal-y: 0;
}

.js .panel.is-visible,
.js .ad-rail.is-visible,
.js .mobile-actions .action-button.is-visible,
.js .desktop-actions .action-button.is-visible,
.js .device-card.is-visible,
.js .file-card.is-visible,
.js .transfer-item.is-visible,
.js .stat-item.is-visible,
.reveal-target.is-visible {
  animation: reveal-in 920ms cubic-bezier(0.16, 0.84, 0.18, 1) both;
  animation-delay: var(--reveal-delay, 0ms);
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
  filter: blur(0);
}

.reveal-target.reveal-done {
  will-change: auto;
}

.js .progress span {
  transform: scaleX(0);
  transform-origin: left center;
}

.transfer-item.is-visible .progress span {
  animation: fill-progress 1100ms cubic-bezier(0.16, 0.84, 0.18, 1) forwards;
  animation-delay: calc(var(--reveal-delay, 0ms) + 220ms);
}

.qr-code i {
  transition: transform 420ms ease, opacity 420ms ease;
}

.room-panel.is-visible .qr-code i {
  animation: qr-pop 560ms ease both;
  animation-delay: calc(var(--qr-delay, 0ms) + 180ms);
}

@keyframes fill-progress {
  to {
    transform: scaleX(1);
  }
}

@keyframes reveal-in {
  0% {
    opacity: 0;
    transform: translate3d(var(--reveal-x), var(--reveal-y), 0) scale(var(--reveal-scale));
    filter: blur(14px);
  }

  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
    filter: blur(0);
  }
}

@keyframes qr-pop {
  0% {
    opacity: 0;
    transform: scale(0.25);
  }

  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@media (max-width: 1240px) {
  .page {
    grid-template-columns: minmax(96px, 1fr) minmax(720px, 1040px) minmax(96px, 1fr);
    gap: 22px;
    padding-right: 16px;
    padding-left: 16px;
  }

  .room-panel {
    grid-template-columns: 1fr minmax(260px, 350px);
    gap: 24px;
    padding-left: 34px;
    padding-right: 30px;
  }

  .devices-grid {
    gap: 14px;
  }

  .files-panel,
  .transfers-panel {
    padding-left: 22px;
    padding-right: 22px;
  }
}

@media (max-width: 1060px) {
  .page {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .ad-rail, .desktop-sidebar {
    display: none;
  }

  .dashboard {
    max-width: 1040px;
    margin: 0 auto;
  }
}

@media (max-width: 760px) {
  body {
    background: var(--bg);
  }

  .page {
    display: block;
    padding: 0;
  }

  .dashboard {
    max-width: 430px;
    min-height: 100vh;
    flex-direction: column;
    gap: 16px;
    margin: 0 auto;
    padding: 14px 16px 94px;
    background: var(--bg);
  }

  .mobile-header {
    display: grid;
    grid-template-columns: 40px 1fr 40px;
    align-items: center;
    min-height: 68px;
  }

  .icon-button.ghost {
    width: 40px;
    height: 40px;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .icon-button svg {
    width: 23px;
    height: 23px;
  }

  .brand {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 11px;
    color: #090b18;
    font-size: 18px;
    font-weight: 850;
  }

  .brand-mark {
    position: relative;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: linear-gradient(135deg, #6a46ff, #0bc5d8);
    transform: rotate(4deg);
  }

  .brand-mark::after {
    content: "";
    position: absolute;
    inset: 7px;
    border-radius: 5px;
    background: #fff;
  }

  .panel {
    border-radius: 18px;
    box-shadow: 0 14px 38px rgba(39, 43, 93, 0.06);
  }

  .room-panel {
    display: block;
    min-height: 0;
    padding: 16px 20px 20px;
    border-color: #e7e0fb;
    box-shadow: 0 18px 44px rgba(83, 50, 244, 0.06);
  }

  .eyebrow {
    margin-bottom: 8px;
    font-size: 13px;
  }

  .room-code-row {
    gap: 14px;
  }

  .room-code {
    font-size: 32px;
    line-height: 1;
  }

  .copy-button {
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 8px;
    box-shadow: none;
  }

  .copy-button svg {
    width: 18px;
    height: 18px;
  }

  .status-line {
    gap: 12px;
    margin-top: 13px;
    color: var(--green);
    font-size: 13px;
    font-weight: 750;
  }

  .status-line span {
    width: 11px;
    height: 11px;
  }

  .mobile-status-line {
    display: flex !important;
    justify-content: center;
    margin-top: 0 !important;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
    color: var(--muted) !important;
    font-weight: 500 !important;
  }

  .join-block {
    grid-template-columns: 104px 1fr;
    gap: 22px;
    min-height: 0;
    margin-top: 16px;
    padding-left: 0;
    border-left: 0;
  }

  .qr-card {
    width: 104px;
    height: 104px;
    border-radius: 12px;
  }

  .qr-code {
    width: 82px;
    height: 82px;
    gap: 1px;
  }

  .join-copy {
    gap: 8px;
  }

  .join-copy strong {
    font-size: 14px;
  }

  .join-copy span {
    font-size: 13px;
    line-height: 1.35;
  }

  .desktop-actions,
  .files-panel,
  .stats-panel {
    display: none;
  }

  .mobile-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 18px;
  }

  .action-button {
    min-width: 0;
    min-height: 58px;
    gap: 11px;
    border-radius: 10px;
    font-size: 13px;
    box-shadow: 0 10px 24px rgba(20, 27, 70, 0.06);
  }

  .action-button svg {
    width: 23px;
    height: 23px;
  }

  .devices-panel {
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .section-heading {
    margin-bottom: 15px;
  }

  .section-heading h2 {
    font-size: 16px;
  }

  .section-heading a {
    font-size: 13px;
  }

  .devices-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
  }

  .device-card {
    min-height: 96px;
    padding: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
  }

  .mobile-hide {
    display: none;
  }

  .you-badge {
    top: -1px;
    right: 2px;
    min-width: 30px;
    padding: 3px 7px 4px;
    border-radius: 8px;
    font-size: 10px;
  }

  .device-icon {
    width: 50px;
    height: 50px;
    margin-bottom: 9px;
  }

  .device-icon svg {
    width: 27px;
    height: 27px;
  }

  .device-card h3 {
    margin-bottom: 8px;
    font-size: clamp(10px, 2.65vw, 12px);
    line-height: 1.1;
  }

  .device-card p {
    gap: 6px;
    font-size: 11px;
  }

  .device-card p span {
    width: 8px;
    height: 8px;
  }

  .content-grid {
    display: block;
  }

  .transfers-panel {
    display: flex;
    flex-direction: column;
    min-height: calc(80vh - 150px);
    padding: 14px 20px 0px;
    margin-bottom: 80px;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .transfer-list {
    gap: 10px;
  }

  .desktop-empty-text { display: none !important; }
  .mobile-empty-text { display: block !important; }

  .transfer-item {
    grid-template-columns: 42px 1fr;
    gap: 12px;
    min-height: 62px;
    padding: 13px 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: transparent;
  }

  .transfer-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    font-size: 9px;
  }

  .transfer-icon::after {
    width: 10px;
    height: 10px;
  }

  .transfer-icon svg {
    width: 16px;
    height: 16px;
  }

  .transfer-top {
    gap: 9px;
  }

  .transfer-top h3 {
    font-size: 12px;
  }

  .transfer-top strong {
    font-size: 11px;
  }

  .transfer-meta {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    margin-top: 0;
    font-size: 11px;
  }

  .transfer-meta span:first-child,
  .transfer-meta span:nth-child(3) {
    display: none;
  }

  .transfer-meta span:nth-child(2) {
    display: block;
  }

  .transfer-meta .complete {
    grid-column: 2;
    font-size: 10px;
  }

  .progress {
    height: 4px;
    margin-top: 8px;
  }

  .bottom-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    max-width: 430px;
    min-height: 70px;
    margin: 0 auto;
    padding: 8px 12px 9px;
    border-top: 1px solid #eceef7;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 -10px 26px rgba(20, 27, 70, 0.06);
    backdrop-filter: blur(12px);
  }

  .bottom-nav a {
    display: grid;
    justify-items: center;
    gap: 4px;
    color: #101735;
    font-size: 10px;
    font-weight: 650;
  }

  .bottom-nav svg {
    width: 23px;
    height: 23px;
  }

  .bottom-nav .active {
    color: var(--primary-dark);
    font-weight: 850;
  }

  .bottom-nav .active svg {
    fill: currentColor;
  }

  .toast {
    bottom: 84px;
  }

}

/* Tabbed Navigation Logic for Desktop and Mobile */
.dashboard[data-active-tab="home"] .transfers-panel,
.dashboard[data-active-tab="home"] .stats-panel {
  display: none !important;
}
.dashboard[data-active-tab="transfers"] .room-panel,
.dashboard[data-active-tab="transfers"] .devices-panel,
.dashboard[data-active-tab="transfers"] .stats-panel {
  display: none !important;
}

@media (max-width: 380px) {
  .dashboard {
    padding-right: 12px;
    padding-left: 12px;
  }

  .mobile-actions {
    gap: 12px;
  }

  .action-button {
    gap: 8px;
    font-size: 12px;
  }

  .devices-grid {
    gap: 8px;
  }
}

/* DARK MODE OVERRIDES FOR DASHBOARD */
html[data-theme="dark"] .sidebar-shell,
html[data-theme="dark"] .panel,
html[data-theme="dark"] .desktop-nav {
  background: var(--panel);
  border-color: var(--border);
  box-shadow: none;
}
html[data-theme="dark"] .desktop-nav a {
  color: #fff;
}
html[data-theme="dark"] .desktop-nav a:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink);
}
html[data-theme="dark"] .action-button:not(.primary) {
  background: var(--panel);
  border-color: var(--border);
  color: var(--ink);
}
html[data-theme="dark"] .action-button:not(.primary):hover {
  background: #1a1d2d;
}
html[data-theme="dark"] .device-card,
html[data-theme="dark"] .file-card {
  background: var(--panel);
  border-color: var(--border);
}
html[data-theme="dark"] .device-card:hover,
html[data-theme="dark"] .file-card:hover {
  border-color: var(--primary);
  background: #1a1d2d;
}
html[data-theme="dark"] .bottom-nav {
  background: rgba(11, 12, 16, 0.95);
  border-top-color: var(--border);
}
html[data-theme="dark"] .bottom-nav a {
  color: var(--muted);
}
html[data-theme="dark"] .bottom-nav a.active {
  color: var(--primary);
}
html[data-theme="dark"] .join-block {
  background: transparent;
  border-color: var(--border);
}
html[data-theme="dark"] .qr-card {
  background: #ffffff; /* keep QR card white so code is scannable */
  border-color: var(--border);
}
html[data-theme="dark"] .qr-code i {
  background: #000000; /* keep QR dots black */
}
html[data-theme="dark"] .icon-button.ghost {
  color: var(--ink);
}
html[data-theme="dark"] .icon-button.ghost:hover {
  background: rgba(255, 255, 255, 0.05);
}
html[data-theme="dark"] .status-line,
html[data-theme="dark"] .status-line span {
  color: var(--muted);
}

/* FIX ALL TEXT COLORS */
html[data-theme="dark"] h1, 
html[data-theme="dark"] h2, 
html[data-theme="dark"] h3, 
html[data-theme="dark"] strong, 
html[data-theme="dark"] .brand-mark + span,
html[data-theme="dark"] .room-code,
html[data-theme="dark"] .action-button span,
html[data-theme="dark"] .device-card h3,
html[data-theme="dark"] .device-card strong,
html[data-theme="dark"] .file-card h3,
html[data-theme="dark"] .file-card strong {
  color: var(--ink) !important;
}

html[data-theme="dark"] .eyebrow,
html[data-theme="dark"] p,
html[data-theme="dark"] small,
html[data-theme="dark"] em,
html[data-theme="dark"] span,
html[data-theme="dark"] .join-copy span,
html[data-theme="dark"] .device-card small,
html[data-theme="dark"] .device-card em,
html[data-theme="dark"] .file-card small,
html[data-theme="dark"] .file-card em,
html[data-theme="dark"] .file-meta {
  color: var(--muted) !important;
}

html[data-theme="dark"] .progress-track {
  background: var(--border);
}
html[data-theme="dark"] .toast {
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--border);
}
html[data-theme="dark"] .section-heading h2 {
  color: var(--ink) !important;
}
html[data-theme="dark"] .section-heading a {
  color: var(--primary) !important;
}
html[data-theme="dark"] .copy-button {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
}
html[data-theme="dark"] .copy-button:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--ink);
}

/* DANGER BUTTON CSS */
.action-button.danger-action {
  background: rgba(255, 60, 60, 0.1) !important;
  color: #ff3c3c !important;
  border: 1px solid rgba(255, 60, 60, 0.3) !important;
  box-shadow: none !important;
}
.action-button.danger-action span {
  color: #ff3c3c !important;
}
.action-button.danger-action svg {
  stroke: #ff3c3c !important;
  fill: none !important;
}

/* Modal Styles */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(10px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 250ms ease;
}

.overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  position: relative;
  width: 100%;
  max-width: 400px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 32px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.1);
  transform: translateY(20px);
  transition: transform 300ms cubic-bezier(0.16, 1, 0.3, 1);
}

.overlay.active .modal {
  transform: translateY(0);
}

.close-button {
  position: absolute;
  top: 24px;
  right: 24px;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  transition: color 150ms ease;
}

.close-button:hover {
  color: var(--ink);
}

.close-button svg {
  width: 20px;
  height: 20px;
}

.modal-header h2 {
  margin: 0 0 8px;
  font-size: 20px;
  color: var(--ink);
}

.modal-header p {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.modal-body {
  margin: 24px 0;
}

.code-input {
  width: 100%;
  padding: 16px;
  font-size: 24px;
  font-weight: 800;
  text-align: center;
  letter-spacing: 4px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  color: var(--ink);
  transition: border-color 200ms ease;
}

.code-input:focus {
  outline: none;
  border-color: var(--primary);
}

.full-width {
  width: 100%;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 24px;
  font-size: 15px;
  font-weight: 700;
  border-radius: 12px;
  cursor: pointer;
  border: none;
  transition: transform 150ms ease, opacity 150ms ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn.primary {
  background: var(--primary);
  color: white;
}

.btn.primary:hover {
  opacity: 0.9;
}

html[data-theme="dark"] .overlay {
  background: rgba(0, 0, 0, 0.8);
}

html[data-theme="dark"] .modal {
  background: var(--panel);
  border-color: var(--line);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
}
html[data-theme="dark"] .code-input {
  background: #111426;
  border-color: var(--line);
  color: #fff;
}

.transfers-panel.drag-over { border: 2px dashed var(--primary); background: rgba(85, 50, 244, 0.05) !important; border-radius: 18px; } html[data-theme='dark'] .transfers-panel.drag-over { background: rgba(85, 50, 244, 0.1) !important; }

html[data-theme="dark"] .add-files {
  color: #fff;
}

.refresh-link {
  font-size: 11px;
  color: var(--primary);
  text-decoration: none;
  padding: 2px 4px;
  display: inline-block;
  white-space: nowrap;
  margin-left: 12px;
  font-weight: 500;
}

html[data-theme="dark"] .refresh-link {
  color: #fff;
}

/* Custom Pulse Animations for Network Status */
.pulse-yellow { background: var(--yellow) !important; animation: pulse-yellow 1.5s infinite; }
.pulse-green { background: var(--green) !important; animation: pulse-green 1.5s infinite; }
.pulse-blue { background: var(--blue) !important; animation: pulse-blue 1.5s infinite; }

@keyframes pulse-yellow {
  0% { box-shadow: 0 0 0 0 rgba(255, 179, 64, 0.7); }
  70% { box-shadow: 0 0 0 8px rgba(255, 179, 64, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 179, 64, 0); }
}
@keyframes pulse-green {
  0% { box-shadow: 0 0 0 0 rgba(32, 217, 148, 0.7); }
  70% { box-shadow: 0 0 0 8px rgba(32, 217, 148, 0); }
  100% { box-shadow: 0 0 0 0 rgba(32, 217, 148, 0); }
}
@keyframes pulse-blue {
  0% { box-shadow: 0 0 0 0 rgba(18, 101, 255, 0.7); }
  70% { box-shadow: 0 0 0 8px rgba(18, 101, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(18, 101, 255, 0); }
}
