@import url("https://fonts.googleapis.com/css2?family=Audiowide&family=Chakra+Petch:wght@400;600;700&display=swap");

:root {
  color-scheme: dark;
  --accent: #00b3ff;
  --accent-rgb: 0, 179, 255;
  --hot: #fd01c7;
  --lime: #98ff37;
  --panel: rgba(5, 14, 18, 0.9);
  --panel-2: rgba(8, 22, 28, 0.78);
  --text: #f2fffe;
  --muted: rgba(242, 255, 254, 0.72);
  --line: rgba(var(--accent-rgb), 0.2);
  background: #000;
  font-family: "Chakra Petch", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

*,
*::before,
*::after {
  -webkit-tap-highlight-color: transparent;
}

html,
body,
#root {
  min-width: 320px;
  width: 100%;
  height: 100%;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  touch-action: manipulation;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

body {
  background: #000;
  color: var(--text);
  font-family: "Chakra Petch", system-ui, sans-serif;
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
}

button,
a,
input,
textarea,
iframe,
audio,
video {
  font: inherit;
}

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

button,
a,
img,
.action,
.file-pill,
.qr-box,
.qr-modal-card,
.pdf-preview,
.hud-audio-play,
.type-chip,
.module-label,
.stage-label {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

img {
  -webkit-user-drag: none;
  user-drag: none;
  pointer-events: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

.hud-audio-range {
  -webkit-user-select: auto;
  user-select: auto;
}

.hidden {
  display: none !important;
}

.app-shell {
  position: relative;
  isolation: isolate;
  height: 100dvh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: clamp(10px, 2.4vw, 28px);
  overflow: hidden;
  background: #000;
}

.gradient-bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 14%, rgba(255, 255, 255, 0.08), transparent 26%),
    linear-gradient(40deg, #5d008d, #001152 52%, #02040a);
}

.gradient-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.42;
  background-image:
    linear-gradient(rgba(var(--accent-rgb), 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(var(--accent-rgb), 0.08) 1px, transparent 1px);
  background-size: 38px 38px;
  mask-image: radial-gradient(circle at center, #000 0 58%, transparent 82%);
}

.gradient-bg span {
  position: absolute;
  width: var(--blob-size);
  height: var(--blob-size);
  left: var(--blob-x);
  top: var(--blob-y);
  border-radius: 44% 56% 59% 41% / 47% 42% 58% 53%;
  filter: blur(36px);
  mix-blend-mode: hard-light;
  opacity: 0.78;
  animation: float-blob 10s ease-in-out infinite alternate;
}

.gradient-bg span:nth-child(1) {
  background: radial-gradient(circle, rgba(0, 232, 255, 0.75), transparent 66%);
}

.gradient-bg span:nth-child(2) {
  background: radial-gradient(circle, rgba(253, 1, 199, 0.66), transparent 65%);
  animation-delay: -2s;
}

.gradient-bg span:nth-child(3) {
  background: radial-gradient(circle, rgba(118, 72, 255, 0.72), transparent 64%);
  animation-delay: -4s;
}

.share-panel {
  width: min(1180px, 100%);
  height: 100%;
  max-height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 10px;
  padding: clamp(8px, 1vw, 14px);
  border: 1px solid rgba(var(--accent-rgb), 0.26);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(8, 18, 22, 0.95), rgba(4, 10, 14, 0.96)),
    var(--panel);
  box-shadow:
    0 30px 90px rgba(0, 0, 0, 0.58),
    0 0 0 1px rgba(255, 255, 255, 0.03) inset,
    0 0 48px rgba(var(--accent-rgb), 0.1);
  overflow: hidden;
}

.share-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 9px;
  border-bottom: 1px solid rgba(var(--accent-rgb), 0.18);
}

.title-stack {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-dot {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(var(--accent-rgb), 0.3);
  animation: pulse 1.7s ease-in-out infinite;
}

h1 {
  margin: 0;
  max-width: 72vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: "Audiowide", system-ui, sans-serif;
  font-size: clamp(16px, 2vw, 25px);
  line-height: 1.1;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.title-stack p {
  margin: 4px 0 0;
  max-width: 72vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
}

.type-chip {
  flex: 0 0 auto;
  min-width: 76px;
  padding: 7px 10px;
  border: 1px solid rgba(var(--accent-rgb), 0.36);
  border-radius: 4px;
  background: rgba(0, 179, 255, 0.09);
  color: var(--accent);
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.share-grid {
  min-height: 0;
  height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(250px, 0.72fr);
  gap: 10px;
}

.preview-stage {
  position: relative;
  isolation: isolate;
  height: 100%;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(var(--accent-rgb), 0.14);
  border-radius: 8px;
  background:
    radial-gradient(circle at center, rgba(var(--accent-rgb), 0.12), transparent 58%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 20%, rgba(255, 255, 255, 0.02)),
    rgba(2, 10, 14, 0.92);
}

.preview-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 0.72;
  background-image:
    linear-gradient(rgba(var(--accent-rgb), 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(var(--accent-rgb), 0.08) 1px, transparent 1px);
  background-size: 40px 40px;
}

.stage-label {
  position: absolute;
  top: 0;
  left: 12px;
  z-index: 3;
  padding: 3px 7px;
  border: 1px solid rgba(var(--accent-rgb), 0.18);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.44);
  color: rgba(242, 255, 254, 0.8);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.scanline {
  position: absolute;
  left: 0;
  right: 0;
  top: -12%;
  z-index: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(var(--accent-rgb), 0.9), transparent);
  animation: scan 3s linear infinite;
  pointer-events: none;
}

.preview-content {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: clamp(14px, 2vw, 24px);
}

.media {
  display: block;
  max-width: 100%;
  max-height: calc(100dvh - 170px);
  border-radius: 8px;
  background: #000;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.34);
}

.image-media {
  object-fit: contain;
}

.image-preview-btn {
  position: relative;
  display: grid;
  place-items: center;
  max-width: 100%;
  max-height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.image-preview-btn .image-media {
  pointer-events: none;
}

.image-open-badge {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 64px;
  height: 64px;
  transform: translate(-50%, -50%);
  border: 2px solid rgba(var(--accent-rgb), 0.62);
  border-radius: 50%;
  background: rgba(0, 5, 10, 0.68);
  box-shadow:
    0 0 32px rgba(0, 179, 255, 0.32),
    inset 0 0 20px rgba(0, 179, 255, 0.08);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  pointer-events: none;
}

.image-open-badge::before,
.image-open-badge::after {
  content: "";
  position: absolute;
  border-color: #fff;
  filter: drop-shadow(0 0 8px rgba(0, 179, 255, 0.9));
}

.image-open-badge::before {
  left: 19px;
  top: 19px;
  width: 18px;
  height: 18px;
  border: 3px solid #fff;
  border-radius: 50%;
}

.image-open-badge::after {
  left: 38px;
  top: 38px;
  width: 14px;
  height: 3px;
  border-radius: 999px;
  background: #fff;
  transform: rotate(45deg);
}

.image-preview-btn:hover .image-open-badge,
.image-preview-btn:focus .image-open-badge {
  border-color: var(--accent);
  background: rgba(0, 179, 255, 0.16);
  box-shadow: 0 0 44px rgba(0, 179, 255, 0.48), inset 0 0 20px rgba(0, 179, 255, 0.1);
}

.video-media {
  width: min(100%, 980px);
}

.pdf-preview {
  display: grid;
  gap: 12px;
  justify-items: center;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.pdf-preview span {
  position: relative;
  z-index: 2;
  padding: 8px 13px;
  border: 1px solid rgba(var(--accent-rgb), 0.32);
  border-radius: 6px;
  background:
    linear-gradient(180deg, rgba(4, 18, 24, 0.98), rgba(3, 13, 18, 0.98)),
    #031018;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.03) inset,
    0 10px 28px rgba(0, 0, 0, 0.22);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.pdf-cover {
  display: block;
  max-width: min(76vw, 360px);
  max-height: calc(100dvh - 230px);
  object-fit: contain;
  border-radius: 7px;
  box-shadow:
    0 22px 54px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(255, 255, 255, 0.12);
}

.audio-player {
  width: min(100%, 620px);
  display: grid;
  gap: 16px;
  justify-items: center;
  padding: clamp(18px, 4vw, 38px);
}

.audio-cover-shell {
  width: clamp(148px, 24vw, 238px);
  aspect-ratio: 1;
  display: block;
  padding: 8px;
  border: 1px solid rgba(var(--accent-rgb), 0.22);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 24%),
    rgba(0, 0, 0, 0.3);
  box-shadow:
    0 24px 58px rgba(0, 0, 0, 0.38),
    0 0 32px rgba(var(--accent-rgb), 0.12);
}

.audio-cover {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 7px;
}

.audio-cover-empty {
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at center, rgba(var(--accent-rgb), 0.24), transparent 58%),
    rgba(2, 12, 16, 0.94);
  color: var(--accent);
  font-family: "Audiowide", system-ui, sans-serif;
  font-size: 28px;
  letter-spacing: 0.04em;
}

.audio-title {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: "Audiowide", system-ui, sans-serif;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.audio-artist {
  max-width: 100%;
  margin-top: -10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: rgba(242, 255, 254, 0.72);
  font-size: 12px;
  letter-spacing: 0.04em;
}

.hud-audio-controls {
  width: min(100%, 540px);
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1px solid rgba(var(--accent-rgb), 0.2);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(5, 18, 24, 0.92), rgba(3, 11, 16, 0.96)),
    #030b10;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.02) inset;
}

.hud-audio-play {
  position: relative;
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  cursor: pointer;
}

.hud-audio-play-icon {
  position: absolute;
  top: 50%;
  left: 52%;
  width: 0;
  height: 0;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  border-left: 15px solid #fff;
  transform: translate(-50%, -50%);
}

.hud-audio-play.is-playing .hud-audio-play-icon {
  left: 50%;
  width: 16px;
  height: 20px;
  border: 0;
  background:
    linear-gradient(90deg, #fff 0 5px, transparent 5px 11px, #fff 11px 16px);
}

.hud-audio-timeline {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.hud-audio-range {
  --progress: 0%;
  width: 100%;
  height: 22px;
  margin: 0;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

.hud-audio-range::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background:
    linear-gradient(90deg, #7be7ff 0 var(--progress), rgba(255, 255, 255, 0.18) var(--progress) 100%);
}

.hud-audio-range::-webkit-slider-thumb {
  width: 16px;
  height: 16px;
  margin-top: -5px;
  appearance: none;
  border: 0;
  border-radius: 50%;
  background: #7be7ff;
  box-shadow: 0 0 14px rgba(123, 231, 255, 0.55);
}

.hud-audio-range::-moz-range-track {
  height: 6px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
}

.hud-audio-range::-moz-range-progress {
  height: 6px;
  border-radius: 999px;
  background: #7be7ff;
}

.hud-audio-range::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: 0;
  border-radius: 50%;
  background: #7be7ff;
  box-shadow: 0 0 14px rgba(123, 231, 255, 0.55);
}

.hud-audio-time {
  display: flex;
  justify-content: space-between;
  color: rgba(242, 255, 254, 0.82);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.audio-player audio {
  display: none;
}

.reader,
.html-frame,
.office-frame {
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: 100%;
  margin: 0;
  border: 1px solid rgba(var(--accent-rgb), 0.16);
  border-radius: 8px;
  background: rgba(2, 8, 12, 0.88);
  color: var(--text);
}

.preview-content.document-preview {
  position: absolute;
  inset: 0;
  height: 100%;
  min-height: 0;
  display: block;
  overflow: hidden;
}

.reader {
  overflow-x: auto;
  overflow-y: auto;
  padding: clamp(16px, 2vw, 26px);
  line-height: 1.55;
  white-space: pre-wrap;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
  -webkit-user-select: text;
  user-select: text;
}

.markdown-reader {
  white-space: normal;
}

.markdown-reader h1,
.markdown-reader h2,
.markdown-reader h3 {
  margin: 0 0 12px;
  font-family: "Audiowide", system-ui, sans-serif;
  letter-spacing: 0.03em;
}

.markdown-reader p {
  margin: 0 0 10px;
}

.md-bullet::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 10px;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: middle;
}

.html-frame,
.office-frame {
  display: block;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.file-card {
  width: min(100%, 520px);
  display: grid;
  justify-items: center;
  gap: 18px;
  padding: clamp(22px, 5vw, 44px);
  text-align: center;
}

.file-icon {
  width: clamp(112px, 18vw, 168px);
  aspect-ratio: 0.82;
  display: grid;
  place-items: center;
  border: 1px solid rgba(var(--accent-rgb), 0.28);
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.12), transparent 42%),
    rgba(0, 179, 255, 0.09);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.36);
  font-family: "Audiowide", system-ui, sans-serif;
  font-size: clamp(20px, 4vw, 34px);
  letter-spacing: 0.04em;
}

.file-icon.pdf {
  background: linear-gradient(180deg, #e32626, #8f1515);
}

.file-icon.audio {
  background: linear-gradient(135deg, rgba(0, 232, 255, 0.32), rgba(253, 1, 199, 0.18));
}

.file-icon.video {
  background: linear-gradient(135deg, rgba(253, 1, 199, 0.34), rgba(0, 179, 255, 0.16));
}

.file-card-copy {
  display: grid;
  gap: 8px;
}

.file-card-copy strong {
  overflow-wrap: anywhere;
  font-family: "Audiowide", system-ui, sans-serif;
  font-size: 18px;
  letter-spacing: 0.03em;
}

.file-card-copy span {
  color: var(--muted);
}

.info-rail {
  min-width: 0;
  display: grid;
  gap: 8px;
  align-content: start;
}

.module,
.actions {
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(var(--accent-rgb), 0.18);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(7, 22, 24, 0.76), rgba(5, 12, 15, 0.9)),
    var(--panel-2);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.02) inset;
}

.module {
  display: grid;
  gap: 9px;
  padding: 12px;
}

.module-label {
  color: rgba(242, 255, 254, 0.76);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.meta-row {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: rgba(242, 255, 254, 0.84);
  font-size: 11px;
}

.meta-row strong {
  min-width: 0;
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #fff;
  font-weight: 700;
}

.size-track {
  position: relative;
  height: 10px;
  overflow: hidden;
  border: 1px solid rgba(var(--accent-rgb), 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.size-track span {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #00e8ff, #7b2cff 58%, var(--hot));
}

.qr-box {
  width: 100%;
  display: grid;
  place-items: center;
  padding: 10px;
  border: 1px solid rgba(var(--accent-rgb), 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
  touch-action: manipulation;
  pointer-events: auto;
}

.qr-box img {
  display: block;
  width: min(150px, 100%);
  aspect-ratio: 1;
  border-radius: 6px;
  background: #fff;
}

.qr-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  background: rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.qr-modal-card {
  display: grid;
  gap: clamp(12px, 2.8vw, 18px);
  place-items: center;
  width: min(88vw, 440px);
  padding: clamp(16px, 4vw, 28px);
  border: 1px solid rgba(var(--accent-rgb), 0.34);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(5, 18, 24, 0.98), rgba(2, 9, 13, 0.98)),
    #02090d;
  box-shadow:
    0 34px 90px rgba(0, 0, 0, 0.54),
    0 0 46px rgba(var(--accent-rgb), 0.18);
}

.qr-modal-card img {
  display: block;
  width: min(68vw, 320px);
  aspect-ratio: 1;
  object-fit: contain;
  padding: clamp(8px, 2vw, 14px);
  border-radius: 8px;
  background: #fff;
}

.qr-modal-title {
  color: #fff;
  font-family: "Audiowide", system-ui, sans-serif;
  font-size: clamp(16px, 4.8vw, 26px);
  letter-spacing: 0.08em;
  text-align: center;
}

.qr-modal-url {
  max-width: 100%;
  overflow: hidden;
  text-overflow: clip;
  white-space: nowrap;
  color: #54d9ff;
  font-family: "Chakra Petch", system-ui, sans-serif;
  font-size: 17px;
  letter-spacing: 0.04em;
  text-align: center;
}

.actions {
  display: grid;
  gap: 8px;
  padding: 8px;
}

.action {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border: 1px solid rgba(var(--accent-rgb), 0.3);
  border-radius: 8px;
  background: rgba(0, 179, 255, 0.1);
  color: var(--text);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 11px;
  cursor: pointer;
  transition:
    transform 160ms ease,
    background 160ms ease,
    border-color 160ms ease;
}

.action:hover {
  transform: translateY(-1px);
  background: rgba(0, 179, 255, 0.18);
  border-color: rgba(var(--accent-rgb), 0.46);
}

.action.primary {
  background: linear-gradient(180deg, rgba(0, 179, 255, 0.22), rgba(0, 179, 255, 0.1));
  font-weight: 700;
}

.action.primary.is-playing {
  background: linear-gradient(180deg, rgba(152, 255, 55, 0.2), rgba(0, 179, 255, 0.08));
}

.action.has-audio-icon {
  gap: 8px;
}

.action-audio-icon {
  position: relative;
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 8px solid #fff;
  filter: drop-shadow(0 0 5px rgba(123, 231, 255, 0.5));
}

.action-audio-icon.is-pause {
  width: 9px;
  height: 11px;
  border: 0;
  background:
    linear-gradient(90deg, #fff 0 3px, transparent 3px 6px, #fff 6px 9px);
}

.action.secondary {
  width: 100%;
  min-height: 34px;
  background: rgba(255, 255, 255, 0.06);
}

.action.disabled,
.action:disabled {
  opacity: 0.48;
  pointer-events: none;
}

.file-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-top: 2px;
}

.file-pill {
  min-width: min(260px, 82vw);
  max-width: 320px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  padding: 8px;
  border: 1px solid rgba(var(--accent-rgb), 0.2);
  border-radius: 8px;
  background: rgba(5, 14, 18, 0.78);
  color: var(--text);
  cursor: pointer;
}

.file-pill.active {
  border-color: rgba(var(--accent-rgb), 0.52);
  background: rgba(0, 179, 255, 0.13);
}

.file-pill span {
  width: 42px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(var(--accent-rgb), 0.22);
  border-radius: 6px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
}

.file-pill strong {
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: stretch;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  background: rgba(0, 0, 0, 0.94);
}

.modal-open {
  overflow: hidden;
}

.lightbox-body {
  min-height: 0;
  display: grid;
  place-items: center;
}

.viewer-frame,
.lightbox-media,
.lightbox-image {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 8px;
  background: #05070f;
}

.lightbox-image {
  object-fit: contain;
}

.lightbox-media {
  object-fit: contain;
}

.image-viewer-shell {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 10px;
}

.image-viewer-canvas {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(var(--accent-rgb), 0.16);
  border-radius: 8px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    #05070f;
  background-size: 28px 28px;
  cursor: grab;
  touch-action: none;
}

.image-viewer-canvas.is-dragging {
  cursor: grabbing;
}

.image-viewer-image {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
  transform-origin: center center;
  will-change: transform;
  user-select: none;
  -webkit-user-drag: none;
  transition: transform 120ms ease;
}

.image-viewer-canvas.is-dragging .image-viewer-image {
  transition: none;
}

.image-viewer-toolbar {
  z-index: 2;
  justify-self: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  max-width: min(100%, 720px);
  padding: 7px;
  overflow-x: auto;
  border: 1px solid rgba(var(--accent-rgb), 0.24);
  border-radius: 8px;
  background: rgba(2, 11, 16, 0.88);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.36);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.image-viewer-toolbar button {
  flex: 0 0 auto;
  width: 38px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(var(--accent-rgb), 0.26);
  border-radius: 6px;
  background: rgba(0, 179, 255, 0.08);
  color: #fff;
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
}

.image-viewer-toolbar button:hover,
.image-viewer-toolbar button:focus {
  border-color: var(--accent);
  background: rgba(0, 179, 255, 0.18);
  outline: none;
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(0.92);
    box-shadow: 0 0 0 0 rgba(var(--accent-rgb), 0.2);
  }
  50% {
    transform: scale(1);
    box-shadow: 0 0 0 8px rgba(var(--accent-rgb), 0);
  }
}

@keyframes scan {
  from {
    top: -12%;
  }
  to {
    top: 112%;
  }
}

@keyframes rotate {
  to {
    transform: rotate(360deg);
  }
}

@keyframes float-blob {
  from {
    transform: translate3d(-2%, -1%, 0) rotate(0deg) scale(1);
  }
  to {
    transform: translate3d(3%, 2%, 0) rotate(9deg) scale(1.08);
  }
}

/* ── Video preview poster (thumbnail + play badge) ─────────── */

/* Auto-sized by the thumbnail image — centered by place-items:center on preview-content */
.video-preview-btn {
  position: relative;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
}

/* Wraps the image tightly — play badge positions relative to this */
.video-thumb-inner {
  position: relative;
  display: block;
}

/*
 * Viewport-based max-height (like .pdf-cover) so the constraint always resolves.
 * max-height: 100% breaks here because preview-content's auto-height grid track
 * makes percentage heights resolve to "auto" (no constraint) — filling the full
 * stage width and clipping portrait images to a landscape crop.
 */
.video-thumb-cover {
  display: block;
  max-width: 100%;
  max-height: calc(100dvh - 200px);
  border-radius: 8px;
  box-shadow:
    0 18px 50px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.08);
}

.video-thumb-empty {
  width: clamp(110px, 16vw, 160px);
  aspect-ratio: 9 / 16;
  display: grid;
  place-items: center;
  border: 1px solid rgba(var(--accent-rgb), 0.28);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(253, 1, 199, 0.34), rgba(0, 179, 255, 0.16));
  font-family: "Audiowide", system-ui, sans-serif;
  font-size: 28px;
  letter-spacing: 0.04em;
  color: var(--text);
}

.video-play-badge {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: rgba(0, 5, 10, 0.65);
  border: 2px solid rgba(0, 179, 255, 0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow:
    0 0 32px rgba(0, 179, 255, 0.32),
    inset 0 0 20px rgba(0, 179, 255, 0.08);
  pointer-events: none;
  transition: border-color 200ms ease, background 200ms ease, box-shadow 200ms ease;
}

.video-play-badge::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 54%;
  transform: translate(-50%, -50%);
  width: 0;
  height: 0;
  border-top: 12px solid transparent;
  border-bottom: 12px solid transparent;
  border-left: 18px solid #fff;
  filter: drop-shadow(0 0 8px rgba(0, 179, 255, 0.9));
}

.video-preview-btn:hover .video-play-badge,
.video-preview-btn:focus .video-play-badge {
  border-color: var(--accent);
  background: rgba(0, 179, 255, 0.16);
  box-shadow: 0 0 44px rgba(0, 179, 255, 0.48), inset 0 0 20px rgba(0, 179, 255, 0.1);
}

/* ── Video HUD lightbox ──────────────────────────────────────── */
.vhud-plyr-wrap {
  position: relative;
  width: min(90vw, 100%);
  height: auto;
  aspect-ratio: var(--video-aspect, 16 / 9);
  max-height: 85vh;
  max-height: 85dvh;
  --plyr-color-main: var(--accent);
  --plyr-video-background: #000;
  --plyr-font-family: system-ui, sans-serif;
  --plyr-border-radius: 10px;
}

.mcv-lightbox-video,
.vhud-plyr-wrap .plyr {
  max-width: 100%;
  max-height: 100%;
  width: 100%;
  height: 100%;
  aspect-ratio: inherit;
}

.mcv-lightbox-video {
  display: block;
  object-fit: contain;
  background: #000;
  border-radius: 10px;
}

.vhud-plyr-wrap .plyr {
  border-radius: 10px;
  overflow: hidden;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.06);
}

.vhud-plyr-wrap .plyr__video-wrapper {
  width: 100%;
  height: 100%;
  aspect-ratio: inherit;
  padding-bottom: 0 !important;
  background: #000;
}

.vhud-plyr-wrap .plyr__video-wrapper video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.vhud-plyr-wrap video::-webkit-media-controls,
.vhud-plyr-wrap video::-webkit-media-controls-enclosure {
  display: none !important;
}

.vhud-plyr-wrap .plyr__poster {
  background-color: #000;
  background-size: contain;
}

.vhud-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 50;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(var(--accent-rgb), 0.36);
  border-radius: 50%;
  background: rgba(0, 5, 10, 0.82);
  color: #fff;
  font-size: 17px;
  cursor: pointer;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 0 16px rgba(0, 0, 0, 0.5);
  transition: background 160ms ease, border-color 160ms ease;
}

.vhud-close:hover,
.vhud-close:focus {
  background: rgba(0, 179, 255, 0.18);
  border-color: var(--accent);
  outline: none;
}

/* ─────────────────────────────────────────────────────────── */
@media (max-width: 940px) {
  .share-panel {
    height: 100%;
    max-height: 100%;
  }

  /* Critical: without explicit grid-template-rows, info-rail (auto height)
     steals all space and collapses the preview stage to zero in landscape. */
  .share-grid {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
    min-height: 0;
  }

  .info-rail {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .actions {
    grid-column: 1 / -1;
  }

  .preview-stage {
    height: 100%;
    min-height: 0;
  }
}

/* ── Landscape phone (e.g. Pixel 6 ~914×393px) ─────────────── */
/* Restore side-by-side: video left, scrollable info right.     */
@media (max-width: 940px) and (max-height: 500px) {
  .share-panel {
    padding: 4px;
    gap: 4px;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .share-grid {
    grid-template-columns: minmax(0, 1fr) 200px;
    grid-template-rows: 1fr;
    gap: 6px;
  }

  .preview-stage {
    height: 100%;
    min-height: 0;
  }

  .info-rail {
    grid-template-columns: 1fr;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    max-height: 100%;
    align-content: start;
  }

  .actions {
    grid-column: 1;
  }

  /* Compact topbar in landscape */
  .share-topbar {
    padding-bottom: 4px;
  }

  h1 {
    font-size: 12px;
  }

  .title-stack p {
    display: none;
  }

  .module {
    gap: 4px;
    padding: 6px;
  }

  .qr-box {
    padding: 5px;
    min-height: 62px;
  }

  .qr-box img {
    width: min(54px, 100%);
  }

  .qr-modal {
    place-items: center;
    padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  }

  .qr-modal-card {
    width: min(88vw, 560px);
    max-height: calc(100dvh - 16px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      "title title"
      "image url";
    gap: 10px 14px;
    padding: 10px;
    overflow: hidden;
  }

  .qr-modal-title {
    grid-area: title;
    font-size: clamp(13px, 4.5dvh, 18px);
  }

  .qr-modal-card img {
    grid-area: image;
    width: min(42dvh, 180px);
    padding: 7px;
  }

  .qr-modal-url {
    grid-area: url;
    align-self: center;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: clamp(9px, 2.6dvh, 13px);
    line-height: 1.2;
  }

  .meta-row {
    font-size: 9px;
  }

  .action {
    min-height: 30px;
    font-size: 9px;
  }

  .file-strip {
    display: none;
  }
}

@media (max-width: 680px) {
  html,
  body,
  #root {
    height: 100%;
    overflow: hidden;
  }

  .app-shell {
    height: 100dvh;
    min-height: 100dvh;
    padding: 4px;
    place-items: start center;
  }

  .share-panel {
    width: 100%;
    height: 100%;
    max-height: 100%;
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 5px;
    border-radius: 10px;
    padding: 6px;
  }

  .share-topbar {
    align-items: center;
    gap: 8px;
    padding-bottom: 5px;
  }

  .title-stack {
    gap: 7px;
  }

  .status-dot {
    width: 9px;
    height: 9px;
  }

  h1 {
    font-size: 13px;
    line-height: 1.05;
  }

  .title-stack p {
    margin-top: 2px;
    font-size: 10px;
  }

  h1,
  .title-stack p {
    max-width: calc(100vw - 104px);
  }

  .type-chip {
    min-width: 54px;
    padding: 5px 6px;
    font-size: 9px;
    letter-spacing: 0.1em;
  }

  .share-grid {
    min-height: 0;
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 5px;
  }

  .preview-stage,
  .reader,
  .html-frame,
  .office-frame {
    height: 100%;
    min-height: 0;
  }

  .preview-content {
    padding: 8px;
  }

  .media,
  .pdf-cover {
    max-height: 42vh;
  }

  .pdf-preview {
    gap: 8px;
  }

  .pdf-preview span {
    padding: 7px 10px;
    font-size: 10px;
  }

  .audio-player {
    gap: 8px;
    padding: 8px;
  }

  .audio-cover-shell {
    width: clamp(176px, 58vw, 260px);
    padding: 5px;
    border-radius: 8px;
  }

  .audio-cover {
    border-radius: 5px;
  }

  .audio-title {
    width: 100%;
    font-size: 11px;
  }

  .hud-audio-controls {
    width: 100%;
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 9px;
    padding: 8px;
  }

  .hud-audio-play {
    width: 38px;
    height: 38px;
  }

  .hud-audio-play-icon {
    border-top-width: 8px;
    border-bottom-width: 8px;
    border-left-width: 12px;
  }

  .hud-audio-play.is-playing .hud-audio-play-icon {
    width: 14px;
    height: 17px;
    background:
      linear-gradient(90deg, #fff 0 4px, transparent 4px 10px, #fff 10px 14px);
  }

  .hud-audio-timeline {
    gap: 4px;
  }

  .hud-audio-range {
    height: 18px;
  }

  .hud-audio-time {
    font-size: 10px;
  }

  .info-rail {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px;
  }

  .module {
    gap: 5px;
    padding: 7px;
    border-radius: 7px;
  }

  .module-label {
    margin: 0;
    font-size: 8px;
    letter-spacing: 0.1em;
  }

  .meta-row {
    gap: 6px;
    font-size: 9.5px;
  }

  .size-track {
    height: 7px;
  }

  .qr-box {
    padding: 5px;
  }

  .qr-box img {
    width: 70px;
  }

  .action.secondary {
    min-height: 28px;
    font-size: 9px;
  }

  .actions {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px;
    padding: 5px;
  }

  .action {
    min-height: 34px;
    padding: 0 8px;
    border-radius: 7px;
    font-size: 9px;
    letter-spacing: 0.08em;
  }

  .file-strip {
    gap: 5px;
  }

  .file-pill {
    min-width: min(220px, 78vw);
    padding: 5px;
  }

  .file-pill span {
    width: 34px;
    height: 28px;
    font-size: 8px;
  }

  .file-pill strong {
    font-size: 10px;
  }

  .lightbox {
    padding: 8px;
  }
}

@media (max-width: 380px), (max-height: 740px) {
  .share-panel {
    gap: 4px;
    padding: 4px;
  }

  .stage-label {
    left: 8px;
    padding: 2px 5px;
    font-size: 8px;
  }

  .preview-content {
    padding: 6px;
  }

  .media,
  .pdf-cover {
    max-height: 35vh;
  }

  .audio-cover-shell {
    width: clamp(150px, 52vw, 218px);
  }

  .audio-player {
    gap: 6px;
    padding: 6px;
  }

  .hud-audio-controls {
    padding: 6px;
  }

  .module:nth-of-type(3) {
    display: none;
  }

  .qr-box img {
    width: 58px;
  }

  .action {
    min-height: 30px;
  }
}

/* ── Portrait video: scrollable adaptive layout on portrait phone ── */
@media (max-width: 680px) {
  body.portrait-video,
  body.portrait-video #root {
    height: auto;
    min-height: 100dvh;
    overflow-y: auto;
  }

  body.portrait-video .app-shell {
    height: auto;
    min-height: 100dvh;
    overflow-y: auto;
    place-items: start center;
  }

  body.portrait-video .share-panel {
    height: auto;
    max-height: none;
  }

  body.portrait-video .share-grid {
    height: auto;
    grid-template-rows: auto auto;
  }

  .preview-stage[data-portrait] {
    height: auto;
    aspect-ratio: var(--video-w, 9) / var(--video-h, 16);
  }
}

/* ── Portrait video in landscape phone: auto-width column ─────── */
@media (max-width: 940px) and (max-height: 500px) {
  .share-panel.portrait-video .share-grid {
    grid-template-columns: auto minmax(160px, 1fr);
  }

  .share-panel.portrait-video .preview-stage {
    height: 100%;
    width: auto;
    aspect-ratio: var(--video-w, 9) / var(--video-h, 16);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
