/* GameFast · base visual: noche índigo, vidrio violeta, neón suave. */
:root {
  color-scheme: dark;
  --bg: #04020b;
  --ink: #f5f1ff;
  --muted: #b7acd9;
  --dim: #8478ad;
  --glass: rgba(13, 8, 30, 0.58);
  --glass-2: rgba(22, 13, 48, 0.62);
  --glass-hi: rgba(40, 24, 84, 0.55);
  --line: rgba(170, 140, 255, 0.24);
  --line-hi: rgba(196, 170, 255, 0.55);
  --violet: #8b5cf6;
  --violet-2: #a855f7;
  --violet-3: #c084fc;
  --indigo: #5b5cf0;
  --sky: #7dd3fc;
  --ok: #4ade80;
  --warn: #fbbf24;
  --bad: #fb7185;
  --info: #93c5fd;
  --grad: linear-gradient(135deg, #6d28d9 0%, #8b5cf6 45%, #a855f7 100%);
  --grad-text: linear-gradient(100deg, #c084fc 0%, #a78bfa 40%, #7dd3fc 100%);
  --glow: 0 0 0 1px rgba(196, 170, 255, 0.35), 0 10px 40px -10px rgba(139, 92, 246, 0.75);
  --r-lg: 22px;
  --r: 16px;
  --r-sm: 11px;
  --f-display: 'Exo 2', 'Outfit', system-ui, sans-serif;
  --f-body: 'Outfit', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --f-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.5 var(--f-body);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
img, video { display: block; max-width: 100%; }
a { color: var(--violet-3); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
::selection { background: rgba(168, 85, 247, 0.45); }
:focus-visible { outline: 2px solid var(--violet-3); outline-offset: 2px; }
[hidden] { display: none !important; }

.ic { width: 1.15em; height: 1.15em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.2em; }

/* ───────────── Fondo ───────────── */
.gf-bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: #05030f center / cover no-repeat; }
.gf-bg video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center; opacity: 0; transition: opacity 0.8s ease; filter: blur(var(--bg-blur, 0px)); transform: translateZ(0); }
.gf-bg video.on { opacity: 1; }
.gf-bg-shade {
  position: absolute; inset: 0;
  background:
    radial-gradient(110% 80% at 50% 35%, transparent 40%, rgba(4, 2, 11, calc(var(--bg-dim, 0.45) + 0.25)) 100%),
    linear-gradient(180deg, rgba(4, 2, 11, calc(var(--bg-dim, 0.45) * 0.5)) 0%, rgba(4, 2, 11, var(--bg-dim, 0.45)) 55%, rgba(4, 2, 11, calc(var(--bg-dim, 0.45) + 0.3)) 100%);
}
.gf-bg.no-stars .gf-stars { display: none; }
.gf-stars {
  position: absolute; inset: -50%;
  background-image:
    radial-gradient(1.2px 1.2px at 20% 30%, rgba(255, 255, 255, 0.8), transparent 60%),
    radial-gradient(1px 1px at 70% 80%, rgba(200, 180, 255, 0.8), transparent 60%),
    radial-gradient(1.4px 1.4px at 40% 70%, rgba(180, 220, 255, 0.7), transparent 60%),
    radial-gradient(1px 1px at 85% 20%, rgba(255, 255, 255, 0.7), transparent 60%);
  background-size: 340px 340px, 420px 420px, 380px 380px, 300px 300px;
  animation: drift 120s linear infinite;
  opacity: 0.5;
}
@keyframes drift { to { transform: translate3d(-170px, -120px, 0); } }
@media (prefers-reduced-motion: reduce) { .gf-stars { animation: none; } }

/* ───────────── Vidrio y superficies ───────────── */
.glass {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  backdrop-filter: blur(18px) saturate(1.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 24px 60px -30px rgba(0, 0, 0, 0.8);
}
.glass-edge { position: relative; }
.glass-edge::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(140deg, rgba(196, 170, 255, 0.65), rgba(125, 211, 252, 0.15) 40%, rgba(168, 85, 247, 0.5));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
}

/* ───────────── Tipografía ───────────── */
.display { font-family: var(--f-display); font-weight: 800; letter-spacing: -0.01em; line-height: 1.05; }
.grad-text { background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent; }
.mono { font-family: var(--f-mono); }
.label { font: 500 11.5px/1 var(--f-mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.small { font-size: 13.5px; }
.center { text-align: center; }
.tnum { font-variant-numeric: tabular-nums; }

/* ───────────── Botones ───────────── */
.btn {
  --h: 48px;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  min-height: var(--h); padding: 0 20px; border-radius: 14px; border: 1px solid transparent;
  font-weight: 600; font-size: 15.5px; white-space: nowrap; user-select: none;
  transition: transform 0.18s var(--ease), box-shadow 0.25s var(--ease), background 0.25s, border-color 0.25s, opacity 0.2s;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; pointer-events: none; }
.btn-primary { background: var(--grad); color: #fff; box-shadow: var(--glow); }
@media (hover: hover) { .btn-primary:hover { box-shadow: 0 0 0 1px rgba(216, 196, 255, 0.6), 0 14px 46px -8px rgba(168, 85, 247, 0.9); } }
.btn-ghost { background: rgba(20, 12, 44, 0.55); border-color: var(--line-hi); color: var(--ink); }
@media (hover: hover) { .btn-ghost:hover { background: rgba(48, 28, 100, 0.6); } }
.btn-soft { background: rgba(139, 92, 246, 0.16); color: #e4d8ff; border-color: rgba(139, 92, 246, 0.3); }
.btn-danger { background: rgba(251, 113, 133, 0.14); color: #fecdd3; border-color: rgba(251, 113, 133, 0.35); }
.btn-ok { background: rgba(74, 222, 128, 0.15); color: #bbf7d0; border-color: rgba(74, 222, 128, 0.35); }
.btn-block { width: 100%; }
.btn-sm { --h: 36px; padding: 0 13px; font-size: 13.5px; border-radius: 11px; gap: 6px; }
.btn-xs { --h: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 9px; gap: 5px; }
.btn-icon { --h: 40px; width: var(--h); padding: 0; border-radius: 12px; }
.spin { width: 18px; height: 18px; border-radius: 50%; border: 2.4px solid rgba(255, 255, 255, 0.3); border-top-color: #fff; animation: spin 0.7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ───────────── Formularios ───────────── */
.field { display: grid; gap: 8px; }
.field > .label { display: flex; justify-content: space-between; gap: 8px; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap > .ic:first-child { position: absolute; left: 15px; color: var(--violet-3); width: 20px; height: 20px; pointer-events: none; }
.input, select.input, textarea.input {
  width: 100%; min-height: 52px; padding: 13px 16px; border-radius: 14px;
  background: rgba(6, 3, 16, 0.72); border: 1px solid rgba(168, 130, 255, 0.45);
  font-size: 16px; outline: none; transition: border-color 0.2s, box-shadow 0.2s;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2);
}
.input-wrap > .ic:first-child + .input { padding-left: 46px; }
.input:focus { border-color: var(--violet-3); box-shadow: 0 0 0 4px rgba(168, 85, 247, 0.18), 0 0 24px -6px rgba(168, 85, 247, 0.7); }
.input::placeholder { color: #6f6596; }
textarea.input { min-height: 96px; resize: vertical; }
.input-sm { min-height: 40px; padding: 8px 12px; font-size: 14.5px; border-radius: 11px; }
.input-wrap .suffix { position: absolute; right: 8px; }
.check { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; }
.check input { appearance: none; width: 24px; height: 24px; margin: 1px 0 0; border-radius: 8px; border: 1.5px solid var(--line-hi); background: rgba(6, 3, 16, 0.7); display: grid; place-content: center; flex: none; transition: background 0.2s; }
.check input:checked { background: var(--grad); border-color: transparent; }
.check input:checked::after { content: ''; width: 11px; height: 6px; border: 2.4px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.switch { position: relative; display: inline-flex; width: 44px; height: 26px; flex: none; }
.switch input { appearance: none; width: 100%; height: 100%; margin: 0; border-radius: 99px; background: rgba(120, 100, 180, 0.35); transition: background 0.2s; cursor: pointer; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform 0.25s var(--ease); }
.switch input:checked { background: var(--violet); }
.switch input:checked::after { transform: translateX(18px); }

/* ───────────── Piezas ───────────── */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; font-size: 12.5px; font-weight: 600; border: 1px solid var(--line); background: rgba(139, 92, 246, 0.14); color: #e4d8ff; white-space: nowrap; }
.tone-ok { background: rgba(74, 222, 128, 0.13); border-color: rgba(74, 222, 128, 0.35); color: #bbf7d0; }
.tone-info { background: rgba(147, 197, 253, 0.13); border-color: rgba(147, 197, 253, 0.35); color: #dbeafe; }
.tone-wait { background: rgba(192, 132, 252, 0.15); border-color: rgba(192, 132, 252, 0.4); color: #f3e8ff; }
.tone-warn { background: rgba(251, 191, 36, 0.13); border-color: rgba(251, 191, 36, 0.4); color: #fde68a; }
.tone-bad { background: rgba(251, 113, 133, 0.13); border-color: rgba(251, 113, 133, 0.4); color: #fecdd3; }
.tone-mute { background: rgba(148, 140, 180, 0.12); border-color: rgba(148, 140, 180, 0.3); color: #c9c2e3; }
.gf-avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; border: 2px solid rgba(196, 170, 255, 0.6); background: #1b1238; flex: none; }
.gf-avatar.ini { display: inline-grid; place-items: center; font: 800 18px var(--f-display); background: var(--grad); color: #fff; }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 13px; font-size: 14px; border: 1px solid; }
.alert .ic { margin-top: 2px; }
.alert.err { background: rgba(251, 113, 133, 0.1); border-color: rgba(251, 113, 133, 0.35); color: #fecdd3; }
.alert.ok { background: rgba(74, 222, 128, 0.1); border-color: rgba(74, 222, 128, 0.35); color: #bbf7d0; }
.alert.info { background: rgba(139, 92, 246, 0.12); border-color: rgba(167, 139, 250, 0.35); color: #e9ddff; }
.alert.warn { background: rgba(251, 191, 36, 0.1); border-color: rgba(251, 191, 36, 0.35); color: #fde68a; }
.divider { height: 1px; background: linear-gradient(90deg, transparent, var(--line-hi), transparent); border: 0; margin: 18px 0; }
.empty { padding: 34px 16px; text-align: center; color: var(--muted); }
.empty .ic { width: 38px; height: 38px; color: var(--violet-3); margin-bottom: 8px; opacity: 0.8; }
.skeleton { background: linear-gradient(90deg, rgba(139, 92, 246, 0.08), rgba(139, 92, 246, 0.2), rgba(139, 92, 246, 0.08)); background-size: 200% 100%; animation: sk 1.3s infinite; border-radius: var(--r); }
@keyframes sk { to { background-position: -200% 0; } }

/* ───────────── Avisos ───────────── */
.gf-toasts { position: fixed; z-index: 200; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: grid; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.gf-toast { display: flex; gap: 10px; align-items: center; padding: 13px 16px; border-radius: 14px; background: rgba(20, 12, 44, 0.92); border: 1px solid var(--line-hi); backdrop-filter: blur(14px); box-shadow: 0 16px 40px -12px #000; font-size: 14.5px; animation: tin 0.35s var(--ease); }
.gf-toast.err { border-color: rgba(251, 113, 133, 0.6); }
.gf-toast.err .ic { color: var(--bad); }
.gf-toast.ok .ic { color: var(--ok); }
.gf-toast.out { opacity: 0; transform: translateY(8px); transition: 0.35s; }
@keyframes tin { from { opacity: 0; transform: translateY(12px) scale(0.97); } }

/* ───────────── Crédito ───────────── */
.gf-credit { margin: 0; text-align: center; font-size: 14px; color: var(--muted); }
.gf-credit a { color: #e9ddff; font-weight: 700; border-bottom: 1px dashed rgba(196, 170, 255, 0.6); }
.gf-credit .heartbeat { color: #c084fc; width: 1.05em; height: 1.05em; margin: 0 2px; filter: drop-shadow(0 0 6px rgba(192, 132, 252, 0.8)); animation: beat 1.25s ease-in-out infinite; transform-origin: center; }
@keyframes beat { 0%, 100% { transform: scale(1); } 14% { transform: scale(1.28); } 28% { transform: scale(1); } 42% { transform: scale(1.2); } 70% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .gf-credit .heartbeat { animation: none; } }

/* ───────────── Hoja/diálogo ───────────── */
.sheet-back { position: fixed; inset: 0; z-index: 100; background: rgba(3, 1, 10, 0.6); backdrop-filter: blur(4px); opacity: 0; transition: opacity 0.3s; }
.sheet-back.on { opacity: 1; }
.sheet {
  position: fixed; z-index: 101; left: 0; right: 0; bottom: 0; max-height: 92dvh; overflow: auto; overscroll-behavior: contain;
  background: rgba(12, 7, 28, 0.94); border: 1px solid var(--line-hi); border-bottom: 0; border-radius: 26px 26px 0 0;
  padding: 10px 18px calc(22px + env(safe-area-inset-bottom)); transform: translateY(105%); transition: transform 0.42s var(--ease);
  box-shadow: 0 -30px 80px -20px rgba(91, 33, 182, 0.55);
}
.sheet.on { transform: none; }
.sheet .grab { width: 44px; height: 5px; border-radius: 9px; background: rgba(196, 170, 255, 0.35); margin: 2px auto 10px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; position: sticky; top: -10px; padding-top: 4px; background: inherit; z-index: 2; }
.sheet-head h3 { margin: 0; font: 800 21px var(--f-display); }
@media (min-width: 760px) {
  .sheet { left: 50%; bottom: auto; top: 50%; width: min(560px, 94vw); max-height: 88dvh; border-radius: 26px; border-bottom: 1px solid var(--line-hi); transform: translate(-50%, -46%) scale(0.97); opacity: 0; transition: transform 0.38s var(--ease), opacity 0.25s; padding-bottom: 24px; }
  .sheet.on { transform: translate(-50%, -50%); opacity: 1; }
  .sheet .grab { display: none; }
  .sheet.wide { width: min(860px, 96vw); }
}
/* Portal y panel: la nebulosa se ve viva; solo se oscurece lo justo para leer. */
.gf-bg.portal .gf-bg-shade { background: radial-gradient(80% 70% at 50% 45%, rgba(4, 2, 11, 0.35), rgba(4, 2, 11, 0.1) 100%); }
.gf-bg.portal .gf-stars { opacity: 0.35; }
