:root {
  --ink: #0f1b2d;
  --muted: #64748b;
  --faint: #94a3b8;
  --line: rgba(15, 27, 45, 0.08);
  --i1: #6366f1;   /* indigo */
  --i2: #22d3ee;   /* cyan   */
  --grad: linear-gradient(135deg, #6366f1, #22d3ee);
  --glass: rgba(255, 255, 255, 0.55);
  --glass-strong: rgba(255, 255, 255, 0.7);
  --radius: 30px;
  --shadow: 0 24px 50px rgba(27, 37, 89, 0.12);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; min-height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: #fafbfe;
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow-x: hidden;
}

/* Aurora de fondo (se ve a través del cristal) */
.aurora {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(440px 440px at 12% 10%, rgba(99, 102, 241, 0.45), transparent 60%),
    radial-gradient(380px 380px at 92% 4%, rgba(34, 211, 238, 0.42), transparent 60%),
    radial-gradient(460px 460px at 16% 94%, rgba(167, 139, 250, 0.40), transparent 62%),
    radial-gradient(340px 340px at 92% 90%, rgba(52, 211, 153, 0.34), transparent 62%),
    #fafbfe;
}

.hidden { display: none !important; }

/* Escudo de privacidad: oculta el contenido al perder foco / segundo plano */
#privacy-shield {
  position: fixed; inset: 0; z-index: 200; display: none; place-items: center;
  background: rgba(250, 251, 254, 0.72);
  backdrop-filter: blur(28px) saturate(120%); -webkit-backdrop-filter: blur(28px) saturate(120%);
  color: var(--muted); font-weight: 700; font-size: 14px; text-align: center; padding: 24px;
}
#privacy-shield.show { display: grid; }

