:root {
  --bg: #0b0e14;
  --surface: #161b22;
  --card: #1c222b;
  --gold: #ffd700;
  --gold2: #c5a000;
  --text: #ececec;
  --muted: #9e9e9e;
  --red: #f44336;
  --orange: #ff9800;
  --purple: #9c27b0;
  --blue: #2a398d;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter,
    system-ui,
    -apple-system,
    "Segoe UI",
    sans-serif;
  padding-bottom: 96px;
}
.qm-page {
  max-width: 760px;
  margin: 0 auto;
  padding: 34px 16px 24px;
}
.qm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.qm-header h1 {
  margin: 0;
  font-size: 1.65rem;
  font-weight: 900;
  letter-spacing: 0.02em;
}
.qm-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}
.header-trophy {
  font-size: 2.5rem;
  color: var(--gold);
}
.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.phase-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: -4px 0 14px;
}
.tab {
  border: 1px solid rgba(255, 215, 0, 0.25);
  background: var(--surface);
  color: var(--muted);
  border-radius: 999px;
  padding: 10px 6px;
  font-weight: 800;
}
.tab.active {
  background: var(--gold);
  color: #111;
  border-color: var(--gold);
}
.phase-tab {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #101721;
  color: var(--muted);
  border-radius: 8px;
  padding: 9px 6px;
  font-weight: 900;
}
.phase-tab.active {
  border-color: rgba(255, 215, 0, 0.6);
  color: var(--gold);
  background: rgba(255, 215, 0, 0.1);
}
.cloud-btn {
  width: 100%;
  border: 1px solid rgba(255, 215, 0, 0.55);
  background: rgba(255, 215, 0, 0.1);
  color: var(--gold);
  border-radius: 12px;
  padding: 12px;
  margin: 0 0 16px;
  font-weight: 900;
}
.points-info {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 16px;
  padding: 12px;
  border: 1px solid rgba(51, 153, 255, 0.35);
  border-radius: 12px;
  background: rgba(0, 51, 102, 0.2);
  color: #8bc5ff;
}
.points-info > span { flex: none; font-size: 1.25rem; }
.points-info strong { display: block; font-size: 0.72rem; letter-spacing: 0.04em; }
.points-info p { margin: 3px 0 0; color: rgba(236, 244, 255, 0.72); font-size: 0.78rem; line-height: 1.35; }
.quinielas-list {
  display: grid;
  gap: 12px;
}
.q-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 14px;
  min-height: 92px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
  cursor: pointer;
}
.q-card h2 {
  margin: 0 0 6px;
  font-size: 1.05rem;
}
.phase-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 999px;
  border: 1px solid rgba(255, 215, 0, 0.28);
  color: var(--gold);
  background: rgba(255, 215, 0, 0.08);
  padding: 3px 8px;
  font-size: 0.68rem;
  font-weight: 900;
  margin-bottom: 7px;
}
.meta {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}
.status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.badge {
  font-size: 0.74rem;
  border-radius: 999px;
  padding: 4px 9px;
  font-weight: 900;
}
.badge.sent {
  background: rgba(255, 215, 0, 0.14);
  color: var(--gold);
  border: 1px solid rgba(255, 215, 0, 0.45);
}
.badge.complete {
  background: rgba(255, 152, 0, 0.14);
  color: var(--orange);
  border: 1px solid rgba(255, 152, 0, 0.45);
}
.badge.draft {
  background: rgba(156, 39, 176, 0.16);
  color: #d68aff;
  border: 1px solid rgba(156, 39, 176, 0.45);
}
.points {
  font-size: 0.78rem;
  color: var(--muted);
}
.card-actions {
  display: grid;
  grid-template-columns: 36px 36px;
  grid-template-rows: 36px 36px;
  align-items: center;
  justify-items: center;
  gap: 6px 10px;
}
.star,
.arrow,
.delete-card-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  width: 36px;
  height: 36px;
  border-radius: 10px;
  font-size: 1.45rem;
  line-height: 1;
}
.star {
  grid-column: 1;
  grid-row: 1;
}
.star.active {
  color: var(--gold);
}
.delete-card-btn {
  grid-column: 1;
  grid-row: 2;
  border: 1px solid rgba(244, 67, 54, 0.32);
  background: rgba(244, 67, 54, 0.08);
  color: var(--red);
  font-size: 1rem;
}
.arrow {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
}
.create-card {
  height: 100px;
  border: 1px dashed rgba(255, 215, 0, 0.55);
  background: transparent;
  color: var(--gold);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: left;
  cursor: pointer;
}
.create-card b {
  display: block;
}
.create-card span {
  display: block;
  color: rgba(255, 215, 0, 0.7);
  font-size: 0.82rem;
}
.create-grid {
  display: grid;
  gap: 10px;
}
.fab {
  position: fixed;
  right: 20px;
  bottom: 112px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 0;
  background: var(--gold);
  color: #111;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 900;
  line-height: 1;
  padding: 0;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
}
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 84px;
  background: rgba(22, 27, 34, 0.98);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: 8px 4px env(safe-area-inset-bottom);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.bottom-nav a {
  color: var(--muted);
  text-decoration: none;
  text-align: center;
  font-weight: 800;
  font-size: 1.35rem;
  border-radius: 16px;
  padding: 6px 2px;
}
.bottom-nav span {
  display: block;
  font-size: 0.72rem;
  margin-top: 3px;
  line-height: 1.05;
}
.bottom-nav a.active {
  color: var(--gold);
  background: rgba(255, 255, 255, 0.04);
}
dialog {
  border: 0;
  color: var(--text);
  background: var(--surface);
  border-radius: 18px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.5);
}
dialog::backdrop {
  background: rgba(0, 0, 0, 0.55);
}
.sheet {
  width: min(520px, calc(100vw - 20px));
  margin: auto auto 10px;
  padding: 10px 16px 18px;
}
.sheet-handle {
  width: 44px;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 215, 0, 0.45);
  margin: 0 auto 14px;
}
.sheet h2,
.modal h2 {
  margin: 0 0 14px;
  color: var(--gold);
}
.sheet-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 800;
  padding: 14px 4px;
  text-align: left;
}
.sheet-item.danger {
  color: var(--red);
}
.sheet-cancel,
.ghost {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  padding: 12px;
}
.modal {
  width: min(440px, calc(100vw - 32px));
  padding: 20px;
}
.modal p {
  color: var(--muted);
  margin-top: 0;
}
.modal label {
  display: grid;
  gap: 6px;
  margin: 10px 0;
  color: var(--muted);
  font-weight: 800;
}
.modal input {
  width: 100%;
  height: 46px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: #0f131a;
  color: var(--text);
  padding: 10px;
  font: inherit;
}
.full {
  width: 100%;
  min-height: 44px;
  border-radius: 12px;
  margin-top: 8px;
  font-weight: 900;
}
.secondary {
  border: 0;
  background: #303846;
  color: var(--text);
}
.danger-btn {
  border: 0;
  background: var(--red);
  color: #fff;
}
.gold-btn {
  border: 0;
  background: var(--gold);
  color: #111;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: 104px;
  transform: translateX(-50%) translateY(20px);
  background: #222b36;
  color: #fff;
  padding: 12px 16px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: 0.2s;
  z-index: 10;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
@media (min-width: 720px) {
  .bottom-nav {
    left: 50%;
    transform: translateX(-50%);
    max-width: 760px;
    border-radius: 24px 24px 0 0;
  }
  .fab {
    right: calc((100vw - 760px) / 2 + 20px);
  }
}

/* Editor de quiniela */
.editor-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.editor-header h1 {
  margin: 0;
  color: var(--gold);
  font-size: 1.2rem;
  font-weight: 900;
}
.editor-header p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}
.back-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(255, 215, 0, 0.25);
  background: var(--surface);
  color: var(--gold);
  font-size: 2rem;
  line-height: 1;
}
.editor-panel {
  display: grid;
  gap: 10px;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 12px;
}
.editor-panel label,
.winner-box {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 800;
  font-size: 0.82rem;
}
.editor-panel input,
.winner-box select {
  width: 100%;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: #0f131a;
  color: var(--text);
  padding: 10px;
  font: inherit;
}
.editor-actions-top {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.editor-actions-top .cloud-btn {
  margin: 0;
}
.groups-editor {
  display: grid;
  gap: 12px;
  padding-bottom: 92px;
}
.group-card-editor {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  overflow: hidden;
}
.group-title {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--gold);
  font: inherit;
  font-weight: 900;
  padding: 14px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.group-title span {
  transition: 0.18s;
}
.group-card-editor.collapsed .group-title span {
  transform: rotate(-90deg);
}
.group-card-editor.collapsed .group-body {
  display: none;
}
.group-card-editor.locked {
  opacity: 0.72;
}
.group-body {
  display: grid;
  gap: 10px;
  padding: 0 12px 12px;
}
.round-locked-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}
.winner-box {
  background: rgba(255, 215, 0, 0.08);
  border: 1px solid rgba(255, 215, 0, 0.22);
  border-radius: 14px;
  padding: 12px;
  color: var(--gold);
}
.match-editor {
  background: #121821;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 12px;
}
.match-date {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  margin-bottom: 9px;
}
.match-row-editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}
.team-editor {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.team-editor span {
  font-size: 1.35rem;
}
.team-editor b {
  font-size: 0.82rem;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.team-editor.away {
  justify-content: flex-end;
  text-align: right;
}
.score-editor {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text);
  font-weight: 900;
}
.score-editor input {
  width: 42px;
  height: 42px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: #0b0e14;
  color: #fff;
  text-align: center;
  font: inherit;
  font-weight: 900;
}
.score-editor input:disabled,
.winner-box select:disabled {
  opacity: 0.62;
  border-color: rgba(76, 175, 80, 0.55);
  color: rgba(255, 255, 255, 0.8);
}
.score-editor input:focus,
.editor-panel input:focus,
.winner-box select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.12);
}
.editor-bottom-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 84px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  background: rgba(22, 27, 34, 0.96);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 12px 16px;
  z-index: 4;
}
.editor-bottom-bar button {
  min-height: 46px;
  border-radius: 12px;
  font-weight: 900;
}
.editor-bottom-bar button:disabled {
  opacity: 0.65;
}
@media (min-width: 720px) {
  .editor-bottom-bar {
    left: 50%;
    transform: translateX(-50%);
    max-width: 760px;
  }
}
