:root {
  --brand-yellow: #ffcc00;
  --brand-purple: #8e1d86;
  --brand-dark: #32255f;
  --bg: #eef0f5;
  --ink: #1a1a1a;
  --muted: #6b7280;
  --card: #ffffff;
  --line: #e5e7eb;
}

[hidden] {
  display: none !important;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: Lato, system-ui, sans-serif;
  font-size: 15px;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}

.site-header {
  background: #fff;
  border-bottom: 3px solid var(--brand-yellow);
  padding: 14px 20px;
  text-align: center;
}

.site-header .logo {
  height: auto;
  max-width: min(220px, 70vw);
  width: 220px;
  display: inline-block;
}

.site-footer {
  text-align: center;
  padding: 28px 16px 40px;
  color: var(--muted);
  font-size: 0.85rem;
}

.gift-banner {
  background: linear-gradient(90deg, var(--brand-purple) 0%, #6a1570 100%);
  color: #fff;
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 16px;
  box-shadow: 0 4px 16px rgba(142, 29, 134, 0.25);
  border: 2px solid var(--brand-yellow);
}

.gift-banner-text {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.45;
  text-align: center;
}

.gift-banner-text strong {
  color: var(--brand-yellow);
  font-weight: 700;
}

.gift-banner-tag {
  display: inline-block;
  background: var(--brand-yellow);
  color: var(--brand-dark);
  font-family: Montserrat, sans-serif;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 999px;
  margin-right: 6px;
  vertical-align: middle;
}

.gift-banner-game {
  margin-bottom: 12px;
}

.gift-banner-game .gift-banner-text {
  font-size: 0.88rem;
}

body.in-game .gift-banner-game {
  position: sticky;
  top: 8px;
  z-index: 5;
}

.stage {
  width: min(520px, calc(100% - 32px));
  margin: 0 auto;
  padding: 20px 0 12px;
}

.stage.in-game {
  width: min(1080px, calc(100% - 24px));
}

.stage.in-game .brand {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 16px;
  margin-bottom: 16px;
}

.stage.in-game .eyebrow {
  margin: 0;
}

.stage.in-game .brand h1 {
  font-size: 1.35rem;
  margin: 0;
}

.stage.in-game .count {
  margin: 0 0 0 auto;
  font-size: 0.82rem;
  padding: 4px 12px;
  background: #fff;
  border-radius: 999px;
  border: 1px solid var(--line);
}

.stage.in-game .subtitle {
  display: none;
}

body.in-game .site-header {
  padding: 8px 16px;
}

body.in-game .site-header .logo {
  width: 160px;
}

body.in-game .site-footer {
  padding: 10px 16px 14px;
}

.stage.wide {
  width: min(860px, calc(100% - 32px));
}

.brand h1 {
  font-family: Montserrat, sans-serif;
  font-weight: 700;
  font-size: 1.75rem;
  margin: 0 0 6px;
  color: var(--brand-dark);
}

.eyebrow {
  font-family: Montserrat, sans-serif;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--brand-purple);
  margin: 0 0 4px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.subtitle,
.hint,
.note,
.waiting p {
  color: var(--muted);
}

.count {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--brand-dark);
  margin: 8px 0 0;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.rules-title {
  font-family: Montserrat, sans-serif;
  font-size: 1rem;
  margin: 0 0 10px;
  color: var(--brand-dark);
}

.rules-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 0.92rem;
}

.rules-list li {
  margin-bottom: 8px;
}

.rules-list strong {
  color: var(--ink);
}

label {
  display: block;
  font-family: Montserrat, sans-serif;
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 8px;
  color: var(--brand-dark);
}

form {
  display: flex;
  gap: 8px;
}