.app {
  max-width: 440px;
  margin: 0 auto;
  padding: 18px 18px calc(20px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column;
  min-height: 100vh;
}

/* ---------- Top bar ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; margin: 6px 4px 18px; }
.brand { display: flex; align-items: center; gap: 10px; }
.logo {
  display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 12px;
  background: var(--grad); color: #fff; font-weight: 800; font-size: 17px;
  box-shadow: 0 6px 14px rgba(99, 102, 241, 0.45);
}
.brand-name { font-weight: 700; font-size: 18px; letter-spacing: -0.02em; }
.pill {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 600; color: rgba(30, 41, 59, 0.85);
  padding: 7px 12px; border-radius: 999px;
  background: var(--glass); border: 1px solid var(--glass-strong);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; }

/* ---------- Glass card ---------- */
.glass {
  background: var(--glass);
  border: 1.5px solid var(--glass-strong);
  backdrop-filter: blur(30px) saturate(140%);
  -webkit-backdrop-filter: blur(30px) saturate(140%);
  box-shadow: var(--shadow);
}
.card { border-radius: var(--radius); padding: 22px; }

/* ---------- Segmented control ---------- */
.seg {
  position: relative; display: grid; grid-template-columns: 1fr 1fr;
  background: rgba(15, 27, 45, 0.05); border-radius: 14px; padding: 4px; margin-bottom: 18px;
}
.seg-btn {
  position: relative; z-index: 1; appearance: none; border: none; background: transparent;
  padding: 10px; font-size: 14px; font-weight: 700; color: var(--muted);
  cursor: pointer; border-radius: 10px; transition: color 0.2s;
}
.seg-btn.is-active { color: var(--ink); }
.seg-thumb {
  position: absolute; z-index: 0; top: 4px; left: 4px;
  width: calc(50% - 4px); height: calc(100% - 8px);
  background: #fff; border-radius: 10px;
  box-shadow: 0 4px 12px rgba(27, 37, 89, 0.12);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.seg-thumb.right { transform: translateX(100%); }

.panel { animation: fade 0.25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.lead { color: var(--muted); font-size: 14px; line-height: 1.5; margin: 0 0 16px; }
.lead strong { color: var(--ink); }

/* ---------- Dropzone ---------- */
.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 9px;
  padding: 30px 18px; border-radius: 20px; cursor: pointer;
  background: rgba(255, 255, 255, 0.42);
  border: 1.5px dashed rgba(99, 102, 241, 0.4);
  transition: border-color 0.2s, background 0.2s, transform 0.1s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--i1); background: rgba(99, 102, 241, 0.06); }
.dropzone.drag { transform: scale(1.01); }
.dz-icon {
  display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px;
  background: var(--grad); box-shadow: 0 8px 16px rgba(99, 102, 241, 0.4);
}
.dz-title { font-weight: 700; font-size: 14.5px; }
.dz-hint { color: var(--muted); font-size: 12.5px; }

/* ---------- Switch ---------- */
.switch { display: flex; align-items: center; gap: 12px; margin-top: 16px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.track {
  flex: none; position: relative; width: 46px; height: 28px; border-radius: 999px;
  background: rgba(15, 27, 45, 0.16); transition: background 0.2s;
}
.thumb {
  position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2); transition: transform 0.22s cubic-bezier(0.4,0,0.2,1);
}
.switch input:checked + .track { background: var(--grad); }
.switch input:checked + .track .thumb { transform: translateX(18px); }
.switch-text { display: flex; flex-direction: column; gap: 1px; }
.switch-title { font-weight: 600; font-size: 13.5px; }
.switch-sub { color: var(--faint); font-size: 11.5px; }

/* ---------- Transfer / file cards ---------- */
.tx {
  margin-top: 16px; padding: 14px;
  background: rgba(255, 255, 255, 0.5); border: 1.5px solid var(--glass-strong);
  border-radius: 15px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.tx-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tx-name { font-weight: 600; font-size: 13.5px; word-break: break-word; }
.tx-meta { color: var(--faint); font-size: 11.5px; white-space: nowrap; }
.file-meta { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.file-card .btn { margin-top: 12px; }

.bar { height: 7px; background: #e6ebf3; border-radius: 6px; margin-top: 10px; overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; background: var(--grad); transition: width 0.15s ease; border-radius: 6px; }

/* ---------- Result (código) ---------- */
.result { margin-top: 18px; text-align: center; }
.result-label { display: block; color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 8px; }
.code-display {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 12px 12px 18px; border-radius: 16px;
  background: rgba(255, 255, 255, 0.65); border: 1.5px solid var(--glass-strong);
}
.code {
  font-family: ui-monospace, "SF Mono", "Roboto Mono", monospace;
  font-size: 26px; font-weight: 800; letter-spacing: 0.12em;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.icon-btn {
  flex: none; appearance: none; border: none; cursor: pointer;
  background: var(--grad); color: #fff; font-weight: 700; font-size: 13px;
  padding: 10px 16px; border-radius: 11px; box-shadow: 0 8px 16px rgba(99,102,241,0.32);
}
.status-row { display: flex; align-items: center; justify-content: center; gap: 9px; margin: 14px 0; color: var(--muted); font-size: 13px; }
.status-row.ok { color: #16a34a; font-weight: 600; }

/* ---------- Code input ---------- */
.code-entry { display: flex; flex-direction: column; gap: 10px; }
.code-input {
  width: 100%; text-align: center;
  font-family: ui-monospace, "SF Mono", "Roboto Mono", monospace;
  font-size: 26px; font-weight: 800; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--ink); padding: 16px; border-radius: 16px;
  background: rgba(255, 255, 255, 0.65); border: 1.5px solid var(--glass-strong); outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.code-input::placeholder { color: rgba(15,27,45,0.25); letter-spacing: 0.18em; }
.code-input:focus { border-color: var(--i1); box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.14); }

.hint-msg { margin-top: 14px; text-align: center; font-size: 13px; padding: 12px; border-radius: 12px; }
.hint-msg.err { background: rgba(244, 63, 94, 0.1); color: #e11d48; }
.hint-msg.ok { background: rgba(34, 197, 94, 0.12); color: #16a34a; font-weight: 600; }

/* ---------- Buttons ---------- */
.btn {
  appearance: none; border: none; cursor: pointer;
  padding: 14px 18px; border-radius: 14px; font-size: 15px; font-weight: 700;
  background: var(--grad); color: #fff; box-shadow: 0 10px 20px rgba(99, 102, 241, 0.3);
  transition: transform 0.08s, opacity 0.2s;
}
.btn:active { transform: scale(0.98); }
.btn[disabled] { opacity: 0.5; cursor: default; box-shadow: none; }
.btn-ghost {
  background: rgba(255, 255, 255, 0.5); color: #334155;
  border: 1.5px solid var(--glass-strong); box-shadow: none;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.full { width: 100%; }

/* ---------- Spinner ---------- */
.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(99, 102, 241, 0.25); border-top-color: var(--i1);
  animation: spin 0.8s linear infinite; flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

.foot { margin-top: auto; padding-top: 18px; display: flex; flex-direction: column; align-items: center; gap: 7px; text-align: center; color: var(--faint); font-size: 11.5px; }
.foot-link { appearance: none; background: none; border: none; cursor: pointer; color: var(--i1); font-weight: 700; font-size: 12.5px; padding: 4px; }
.foot-link:hover { text-decoration: underline; }
.install-tip { margin: 0; font-size: 13px; line-height: 1.5; color: var(--muted); background: rgba(99, 102, 241, 0.07); border: 1px solid rgba(99, 102, 241, 0.15); border-radius: 12px; padding: 12px 14px; text-align: left; }
.install-tip b { color: var(--ink); }
.modal-card .btn-ghost { margin-top: 10px; }
.modal-card .install-tip + .btn { margin-top: 6px; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 22px; background: rgba(15, 27, 45, 0.28); }
.modal-card { border-radius: 24px; padding: 24px; max-width: 360px; width: 100%; text-align: center; }
.modal-card h2 { margin: 0 0 8px; font-size: 19px; }
.modal-card p { color: var(--muted); font-size: 14px; line-height: 1.5; margin: 0 0 16px; }
.plans { display: flex; gap: 10px; margin-bottom: 18px; }
.plan { flex: 1; display: flex; flex-direction: column; gap: 2px; background: rgba(255,255,255,0.55); border: 1px solid var(--glass-strong); border-radius: 12px; padding: 12px; }
.plan strong { color: var(--i1); }
.plan span { color: var(--muted); font-size: 13px; }
