/* Fyle Drop — single stylesheet. No inline styles anywhere (strict CSP). */

:root {
  --bg: #0f1115;
  --surface: #171a21;
  --surface-2: #1f232c;
  --line: #2b303b;
  --text: #e7e9ee;
  --text-dim: #9aa2b1;
  --accent: #5b8cff;
  --accent-ink: #0b1020;
  --ok: #37d199;
  --warn: #ffcf6b;
  --stage: #35c2d1;
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f5f8;
    --surface: #ffffff;
    --surface-2: #f0f2f7;
    --line: #dde1ea;
    --text: #161922;
    --text-dim: #5a6273;
    --accent-ink: #ffffff;
    --stage: #0f8b9a;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.5;
}

.shell {
  max-width: 560px;
  margin: 0 auto;
  padding: 28px 18px 60px;
}

.brand h1 {
  margin: 0;
  font-size: 26px;
  letter-spacing: 0.5px;
}
.brand p {
  margin: 6px 0 22px;
  color: var(--text-dim);
  font-size: 14px;
}

.main > section { animation: fade 0.18s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.page-title {
  font-size: 18px;
  margin: 0 0 16px;
}

/* ---------- tiles ---------- */

.grid2 {
  display: grid;
  gap: 14px;
}
@media (min-width: 460px) {
  .grid2 { grid-template-columns: 1fr 1fr; }
}

.tile {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
  width: 100%;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font: inherit;
}
.tile:hover { border-color: var(--accent); }
.tile-primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.tile-primary .tile-sub { color: var(--accent-ink); opacity: 0.8; }
.tile-title { font-size: 16px; font-weight: 600; }
.tile-sub { font-size: 13px; color: var(--text-dim); }

/* Large tap-to-copy code target (GAP 10) — big, obvious, no overlap with buttons */
.tile-code {
  align-items: center;
  text-align: center;
  padding: 30px 20px;
  margin-bottom: 16px;
  gap: 10px;
}
.code-value {
  font-size: clamp(30px, 11vw, 46px);
  font-weight: 700;
  letter-spacing: 3px;
  font-variant-numeric: tabular-nums;
}

/* ---------- forms / inputs ---------- */

.stack { display: flex; flex-direction: column; gap: 12px; }
.field-label { font-size: 12px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-dim); }

.code-input {
  font-size: 30px;
  letter-spacing: 10px;
  text-align: center;
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.code-input:focus { outline: 2px solid var(--accent); border-color: transparent; }

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }

.btn {
  appearance: none;
  border: 1px solid transparent;
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit;
  font-weight: 600;
  padding: 11px 16px;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}
.btn:hover { filter: brightness(1.05); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn-full { display: block; width: 100%; }
.btn-sm { padding: 8px 12px; font-size: 13px; }

/* ---------- status / progress ---------- */

.status, .status-text { font-size: 14px; }
.status { display: flex; flex-direction: column; gap: 4px; margin: 16px 0; }
.status-text { color: var(--text-dim); }
.note { font-size: 12.5px; color: var(--text-dim); margin: 10px 0 0; }

.bar {
  height: 8px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
  margin: 8px 0;
}
.bar-fill { height: 100%; width: 0%; background: var(--accent); transition: width 0.15s linear; }

.expired { margin-top: 18px; padding: 16px; border: 1px dashed var(--line); border-radius: var(--radius); }
.expired p { margin: 0 0 10px; }

/* ---------- scan / QR ---------- */

.scan-area { margin: 16px 0; }
.scan-video {
  width: 100%;
  max-height: 320px;
  border-radius: var(--radius);
  background: #000;
  object-fit: cover;
}
.qr-panel, .sas-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin: 22px 0;
}
.qr-canvas {
  width: 220px;
  height: 220px;
  image-rendering: pixelated;
  background: #fff;
  border-radius: 10px;
  padding: 8px;
}
.sas-code {
  font-size: clamp(34px, 12vw, 52px);
  font-weight: 700;
  letter-spacing: 8px;
  font-variant-numeric: tabular-nums;
  padding: 12px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

/* ---------- session home ---------- */

.session-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.lock { font-size: 13px; color: var(--ok); font-weight: 600; }

.hidden-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* ---------- stage (idle today; hosts voice/video tiles later) ---------- */

.stage {
  margin: 0 0 14px;
  padding: 22px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.stage-ring {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1.5px solid color-mix(in srgb, var(--stage) 55%, transparent);
  display: grid;
  place-items: center;
}
.stage-ring::before {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 1.5px solid color-mix(in srgb, var(--stage) 30%, transparent);
}
@media (prefers-reduced-motion: no-preference) {
  .stage-ring::before { animation: stage-pulse 2.6s ease-out infinite; }
}
@keyframes stage-pulse {
  0% { transform: scale(0.85); opacity: 0.9; }
  100% { transform: scale(1.35); opacity: 0; }
}
.stage-ring-core { width: 8px; height: 8px; border-radius: 50%; background: var(--stage); }
.stage-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--stage);
  margin-top: 4px;
}
.stage-sub { font-size: 12.5px; color: var(--text-dim); text-align: center; }