input,
textarea,
button {
  font: inherit;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

input:focus,
textarea:focus {
  border-color: var(--brand-purple);
  box-shadow: 0 0 0 2px rgba(142, 29, 134, 0.15);
}

textarea {
  resize: vertical;
  margin-bottom: 12px;
}

button {
  border: 0;
  border-radius: 8px;
  padding: 12px 18px;
  background: var(--brand-yellow);
  color: #000;
  font-family: Montserrat, sans-serif;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
}

button:hover:not(:disabled) {
  background: #e6b800;
}

button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.primary-wide {
  width: 100%;
}

.danger,
button.btn-danger {
  background: #fff;
  color: #c62828;
  border: 1px solid #ef9a9a;
}

button.btn-danger:hover:not(:disabled),
button.danger:hover:not(:disabled) {
  background: #ffebee;
}

.hint {
  font-size: 0.88rem;
  margin: 10px 0 0;
}

.block-hint {
  margin: 0 0 12px;
}

.error {
  color: #c62828;
  font-weight: 700;
  font-size: 0.9rem;
  margin-top: 10px;
}

.ok {
  color: #2e7d32;
  font-weight: 700;
  font-size: 0.9rem;
  margin-top: 10px;
}

a {
  color: var(--brand-purple);
  font-weight: 700;
}

.reveal {
  margin-top: 8px;
}

.game-board {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(50, 37, 95, 0.08);
  overflow: hidden;
  min-height: 320px;
}

.game-col {
  display: flex;
  flex-direction: column;
  padding: 24px 22px;
  border-right: 1px solid var(--line);
  min-width: 0;
}

.game-col:last-child {
  border-right: 0;
}

.game-col-target {
  justify-content: center;
}

.game-col-target > div {
  display: flex;
  flex-direction: column;
  flex: 1;
  justify-content: center;
}

.col-label {
  margin: 0 0 6px;
  font-family: Montserrat, sans-serif;
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--brand-purple);
}

.col-hint {
  margin: 0 0 16px;
  font-size: 0.88rem;
  color: var(--muted);
}

.btn-secondary {
  background: var(--brand-dark);
  color: #fff;
  width: 100%;
}

.btn-secondary:hover:not(:disabled) {
  background: #43356e;
}

.character {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  flex: 1;
  min-height: 180px;
  border-radius: 14px;
  padding: 24px 16px;
  color: #fff;
  position: relative;
  overflow: hidden;
}

.character::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.12) 0%, transparent 45%);
  pointer-events: none;
}

.character.pop-in {
  animation: charPop 0.75s cubic-bezier(0.2, 1.3, 0.3, 1) both;
}

.character.reveal-in {
  animation: charReveal 0.9s cubic-bezier(0.2, 1.2, 0.3, 1) both;
}

.emoji-wrap {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  display: grid;
  place-items: center;
  position: relative;
  z-index: 1;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.emoji {
  font-size: 36px;
  line-height: 1;
  position: relative;
  z-index: 1;
}

.cname {
  font-family: Montserrat, sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  margin: 0;
  position: relative;
  z-index: 1;
  letter-spacing: 0.02em;
}

.wish-fields {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
  flex: 1;
}

.wish-fields textarea {
  padding: 10px 12px;
  font-size: 0.9rem;
  min-height: 52px;
  resize: vertical;
  line-height: 1.45;
}

.friend-wishes {
  min-width: 0;
}

.wishes-empty {
  margin: 12px 0 0;
  padding: 10px 12px;
  background: #f9fafb;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.88rem;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.wishes-title {
  font-size: 0.82rem;
  font-weight: 700;
  margin: 12px 0 6px;
  color: var(--brand-dark);
}

.wishes-list {
  font-size: 0.88rem;
  margin: 0;
  padding-left: 18px;
  color: var(--ink);
}

.wishes-list li {
  margin-bottom: 6px;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.45;
}

.note {
  font-size: 0.78rem;
  margin: 10px 0 0;
  color: var(--muted);
}

.spark-btn {
  width: 100%;
  min-height: 52px;
  font-size: 0.95rem;
  animation: pulse 2s ease-in-out infinite;
}

.burst {
  position: fixed;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 999;
}

@keyframes charPop {
  from {
    transform: scale(0.6) rotateX(25deg);
    opacity: 0;
  }
}

@keyframes charReveal {
  from {
    transform: scale(0.5) translateX(30px);
    opacity: 0;
    filter: blur(6px);
  }
  60% {
    transform: scale(1.05) translateX(-4px);
    opacity: 1;
    filter: blur(0);
  }
}

@keyframes pulse {
  50% {
    box-shadow: 0 0 0 6px rgba(255, 204, 0, 0.25);
  }
}

/* —— Admin (precargar) —— */

.stage.admin {
  width: min(920px, calc(100% - 24px));
}

.admin-brand {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.admin-brand h1 {
  margin: 0;
}

.back-link {
  font-family: Montserrat, sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--brand-dark);
  white-space: nowrap;
}

.back-link:hover {
  border-color: var(--brand-purple);
  color: var(--brand-purple);
}

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

.stat-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(50, 37, 95, 0.05);
}

