/* ============================================================
   Zafrán v84 · capa de diseño (se carga la última)
   - Colores «azafrán refinado» (solo si no has elegido otro color en Ajustes)
   - Menú en rueda (semicírculo giratorio con todas las secciones)
   - Transiciones suaves, pantallas vacías con guía
   - Buscador, accesos directos, anillos, guía de primeros pasos, bloqueo
   Respeta el modo oscuro, «menos movimiento» y el alto contraste.
   ============================================================ */

/* ---------- 1 · Colores azafrán refinado ---------- */
:root:not([data-accent]) {
  --brand: #D9690B; --brand2: #FF9A1F; --brandSoft: #FFEFD9; --brandInk: #7A3A05;
  --bg: #F6F1E7; --chip: #EDE6D8; --input: #F9F5EC; --track: #EAE3D5; --line: rgba(40, 28, 10, .10);
  --z84-a: #FFB02E; --z84-b: #FF7A1A; --z84-ink: #1F1000;
  --sh1: 0 1px 2px rgba(60, 40, 10, .06), 0 1px 1px rgba(60, 40, 10, .03);
  --sh2: 0 1px 2px rgba(60, 40, 10, .06), 0 10px 26px -8px rgba(90, 55, 10, .16);
  --sh3: 0 2px 4px rgba(60, 40, 10, .07), 0 24px 50px -14px rgba(90, 55, 10, .32);
}
:root { --z84-a: #FFB02E; --z84-b: #FF7A1A; --z84-ink: #1F1000; }
:root[data-theme="dark"]:not([data-accent]) {
  --bg: #12110E; --surface: #1C1A16; --chip: #2A2721; --input: #23201B; --track: #2C2923; --line: rgba(255, 236, 200, .09);
  --brand: #FF9A1F; --brand2: #FFB648; --brandSoft: #33230C; --brandInk: #FFC878;
  --sh1: 0 1px 0 rgba(255, 255, 255, .03) inset; --sh2: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 10px 28px -8px rgba(0, 0, 0, .6);
  --sh3: 0 1px 0 rgba(255, 255, 255, .05) inset, 0 24px 48px -12px rgba(0, 0, 0, .7);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-accent]) {
    --bg: #12110E; --surface: #1C1A16; --chip: #2A2721; --input: #23201B; --track: #2C2923; --line: rgba(255, 236, 200, .09);
    --brand: #FF9A1F; --brand2: #FFB648; --brandSoft: #33230C; --brandInk: #FFC878;
    --sh1: 0 1px 0 rgba(255, 255, 255, .03) inset; --sh2: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 10px 28px -8px rgba(0, 0, 0, .6);
    --sh3: 0 1px 0 rgba(255, 255, 255, .05) inset, 0 24px 48px -12px rgba(0, 0, 0, .7);
  }
}
:root:not([data-accent]) body {
  background:
    radial-gradient(120% 55% at 100% -10%, rgba(255, 154, 31, .20), transparent 55%),
    radial-gradient(90% 45% at -10% 0%, rgba(255, 196, 80, .14), transparent 50%),
    var(--bg);
  background-attachment: fixed;
}
/* Botón principal: degradado ámbar-naranja con texto oscuro (contraste alto en claro y en oscuro) */
:root:not([data-accent]):not([data-hc="y"]) .btn.primary {
  background: linear-gradient(135deg, var(--z84-a), var(--z84-b));
  color: var(--z84-ink);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .35) inset, 0 10px 22px -8px rgba(255, 122, 26, .6);
}
:root:not([data-accent]):not([data-hc="y"]) .btn.primary:disabled { filter: saturate(.4); opacity: .6; box-shadow: none; }
:root:not([data-accent]) .panel { box-shadow: var(--sh1); }

