:root {
  --bg: #12100f;
  --bg-soft: #1b1817;
  --panel: #201c1a;
  --panel-2: #272220;
  --line: #3a3230;
  --text: #f4ede8;
  --muted: #a99c94;
  --fire: #ff6b35;
  --fire-2: #ffa62b;
  --ember: #e63946;
  --green: #6bbf59;
  --radius: 14px;
  --shadow: 0 18px 45px rgba(0, 0, 0, .45);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(1100px 600px at 12% -12%, #34211a 0%, transparent 62%),
    radial-gradient(900px 520px at 96% 4%, #2a1c2b 0%, transparent 58%),
    var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
}

h1, h2, h3 { margin: 0; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* ---------- Topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(18, 16, 15, .72);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark { font-size: 30px; line-height: 1; }

.topbar h1 {
  font-family: "Bebas Neue", Impact, sans-serif;
  font-size: 30px;
  letter-spacing: 1.5px;
  background: linear-gradient(92deg, var(--fire-2), var(--fire) 55%, var(--ember));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand-sub {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--muted);
  max-width: 62ch;
}

/* ---------- Layout ---------- */
.layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr) 360px;
  gap: 18px;
  padding: 18px 24px 48px;
  align-items: start;
}

@media (max-width: 1180px) {
  .layout { grid-template-columns: 1fr 1fr; }
  .panel-wheel { grid-column: 1 / -1; order: -1; }
}

@media (max-width: 720px) {
  .layout { grid-template-columns: 1fr; padding: 14px; }
  .topbar { flex-direction: column; align-items: flex-start; }
}

.panel {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

.panel h2 {
  font-family: "Bebas Neue", Impact, sans-serif;
  font-size: 22px;
  letter-spacing: 1.2px;
  color: var(--fire-2);
  margin-bottom: 12px;
}

.panel-head { display: flex; align-items: center; justify-content: space-between; }
.panel-head h2 { margin-bottom: 0; }

/* ---------- Controles ---------- */
.field { margin-bottom: 16px; }
.field-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--muted);
  margin-bottom: 8px;
}

.hint { margin: 6px 0 0; font-size: 11.5px; color: var(--muted); line-height: 1.45; }

.pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(255, 107, 53, .16);
  color: var(--fire-2);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.chips { display: flex; flex-wrap: wrap; gap: 7px; }

.chip {
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--muted);
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: .16s ease;
}
.chip:hover { border-color: var(--fire); color: var(--text); }
.chip[aria-pressed="true"] {
  background: linear-gradient(135deg, var(--fire), var(--ember));
  border-color: transparent;
  color: #fff;
}

input[type="range"] { width: 100%; accent-color: var(--fire); }

.toggles { display: grid; gap: 9px; }
.switch { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--text); cursor: pointer; }
.switch input { accent-color: var(--fire); width: 16px; height: 16px; }

.input {
  width: 100%;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 9px 11px;
  font: inherit;
  font-size: 13px;
}
.input:focus { outline: 2px solid var(--fire); outline-offset: 1px; }

