:root {
  --bg: #f7f8ff;
  --bg-strong: #e5e8ff;
  --card: #ffffff;
  --text: #1b1b2b;
  --muted: #5a5a72;
  --primary: #ff6b6b;
  --primary-strong: #ff4d6d;
  --secondary: #4cc9f0;
  --success: #3ccf7a;
  --danger: #ff3b30;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

body.theme-dark {
  --bg: #0e1224;
  --bg-strong: #1b2040;
  --card: #141832;
  --text: #f5f6ff;
  --muted: #b9bedf;
  --primary: #ff8fab;
  --primary-strong: #ff6b81;
  --secondary: #6dd3ff;
  --success: #5cf29c;
  --danger: #ff6b6b;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", system-ui, -apple-system, sans-serif;
  background: radial-gradient(120% 120% at 20% 20%, rgba(255, 204, 112, 0.35), transparent 55%),
    radial-gradient(150% 150% at 80% 0%, rgba(88, 205, 255, 0.2), transparent 50%),
    var(--bg);
  color: var(--text);
  padding: 20px;
  transition: background 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
}

body.animations-off * {
  transition: none !important;
  animation: none !important;
}

.app {
  max-width: 1100px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.background-shape {
  position: fixed;
  width: 240px;
  height: 240px;
  border-radius: 40%;
  filter: blur(50px);
  opacity: 0.45;
  z-index: 0;
}

.shape-1 {
  background: #ffd166;
  top: 10%;
  left: -60px;
}

.shape-2 {
  background: #9bf6ff;
  bottom: 5%;
  right: -80px;
}

.shape-3 {
  background: #ffc6ff;
  top: 60%;
  left: 40%;
}

h1, h2, h3 {
  font-family: "Fredoka", "Space Grotesk", system-ui, sans-serif;
  margin: 0 0 8px;
  letter-spacing: -0.5px;
}

p {
  margin: 0;
  color: var(--muted);
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.brand {
  display: flex;
  gap: 10px;
  align-items: center;
}

.logo {
  font-size: 32px;
}

.brand-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
}

.top-actions {
  display: flex;
  gap: 8px;
}

.screen {
  display: block;
}

.hidden {
  display: none !important;
}

.hero {
  background: linear-gradient(135deg, rgba(255, 107, 107, 0.16), rgba(76, 201, 240, 0.18));
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: 32px;
  border-radius: 22px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
}

.hero-title {
  font-size: clamp(28px, 5vw, 40px);
  margin-bottom: 18px;
}

.tag {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 12px;
  background: var(--bg-strong);
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
  margin: 0 0 8px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.chip {
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--bg-strong);
  box-shadow: var(--shadow);
}

.card {
  background: var(--card);
  border-radius: 18px;
  padding: 18px;
  box-shadow: var(--shadow);
  position: relative;
}

.form-card {
  margin-bottom: 16px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

label {
  font-weight: 600;
}

input[type="text"],
input[type="number"],
select {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--bg-strong);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
}

input:focus,
select:focus {
  outline: 2px solid var(--secondary);
}

.help-text {
  font-size: 13px;
}

.primary-btn,
.secondary-btn,
.ghost-btn {
  border: none;
  border-radius: 14px;
  padding: 12px 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.2s ease, background 0.2s ease;
  font-family: "Fredoka", "Space Grotesk", sans-serif;
}

.primary-btn {
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: #fff;
  box-shadow: 0 12px 30px rgba(255, 107, 107, 0.35);
}

.secondary-btn {
  background: var(--bg-strong);
  color: var(--text);
}

.ghost-btn {
  background: transparent;
  border: 1px solid var(--bg-strong);
  color: var(--text);
}

.primary-btn.big {
  width: 100%;
  font-size: 18px;
}

.secondary-btn.small,
.ghost-btn.small {
  padding: 8px 12px;
  font-size: 14px;
}

.primary-btn:hover,
.secondary-btn:hover,
.ghost-btn:hover {
  transform: translateY(-1px) scale(1.01);
}

.primary-btn:active,
.secondary-btn:active,
.ghost-btn:active {
  transform: translateY(0);
}

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

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--bg-strong);
  font-weight: 600;
}

.pill button {
  border: none;
  background: none;
  cursor: pointer;
  color: var(--danger);
  font-size: 16px;
}

.inline {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.switch-field {
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
}

.switch {
  position: relative;
  display: inline-block;
  width: 54px;
  height: 28px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-strong);
  transition: .3s;
  border-radius: 28px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
  box-shadow: var(--shadow);
}

.switch input:checked + .slider {
  background-color: var(--secondary);
}

.switch input:checked + .slider:before {
  transform: translateX(26px);
}

.themes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.theme-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border-radius: 14px;
  background: var(--bg);
  border: 1px solid var(--bg-strong);
  cursor: pointer;
  font-weight: 700;
  user-select: none;
}

.theme-box input {
  width: 18px;
  height: 18px;
}

.error-text {
  color: var(--danger);
  font-weight: 700;
  margin: 8px 0;
}

.action-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: space-between;
}

.reveal-card {
  max-width: 520px;
  margin: 0 auto;
  text-align: center;
}

.card-flip {
  perspective: 1000px;
  margin: 20px 0;
}

