/* =========================================================
   LA RULETA · Herzio Tools (usa los tokens de style.css)
   ========================================================= */
.rule-page .footer { padding-right: var(--gutter); padding-bottom: calc(28px + env(safe-area-inset-bottom)); }
.rule-bg { position: fixed; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(10, 6, 18, 0.55) 0%, var(--night) 70%), url("images/fondo-synthwave.svg") center 30% / cover no-repeat; opacity: 0.55; }
.rule-back svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; }

.rule-shell { width: 100%; max-width: 1240px; margin: 0 auto; padding: 120px var(--gutter) 64px; }
.rule-head { margin-bottom: 32px; }
.rule-layout { display: grid; grid-template-columns: minmax(300px, 420px) minmax(0, 1fr); gap: 28px; align-items: start; }

/* --- Opciones --- */
.rule-builder { display: flex; flex-direction: column; gap: 16px; box-shadow: var(--shadow); }
.rule-add { display: flex; gap: 10px; }
.rule-input { flex: 1 1 auto; min-width: 0; min-height: 46px; padding: 0 14px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.14); background: rgba(255, 255, 255, 0.05); color: var(--text); font-family: var(--body); font-size: 16px; transition: border-color 0.2s, background 0.2s, box-shadow 0.2s; }
.rule-input::placeholder { color: #8a7eaa; }
.rule-input:focus { outline: none; border-color: var(--teal); background: rgba(46, 230, 214, 0.06); animation: neon-pulse 1.6s ease-in-out infinite; }
.rule-input.is-error { border-color: var(--pink); animation: shake 0.4s; }
.rule-stats { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 10px; border-bottom: 1px solid rgba(46, 230, 214, 0.2); font-family: var(--display); font-size: 18px; letter-spacing: 2px; color: var(--teal); text-transform: uppercase; }
.rule-clear { min-height: 36px; padding: 0 12px; border-radius: 999px; color: var(--muted); font-family: var(--display); font-size: 16px; letter-spacing: 2px; text-transform: uppercase; transition: color 0.2s, background 0.2s; }
.rule-clear:hover:not(:disabled) { color: var(--pink-soft); background: rgba(255, 61, 139, 0.1); }
.rule-clear:disabled, .rule-page button:disabled { opacity: 0.4; cursor: not-allowed; }

.rule-items { display: flex; flex-direction: column; gap: 8px; max-height: 360px; overflow-y: auto; padding-right: 4px; scrollbar-width: thin; }
.rule-items:empty { display: none; }
.rule-item { display: grid; grid-template-columns: 14px 28px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 48px; padding: 0 6px 0 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); animation: item-in 0.35s cubic-bezier(.2,.8,.2,1); transition: border-color 0.3s, background 0.3s, box-shadow 0.3s; }
@keyframes item-in { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: none; } }
.rule-swatch { width: 14px; height: 14px; border-radius: 4px; background: var(--c); box-shadow: 0 0 8px var(--c); }
.rule-num { font-family: var(--display); font-size: 18px; color: var(--muted); }
.rule-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.rule-del { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; color: var(--muted); transition: color 0.2s, background 0.2s; }
.rule-del svg { width: 18px; height: 18px; }
.rule-del:hover:not(:disabled) { color: var(--pink-soft); background: rgba(255, 61, 139, 0.12); }
.rule-item.is-winner { border-color: var(--sun); background: linear-gradient(90deg, rgba(255, 176, 87, 0.2), rgba(255, 61, 139, 0.08)); box-shadow: 0 0 24px rgba(255, 176, 87, 0.25); }
.rule-empty { padding: 22px; border-radius: 12px; border: 1px dashed var(--line-2); color: var(--muted); text-align: center; font-size: 15px; }
.rule-empty[hidden] { display: none; }

/* --- Ruleta --- */
.rule-wheel-panel { display: flex; flex-direction: column; align-items: center; gap: 24px; padding: 32px 24px; box-shadow: var(--shadow); }
.rule-stage { position: relative; width: min(100%, 470px); padding-top: 18px; }
.rule-pointer { position: absolute; top: 0; left: 50%; z-index: 3; width: 40px; height: 40px; margin-left: -20px; fill: var(--text); stroke: var(--night); stroke-width: 1.2; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.7)) drop-shadow(0 0 10px rgba(46, 230, 214, 0.6)); transform-origin: 50% 20%; }
.rule-pointer.is-ticking { animation: tick 0.12s ease-in-out infinite alternate; }
@keyframes tick { from { transform: rotate(-9deg); } to { transform: rotate(7deg); } }
.rule-wheel-wrap { position: relative; width: 100%; aspect-ratio: 1; }
.rule-wheel { position: absolute; inset: 0; border-radius: 50%; border: 6px solid var(--text); background: conic-gradient(#1a1030, var(--night-2)); box-shadow: 0 0 0 8px rgba(10, 6, 18, 0.6), 0 30px 80px rgba(0, 0, 0, 0.6), 0 0 60px rgba(255, 61, 139, 0.25); transform: rotate(0deg); will-change: transform; overflow: hidden; }
.rule-labels { position: absolute; inset: 0; width: 100%; height: 100%; }
.rule-labels text { font-family: var(--display); letter-spacing: 0.3px; stroke: none; }
.rule-labels line { stroke: rgba(10, 6, 18, 0.35); stroke-width: 0.4; }
.rule-hub { position: absolute; left: 50%; top: 50%; width: 16%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; background: var(--night); border: 5px solid var(--text); box-shadow: 0 0 0 3px var(--teal), 0 0 24px rgba(46, 230, 214, 0.6); }
.rule-wheel-wrap.is-empty .rule-wheel { opacity: 0.5; }

.rule-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.rule-actions .btn svg { fill: none; stroke: currentColor; stroke-width: 2.4; }

.rule-result { width: min(100%, 470px); display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 18px 20px; border-radius: 16px; background: rgba(10, 6, 18, 0.7); border: 1px solid var(--line); text-align: center; transition: border-color 0.3s, box-shadow 0.3s; }
.rule-result-label { font-family: var(--display); font-size: 18px; letter-spacing: 4px; color: var(--muted); text-transform: uppercase; }
.rule-result-value { font-family: var(--display); font-size: clamp(36px, 5vw, 56px); line-height: 1; letter-spacing: 2px; text-transform: uppercase; overflow-wrap: anywhere; }
.rule-result.is-winner { border-color: var(--sun); box-shadow: 0 0 40px rgba(255, 176, 87, 0.25); }
.rule-result.is-winner .rule-result-label { color: var(--teal); }
.rule-result.is-winner .rule-result-value { background: var(--grad-sunset); -webkit-background-clip: text; background-clip: text; color: transparent; animation: mp-pop 0.8s cubic-bezier(.2,1.6,.4,1) both; }

@media (max-width: 920px) {
  .rule-layout { grid-template-columns: minmax(0, 1fr); }
  .rule-shell { padding-top: 96px; }
}
@media (max-width: 600px) {
  .rule-back { padding: 0 14px; font-size: 17px; }
  .rule-actions .btn { flex: 1 1 100%; }
  .rule-wheel-panel { padding: 24px 14px; }
  .rule-wheel { border-width: 4px; }
}
@media (max-width: 1024px) {
  .rule-page .site-nav { padding-top: 12px; padding-bottom: 12px; }
}
