:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #000000;
  color: #f4f7fb;
  --accent: #34d399;
  --accent-soft: #6ee7b7;
  --accent-glow: rgba(52, 211, 153, .12);
  --muted: #7a8a9e;
  --border: rgba(255, 255, 255, .08);
  --surface: rgba(18, 18, 18, .95);
  --surface-hover: rgba(30, 30, 30, .95);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #000000;
  background-image:
    radial-gradient(ellipse at 20% 0%, rgba(52, 211, 153, .06) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(34, 180, 120, .04) 0%, transparent 50%);
}

/* ===== Card ===== */
.card {
  width: min(100%, 540px);
  padding: 36px 36px 40px;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--surface);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, .03),
    0 40px 100px rgba(0, 0, 0, .6),
    0 0 80px rgba(52, 211, 153, .03);
  backdrop-filter: blur(24px);
  transition: box-shadow .3s ease;
}
.card:hover {
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, .05),
    0 40px 100px rgba(0, 0, 0, .6),
    0 0 120px rgba(52, 211, 153, .06);
}

/* ===== Brand ===== */
.brand {
  margin-bottom: 16px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .22em;
  text-transform: uppercase;
}
.brand span {
  font-size: 18px;
  color: var(--accent-soft);
  opacity: .7;
}

/* ===== Typography ===== */
h1 {
  margin: 0 0 10px;
  font-size: clamp(24px, 5vw, 30px);
  font-weight: 700;
  letter-spacing: -.03em;
  color: #eef2f7;
}
.subtitle, .hint {
  color: var(--muted);
  line-height: 1.55;
}
.subtitle {
  margin: 0 auto 24px;
  max-width: 380px;
  font-size: 15px;
}

/* ===== QR View ===== */
.qr-view {
  min-height: 320px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 17px;
  color: var(--muted);
}
.qr-view img {
  width: min(260px, 78vw);
  padding: 14px;
  border-radius: 16px;
  background: #ffffff;
  box-shadow:
    0 16px 40px rgba(0, 0, 0, .4),
    0 0 60px rgba(52, 211, 153, .08);
  transition: transform .2s ease;
}
.qr-view p { margin: 0; font-size: 14px; }

/* ===== Loader ===== */
.loader {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255, 255, 255, .08);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.hidden { display: none !important; }

/* ===== Status ===== */
.status {
  margin: 18px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #f2c86b;
  font-size: 14px;
  font-weight: 500;
}
.status i {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}
.status.connected {
  color: #34d399;
}

/* ===== Drop Zone ===== */
.drop-zone {
  min-height: 180px;
  margin-top: 24px;
  display: grid;
  place-content: center;
  gap: 8px;
  border: 1.5px dashed rgba(255, 255, 255, .12);
  border-radius: 16px;
  color: #e0e0e0;
  cursor: pointer;
  background: rgba(255, 255, 255, .02);
  transition: all .25s ease;
}
.drop-zone:hover,
.drop-zone.over {
  border-color: var(--accent);
  background: var(--accent-glow);
  transform: translateY(-2px);
  box-shadow: 0 0 40px rgba(52, 211, 153, .08);
}
.drop-zone:hover strong,
.drop-zone.over strong {
  color: var(--accent);
}
.drop-zone strong {
  font-size: 16px;
  font-weight: 600;
  transition: color .25s ease;
}
.drop-zone span {
  color: var(--muted);
  font-size: 14px;
}
.drop-zone input { display: none; }
.drop-zone .hint {
  font-size: 12px;
  opacity: .5;
}

/* ===== Chat / File List ===== */
.chat {
  position: relative;
  margin: 18px 0 0;
  text-align: left;
}
.chat::before,
.chat::after {
  position: absolute;
  z-index: 1;
  right: 0;
  left: 0;
  height: 20px;
  content: '';
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s ease;
}
.chat.has-scroll::before,
.chat.has-scroll::after {
  opacity: 1;
}
.chat::before { top: 0; background: linear-gradient(to bottom, rgba(18, 18, 18, .98), transparent); }
.chat::after { bottom: 0; background: linear-gradient(to top, rgba(18, 18, 18, .98), transparent); }

.file-list {
  max-height: 250px;
  overflow-y: auto;
  padding: 4px 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(52, 211, 153, .25) transparent;
}
.file-list::-webkit-scrollbar { width: 6px; }
.file-list::-webkit-scrollbar-track { background: transparent; }
.file-list::-webkit-scrollbar-thumb { background: rgba(52, 211, 153, .25); border-radius: 3px; }

.file-item {
  margin: 8px 0;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #d0d8e4;
  font-size: 14px;
  border: 1px solid rgba(255, 255, 255, .06);
  border-radius: 12px;
  background: rgba(255, 255, 255, .04);
  animation: file-in .25s ease-out;
  transition: background .2s ease;
}
.file-item:hover {
  background: rgba(255, 255, 255, .06);
}
.file-item::before {
  content: '✓';
  order: 3;
  flex: 0 0 auto;
  margin-left: auto;
  color: #34d399;
  font-weight: 700;
}
.file-item.pending::before {
  content: '';
  width: 16px;
  height: 16px;
  background: var(--muted);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 8v8M8 12l4 4 4-4'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 8v8M8 12l4 4 4-4'/%3E%3C/svg%3E") center / contain no-repeat;
}
.file-item.sending::before {
  content: '';
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, .15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
.file-item.downloaded::before {
  content: '✓';
  color: #34d399;
}
@keyframes file-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.file-item.error {
  color: #f87171;
  border-color: rgba(248, 113, 113, .2);
  background: rgba(248, 113, 113, .08);
}
.file-item.error::before {
  content: '×';
  color: #f87171;
}

/* ===== Thumbnails ===== */
.file-thumb {
  order: 1;
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  gap: 2px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 10px;
  background: rgba(255, 255, 255, .04);
}
.file-thumb.photo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.file-thumb.icon {
  color: var(--accent-soft);
}
.file-thumb.icon svg {
  width: 30px;
  height: 30px;
  opacity: .85;
}
.file-thumb.icon .ext {
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .06em;
}
.file-thumb.icon.folder {
  color: #f2c86b;
}
.file-body {
  order: 2;
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
}
.file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-item a.file-name {
  color: var(--accent-soft);
  text-decoration: none;
  font-weight: 600;
  transition: color .2s ease;
}
.file-item a.file-name:hover {
  color: #ffffff;
  text-decoration: underline;
}
.file-meta {
  display: flex;
  gap: 10px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
}
.file-item.error .file-meta {
  color: #f87171;
}

/* ===== Button ===== */
.button {
  border: 0;
  border-radius: 12px;
  padding: 12px 20px;
  color: #ffffff;
  font-weight: 600;
  font-size: 14px;
  background: linear-gradient(135deg, rgba(52, 211, 153, .2), rgba(34, 180, 120, .15));
  border: 1px solid rgba(52, 211, 153, .2);
  cursor: pointer;
  transition: all .2s ease;
}
.button:hover {
  background: linear-gradient(135deg, rgba(52, 211, 153, .3), rgba(34, 180, 120, .25));
  border-color: rgba(52, 211, 153, .35);
  box-shadow: 0 0 20px rgba(52, 211, 153, .1);
}

/* ===== Hint ===== */
.hint {
  margin: 24px 0 0;
  font-size: 12px;
  opacity: .6;
}

/* ===== Responsive ===== */
@media (max-width: 540px) {
  body { padding: 14px; }
  .card { padding: 28px 20px 32px; border-radius: 20px; }
  .drop-zone { min-height: 150px; }
}