/* ---------- 2 · Transición al cambiar de pantalla ---------- */
@keyframes z84-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes z84-slide { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes z84-up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes z84-pop { 0% { transform: scale(.6); opacity: 0; } 70% { transform: scale(1.06); } 100% { transform: scale(1); opacity: 1; } }
@media (prefers-reduced-motion: no-preference) {
  .app > section:not([hidden]) { animation: z84-fade .28s ease-out; }
  .app > section:not([hidden]) > .head { animation: z84-slide .36s cubic-bezier(.2, .8, .2, 1); }
}

/* ---------- 3 · Menú en rueda (móvil y tableta) ---------- */
.z84-dome { display: none; }
#z84Find svg { width: 22px; height: 22px; }
html.z84-wheel .app { padding-bottom: 176px; }
html.z84-wheel .nav.nav {
  zoom: 1 !important; height: calc(148px + env(safe-area-inset-bottom, 0px)); padding: 0 !important; overflow: hidden;
  background: none !important; border: 0 !important; box-shadow: none !important; -webkit-backdrop-filter: none !important; backdrop-filter: none !important;
  pointer-events: none;
}
html.z84-wheel .nav-in {
  display: block !important; position: absolute; inset: 0; max-width: none !important; margin: 0; min-height: 0;
  touch-action: pan-y; pointer-events: none; -webkit-user-select: none; user-select: none;
}
html.z84-wheel .z84-dome {
  display: block; position: absolute; left: 50%; top: 14px; pointer-events: auto;
  width: calc(var(--z84-r, 180px) * 2 + 104px); height: calc(var(--z84-r, 180px) * 2 + 104px); margin-left: calc(var(--z84-r, 180px) * -1 - 52px);
  border-radius: 50%; border: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(18px); backdrop-filter: saturate(180%) blur(18px);
  box-shadow: 0 -14px 36px -16px rgba(0, 0, 0, .5), 0 1px 0 rgba(255, 255, 255, .08) inset;
}
html.z84-wheel .nav-in > #navMore, html.z84-wheel .nav .nav-in > [hidden][hidden], html.z84-wheel .navmenu, html.z84-wheel .z84-scrim { display: none !important; }
html.z84-wheel .nav-in > .nv, html.z84-wheel .nav-in > .fabwrap {
  position: absolute !important; left: 50%; top: 34px; width: 76px; margin: 0 0 0 -38px !important; padding: 0 !important; min-height: 0 !important; min-width: 0;
  display: flex !important; flex-direction: column; align-items: center; justify-content: flex-start; gap: 4px;
  background: none !important; border: 0; border-radius: 0; box-shadow: none !important; order: 0;
  transform-origin: 50% 23px; transform: translate(var(--x, 0px), var(--y, 0px)) scale(var(--s, 1)); opacity: var(--o, 1);
  transition: transform .42s cubic-bezier(.3, 1.25, .5, 1), opacity .3s;
  pointer-events: auto; color: var(--ink); cursor: pointer; -webkit-tap-highlight-color: transparent;
}
html.z84-wheel .nav-in.drag > * { transition: none !important; }
html.z84-wheel .nav-in > .nv.is-on::before { display: none; }
/* la «burbuja» del icono: igual para todos */
html.z84-wheel .nav-in > .nv > svg, :root:root:root.z84-wheel .nav .nav-in .fab {
  width: 46px !important; height: 46px !important; box-sizing: border-box; border-radius: 50%; flex: none;
  background: var(--chip) !important; color: var(--ink) !important; border: 1px solid var(--line) !important; box-shadow: none !important;
  transition: background .25s, color .25s, box-shadow .25s;
}
html.z84-wheel .nav-in > .nv > svg { padding: 11px; margin: 0; transform: none !important; }
:root:root:root.z84-wheel .nav .nav-in .fab { display: grid; place-items: center; padding: 0; transform: none !important; }
:root:root:root.z84-wheel .nav .nav-in .fab svg { width: 24px !important; height: 24px !important; color: inherit !important; }
/* dónde estás: burbuja naranja */
html.z84-wheel .nav-in > .nv.z84-on > svg, :root:root:root.z84-wheel .nav .nav-in > .z84-on .fab {
  background: linear-gradient(145deg, var(--z84-a), var(--z84-b)) !important; color: var(--z84-ink) !important; border-color: transparent !important;
  box-shadow: 0 8px 18px -6px rgba(255, 122, 26, .75) !important;
}
html.z84-wheel .nav-in > .nv > span, html.z84-wheel .nav-in .fablbl {
  display: block; margin: 0; max-width: 84px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: .64rem !important; font-weight: 700; line-height: 1.1; color: var(--muted) !important; transition: opacity .2s;
}
html.z84-wheel .nav-in > .z84-mid > span, html.z84-wheel .nav-in > .z84-mid .fablbl, html.z84-wheel .nav-in > .z84-on > span, html.z84-wheel .nav-in > .z84-on .fablbl { color: var(--ink) !important; font-weight: 800; }
html.z84-wheel .nav-in > .z84-tiny > span, html.z84-wheel .nav-in > .z84-tiny .fablbl { opacity: 0; }
html.z84-wheel .nav-in .nvbadge { position: absolute !important; top: -3px; right: 10px; margin: 0; }
html.z84-wheel .nav-in .nv-hot span::after { content: none; }
html.z84-wheel .toast { bottom: calc(168px + env(safe-area-inset-bottom, 0px)); }
html.z84-wheel .instbar { bottom: calc(158px + env(safe-area-inset-bottom, 0px)); }
html.z84-wheel .qfab { bottom: calc(160px + env(safe-area-inset-bottom, 0px)); }
/* La rueda se puede bajar y subir: desliza hacia abajo/arriba sobre ella o toca el asa */
.z84-grip { display: none; }
html.z84-wheel .nav-in { touch-action: none; }
html.z84-wheel .nav.nav { transition: transform .35s cubic-bezier(.3, 1.1, .4, 1); }
html.z84-wheel .z84-grip { display: block; position: absolute; left: 50%; top: 6px; width: 96px; height: 30px; margin-left: -48px; z-index: 30; pointer-events: auto; cursor: pointer; }
html.z84-wheel .z84-grip::before { content: ""; position: absolute; left: 50%; top: 14px; width: 44px; height: 5px; margin-left: -22px; border-radius: 3px; background: var(--muted); opacity: .6; }
html.z84-wheel.z84-wdown .nav.nav { transform: translateY(calc(100% - 44px - env(safe-area-inset-bottom, 0px))); }
html.z84-wheel.z84-wdown .nav-in > .nv, html.z84-wheel.z84-wdown .nav-in > .fabwrap { pointer-events: none; opacity: 0 !important; }
html.z84-wheel.z84-wdown .z84-grip::before { background: var(--brand2); opacity: 1; width: 56px; margin-left: -28px; }
html.z84-wheel.z84-wdown .app { padding-bottom: 72px; }
html.z84-wheel.z84-wdown .toast { bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }
html.z84-wheel.z84-wdown .qfab, html.z84-wheel.z84-wdown .instbar { bottom: calc(56px + env(safe-area-inset-bottom, 0px)); }
@media (prefers-reduced-motion: reduce) { html.z84-wheel .nav-in > *, html.z84-wheel .nav.nav { transition: none !important; } }

/* ---------- 5 · Pantallas vacías con guía ---------- */
.z84-empty {
  display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center;
  margin: 12px 0 !important; padding: 22px 16px !important; border-radius: 20px;
  border: 1.5px dashed var(--line); background: var(--input); color: var(--muted) !important; font-size: .95rem !important;
}
.z84-empty > .z84-ic { width: 40px; height: 40px; padding: 9px; box-sizing: border-box; border-radius: 14px; background: var(--brandSoft); color: var(--brandInk); }
.z84-empty .btn { min-height: 46px; padding: 10px 18px; font-size: .95rem; }

/* ---------- 6 · Capas propias (buscador, editor, guía, bloqueo) ---------- */
.z84-ov { position: fixed; inset: 0; z-index: 60; background: rgba(15, 10, 0, .55); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); display: flex; justify-content: center; align-items: flex-start; padding: calc(12px + env(safe-area-inset-top, 0px)) 12px 12px; animation: z84-fade .18s ease-out; }
.z84-box { width: 100%; max-width: 560px; max-height: 100%; display: flex; flex-direction: column; background: var(--surface); color: var(--text); border-radius: 24px; box-shadow: var(--sh3); border: 1px solid var(--line); overflow: hidden; animation: z84-slide .25s cubic-bezier(.2, .8, .2, 1); }
.z84-shead { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.z84-shead svg { width: 22px; height: 22px; flex: none; color: var(--brand); }
.z84-shead input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-size: 1.1rem; font-weight: 600; color: var(--ink); min-height: 44px; }
.z84-x { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--chip); color: var(--ink); font-size: 1.4rem; line-height: 1; }
.z84-res { overflow-y: auto; padding: 6px; overscroll-behavior: contain; }
.z84-res h4 { margin: 10px 10px 4px; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.z84-it { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 54px; padding: 8px 10px; border: 0; border-radius: 14px; background: none; color: var(--ink); text-align: left; font-size: 1rem; }
.z84-it:hover, .z84-it.sel { background: var(--brandSoft); }
.z84-it i { flex: none; width: 38px; height: 38px; border-radius: 12px; background: var(--chip); display: grid; place-items: center; color: var(--brand); }
.z84-it i svg { width: 20px; height: 20px; }
.z84-it b { display: block; font-weight: 700; }
.z84-it small { display: block; color: var(--muted); font-size: .8rem; }
.z84-none { padding: 26px 16px; text-align: center; color: var(--muted); }
.z84-flash { animation: z84-flash 1.6s ease-out; border-radius: 12px; }
@keyframes z84-flash { 0%, 60% { box-shadow: 0 0 0 4px var(--brand2); background: var(--brandSoft); } 100% { box-shadow: 0 0 0 4px transparent; } }

/* Accesos directos de Inicio */
.z84-short { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 6px; margin: 8px 0 12px; scrollbar-width: none; }
.z84-short::-webkit-scrollbar { display: none; }
.z84-sc { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 8px; min-height: 46px; padding: 0 16px 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 700; font-size: .92rem; box-shadow: var(--sh1); white-space: nowrap; transition: transform .15s; }
.z84-sc:active { transform: scale(.95); }
.z84-sc .z84-ic { width: 20px; height: 20px; flex: none; color: var(--brand); }
.z84-sc.edit .z84-ic { color: inherit; width: 16px; height: 16px; }
.z84-sc.edit { background: none; border-style: dashed; color: var(--muted); box-shadow: none; padding: 0 14px; }
.z84-pick { display: grid; gap: 4px; padding: 8px 12px 4px; overflow-y: auto; }
.z84-pick label { display: flex; align-items: center; gap: 12px; min-height: 50px; padding: 4px 8px; border-radius: 14px; font-weight: 600; }
.z84-pick label:has(input:checked) { background: var(--brandSoft); }
.z84-pick input { width: 22px; height: 22px; accent-color: var(--brand); flex: none; }
.z84-foot { display: flex; gap: 8px; padding: 12px 14px calc(14px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); }
.z84-foot .btn { flex: 1; }
.z84-h { margin: 0; padding: 16px 16px 4px; font-size: 1.3rem; font-weight: 900; color: var(--ink); }
.z84-p { margin: 0; padding: 0 16px 8px; color: var(--muted); font-size: .92rem; }

/* Anillos del día */
.z84-rings { display: flex; align-items: center; gap: 16px; margin: 12px 0; padding: 14px 16px; }
.z84-rings svg { width: 118px; height: 118px; flex: none; transform: rotate(-90deg); }
.z84-rings circle { fill: none; stroke-width: 10; stroke-linecap: round; transition: stroke-dashoffset 1s cubic-bezier(.2, .8, .2, 1); }
.z84-rings .tr { stroke: var(--track); }
.z84-rings .r1 { stroke: var(--brand2); } .z84-rings .r2 { stroke: var(--prot); } .z84-rings .r3 { stroke: var(--fat); }
.z84-rl { flex: 1; min-width: 0; display: grid; gap: 7px; }
.z84-rl h3 { margin: 0 0 2px; font-size: 1.05rem; font-weight: 900; color: var(--ink); }
.z84-rl p { margin: 0; display: flex; align-items: center; gap: 8px; font-size: .9rem; color: var(--text); }
.z84-rl p i { flex: none; width: 10px; height: 10px; border-radius: 50%; }
.z84-rl p b { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--ink); white-space: nowrap; }
.z84-rl .linkbtn, .z84-link { background: none; border: 0; padding: 0; color: var(--brandInk); font-weight: 800; text-decoration: underline; text-underline-offset: 3px; text-align: left; }
.z84-rings.done { box-shadow: 0 0 0 2px var(--brand2), var(--sh2); }
.z84-rings.party svg { animation: z84-party .9s cubic-bezier(.34, 1.45, .5, 1); }
@keyframes z84-party { 0% { transform: rotate(-90deg) scale(1); } 45% { transform: rotate(-90deg) scale(1.14); } 100% { transform: rotate(-90deg) scale(1); } }

