:root {
  --bg-1: #020617;
  --bg-2: #0f172a;
  --panel: rgba(15, 23, 42, 0.94);
  --panel-2: rgba(2, 8, 23, 0.88);
  --line: rgba(148, 163, 184, 0.22);
  --text: #e5eefb;
  --muted: #94a3b8;
  --shadow: 0 14px 36px rgba(0, 0, 0, 0.35);
  --radius: 20px;
  --neon-blue: #0ea5e9;
  --neon-gold: #facc15;
  --win-glow: rgba(34, 197, 94, 0.6);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(14, 165, 233, 0.18), transparent 28%),
    linear-gradient(180deg, var(--bg-1), var(--bg-2));
}

body {
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.hidden {
  display: none !important;
}

body.mobile-fullscreen {
  overflow-x: hidden;
}

body.mobile-fullscreen .main {
  max-width: 100%;
  padding-top: 8px;
}

body.modal-open {
  overflow: hidden;
}

input[type="text"],
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(2, 6, 23, 0.9);
  color: var(--text);
  border-radius: 14px;
  padding: 13px 14px;
  font: inherit;
  min-height: 48px;
}

input[type="checkbox"] {
  transform: scale(1.1);
}

textarea {
  resize: vertical;
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px 12px 28px;
  overflow-y: auto;
  flex: 1;
}

.fullscreen-wrapper {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}

.step-panel {
  display: none;
  flex-direction: column;
}

.step-panel.active {
  display: flex;
}

