:root {
  --bg: #0a0813;
  --text: #eceaf7;
  --muted: #9b95b5;
  --violet: #a970ff;
  --violet2: #7c4dff;
  --gold: #f7931a;
  --green: #35d07f;
  --red: #ff5c6c;
  --glass: rgba(24, 20, 38, 0.55);
  --stroke: rgba(255, 255, 255, 0.09);
  --radius: 20px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; padding: 0 16px 60px; color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", system-ui, sans-serif;
  line-height: 1.5; min-height: 100vh;
  background:
    radial-gradient(1000px 520px at 50% -220px, rgba(139, 92, 246, 0.20), transparent 60%),
    radial-gradient(760px 520px at 108% 6%, rgba(124, 77, 255, 0.14), transparent 55%),
    radial-gradient(600px 400px at -10% 30%, rgba(169, 112, 255, 0.08), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}
h1, h2 { margin: 0; letter-spacing: -0.01em; }
a { color: inherit; text-decoration: none; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
.green { color: var(--green); }
.red { color: var(--red); }

/* --- glass primitives --- */
.glass {
  background: var(--glass);
  backdrop-filter: blur(22px) saturate(150%);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  border: 1px solid var(--stroke);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}
.card { border-radius: var(--radius); padding: 22px; }

.glass-btn {
  font: inherit; font-weight: 600; color: var(--text); cursor: pointer;
  padding: 11px 20px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: transform .12s ease, background .15s ease, box-shadow .15s ease;
}
.glass-btn:hover { background: rgba(255, 255, 255, 0.12); transform: translateY(-1px); }
.glass-btn:active { transform: translateY(0); }
.glass-btn.primary { background: linear-gradient(135deg, var(--violet), var(--violet2)); border: 0; color: #fff; box-shadow: 0 8px 24px rgba(124, 77, 255, 0.4); }
.glass-btn.gold { background: linear-gradient(135deg, #ffb64a, var(--gold)); border: 0; color: #1a1206; box-shadow: 0 8px 24px rgba(247, 147, 26, 0.35); }
.glass-btn.nostr { border-color: rgba(169, 112, 255, 0.5); color: #d9c9ff; }
.glass-btn.sec { background: rgba(255, 255, 255, 0.06); }
.glass-btn.sm { padding: 7px 14px; font-size: .85rem; }

/* --- navbar --- */
.navbar {
  position: sticky; top: 12px; z-index: 50;
  max-width: 1200px; margin: 14px auto; padding: 12px 20px;
  border-radius: 999px; display: flex; align-items: center; gap: 18px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: .14em; font-size: 1.05rem; }
.nav-ball { display: none; }
.brand .eye { display: inline; font-size: 1.5rem; filter: drop-shadow(0 0 12px rgba(169, 112, 255, 0.55)); }
.navlinks { display: flex; gap: 26px; margin: 0 auto; font-size: .95rem; }
.navlinks a { color: var(--muted); transition: color .15s; }
.navlinks a:hover { color: var(--text); }
.navlinks a.active { color: var(--violet); text-shadow: 0 0 16px rgba(169, 112, 255, 0.6); }

/* --- hero --- */
.hero {
  max-width: 1080px; margin: 34px auto 10px; padding: 0 8px;
  display: grid; grid-template-columns: 320px 1fr; gap: 20px; align-items: center;
}
.hero-ball { width: 100%; max-width: 340px; height: auto; border-radius: 22px; border: 1px solid rgba(169, 112, 255, 0.28); box-shadow: 0 20px 50px rgba(124, 77, 255, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.05); }
.hero-text { text-align: center; }
.hero h1 { font-size: clamp(2rem, 5vw, 3.2rem); font-weight: 800; line-height: 1.08; }
.hero h1 .grad { background: linear-gradient(120deg, #c9a6ff, var(--violet)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero .tag { color: var(--muted); max-width: 620px; margin: 14px auto 0; font-size: 1.02rem; }
.hero .tag b { color: #c9a6ff; }

.badge {
  display: inline-block; margin-top: 18px; font-size: .82rem; padding: 8px 18px;
  border-radius: 999px; background: rgba(169, 112, 255, 0.12);
  border: 1px solid rgba(169, 112, 255, 0.28); color: #d9c9ff;
  backdrop-filter: blur(10px);
}

/* --- main --- */
main { max-width: 1080px; margin: 26px auto 0; display: flex; flex-direction: column; gap: 18px; }
h2 { font-size: 1.2rem; display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.spark { color: var(--violet); }

/* create card */
.create .field { position: relative; margin-bottom: 14px; }
.create label { display: block; color: var(--muted); font-size: .82rem; margin-bottom: 6px; }
.create textarea, .stepper input {
  font: inherit; color: var(--text); background: rgba(10, 8, 18, 0.6);
  border: 1px solid var(--stroke); border-radius: 14px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.create textarea { width: 100%; padding: 14px 16px; resize: vertical; min-height: 56px; }
.create textarea:focus, .stepper input:focus { border-color: rgba(169, 112, 255, 0.6); box-shadow: 0 0 0 3px rgba(169, 112, 255, 0.15); }
.counter { position: absolute; right: 12px; bottom: 10px; font-size: .72rem; color: var(--muted); pointer-events: none; }
.create-row { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; margin-top: 6px; }
.stepper { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .9rem; }
.stepper .ico { opacity: .7; }
.stepper input { width: 68px; padding: 9px 10px; text-align: center; }
.create-row .primary { margin-left: auto; }
.error { color: var(--red); min-height: 1.1em; margin: 10px 0 0; font-size: .9rem; }

/* features */
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.feature { display: flex; align-items: center; gap: 14px; padding: 18px; }
.ftile { width: 46px; height: 46px; flex: none; border-radius: 14px; display: grid; place-items: center; font-size: 1.3rem;
  background: rgba(169, 112, 255, 0.14); border: 1px solid rgba(169, 112, 255, 0.25); }
.ftext { display: flex; flex-direction: column; }
.ftext b { font-size: .98rem; }
.ftext span { color: var(--muted); font-size: .85rem; }

/* análisis de probabilidad */
.analisis { margin: 12px 0 4px; }
#analisisBox { margin-top: 10px; padding: 14px; border-radius: 14px; background: rgba(169, 112, 255, 0.08); border: 1px solid rgba(169, 112, 255, 0.22); }
.probRow { display: flex; align-items: center; gap: 16px; }
.probNum { font-size: 2.2rem; font-weight: 800; line-height: 1; }
.probTxt { font-size: .9rem; }
.probBar { height: 8px; border-radius: 99px; background: rgba(255, 255, 255, 0.08); margin-top: 12px; overflow: hidden; }
.probBar div { height: 100%; border-radius: 99px; transition: width .5s ease; }
.atajos { margin: 8px 0 0; font-size: .82rem; }
.atajos .linkbtn { font-size: .82rem; }
/* --- calendario propio (date picker inequívoco) --- */
.stepper.picker { position: relative; }
.picker-trigger {
  font: inherit; color: var(--text); background: rgba(10, 8, 18, 0.6); cursor: pointer;
  border: 1px solid var(--stroke); border-radius: 12px; padding: 9px 13px; outline: none;
  min-width: 215px; text-align: left; transition: border-color .15s, box-shadow .15s;
}
.picker-trigger::before { content: "📅 "; opacity: .7; }
.picker-trigger:hover, .picker-trigger:focus { border-color: rgba(169, 112, 255, 0.6); box-shadow: 0 0 0 3px rgba(169, 112, 255, 0.12); }
.cal-pop {
  position: absolute; z-index: 100; top: calc(100% + 8px); left: 0; width: 262px;
  background: #141024; border: 1px solid rgba(169, 112, 255, 0.3); border-radius: 16px;
  padding: 14px; box-shadow: 0 18px 48px rgba(0, 0, 0, 0.6);
}
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.cal-head b { text-transform: capitalize; font-size: .95rem; color: var(--text); }
.cal-nav { background: rgba(255, 255, 255, 0.06); border: 1px solid var(--stroke); color: var(--text);
  width: 30px; height: 30px; border-radius: 9px; cursor: pointer; font-size: 1.1rem; line-height: 1; }
.cal-nav:hover { background: rgba(169, 112, 255, 0.18); }
.cal-dows, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-dows span { text-align: center; font-size: .68rem; color: var(--muted); padding: 2px 0; }
.cal-d { background: none; border: 1px solid transparent; color: var(--text); border-radius: 8px;
  height: 32px; cursor: pointer; font: inherit; font-size: .85rem; }
.cal-d.empty { visibility: hidden; cursor: default; }
.cal-d:not(.empty):hover { background: rgba(169, 112, 255, 0.18); }
.cal-d.hoy { border-color: rgba(169, 112, 255, 0.45); }
.cal-d.sel { background: linear-gradient(135deg, var(--violet), var(--violet2)); color: #fff; font-weight: 700; }
.cal-time { display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--stroke); font-size: .85rem; color: var(--muted); }
.cal-pop .cal-hora { font: inherit; color: var(--text); background: rgba(10, 8, 18, 0.6);
  border: 1px solid var(--stroke); border-radius: 9px; padding: 7px 10px; outline: none;
  width: auto; min-width: 96px; text-align: left; }
.cal-pop .cal-hora:focus { border-color: rgba(169, 112, 255, 0.6); }
.cal-pop .cal-hora::-webkit-calendar-picker-indicator { filter: invert(0.7); cursor: pointer; }
.cal-save { width: 100%; margin-top: 12px; padding: 10px; border: 0; border-radius: 11px; cursor: pointer;
  font: inherit; font-weight: 700; color: #fff; background: linear-gradient(135deg, var(--violet), var(--violet2));
  box-shadow: 0 6px 18px rgba(124, 77, 255, 0.35); transition: transform .12s, box-shadow .12s; }
.cal-save:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(124, 77, 255, 0.45); }
.cal-save:active { transform: translateY(0); }

/* acceso (QR para la sala) */
.accesoRow { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; margin-top: 14px; }
.accesoQr { width: 190px; height: 190px; border-radius: 16px; background: #fff; padding: 10px; flex: none; }
.accesoInfo { flex: 1; min-width: 220px; }
.accesoUrl {
  font-family: ui-monospace, SFMono-Regular, monospace; font-size: 1.05rem; font-weight: 700;
  color: var(--violet); word-break: break-all; margin-bottom: 8px;
}

/* chat con el oráculo */
#chatLog { display: flex; flex-direction: column; gap: 10px; max-height: 320px; overflow-y: auto; margin: 12px 0; }
#chatLog:empty { display: none; }
.msg { padding: 11px 15px; border-radius: 14px; max-width: 88%; font-size: .92rem; white-space: pre-wrap; }
.msg.yo { align-self: flex-end; background: linear-gradient(135deg, rgba(169, 112, 255, .3), rgba(124, 77, 255, .22)); border: 1px solid rgba(169, 112, 255, .35); }
.msg.oraculo { align-self: flex-start; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--stroke); }
.msg.pensando { opacity: .7; animation: pulse 1.2s infinite; }
.msg .sources { margin-top: 8px; font-size: .76rem; }

/* globo para preguntar al oráculo, encima de "Nueva apuesta" (mismo ancho que las tarjetas) */
.askBarWrap { display: flex; flex-direction: column; gap: 10px; }
.askBar {
  display: flex; align-items: center; gap: 14px; padding: 16px;
  border-radius: 28px;
}
.askIcon { font-size: 1.5rem; flex: none; filter: drop-shadow(0 0 10px rgba(169, 112, 255, 0.5)); }
.askBar textarea {
  flex: 1; font: inherit; font-size: 1.05rem; line-height: 1.5; color: var(--text);
  background: rgba(10, 8, 18, 0.6); border: 1px solid var(--stroke);
  border-radius: 18px; outline: none; padding: 14px 18px; resize: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.askBar textarea::placeholder { color: var(--muted); }
.askBar textarea:focus { border-color: rgba(169, 112, 255, 0.6); box-shadow: 0 0 0 3px rgba(169, 112, 255, 0.15); }
.askBar .primary { flex: none; white-space: nowrap; padding: 14px 24px; }
.askBarWrap #chatLog { margin: 0; }

/* cómo funciona */
.howto h2 { margin-bottom: 18px; }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.step { position: relative; padding: 20px 18px; display: flex; flex-direction: column; gap: 6px; }
.step .stepnum { position: absolute; top: 14px; right: 16px; font-size: .9rem; font-weight: 800; color: var(--violet); opacity: .55; }
.step .stepicon { font-size: 1.7rem; margin-bottom: 4px; }
.step b { font-size: 1rem; }
.step span { color: var(--muted); font-size: .86rem; }
.step i { color: #c9a6ff; font-style: italic; }
@media (max-width: 820px) { .steps { grid-template-columns: 1fr; } }

/* --- markets --- */
.market .q { font-size: 1.15rem; font-weight: 700; margin-bottom: 3px; }
.market .meta { color: var(--muted); font-size: .82rem; margin: 4px 0 12px; }
.linkbtn { background: none; border: 0; color: var(--violet); cursor: pointer; font: inherit; font-size: .78rem; padding: 0; }
.poolbar { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: rgba(255, 255, 255, 0.06); margin: 8px 0; }
.poolbar .si { background: linear-gradient(90deg, #2fae6a, var(--green)); }
.poolbar .no { background: linear-gradient(90deg, var(--red), #ff8a94); }
.pools { display: flex; justify-content: space-between; font-size: .85rem; margin-bottom: 12px; }
.market + .market, #markets .card + .card { margin-top: 16px; }

.betBox { background: rgba(10, 8, 18, 0.5); border: 1px solid var(--stroke); border-radius: 16px; padding: 14px; margin-top: 12px; }
.betLabel { font-size: .8rem; color: var(--muted); margin-bottom: 8px; }
.side { display: flex; gap: 10px; }
.side button { flex: 1; font-weight: 800; }
.side .selSi { background: linear-gradient(135deg, #2fae6a, var(--green)); border: 0; color: #06180c; }
.side .selNo { background: linear-gradient(135deg, var(--red), #ff8a94); border: 0; color: #220a0d; }
.betRow { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.betRow input { font: inherit; color: var(--text); background: rgba(10, 8, 18, 0.6); border: 1px solid var(--stroke); border-radius: 12px; padding: 11px 13px; outline: none; }
.betRow input[type=number] { width: 110px; }
.betRow input[type=text] { flex: 1; min-width: 190px; }
.betRow input:focus { border-color: rgba(169, 112, 255, 0.6); }
.retorno { margin-top: 10px; font-size: .9rem; color: var(--text); }
.retorno b { color: var(--gold); }

/* apuesta inicial al crear */
.create-stake { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; color: var(--muted); font-size: .9rem; }
.create-stake .ico { opacity: .8; }
.create-stake input[type=number] { width: 96px; font: inherit; color: var(--text); background: rgba(10, 8, 18, 0.6);
  border: 1px solid var(--stroke); border-radius: 12px; padding: 9px 11px; outline: none; text-align: center; }
.create-stake input[type=text] { flex: 1; min-width: 190px; font: inherit; color: var(--text); background: rgba(10, 8, 18, 0.6);
  border: 1px solid var(--stroke); border-radius: 12px; padding: 9px 13px; outline: none; }
.create-stake input:focus { border-color: rgba(169, 112, 255, 0.6); }
#cSi.selSi { background: linear-gradient(135deg, #2fae6a, var(--green)); border: 0; color: #06180c; }
#cNo.selNo { background: linear-gradient(135deg, var(--red), #ff8a94); border: 0; color: #220a0d; }

.verdict { border-left: 3px solid var(--violet); padding: 12px 16px; background: rgba(169, 112, 255, 0.08); border-radius: 12px; margin-top: 12px; }
.verdict .outcome { font-size: 1.2rem; font-weight: 800; }
.verdict .outcome.si { color: var(--green); }
.verdict .outcome.no { color: var(--red); }
.verdict .outcome.indeterminado { color: var(--muted); }
.verdict .sources { font-size: .8rem; word-break: break-all; margin-top: 6px; }
.verdict .sources a { color: var(--violet); }
.payouts { font-size: .85rem; margin-top: 8px; color: #c9a6ff; }
.resolving { color: var(--violet); font-weight: 700; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .45; } }

/* --- divider + footer --- */
.divider { text-align: center; color: var(--violet); margin: 34px 0 10px; opacity: .8; }
footer { text-align: center; color: var(--muted); font-size: .9rem; }

/* --- modal --- */
.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 100; }
.modalCard { text-align: center; max-width: 360px; width: 100%; }
.modalCard img { width: 240px; height: 240px; border-radius: 14px; background: #fff; padding: 8px; }
.modalCard h2 { justify-content: center; }
.invoice { font-family: ui-monospace, monospace; font-size: .64rem; word-break: break-all; color: var(--muted); max-height: 56px; overflow: auto; margin: 10px 0; }

/* --- responsive --- */
@media (max-width: 820px) {
  .navlinks { display: none; }
  .hero { grid-template-columns: 1fr; text-align: center; }
  .hero-ball { max-width: 220px; margin: 0 auto; }
  .features { grid-template-columns: 1fr; }
  .create-row .primary { margin-left: 0; width: 100%; }
}

/* --- separación abiertas/cerradas, admin y detalle --- */
.secTitle { font-size: 1.15rem; margin: 6px 4px 14px; display: flex; align-items: center; gap: 8px; }
.secTitle .spark { color: var(--violet); }
.closedTitle { margin-top: 30px; opacity: .85; }
.cardActions { margin-top: 12px; border-top: 1px solid var(--stroke); padding-top: 10px; }
.cardActions .linkbtn { font-size: .85rem; }

#admin { margin-top: 30px; }
.adminRow { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.adminRow input { font: inherit; color: var(--text); background: rgba(10, 8, 18, 0.6);
  border: 1px solid var(--stroke); border-radius: 12px; padding: 11px 14px; outline: none; min-width: 180px; }
.adminRow input:focus { border-color: rgba(169, 112, 255, 0.6); }
.adminItem { display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 14px; border: 1px solid var(--stroke); border-radius: 14px; margin-top: 10px; background: rgba(10, 8, 18, 0.4); }
.adminQ { font-size: .92rem; }
.adminBtns { display: flex; gap: 8px; flex: none; }
.glass-btn.sm { padding: 7px 12px; font-size: .82rem; }
.glass-btn.danger { border-color: rgba(255, 92, 108, 0.5); color: #ffb3ba; }
.glass-btn.danger:hover { background: rgba(255, 92, 108, 0.15); }

.detailCard { text-align: left; max-width: 460px; }
.detailMeta { font-size: .9rem; margin-bottom: 12px; }
.betDetailList { display: flex; flex-direction: column; gap: 8px; max-height: 320px; overflow-y: auto; }
.betDetailRow { display: flex; align-items: center; gap: 12px; padding: 9px 12px;
  background: rgba(10, 8, 18, 0.5); border: 1px solid var(--stroke); border-radius: 12px; }
.betDetailRow .pill { font-size: .72rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.betDetailRow .pill.si { background: rgba(53, 208, 127, 0.18); color: var(--green); }
.betDetailRow .pill.no { background: rgba(255, 92, 108, 0.18); color: var(--red); }
.betDetailRow .bdSats { font-weight: 600; }
.betDetailRow .bdWho { margin-left: auto; font-size: .85rem; }
.bdNote { font-size: .78rem; margin-top: 12px; }

/* criterio dinámico (resolución anticipada) */
.anticipada-row { display: flex; align-items: center; gap: 9px; margin-top: 12px; cursor: pointer; font-size: .86rem; color: var(--muted); }
.anticipada-row input { accent-color: var(--violet); width: 16px; height: 16px; cursor: pointer; }
.anticipada-row b { color: var(--text); font-weight: 600; }
.dyn { color: #c9a6ff; background: rgba(169,112,255,.12); border: 1px solid rgba(169,112,255,.3); border-radius: 999px; padding: 2px 9px; font-size: .72rem; white-space: nowrap; }