/* Ajustes v84 */
.z84-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 6px 0 10px 34px; font-size: .92rem; color: var(--muted); }
.z84-row input[type=time], .z84-row select { min-height: 44px; padding: 6px 10px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--input); color: var(--ink); font: inherit; font-weight: 700; }
.z84-note { margin: 8px 0; padding: 10px 12px; border-radius: 14px; background: var(--brandSoft); color: var(--brandInk); font-size: .9rem; }

/* Guía de primeros pasos */
.z84-tour { position: fixed; inset: 0; z-index: 70; }
.z84-hole { position: fixed; border-radius: 22px; box-shadow: 0 0 0 4px var(--brand2), 0 0 0 9999px rgba(10, 6, 0, .72); transition: all .35s cubic-bezier(.2, .8, .2, 1); pointer-events: none; }
.z84-tip { position: fixed; left: 16px; right: 16px; max-width: 420px; margin: 0 auto; background: var(--surface); color: var(--text); border-radius: 22px; padding: 16px; box-shadow: var(--sh3); animation: z84-pop .3s ease-out; }
.z84-tip h3 { margin: 0 0 6px; font-size: 1.2rem; font-weight: 900; color: var(--ink); }
.z84-tip p { margin: 0 0 12px; }
.z84-tip .row { display: flex; gap: 8px; align-items: center; }
.z84-tip .row small { margin-right: auto; color: var(--muted); font-weight: 700; }
.z84-tip .btn { min-height: 46px; padding: 8px 18px; }