/* ---------- the wire: one feed for messages and file transfers ---------- */

.wire {
  height: 380px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
}

.msg { max-width: 78%; padding: 8px 11px; border-radius: 12px; font-size: 14px; }
.msg-body { white-space: pre-wrap; word-break: break-word; }
.msg-time { font-size: 10.5px; color: var(--text-dim); margin-top: 3px; text-align: right; }
.msg-in { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--line); }
.msg-out { align-self: flex-end; background: var(--accent); color: var(--accent-ink); }
.msg-out .msg-time { color: var(--accent-ink); opacity: 0.75; }

.card {
  max-width: 82%;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.card.out { align-self: flex-end; }
.card.in { align-self: flex-start; }
.card-name { font-size: 13.5px; font-weight: 600; word-break: break-all; }
.card-note { font-size: 11px; color: var(--warn); }
.card .bar { margin: 0; }
.card-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-size { font-size: 12px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.card-right { display: flex; align-items: center; gap: 10px; }
.card-status { font-size: 12px; font-weight: 600; color: var(--text-dim); }
.card-status.ok { color: var(--ok); }
.card-actions { gap: 8px; }
.pillbtn {
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
.pillbtn.solid { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.card-save { font-size: 12.5px; font-weight: 600; color: var(--accent); text-decoration: none; }

/* ---------- composer: attach and type from the same control ---------- */

.composer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 6px 6px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-2);
}
.attach-btn {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: var(--surface);
  color: var(--text-dim);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.attach-btn:hover { color: var(--text); }
.attach-btn svg { width: 16px; height: 16px; }
.composer-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  padding: 8px 2px;
}
.composer-input:focus { outline: none; }

/* ---------- modal ---------- */

/* `[hidden]` alone isn't enough once an element also has an author `display`
   rule — same-specificity author CSS beats the UA `[hidden]{display:none}`
   default, so the modal would stay laid out (and its fixed, full-viewport
   backdrop would keep intercepting clicks) even while "hidden". */
.modal[hidden] { display: none; }
.modal { position: fixed; inset: 0; display: grid; place-items: center; padding: 20px; z-index: 20; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.6); }
.modal-panel {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  max-width: 420px;
  width: 100%;
}
.modal-panel.modal-panel-wide {
  max-width: 560px;
  max-height: 80vh;
  overflow-y: auto;
}
.modal-title { margin: 0 0 12px; font-size: 17px; }
.modal-panel p { font-size: 14px; color: var(--text-dim); margin: 8px 0; }
.modal-panel h3 { font-size: 14.5px; margin: 18px 0 6px; color: var(--text); }
.modal-panel h3:first-of-type { margin-top: 4px; }
.link-btn {
  appearance: none;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 13.5px;
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
}

/* ---------- toast ---------- */

#toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%) translateY(20px);
  background: var(--text);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s, transform 0.18s;
  z-index: 30;
}
#toast.toast-on { opacity: 1; transform: translateX(-50%) translateY(0); }
