/* Cripto Radar — oscuro tipo exchange + acabado iOS (cristal, tipografía del sistema, movimiento suave) */
:root {
  --bg: #0b0e11;
  --bg2: #12161c;
  --glass: rgba(30, 35, 41, 0.62);
  --glass-hi: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.08);
  --text: #eaecef;
  --muted: #848e9c;
  --gold: #f0b90b;
  --gold-soft: rgba(240, 185, 11, 0.16);
  --up: #0ecb81;
  --down: #f6465d;
  --amber: #ffb020;
  --radius: 22px;
  --spring: cubic-bezier(.32, .72, 0, 1);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding: calc(env(safe-area-inset-top) + 8px) 18px calc(env(safe-area-inset-bottom) + 28px);
  max-width: 560px; margin: 0 auto; min-height: 100vh; position: relative; overflow-x: hidden;
}

/* Halo dorado de fondo */
.bg-glow {
  position: fixed; inset: -20% -30% auto; height: 70vh; z-index: -1; pointer-events: none;
  background:
    radial-gradient(40% 45% at 75% 20%, rgba(240,185,11,.18), transparent 70%),
    radial-gradient(35% 40% at 15% 35%, rgba(14,203,129,.08), transparent 70%);
  filter: blur(20px);
  animation: drift 18s ease-in-out infinite alternate;
}
@keyframes drift { from { transform: translate3d(0,0,0) } to { transform: translate3d(-4%,3%,0) } }

/* Cabecera estilo iOS: título grande */
.top { display: flex; justify-content: space-between; align-items: flex-end; padding: 14px 2px 6px; }
.eyebrow { margin: 0; font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
h1 { margin: 2px 0 0; font-size: 34px; font-weight: 800; letter-spacing: -.02em; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--glass); color: var(--gold); display: grid; place-items: center; cursor: pointer;
  -webkit-backdrop-filter: blur(20px) saturate(160%); backdrop-filter: blur(20px) saturate(160%);
  transition: transform .2s var(--spring);
}
.icon-btn:active { transform: scale(.9); }
.icon-btn.spin svg { animation: spin .8s var(--spring); }
@keyframes spin { to { transform: rotate(360deg) } }

/* Control segmentado iOS */
.segmented {
  position: relative; display: grid; grid-template-columns: 1fr 1fr; margin: 12px 0 4px;
  background: rgba(118,118,128,.18); border-radius: 12px; padding: 3px;
}
.seg-thumb {
  position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc(50% - 3px); border-radius: 9px;
  background: #2b3139; box-shadow: 0 3px 8px rgba(0,0,0,.35), 0 0 0 .5px rgba(255,255,255,.06) inset;
  transition: transform .35s var(--spring);
}
.segmented.right .seg-thumb { transform: translateX(100%); }
.seg {
  position: relative; z-index: 1; border: 0; background: none; color: var(--muted);
  font: inherit; font-size: 14px; font-weight: 600; padding: 8px 0; cursor: pointer; transition: color .25s;
}
.seg.active { color: var(--text); }

/* Tarjetas de cristal */
.card {
  position: relative; background: var(--glass); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; margin: 12px 0;
  -webkit-backdrop-filter: blur(24px) saturate(170%); backdrop-filter: blur(24px) saturate(170%);
  box-shadow: 0 1px 0 var(--glass-hi) inset, 0 10px 30px rgba(0,0,0,.25);
}
.reveal { opacity: 0; transform: translateY(14px) scale(.985); animation: rise .7s var(--spring) forwards; }
.reveal:nth-of-type(1) { animation-delay: .05s }
main > .reveal:nth-of-type(2) { animation-delay: .12s }
main > .reveal:nth-of-type(3) { animation-delay: .19s }
main > .reveal:nth-of-type(4) { animation-delay: .26s }
@keyframes rise { to { opacity: 1; transform: none } }

.section-title { margin: 22px 4px 0; font-size: 20px; font-weight: 700; letter-spacing: -.01em; }

/* Precio */
.pair-row { display: flex; justify-content: space-between; align-items: center; }
.coin { display: flex; align-items: center; gap: 10px; }
.coin-badge {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: var(--gold-soft); color: var(--gold); font-weight: 800; font-size: 18px;
}
.coin-name { font-weight: 700; font-size: 16px; }
.coin-pair { font-size: 12px; color: var(--muted); margin-top: 1px; }
.live { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--up); animation: blink 2s infinite; }
@keyframes blink { 0%,100% { opacity: 1; box-shadow: 0 0 0 0 rgba(14,203,129,.6) } 50% { opacity: .5; box-shadow: 0 0 0 5px rgba(14,203,129,0) } }

.price {
  font-size: 44px; font-weight: 800; letter-spacing: -.025em; margin: 14px 0 10px;
  font-variant-numeric: tabular-nums; transition: color .6s;
}
.price.flash-up { color: var(--up); }
.price.flash-down { color: var(--down); }

