@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wdth,wght@12..96,75..100,400..800&family=DM+Mono:wght@400;500&family=Instrument+Sans:wght@400;500;600&display=swap');

:root {
  --bg: #0A100F; --panel: #0F1719; --panel-2: #131E20;
  --line: #1D292C; --line-2: #2A3A3D;
  --text: #E8EFEC; --muted: #7C8F8D;
  --amber: #E8A33B; --mint: #5FD3AB; --red: #E3644A;
  --r: 14px;
  --mono: "DM Mono", ui-monospace, Menlo, monospace;
  --body: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Bricolage Grotesque", "Instrument Sans", system-ui, sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0; min-height: 100vh;
  background: radial-gradient(1100px 600px at 50% -10%, #12201F 0%, transparent 60%), var(--bg);
  color: var(--text); font-family: var(--body); -webkit-font-smoothing: antialiased;
  display: flex; align-items: flex-start; justify-content: center;
  padding: max(32px, env(safe-area-inset-top)) 20px max(32px, env(safe-area-inset-bottom));
}
.shell { width: 100%; max-width: 660px; }

/* ancorado no topo por padrao - com telas curtas (a maioria dos celulares)
   e conteudo curto (ex: tela de transferencia sem QR), centralizar
   verticalmente sobra vazio enorme em cima e embaixo. So centraliza em
   janelas bem altas (desktop/notebook com bastante espaco vertical), onde
   vira mesmo intencional. */
@media (min-height: 900px) {
  body { align-items: center; }
}

.top { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 24px; }
.wordmark { font-family: var(--display); font-variation-settings: "wdth" 82; font-weight: 700; font-size: 19px; letter-spacing: -.02em; margin: 0; }
.wordmark span { color: var(--amber); }
.nosrv { font-family: var(--mono); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }

.site-footer { margin-top: 20px; text-align: center; font-family: var(--mono); font-size: 11px; letter-spacing: .04em; color: var(--muted); }

/* diagrama */
.diagram { background: linear-gradient(180deg, var(--panel-2), var(--panel)); border: 1px solid var(--line); border-bottom: none; border-radius: var(--r) var(--r) 0 0; padding: 22px 20px 6px; }
.diagram svg { display: block; width: 100%; height: auto; }
.port-box { fill: #0C1415; stroke: var(--line-2); }
.port-label { font-family: var(--mono); font-size: 9.5px; letter-spacing: .16em; fill: var(--muted); text-transform: uppercase; }
.port-name { font-family: var(--body); font-size: 13px; font-weight: 600; fill: var(--text); }
.jack-ring { fill: none; stroke: var(--line-2); stroke-width: 1.5; }
.jack-core { fill: var(--muted); transition: fill .35s; }
.live .jack-core { fill: var(--mint); }
#cable { fill: none; stroke: var(--amber); stroke-width: 2.4; stroke-linecap: round; transition: stroke .5s; }
.live #cable { stroke: var(--mint); }
#pulse { opacity: 0; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 0 0 var(--r) var(--r); overflow: hidden; }
.body { padding: 24px 22px; }
.eyebrow { font-family: var(--mono); font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); margin: 0 0 12px; }

/* ---- tela 1: escolha ---- */
.intent { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.big {
  appearance: none; cursor: pointer; text-align: left; width: 100%;
  background: #0C1415; border: 1px solid var(--line-2); border-radius: 12px;
  padding: 20px 18px; color: var(--text); font-family: var(--body);
  transition: border-color .2s, background .2s, transform .15s;
}
.big:hover { border-color: var(--amber); background: #101A19; transform: translateY(-1px); }
.big:focus-visible { outline: 2px solid var(--mint); outline-offset: 2px; }
.big strong { display: block; font-size: 15.5px; font-weight: 600; margin-bottom: 5px; }
.big small { font-size: 12.5px; color: var(--muted); line-height: 1.5; display: block; }
.arrow { display: block; margin-bottom: 14px; color: var(--amber); font-family: var(--mono); font-size: 15px; letter-spacing: .05em; }

.sep { display: flex; align-items: center; gap: 14px; margin: 24px 0 18px; }
.sep::before, .sep::after { content: ""; height: 1px; background: var(--line); flex: 1; }
.sep span { font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }

/* ---- sala aberta: QR + codigo lado a lado ---- */
.join { display: grid; grid-template-columns: auto 1fr; gap: 22px; align-items: center; }
.qrcard { background: #EDEFEA; border-radius: 12px; padding: 10px; line-height: 0; width: 168px; height: 168px; }
.qrcard svg, .qrcard img { width: 100%; height: 100%; display: block; }
.joinside strong { display: block; font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.joinside p { margin: 0 0 14px; font-size: 13px; color: var(--muted); line-height: 1.6; }
.code-shell { display: flex; gap: 10px; flex-wrap: wrap; }
.code {
  flex: 1 1 160px; min-width: 0; border: 1px solid var(--line-2); border-radius: 10px; background: #0C1415;
  padding: 12px 16px; font-family: var(--mono); font-weight: 500; font-size: 24px; letter-spacing: .22em;
  color: var(--amber); user-select: all;
}

.btn { appearance: none; cursor: pointer; border-radius: 10px; font-family: var(--body); font-size: 13.5px; font-weight: 600; padding: 0 18px; transition: background .18s, border-color .18s, color .18s; }
.btn:focus-visible { outline: 2px solid var(--mint); outline-offset: 2px; }
.btn-ghost { background: transparent; border: 1px solid var(--line-2); color: var(--text); }
.btn-ghost:hover { border-color: var(--muted); background: #121C1E; }
.btn-solid { background: var(--amber); border: 1px solid var(--amber); color: #10161A; }
.btn-solid:hover { background: #F2B152; }
.btn-solid:disabled { background: #1A2426; border-color: #1A2426; color: #5B6C6A; cursor: not-allowed; }
.btn-save {
  background: var(--mint);
  border: 1px solid var(--mint);
  color: #0A100F; /* texto escuro: contraste ~9:1 */
  font-family: var(--body);
  font-weight: 600;
  font-size: 13.5px;
}
.btn-save:hover { background: #74E0BB; border-color: #74E0BB; }
.btn-save:disabled { background: #1A2426; border-color: #1A2426; color: #5B6C6A; cursor: not-allowed; }
.row { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.row .btn { padding: 13px 18px; }

/* arquivo */
.drop { border: 1px dashed var(--line-2); border-radius: 10px; background: #0C1415; padding: 20px; text-align: center; cursor: pointer; transition: border-color .2s, background .2s; margin-bottom: 18px; }
.drop:hover, .drop.over { border-color: var(--amber); background: #101A19; }
.drop:focus-visible { outline: 2px solid var(--mint); outline-offset: 2px; }
.drop p { margin: 0; font-size: 14px; }
.drop small { display: block; margin-top: 6px; font-family: var(--mono); font-size: 10.5px; letter-spacing: .08em; color: var(--muted); }
.file-row { display: flex; align-items: center; gap: 12px; border: 1px solid var(--line-2); border-radius: 10px; background: #0C1415; padding: 13px 16px; margin-bottom: 18px; }
.file-glyph { width: 30px; height: 30px; border-radius: 7px; background: #16241F; display: grid; place-items: center; flex: 0 0 auto; }
.file-glyph i { display: block; width: 11px; height: 14px; border: 1.5px solid var(--mint); border-radius: 2px; }
.file-meta { min-width: 0; flex: 1; }
.file-meta strong { display: block; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-meta span { font-family: var(--mono); font-size: 10.5px; color: var(--muted); letter-spacing: .06em; }
.file-x { background: none; border: 0; color: var(--muted); cursor: pointer; font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; padding: 6px; }
.file-x:hover { color: var(--red); }
.file-list { margin-bottom: 18px; }
.file-list .file-row:last-child { margin-bottom: 0; }

/* slots do codigo */
.slots { display: flex; gap: 8px; }
.slots input {
  width: 100%; min-width: 0; aspect-ratio: 3/4; max-height: 64px; background: #0C1415;
  border: 1px solid var(--line-2); border-radius: 10px; color: var(--text);
  font-family: var(--mono); font-size: 22px; font-weight: 500; text-align: center; text-transform: uppercase; padding: 0;
  transition: border-color .15s, background .15s;
}
.slots input:focus { outline: none; border-color: var(--amber); background: #101A19; }
.slots.err input { border-color: var(--red); }

/* scanner */
#scan { width: 100%; border-radius: 12px; background: #000; display: block; aspect-ratio: 4/3; object-fit: cover; }
.scanwrap { position: relative; }
.reticle { position: absolute; inset: 16%; border: 1.5px solid var(--mint); border-radius: 14px; box-shadow: 0 0 0 100vmax rgba(10, 16, 15, .55); pointer-events: none; }

.hint { margin: 14px 0 0; font-size: 13px; color: var(--muted); line-height: 1.6; }
.hint.error { color: var(--red); }
.back { background: none; border: 0; padding: 0; margin-bottom: 16px; cursor: pointer; font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.back:hover { color: var(--text); }

.bar { height: 3px; background: #16211F; border-radius: 2px; overflow: hidden; margin-top: 16px; }
.bar i { display: block; height: 100%; width: 0; background: var(--mint); transition: width .25s linear; }
.stage { position: relative; border-radius: 10px; overflow: hidden; }
.fade-out { opacity: 0; transition: opacity .5s; }

/* grade de miniaturas dos arquivos recebidos */
.thumb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; margin-bottom: 18px; }
.thumb { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: #0C1415; border: 1px solid var(--line-2); }
.thumb-media { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.thumb-dust { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.thumb-name {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 5px 7px;
  font-family: var(--mono); font-size: 9px; color: var(--text);
  background: linear-gradient(to top, rgba(10, 16, 15, .9), transparent);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.status { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 14px; border-top: 1px solid var(--line); padding: 14px 22px; font-family: var(--mono); font-size: 11px; letter-spacing: .09em; color: var(--muted); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); display: inline-block; margin-right: 9px; vertical-align: 1px; }
.dot.wait { background: var(--amber); animation: blink 1.6s ease-in-out infinite; }
.dot.on { background: var(--mint); }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }

.toast { position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 14px); background: #16211F; border: 1px solid var(--line-2); border-radius: 9px; padding: 10px 16px; font-family: var(--mono); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.hide { display: none !important; }

@media (max-width: 600px) {
  .intent { grid-template-columns: 1fr; }
  .join { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .joinside { width: 100%; }
  .code { font-size: 21px; letter-spacing: .18em; text-align: center; }
  .code-shell { justify-content: center; }
}
@media (prefers-reduced-motion: reduce) { *{ animation: none !important; transition-duration: .01ms !important; } }
