:root {
  --cell: clamp(56px, 13vw, 76px);
}

.tango-panel {
  margin-top: 0.5rem;
  text-align: center;
}

.tango-board {
  width: max-content;
  margin: 1.4rem auto 0;
  display: grid;
  gap: 8px;
  justify-content: center;
  align-items: center;
  touch-action: manipulation;
}

.tango-board .cell {
  width: var(--cell);
  height: var(--cell);
  min-width: 0;
  min-height: 0;
  padding: 0;
  margin: 0;
  border: 2px solid var(--border);
  border-radius: 18px;
  background: var(--card);
  color: var(--fg);
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 900;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

.tango-board .cell:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.tango-board .cell.fixed {
  background: color-mix(in oklab, var(--accent) 26%, var(--card));
  border-color: color-mix(in oklab, var(--accent) 80%, var(--border));
  cursor: default;
}

.tango-board .cell.error {
  border-color: var(--bad);
  background: color-mix(in oklab, var(--bad) 12%, var(--card));
}

@media (max-width: 480px) {
  :root {
    --cell: clamp(44px, 19vw, 64px);
  }

  .tango-board {
    gap: 5px;
  }

  .tango-board .cell {
    border-radius: 14px;
  }
}

/* Evita artefactos visuales de foco/click en Tango */
.tango-board .cell {
  position: relative;
  appearance: none;
  -webkit-appearance: none;
}

.tango-board .cell:focus:not(:focus-visible) {
  outline: none;
}

.tango-board .cell:disabled {
  opacity: 1;
}

.btn-ayuda {
  width: 40px;
  height: 40px;
  border-radius: 999px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(15, 23, 42, 0.55);
}

.modal-backdrop[hidden] {
  display: none !important;
}

.modal-card {
  width: min(100%, 640px);
  max-height: min(86vh, 760px);
  overflow: auto;
  background: var(--card);
  color: var(--fg);
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.32);
  padding: 1.5rem 1.75rem;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 900;
}

.modal-close {
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 1.2rem;
  color: var(--muted);
}

.modal-tabs {
  display: flex;
  gap: 1rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}

.tab-btn {
  border: 0;
  background: transparent;
  padding: 0 0 0.5rem;
  font-weight: 800;
  cursor: pointer;
  color: var(--muted);
  border-bottom: 2px solid transparent;
}

.tab-btn--active {
  color: var(--fg);
  border-bottom-color: var(--btn-primary-bg);
}

.modal-text {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
}

.modal-list {
  margin: 0 0 0.75rem;
  padding-left: 1.2rem;
  font-size: 0.92rem;
}

.modal-list--ordered {
  list-style: decimal;
}

.modal-note,
.modal-version {
  margin: 0 0 0.5rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.modal-actions {
  margin-top: 1rem;
  display: flex;
  justify-content: flex-end;
}

.next-btn {
  margin-top: 1rem;
  width: min(100%, 360px);
  border-radius: 999px;
}

.final-actions[hidden] {
  display: none !important;
}

.final-actions .btn {
  width: min(100%, 360px);
  border-radius: 999px;
}

.final-actions a.btn.secundario {
  background: #ffffff;
  color: #0f172a !important;
  border: 1px solid #dbe2ea;
  text-decoration: none;
}

.tango-progreso {
  width: min(100%, 520px);
  margin: 1rem auto 1.2rem;
}

.progreso-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.progreso-bar {
  height: 10px;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
}

#progressFill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.25s ease;
}

/* Ajuste final pantalla de cierre */
.final-actions {
  margin-top: 2.25rem;
  padding-top: 1.4rem;
  border-top: 1px solid #e5e7eb;
}

@media (min-width: 640px) {
  .final-actions {
    flex-direction: row;
    justify-content: center;
    gap: 1rem;
  }

  .final-actions .btn {
    width: min(100%, 360px);
  }
}