.changes { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  font-size: 13px; font-weight: 600; padding: 5px 10px; border-radius: 999px;
  background: rgba(255,255,255,.06); color: var(--muted); font-variant-numeric: tabular-nums;
  transition: background .4s, color .4s;
}
.chip.up { background: rgba(14,203,129,.14); color: var(--up); }
.chip.down { background: rgba(246,70,93,.14); color: var(--down); }

.spark { width: 100%; height: 80px; margin-top: 16px; display: block; color: var(--up); overflow: visible; }
.spark.down { color: var(--down); }
#sparkLine { stroke-dasharray: var(--len, 1000); stroke-dashoffset: var(--len, 1000); }
.spark.draw #sparkLine { animation: draw 1.2s var(--spring) forwards; }
.spark.draw #sparkArea { animation: fade 1.2s ease forwards; }
#sparkArea { opacity: 0; }
@keyframes draw { to { stroke-dashoffset: 0 } }
@keyframes fade { to { opacity: 1 } }
.spark-caption { font-size: 11px; color: var(--muted); text-align: right; margin-top: 4px; }

/* Semáforo */
.light-card { display: flex; gap: 16px; align-items: center; }
.light-wrap { position: relative; width: 56px; height: 56px; min-width: 56px; display: grid; place-items: center; }
.light { width: 34px; height: 34px; border-radius: 50%; background: #2b3139; position: relative; transition: background .5s, box-shadow .5s; }
.light::after {
  content: ""; position: absolute; inset: -11px; border-radius: 50%; border: 2px solid currentColor; opacity: 0;
}
.light.green { background: var(--up); color: var(--up); box-shadow: 0 0 24px rgba(14,203,129,.55); }
.light.yellow { background: var(--amber); color: var(--amber); box-shadow: 0 0 24px rgba(255,176,32,.55); }
.light.red { background: var(--down); color: var(--down); box-shadow: 0 0 24px rgba(246,70,93,.6); }
.light.green::after, .light.yellow::after, .light.red::after { animation: ring 2.4s ease-out infinite; }
.light.red::after { animation-duration: 1.4s; }
@keyframes ring { 0% { transform: scale(.6); opacity: .8 } 100% { transform: scale(1.25); opacity: 0 } }
.light-card h2 { margin: 0 0 4px; font-size: 17px; font-weight: 700; }
.light-card p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.45; }

/* Lista estilo Ajustes de iOS */
.list-card { padding: 4px 0; }
.indicators { list-style: none; margin: 0; padding: 0; }
.indicators li {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 13px 18px; font-size: 15px; position: relative;
  opacity: 0; transform: translateX(-8px); animation: slide .5s var(--spring) forwards;
}
.indicators li + li::before { content: ""; position: absolute; top: 0; left: 18px; right: 0; height: .5px; background: var(--line); }
@keyframes slide { to { opacity: 1; transform: none } }
.indicators .name { font-weight: 500; }
.indicators .desc { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; font-weight: 400; }
.indicators .val { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--muted); font-weight: 600; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-left: 8px; vertical-align: middle; }
.dot.ok { background: var(--up); } .dot.warn { background: var(--amber); } .dot.bad { background: var(--down); } .dot.na { background: transparent; }

/* Formulario */
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
label { font-size: 12px; font-weight: 600; color: var(--muted); display: flex; flex-direction: column; gap: 6px; }
input {
  background: rgba(0,0,0,.25); color: var(--text); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px; font-size: 17px; width: 100%; font-variant-numeric: tabular-nums;
  transition: border-color .2s, box-shadow .2s;
}
input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.position { margin-top: 14px; font-size: 15px; line-height: 1.6; }
.position strong { font-variant-numeric: tabular-nums; }
.up { color: var(--up); } .down { color: var(--down); }
.hint { font-size: 12px; color: var(--muted); margin: 10px 0 0; }
.footer { text-align: center; font-size: 12px; color: var(--muted); margin: 22px 0 4px; }
.disclaimer { font-size: 11px; color: #5e6673; line-height: 1.5; margin: 6px 6px; text-align: center; }

/* Esqueletos de carga */
.loading .skel { color: transparent; background: linear-gradient(90deg, rgba(255,255,255,.05) 25%, rgba(255,255,255,.12) 50%, rgba(255,255,255,.05) 75%); background-size: 200% 100%; border-radius: 10px; animation: shimmer 1.3s infinite; width: 70%; }
.skel-row { height: 46px; margin: 6px 18px; border-radius: 10px; opacity: 1 !important; transform: none !important;
  background: linear-gradient(90deg, rgba(255,255,255,.04) 25%, rgba(255,255,255,.09) 50%, rgba(255,255,255,.04) 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite !important; }
.skel-row::before { display: none; }
@keyframes shimmer { from { background-position: 200% 0 } to { background-position: -200% 0 } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal, .indicators li { opacity: 1; transform: none; }
  #sparkLine { stroke-dashoffset: 0; } #sparkArea { opacity: 1; }
}