.row { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.row-wrap { flex-wrap: wrap; }
.row-center { justify-content: center; }

.btn {
  border-radius: 10px;
  padding: 9px 14px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: .16s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-primary { background: linear-gradient(135deg, var(--fire), var(--ember)); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: var(--bg-soft); border-color: var(--line); color: var(--text); }
.btn-ghost:hover { border-color: var(--fire); }
.btn-danger { background: rgba(230, 57, 70, .14); border-color: rgba(230, 57, 70, .5); color: #ff9aa2; }
.btn-danger:hover { background: rgba(230, 57, 70, .26); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.summary { font-size: 12px; color: var(--muted); margin: 4px 0 0; line-height: 1.5; }

/* ---------- Ruleta ---------- */
.panel-wheel { display: grid; justify-items: center; gap: 12px; }

.wheel-stage {
  position: relative;
  width: min(100%, 560px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}

#wheel {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 22px 40px rgba(0, 0, 0, .55));
}

.wheel-pointer {
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 15px solid transparent;
  border-right: 15px solid transparent;
  border-top: 30px solid var(--fire-2);
  z-index: 3;
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, .6));
}

.spin-btn {
  position: absolute;
  width: 23%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 5px solid #12100f;
  background: linear-gradient(150deg, var(--fire-2), var(--ember));
  color: #fff;
  font-family: "Bebas Neue", Impact, sans-serif;
  font-size: clamp(16px, 3.4vw, 26px);
  letter-spacing: 2px;
  cursor: pointer;
  z-index: 2;
  box-shadow: 0 10px 26px rgba(0, 0, 0, .55);
  transition: transform .14s ease;
}
.spin-btn:hover:not(:disabled) { transform: scale(1.06); }
.spin-btn:disabled { filter: grayscale(.55); cursor: not-allowed; }

.wheel-status { font-size: 13px; color: var(--muted); text-align: center; margin: 0; min-height: 20px; }

/* ---------- Ruleta vertical (muchas porciones) ---------- */
.wheel-stage.is-vertical {
  aspect-ratio: auto;
  width: min(100%, 420px);
  display: block;
}
.wheel-stage.is-vertical .spin-btn {
  position: static;
  width: 84px;
  margin: 14px auto 0;
}
.wheel-vertical {
  position: relative;
  width: 100%;
  height: 280px;
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  box-shadow: inset 0 30px 24px -24px rgba(0, 0, 0, .6), inset 0 -30px 24px -24px rgba(0, 0, 0, .6);
}
.reel-track { position: absolute; top: 0; left: 0; width: 100%; }
.reel-row {
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}
.reel-empty { justify-content: center; color: var(--muted); font-weight: 500; }
.reel-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reel-rating { color: var(--muted); font-size: 12px; flex-shrink: 0; }
.reel-row-parrillada { border-left: 4px solid #e2542c; }
.reel-row-restaurante { border-left: 4px solid #3f9d6e; }
.reel-pointer {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  transform: translateY(-50%);
  height: 56px;
  border-top: 2px solid var(--fire-2);
  border-bottom: 2px solid var(--fire-2);
  background: rgba(255, 122, 47, .08);
  z-index: 2;
  pointer-events: none;
}

/* ---------- Lista ---------- */
.place-list {
  list-style: none;
  margin: 10px 0 14px;
  padding: 0;
  max-height: 460px;
  overflow-y: auto;
  display: grid;
  gap: 7px;
}

.place-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 11px;
}
.place-item.is-out { opacity: .42; }
.place-item input[type="checkbox"] { accent-color: var(--fire); width: 16px; height: 16px; }

.place-name { font-size: 13.5px; font-weight: 600; line-height: 1.25; }
.place-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

.tag {
  border-radius: 5px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.tag-parrillada { background: rgba(230, 57, 70, .2); color: #ff9aa2; }
.tag-restaurante { background: rgba(107, 191, 89, .16); color: #a8dd9c; }
.tag-unverified { background: rgba(255, 166, 43, .16); color: var(--fire-2); }
.tag-out { background: rgba(169, 156, 148, .18); color: var(--muted); }

.place-right { display: grid; justify-items: end; gap: 3px; text-align: right; }
.place-rating { font-size: 13px; font-weight: 700; color: var(--fire-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.place-gasto {
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  cursor: help;
}

.empty { font-size: 13px; color: var(--muted); text-align: center; padding: 22px 8px; line-height: 1.5; }

/* ---------- Drawers y formularios ---------- */
.drawer { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 10px; }
.drawer summary { cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--fire-2); }
.drawer[open] summary { margin-bottom: 12px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-grid label { font-size: 11.5px; color: var(--muted); display: grid; gap: 5px; }
.span-2 { grid-column: span 2; }

/* ---------- Diálogos ---------- */
.dialog {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  color: var(--text);
  padding: 24px;
  width: min(94vw, 540px);
  box-shadow: var(--shadow);
  position: relative;
}
.dialog::backdrop { background: rgba(8, 6, 6, .72); backdrop-filter: blur(3px); }
.dialog h2 {
  font-family: "Bebas Neue", Impact, sans-serif;
  font-size: 26px;
  letter-spacing: 1.2px;
  margin-bottom: 10px;
}
.dialog .hint { margin-bottom: 14px; }

.dialog-close { position: absolute; top: 10px; right: 12px; margin: 0; }
.icon-btn {
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 17px;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}
.icon-btn:hover { color: var(--text); }

.log {
  background: #100e0d;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px;
  font-size: 11.5px;
  line-height: 1.55;
  max-height: 190px;
  overflow: auto;
  white-space: pre-wrap;
  color: var(--muted);
  margin: 0 0 12px;
}

.dialog-map { width: min(94vw, 760px); }
.map-canvas {
  width: 100%;
  height: min(70vh, 520px);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.map-canvas .leaflet-popup-content-wrapper,
.map-canvas .leaflet-popup-tip { background: var(--panel); color: var(--text); }
.map-canvas .leaflet-popup-content a { color: var(--fire); }

.dialog-winner { text-align: center; overflow: hidden; }
.winner-kicker {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .2em;
  color: var(--muted);
  margin: 6px 0 4px;
}
#winner-name {
  font-family: "Bebas Neue", Impact, sans-serif;
  font-size: clamp(30px, 6vw, 46px);
  letter-spacing: 1px;
  background: linear-gradient(92deg, var(--fire-2), var(--ember));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1.05;
}
.winner-meta { font-size: 13px; color: var(--muted); margin: 8px 0 18px; }
.confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  .btn, .chip, .spin-btn { transition: none; }
}
