/* Paleta y tipografías tomadas de ganamos.ac (theme.js) */
:root {
  --bg: #110326;
  --bg-2: #130227;
  --bg-3: #0d0024;
  --card: linear-gradient(180deg, #320548 0%, #1f073a 100%);
  --card-flat: #1f073a;
  --card-2: #2a0a44;
  --input: #0d0024;
  --border: rgba(188, 103, 223, .28);
  --border-strong: rgba(188, 103, 223, .55);
  --text: #ffffff;
  --text-2: #ededed;
  --muted: #9583a0;
  --faint: #6e5d80;
  --accent: #A542DA;
  --accent-2: #9533D4;
  --gold: #F5C24B;
  --grad: linear-gradient(135deg, #4E2AAD, #A542DA);
  --grad-deco: linear-gradient(113deg, #5428B4 15%, #B339E2 85%);
  --bubble-me: linear-gradient(135deg, #4E2AAD, #8a37c4);
  --bubble-other: #2a0a44;
  --danger: #dc3545;
  --ok: #2ecc71;
  --warn: #F5C24B;
  --radius: 14px;
  --shadow: 0 12px 34px rgba(0, 0, 0, .45);
  --font: 'Rubik', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --font-head: 'Montserrat', 'Rubik', system-ui, sans-serif;
  color-scheme: dark;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background:
    radial-gradient(1200px 600px at 50% -200px, rgba(165, 66, 218, .28), transparent 70%),
    radial-gradient(800px 500px at 100% 100%, rgba(78, 42, 173, .18), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--gold); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.gold { color: var(--gold); }

/* ---------- formularios ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; color: var(--text-2); font-weight: 500; }
.field .hint { font-size: 12px; color: var(--muted); }
.input, .textarea, .select {
  width: 100%; background: var(--input); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px; color: var(--text); transition: border-color .15s, box-shadow .15s;
}
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:focus, .textarea:focus, .select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(165, 66, 218, .2); }
.textarea { resize: vertical; min-height: 70px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; color: var(--text-2); margin-bottom: 14px; cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--accent); width: 16px; height: 16px; }

/* ---------- botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 10px; padding: 11px 16px; border: 1px solid var(--border-strong);
  background: transparent; color: var(--text); cursor: pointer; font-weight: 600; white-space: nowrap;
  font-family: var(--font-head); text-decoration: none; transition: filter .15s, background .15s, border-color .15s, transform .1s;
}
.btn:hover { border-color: var(--accent); background: rgba(165, 66, 218, .08); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--grad); border-color: transparent; box-shadow: 0 4px 22px rgba(165, 66, 218, .45), inset 0 0 0 1px rgba(255, 255, 255, .12); font-weight: 800; }
.btn-primary:hover { filter: brightness(1.12); background: var(--grad); }
.btn-gold { background: linear-gradient(180deg, #ffd66b, #F5C24B 55%, #d9a22a); color: #1a0730; border-color: transparent; font-weight: 800; box-shadow: 0 0 24px rgba(245, 194, 75, .35); }
.btn-gold:hover { filter: brightness(1.06); background: linear-gradient(180deg, #ffd66b, #F5C24B 55%, #d9a22a); }
.btn-outline { border: 1.5px solid var(--accent); color: #fff; background: rgba(50, 5, 72, .65); font-weight: 800; }
.btn-danger { border-color: rgba(220, 53, 69, .6); color: #ff9aa5; }
.btn-danger:hover { border-color: var(--danger); background: rgba(220, 53, 69, .1); }
.btn-ok { border-color: rgba(46, 204, 113, .6); color: #8ff0b5; }
.btn-ok:hover { border-color: var(--ok); background: rgba(46, 204, 113, .1); }
.btn-sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; padding: 14px; font-size: 16px; }
.btn-big { padding: 16px; font-size: 16.5px; letter-spacing: .4px; }
.icon-btn { background: transparent; border: 0; color: var(--muted); cursor: pointer; padding: 8px; border-radius: 50%; display: inline-flex; }
.icon-btn:hover { color: var(--text); background: rgba(255, 255, 255, .07); }
.link-btn { background: none; border: 0; color: var(--gold); cursor: pointer; text-decoration: underline; padding: 6px; font-size: 14px; }
.btn-play {
  position: relative; overflow: hidden; padding: 20px 16px; border-radius: 14px; border: none;
  font-size: 21px; font-weight: 900; letter-spacing: .8px; color: #1a0730;
  background: linear-gradient(135deg, #ffe08a, #F5C24B 45%, #d39a1f);
  box-shadow: 0 0 34px rgba(245, 194, 75, .45), inset 0 1px rgba(255, 255, 255, .5);
}
.btn-play::before {
  content: ''; position: absolute; top: 0; left: -100%; width: 60%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .75), transparent);
  transform: skew(-25deg); animation: shine 3.2s infinite ease-in-out; pointer-events: none;
}
@keyframes shine { 0% { left: -100%; } 60%, 100% { left: 160%; } }
@media (prefers-reduced-motion: reduce) { .btn-play::before { animation: none; display: none; } }

/* ---------- piezas ---------- */
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: 18px;
  box-shadow: var(--shadow); padding: 22px 20px;
}
.card h1, .card h2 { font-family: var(--font-head); margin: 0 0 6px; }
.card h1 { font-size: 21px; }
.card h2 { font-size: 17px; }
.lead { margin: 0 0 18px; color: var(--muted); font-size: 14px; }
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--gold); color: #1a0730; font-size: 12px; font-weight: 800; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12px; border: 1px solid var(--border); color: var(--muted); white-space: nowrap; }
.pill.ok { color: #8ff0b5; border-color: rgba(46, 204, 113, .45); }
.pill.warn { color: #ffe08a; border-color: rgba(245, 194, 75, .5); }
.pill.danger { color: #ffb1ba; border-color: rgba(220, 53, 69, .5); }
.pill.info { color: #d9b3ff; border-color: rgba(165, 66, 218, .55); }
.error-box { background: rgba(220, 53, 69, .12); border: 1px solid rgba(220, 53, 69, .45); color: #ffc1c8; border-radius: 10px; padding: 10px 12px; font-size: 14px; margin-bottom: 12px; }
.ok-box { background: rgba(46, 204, 113, .1); border: 1px solid rgba(46, 204, 113, .4); color: #a8f3c6; border-radius: 10px; padding: 10px 12px; font-size: 14px; margin-bottom: 12px; }
.warn-box { background: rgba(245, 194, 75, .1); border: 1px solid rgba(245, 194, 75, .4); color: #ffe6a6; border-radius: 10px; padding: 10px 12px; font-size: 13.5px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip { border: 1px solid var(--border-strong); background: transparent; color: var(--text); border-radius: 999px; padding: 7px 13px; cursor: pointer; font-size: 14px; }
.chip[aria-pressed="true"] { background: rgba(165, 66, 218, .25); border-color: var(--accent); font-weight: 600; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--grad); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-family: var(--font-head); flex-shrink: 0; font-size: 14px; }
.spacer { flex: 1; }
.foot-note { margin: 18px auto 0; font-size: 12.5px; color: var(--muted); text-align: center; }
.copy-row { display: flex; align-items: center; gap: 10px; background: var(--input); border: 1px dashed var(--border-strong); border-radius: 12px; padding: 12px 14px; }
.copy-row b { font-size: 18px; letter-spacing: .3px; word-break: break-all; color: var(--gold); flex: 1; }
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  background: #2a0a44; border: 1px solid var(--border-strong); padding: 10px 16px; border-radius: 12px; z-index: 100;
  box-shadow: var(--shadow); font-size: 14px; max-width: calc(100% - 32px);
}

/* ---------- jugador ---------- */
.shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; background: rgba(16, 3, 37, .92); border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.logo { height: 34px; width: auto; display: block; }
.logo-lg { height: 64px; width: auto; margin: 0 auto; display: block; filter: drop-shadow(0 6px 24px rgba(165, 66, 218, .5)); }
.wrap { width: 100%; max-width: 520px; margin: 0 auto; padding: 18px 16px 34px; display: flex; flex-direction: column; gap: 14px; }
.hero { text-align: center; padding: 18px 4px 6px; }
.hero h1 { font-family: var(--font-head); font-size: 27px; line-height: 1.15; margin: 18px 0 8px; font-weight: 900; }
.hero h1 span { background: linear-gradient(90deg, #F5C24B, #ffe08a); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: var(--text-2); margin: 0 0 6px; }
.perks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.perk { background: rgba(50, 5, 72, .55); border: 1px solid var(--border); border-radius: 12px; padding: 12px 8px; text-align: center; font-size: 12.5px; color: var(--text-2); }
.perk b { display: block; font-size: 20px; margin-bottom: 2px; }
.hello { margin: 2px 0; font-size: 18px; font-family: var(--font-head); }
.actions { display: flex; flex-direction: column; gap: 11px; }
.secondary { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.user-chip { display: inline-flex; align-items: center; gap: 8px; background: rgba(50, 5, 72, .8); border: 1px solid var(--border); border-radius: 999px; padding: 4px 12px 4px 4px; color: var(--text); cursor: pointer; font-size: 13.5px; }
.user-chip .avatar { width: 28px; height: 28px; font-size: 12px; }
.tabs-auth { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: var(--input); padding: 4px; border-radius: 12px; margin-bottom: 16px; }
.tabs-auth button { border: 0; background: transparent; padding: 9px; border-radius: 9px; cursor: pointer; color: var(--muted); font-weight: 600; font-family: var(--font-head); }
.tabs-auth button[aria-selected="true"] { background: var(--grad); color: #fff; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.seg button { border: 1px solid var(--border); background: var(--input); border-radius: 10px; padding: 10px; cursor: pointer; font-size: 13.5px; text-align: left; }
.seg button[aria-pressed="true"] { border-color: var(--accent); background: rgba(165, 66, 218, .15); }
.seg b { display: block; font-size: 14px; }

/* hoja inferior / modal */
.sheet-bg { position: fixed; inset: 0; background: rgba(5, 0, 15, .7); z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  width: 100%; max-width: 520px; max-height: 92vh; overflow: auto; background: var(--bg-2);
  border: 1px solid var(--border); border-bottom: 0; border-radius: 20px 20px 0 0; padding: 18px 18px calc(22px + env(safe-area-inset-bottom, 0px));
  box-shadow: var(--shadow);
}
.sheet-head { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.sheet-head h2 { font-family: var(--font-head); font-size: 18px; margin: 0; flex: 1; }
@media (min-width: 700px) {
  .sheet-bg { align-items: center; }
  .sheet { border-radius: 20px; border-bottom: 1px solid var(--border); }
}
.steps { margin: 0 0 16px; padding-left: 20px; color: var(--text-2); font-size: 14px; }
.steps li { margin-bottom: 6px; }
.file-drop { display: flex; align-items: center; gap: 10px; border: 1px dashed var(--border-strong); border-radius: 12px; padding: 12px; cursor: pointer; background: var(--input); font-size: 14px; }
.file-drop input { display: none; }
.hist-item { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); }
.hist-item:last-child { border-bottom: 0; }
.hist-item .amt { font-weight: 700; font-family: var(--font-head); }

/* ---------- chat (compartido) ---------- */
.chat { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border); background: rgba(16, 3, 37, .92); }
.chat-head .who { flex: 1; min-width: 0; }
.chat-head .who b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-body { flex: 1; overflow-y: auto; padding: 16px 12px; display: flex; flex-direction: column; gap: 6px; }
.day { align-self: center; font-size: 12px; color: var(--muted); background: rgba(42, 10, 68, .8); border-radius: 999px; padding: 3px 10px; margin: 8px 0; }
.msg { max-width: 82%; padding: 8px 11px 6px; border-radius: 14px; background: var(--bubble-other); border: 1px solid rgba(188, 103, 223, .14); white-space: pre-wrap; word-wrap: break-word; font-size: 14.5px; align-self: flex-start; }
.msg.me { align-self: flex-end; background: var(--bubble-me); border-color: transparent; border-bottom-right-radius: 4px; }
.msg.them { border-bottom-left-radius: 4px; }
.msg.sys { align-self: center; max-width: 92%; background: rgba(245, 194, 75, .08); border: 1px solid rgba(245, 194, 75, .3); text-align: center; color: #ffeec2; }
.msg .meta { display: block; text-align: right; font-size: 11px; color: rgba(255, 255, 255, .6); margin-top: 3px; }
.msg img.att { display: block; max-width: 240px; max-height: 280px; width: 100%; object-fit: cover; border-radius: 10px; margin-bottom: 4px; cursor: zoom-in; }
.msg a.att { display: inline-flex; gap: 6px; align-items: center; color: #fff; }
.req-card { border-radius: 12px; background: rgba(13, 0, 36, .55); border: 1px solid var(--border-strong); padding: 10px; margin-top: 6px; white-space: normal; text-align: left; }
.req-card .row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.req-card .amt { font-weight: 800; font-family: var(--font-head); font-size: 16px; }
.req-card .actions-row { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.req-card .result { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.typing { font-size: 12.5px; color: var(--muted); padding: 0 16px 6px; min-height: 20px; }
.composer { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--border); background: rgba(16, 3, 37, .95); }
.composer .textarea { min-height: 44px; max-height: 140px; resize: none; padding: 11px 13px; border-radius: 22px; }
.composer .send { width: 44px; height: 44px; border-radius: 50%; padding: 0; flex-shrink: 0; }
.attach-preview { display: flex; align-items: center; gap: 8px; padding: 6px 14px; font-size: 13px; color: var(--text-2); }
.lightbox { position: fixed; inset: 0; background: rgba(0, 0, 0, .9); z-index: 90; display: flex; align-items: center; justify-content: center; padding: 16px; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 10px; }

.player-chat { position: fixed; inset: 0; z-index: 30; background: var(--bg); display: flex; flex-direction: column; padding-top: env(safe-area-inset-top, 0px); }
.player-chat .chat { max-width: 760px; width: 100%; margin: 0 auto; border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