.card-inner {
  position: relative;
  width: 100%;
  min-height: 240px;
  transform-style: preserve-3d;
  transition: transform 0.8s;
}

.card-inner.flipped {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 18px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 14px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.06));
  border: 2px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.35), 0 0 35px rgba(255, 255, 255, 0.08) inset;
  color: #f9fbff;
  text-align: center;
}

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

.card-front {
  transform: rotateY(180deg);
}

.card-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #fff6ff;
  text-shadow:
    0 0 14px rgba(255, 255, 255, 0.65),
    0 0 24px rgba(255, 77, 159, 0.55),
    0 0 28px rgba(124, 248, 255, 0.45);
}

.card-word {
  font-size: 36px;
  font-weight: 800;
  color: #fafff2;
  text-align: center;
  text-shadow: 0 0 14px rgba(255, 255, 255, 0.55);
}

.card-hint {
  font-size: 15px;
  color: #e8f2ff;
  text-shadow: 0 0 8px rgba(232, 242, 255, 0.35);
}

.card-suit {
  position: absolute;
  font-size: 32px;
  font-weight: 800;
  font-family: "Fredoka", "Space Grotesk", sans-serif;
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.45);
}

.card-suit.top {
  top: 12px;
  left: 14px;
}

.card-suit.bottom {
  bottom: 12px;
  right: 14px;
  transform: rotate(180deg);
}

.suit-heart { color: #ff4d9f; }
.suit-diamond { color: #ffd447; }
.suit-club { color: #4cffc3; }
.suit-spade { color: #7fb7ff; }

/* Temas neón tipo baraja */
.card-theme-1 .card-face {
  background: radial-gradient(circle at 20% 20%, rgba(255, 78, 140, 0.65), transparent 35%),
    radial-gradient(circle at 80% 80%, rgba(92, 225, 255, 0.55), transparent 40%),
    linear-gradient(135deg, #0f1227, #1f2646 45%, #2f3e6f);
  border: 2px solid #ff4d9f;
  box-shadow: 0 0 28px rgba(255, 78, 140, 0.45), 0 0 18px rgba(92, 225, 255, 0.35);
}

.card-theme-2 .card-face {
  background: radial-gradient(circle at 15% 80%, rgba(255, 243, 122, 0.65), transparent 38%),
    radial-gradient(circle at 85% 10%, rgba(255, 133, 255, 0.55), transparent 32%),
    linear-gradient(135deg, #0f1a2b, #1c2944 50%, #283a64);
  border: 2px solid #ffd447;
  box-shadow: 0 0 28px rgba(255, 243, 122, 0.45), 0 0 18px rgba(255, 133, 255, 0.35);
}

.card-theme-3 .card-face {
  background: radial-gradient(circle at 30% 30%, rgba(126, 255, 200, 0.6), transparent 32%),
    radial-gradient(circle at 80% 70%, rgba(255, 156, 104, 0.55), transparent 32%),
    linear-gradient(135deg, #11192d, #1d2d46 50%, #2a3d5e);
  border: 2px solid #4cffc3;
  box-shadow: 0 0 28px rgba(76, 255, 195, 0.45), 0 0 18px rgba(255, 156, 104, 0.3);
}

.card-theme-4 .card-face {
  background: radial-gradient(circle at 25% 75%, rgba(144, 168, 255, 0.65), transparent 36%),
    radial-gradient(circle at 75% 20%, rgba(255, 115, 180, 0.55), transparent 34%),
    linear-gradient(135deg, #0f162c, #1d2344 50%, #2b325a);
  border: 2px solid #7fb7ff;
  box-shadow: 0 0 28px rgba(144, 168, 255, 0.45), 0 0 18px rgba(255, 115, 180, 0.35);
}

.card-theme-5 .card-face {
  background: radial-gradient(circle at 15% 15%, rgba(255, 152, 88, 0.65), transparent 32%),
    radial-gradient(circle at 85% 85%, rgba(102, 255, 228, 0.55), transparent 32%),
    linear-gradient(135deg, #10162d, #1c2349 50%, #2a345f);
  border: 2px solid #ff9a5c;
  box-shadow: 0 0 28px rgba(255, 152, 88, 0.45), 0 0 18px rgba(102, 255, 228, 0.35);
}

.card-turn {
  font-weight: 700;
  color: #7cf8ff;
  text-shadow: 0 0 12px rgba(124, 248, 255, 0.65);
}

.card-turn-name {
  color: #fff9d9;
  text-shadow: 0 0 10px rgba(255, 249, 217, 0.6);
}

.card-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.summary {
  margin-top: 12px;
  padding: 12px;
  border-radius: 12px;
  background: var(--bg-strong);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.section-header.small h3 {
  margin: 0;
}

.switch-label {
  font-weight: 700;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 10;
}

.modal-content {
  background: var(--card);
  padding: 18px;
  border-radius: 16px;
  max-width: 480px;
  width: 100%;
  box-shadow: var(--shadow);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.steps {
  padding-left: 18px;
  color: var(--text);
}

.steps li {
  margin: 8px 0;
}

@media (max-width: 720px) {
  body {
    padding: 16px;
  }

  .top-actions {
    display: none;
  }

  .inline {
    grid-template-columns: 1fr;
  }

  .hero {
    padding: 22px;
  }

  .primary-btn.big {
    font-size: 16px;
  }
}