.panel {
  margin-top: 12px;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.panel--intro {
  margin-top: 0;
}

.panel-content {
  flex: 1;
}

.panel-actions {
  margin-top: 24px;
}

.panel__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.panel__header h2 {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.2;
}

.identity-strip {
  display: inline-block;
  margin-bottom: 14px;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  color: #dbeafe;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
}

.chip {
  display: inline-block;
  padding: 7px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: #bae6fd;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.28);
}

.setup-grid,
.control-grid,
.dice-single,
.sudden-grid {
  display: grid;
  gap: 16px;
}

.setup-grid,
.control-grid,
.sudden-grid {
  grid-template-columns: 1fr 1fr;
}

.card-lists {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.control-panel {
  border: 1px solid rgba(56, 189, 248, 0.32);
  background: linear-gradient(180deg, rgba(14, 165, 233, 0.16), rgba(15, 23, 42, 0.96));
}

.field label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
  color: #dbeafe;
  font-size: 0.98rem;
}

.field-inline {
  margin-top: 14px;
}

.checkbox-wrap {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.toolbar-center {
  justify-content: center;
}

.action-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.action-buttons .btn {
  flex: 1;
  min-width: 140px;
}

.btn {
  appearance: none;
  border: none;
  border-radius: 14px;
  padding: 12px 15px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease, filter 0.15s ease;
  box-shadow: var(--shadow);
  min-height: 48px;
  font-size: 15px;
}

.btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn--primary {
  background: linear-gradient(135deg, #2563eb, #06b6d4);
}

.btn--secondary {
  background: linear-gradient(135deg, #334155, #475569);
}

.btn--success {
  background: linear-gradient(135deg, #15803d, #22c55e);
}

.btn--warning {
  background: linear-gradient(135deg, #c2410c, #f97316);
}

.btn--next {
  background: linear-gradient(135deg, #7c3aed, #06b6d4);
  font-size: 1.05rem;
}

.info-box {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  line-height: 1.5;
}

.info-box--story {
  border-color: rgba(250, 204, 21, 0.24);
  background: rgba(250, 204, 21, 0.08);
}

.info-box--mini {
  font-size: 0.95rem;
}

.intro-main-box {
  font-size: 1.02rem;
}

.how-panel {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  overflow: hidden;
}

.how-panel summary {
  list-style: none;
  cursor: pointer;
  padding: 14px;
  font-weight: 700;
  color: #dbeafe;
}

.how-panel summary::-webkit-details-marker {
  display: none;
}

.how-panel__content {
  padding: 0 14px 14px 14px;
  color: #dbeafe;
  line-height: 1.55;
  white-space: normal;
}

.card-display {
  padding: 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(2, 6, 23, 0.68);
  line-height: 1.55;
}

.card-display--empty {
  color: var(--muted);
}

.card-hero {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 16px;
  align-items: start;
}

.card-image-wrap {
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-image {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

.card-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: #f8fafc;
  margin-bottom: 8px;
}

.card-subtitle {
  color: #cbd5e1;
  margin-bottom: 10px;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.mini-chip {
  display: inline-block;
  padding: 6px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
}

.card-list {
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  padding: 12px;
}

.card-list h3 {
  margin: 0 0 8px;
  font-size: 0.98rem;
  color: #dbeafe;
}

.card-list ul {
  margin: 0;
  padding-left: 18px;
}

.card-list li {
  margin-bottom: 4px;
}

.card-despertar {
  border-color: rgba(14, 165, 233, 0.7);
  box-shadow: 0 0 12px rgba(14, 165, 233, 0.18);
}

.card-pro {
  border-color: rgba(249, 115, 22, 0.7);
  box-shadow: 0 0 12px rgba(249, 115, 22, 0.18);
}

.card-leyenda {
  border-color: rgba(250, 204, 21, 0.85);
  box-shadow: 0 0 20px rgba(250, 204, 21, 0.3);
}

.dice-visual-wrap {
  display: flex;
  justify-content: center;
  margin: 18px 0 12px;
}

.dice-cube {
  width: 84px;
  height: 84px;
  border-radius: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(37,99,235,.22), rgba(6,182,212,.18));
  border: 1px solid rgba(56,189,248,.35);
  box-shadow: 0 0 30px rgba(14,165,233,.25);
  font-size: 2rem;
  font-weight: 700;
}

.dice-cube.rolling {
  animation: spinDice 0.9s ease;
}

@keyframes spinDice {
  0% { transform: rotate(0) scale(1); }
  20% { transform: rotate(90deg) scale(1.06); }
  40% { transform: rotate(180deg) scale(.98); }
  60% { transform: rotate(270deg) scale(1.05); }
  100% { transform: rotate(360deg) scale(1); }
}

.dice-card {
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(2, 6, 23, 0.7);
  padding: 14px 10px;
  text-align: center;
}

.dice-card__label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.dice-card__value {
  font-size: 1.2rem;
  font-weight: 700;
}

.execution-info {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.btn-cromo-toggle {
  appearance: none;
  width: 100%;
  border: 1px solid rgba(56, 189, 248, 0.28);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.18), rgba(6, 182, 212, 0.18));
  color: #e5eefb;
  border-radius: 14px;
  padding: 12px 14px;
  font-weight: 700;
  font-size: 15px;
  text-align: center;
  cursor: pointer;
}

.execution-guide {
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(250, 204, 21, 0.25);
  background: rgba(250, 204, 21, 0.08);
}

.execution-guide__title {
  font-weight: 700;
  color: #fde68a;
  margin-bottom: 8px;
}

.execution-guide__text {
  color: #fef3c7;
  line-height: 1.5;
}

.current-load-box {
  background: rgba(56, 189, 248, 0.2);
  border: 1px solid var(--neon-blue);
  border-radius: 12px;
  padding: 8px 12px;
  text-align: center;
  font-weight: bold;
}

.mini-feedback-box {
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(56, 189, 248, 0.25);
  background: rgba(56, 189, 248, 0.08);
}

.mini-feedback-box__title {
  font-weight: 700;
  color: #dbeafe;
  margin-bottom: 12px;
}

.mini-feedback-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.player-feedback {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(2, 8, 23, 0.45);
  padding: 12px;
}

.player-feedback__name,
.sudden-card__name {
  font-weight: 700;
  font-size: 1rem;
  color: #f8fafc;
  margin-bottom: 10px;
}

.feedback-group {
  margin-bottom: 12px;
}

.feedback-group:last-child {
  margin-bottom: 0;
}

.feedback-group__title {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
  text-transform: uppercase;
}

.choice-chip {
  display: block;
  margin-bottom: 8px;
  cursor: pointer;
}

.choice-chip input {
  display: none;
}

.choice-chip span {
  display: block;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.04);
  transition: 0.2s ease;
}

.choice-chip input:checked + span {
  border-color: rgba(34, 197, 94, 0.55);
  background: rgba(34, 197, 94, 0.14);
}

.choice-chip--bad input:checked + span {
  border-color: rgba(239, 68, 68, 0.55);
  background: rgba(239, 68, 68, 0.14);
}

.sudden-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(2, 8, 23, 0.45);
  padding: 14px;
}

.sudden-card__question {
  background: rgba(255,255,255,0.04);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 12px;
  line-height: 1.45;
}

.sudden-card__options .choice-chip {
  margin-bottom: 10px;
}

.winner-box {
  padding: 20px;
  border-radius: 20px;
  border: 2px solid var(--line);
  background: rgba(34, 197, 94, 0.15);
  line-height: 1.6;
  font-size: 1.2rem;
  text-align: center;
  transition: all 0.3s ease;
  box-shadow: 0 0 15px rgba(34, 197, 94, 0.3);
}

.winner-box--win {
  background: rgba(34, 197, 94, 0.25);
  border-color: #22c55e;
  box-shadow: 0 0 25px var(--win-glow);
  animation: winPulse 0.8s ease-in-out 2;
}

@keyframes winPulse {
  0% { box-shadow: 0 0 0 0 var(--win-glow); }
  70% { box-shadow: 0 0 0 15px var(--win-glow); }
  100% { box-shadow: 0 0 0 0 var(--win-glow); }
}

.winner-box strong {
  font-size: 1.8rem;
  display: block;
  margin-bottom: 8px;
  color: #facc15;
}

.history-box {
  margin-top: 16px;
}

.history-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.history-chip,
.achievement-chip {
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.05);
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 12px;
  color: #e2e8f0;
}

.achievement-chip {
  border-color: rgba(250,204,21,.32);
  background: rgba(250,204,21,.08);
}

.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 90%;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(12px);
  border: 2px solid var(--neon-blue);
  border-radius: 40px;
  padding: 16px 22px;
  color: white;
  font-weight: bold;
  font-size: 1.05rem;
  text-align: center;
  z-index: 2000;
  box-shadow: 0 0 30px rgba(14, 165, 233, 0.5);
  line-height: 1.4;
}

.toast.show {
  display: block;
  animation: fadeInOutCentered 2.8s ease forwards;
}

@keyframes fadeInOutCentered {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
  15% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  85% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 16px;
}

.modal-content {
  background: var(--panel);
  border-radius: 28px;
  max-width: 700px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 24px;
  border: 1px solid var(--line);
  position: relative;
}

.lightbox-content {
  background: transparent;
  box-shadow: none;
  max-width: 95%;
  width: auto;
  text-align: center;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 18px;
  font-size: 32px;
  cursor: pointer;
  color: var(--muted);
  line-height: 1;
}

.modal-close:hover {
  color: white;
}

.collection-content {
  max-height: 60vh;
  overflow-y: auto;
}

.collection-section {
  margin-bottom: 24px;
}

.collection-section h3 {
  color: var(--neon-gold);
  margin-bottom: 12px;
  font-size: 1.1rem;
}

.collection-grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 12px;
}

.collection-card {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 6px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.2s, background .2s;
  border: 1px solid transparent;
}

.collection-card:hover {
  transform: scale(1.02);
  background: rgba(255, 255, 255, 0.1);
}

.collection-thumb-wrap {
  border-radius: 10px;
  overflow: hidden;
  aspect-ratio: 1 / 1.2;
  background: rgba(2, 8, 23, .7);
  display: flex;
  align-items: center;
  justify-content: center;
}

.collection-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.collection-code {
  font-size: 11px;
  margin-top: 6px;
  color: #e2e8f0;
  font-weight: 700;
}

@media (max-width: 900px) {
  .setup-grid,
  .control-grid,
  .card-lists,
  .sudden-grid,
  .mini-feedback-grid,
  .card-hero {
    grid-template-columns: 1fr;
  }

  .panel {
    padding: 16px;
    border-radius: 18px;
  }

  .btn {
    width: 100%;
    font-size: 16px;
  }

  .action-buttons .btn {
    min-width: 100%;
  }

  .fullscreen-wrapper {
    position: sticky;
    top: 0;
    z-index: 30;
    background: linear-gradient(180deg, rgba(2,6,23,.95), rgba(2,6,23,0));
    padding-top: 4px;
  }

  .dice-cube {
    width: 76px;
    height: 76px;
    font-size: 1.8rem;
  }

  .toast {
    border-radius: 22px;
    font-size: 0.98rem;
    white-space: normal;
  }

  .modal-content {
    padding: 18px;
    border-radius: 20px;
  }
}