/* Bloqueo con huella o PIN */
html[data-z84lock="1"] body > *:not(#z84Lock) { visibility: hidden !important; }
#z84Lock { position: fixed; inset: 0; z-index: 2147483000; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px;
  background: radial-gradient(90% 60% at 100% 0%, rgba(255, 154, 31, .35), transparent 60%), linear-gradient(160deg, #1B1710, #0B0906); color: #FFF6E6; text-align: center; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
#z84Lock img { width: 76px; height: 76px; border-radius: 20px; box-shadow: 0 14px 30px -10px rgba(0, 0, 0, .7); }
#z84Lock h2 { margin: 0; font-size: 1.5rem; font-weight: 900; }
#z84Lock p { margin: 0; color: #C9BDA6; min-height: 1.4em; }
#z84Lock .dots { display: flex; gap: 12px; margin: 6px 0; }
#z84Lock .dots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #FFB02E; }
#z84Lock .dots i.f { background: #FFB02E; }
#z84Lock .pad { display: grid; grid-template-columns: repeat(3, 72px); gap: 12px; }
#z84Lock .pad button { height: 64px; border-radius: 20px; border: 0; background: rgba(255, 255, 255, .1); color: #fff; font-size: 1.5rem; font-weight: 800; }
#z84Lock .pad button:active { background: rgba(255, 176, 46, .45); }
#z84Lock .pad button.alt { background: none; font-size: 1.1rem; }
#z84Lock .lnk { background: none; border: 0; color: #FFC878; font-weight: 800; text-decoration: underline; text-underline-offset: 3px; min-height: 44px; }
#z84Lock.shake .dots { animation: z84-shake .4s; }
@keyframes z84-shake { 20%, 60% { transform: translateX(-9px); } 40%, 80% { transform: translateX(9px); } }

/* Iconos de línea en casillas y listas de la v84 */
.z84-pick .z84-ic, label.chk .z84-ic { width: 20px; height: 20px; flex: none; color: var(--brand); vertical-align: -4px; margin-right: 8px; }
#z84Lock .pad .z84-ic { width: 26px; height: 26px; }

/* vuelta lenta de la rueda a la seccion actual */
html.z84-wheel .nav-in.slow > .nv, html.z84-wheel .nav-in.slow > .fabwrap { transition: transform 1.3s cubic-bezier(.45, 0, .2, 1), opacity .6s !important; }