.stat-value {
  display: block;
  font-family: Montserrat, sans-serif;
  font-weight: 700;
  font-size: 1.75rem;
  line-height: 1.1;
  color: var(--brand-dark);
}

.stat-label {
  display: block;
  margin-top: 4px;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.stat-ok .stat-value {
  color: #2e7d32;
}

.stat-pending .stat-value {
  color: var(--brand-purple);
}

.stat-wishlist-ok .stat-value {
  color: #1565c0;
}

.stat-wishlist-pending .stat-value {
  color: #e65100;
}

.admin-board-wishlist {
  margin-bottom: 16px;
}

.admin-board-wishlist .col-hint {
  margin: 0 0 10px;
  font-size: 0.82rem;
}

.progress-wrap {
  margin-bottom: 16px;
}

.progress-bar {
  height: 8px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 6px;
}

.progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--brand-purple), #b832a8);
  border-radius: 999px;
  transition: width 0.4s ease;
}

.progress-text {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.admin-board {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(50, 37, 95, 0.08);
  overflow: hidden;
  margin-bottom: 16px;
}

.admin-col {
  padding: 20px 22px;
  border-right: 1px solid var(--line);
  min-height: 200px;
}

.admin-col:last-child {
  border-right: 0;
}

.admin-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px 24px;
  box-shadow: 0 4px 24px rgba(50, 37, 95, 0.08);
}

.admin-panel textarea {
  margin-bottom: 12px;
  font-size: 0.88rem;
  line-height: 1.5;
  font-family: ui-monospace, "Cascadia Code", monospace;
}

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

.admin-actions button {
  flex: 1;
  min-width: 160px;
}

.admin-actions .btn-danger {
  flex: 0 1 auto;
  width: auto;
  min-width: 140px;
}

.mail-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 260px;
  overflow: auto;
}

.mail-list li {
  font-size: 0.85rem;
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 4px;
  word-break: break-all;
  background: #f9fafb;
  border: 1px solid transparent;
}

.mail-list.in li:not(.empty) {
  border-left: 3px solid #2e7d32;
}

.mail-list.out li:not(.empty) {
  border-left: 3px solid var(--brand-purple);
}

.mail-list li.empty {
  background: transparent;
  border: 0;
  color: var(--muted);
  font-style: italic;
  padding-left: 0;
}

@media (max-width: 900px) {
  .game-board {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .game-col {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 20px 18px;
  }

  .game-col:last-child {
    border-bottom: 0;
  }

  .character {
    min-height: 140px;
  }
}

@media (max-width: 560px) {
  form {
    flex-direction: column;
  }

  .stage.in-game {
    width: calc(100% - 24px);
  }

  .admin-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .admin-board {
    grid-template-columns: 1fr;
  }

  .admin-col {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    min-height: 0;
  }

  .admin-col:last-child {
    border-bottom: 0;
  }

  .admin-actions {
    flex-direction: column;
  }

  .admin-actions button,
  .admin-actions .btn-secondary {
    width: 100%;
  }
}
