*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #eef6ff;
  --card: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --orange: #f97316;
  --orange-soft: #fff7ed;
  --green: #22c55e;
  --green-soft: #f0fdf4;
  --blue: #3b82f6;
  --blue-soft: #eff6ff;
  --shadow: 0 16px 40px rgba(59, 130, 246, 0.12);
}

html {
  height: 100%;
}

body {
  min-height: 100%;
  font-family: "Nunito", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem 2.5rem;
  position: relative;
  overflow: hidden;
}

.page-home {
  background:
    radial-gradient(circle at 10% 20%, rgba(249, 115, 22, 0.15), transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(34, 197, 94, 0.15), transparent 40%),
    radial-gradient(circle at 50% 0%, rgba(59, 130, 246, 0.1), transparent 50%),
    var(--bg);
}

.page-gracias {
  background:
    radial-gradient(circle at 85% 15%, rgba(34, 197, 94, 0.18), transparent 35%),
    radial-gradient(circle at 15% 85%, rgba(249, 115, 22, 0.18), transparent 35%),
    var(--bg);
}

.page-gracias-layout {
  flex-direction: row;
  align-items: flex-start;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1.25rem;
  max-width: 56rem;
  width: 100%;
}

.gracias-main {
  flex: 1 1 20rem;
  max-width: 28rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.gracias-main footer {
  width: 100%;
  text-align: center;
}

.votes-panel {
  flex: 0 1 16rem;
  width: 100%;
  max-width: 16rem;
  max-height: calc(100vh - 4rem);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  text-align: left;
  position: sticky;
  top: 2rem;
}

.votes-panel h2 {
  font-size: 1.1rem;
  font-weight: 800;
  margin-bottom: 1rem;
  text-align: center;
}

.votes-list {
  list-style: none;
  overflow-y: auto;
  flex: 1;
  padding-right: 0.25rem;
}

.vote-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid rgba(100, 116, 139, 0.15);
}

.vote-item:last-child {
  border-bottom: none;
}

.vote-name {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--text);
}

.vote-stars {
  font-size: 1.1rem;
  letter-spacing: 0.05em;
  color: var(--orange);
}

.votes-empty {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
  padding: 1rem 0.5rem;
}

.gallery-cta {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  width: 100%;
  margin-top: 1.5rem;
  padding: 1rem 1.15rem;
  text-decoration: none;
  color: inherit;
  background: linear-gradient(135deg, var(--orange-soft), var(--blue-soft));
  border: 2px solid rgba(249, 115, 22, 0.35);
  border-radius: 1rem;
  transition: transform 0.15s, box-shadow 0.15s;
}

.gallery-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(249, 115, 22, 0.2);
}

.gallery-cta-icon {
  font-size: 2rem;
  flex-shrink: 0;
  line-height: 1;
}

.gallery-cta-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  text-align: left;
}

.gallery-cta-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
}

.gallery-cta-sub {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.35;
}

.gallery-cta-arrow {
  flex-shrink: 0;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--orange);
}

.rating-section {
  margin-top: 1.75rem;
  padding-top: 1.5rem;
  border-top: 2px dashed rgba(59, 130, 246, 0.15);
  text-align: center;
}

.rating-section h2 {
  font-size: 1.15rem;
  font-weight: 800;
  margin-bottom: 1rem;
}

.rating-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.field-label {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--muted);
  text-align: left;
  margin-top: 0.35rem;
}

.rating-form input[type="text"] {
  width: 100%;
  padding: 0.65rem 0.85rem;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  border: 2px solid rgba(59, 130, 246, 0.2);
  border-radius: 0.75rem;
  outline: none;
  transition: border-color 0.2s;
}

.rating-form input[type="text"]:focus {
  border-color: var(--blue);
}

.stars-input {
  display: flex;
  justify-content: center;
  gap: 0.25rem;
  margin: 0.25rem 0 0.75rem;
}

.star-btn {
  background: none;
  border: none;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  color: #cbd5e1;
  padding: 0.15rem;
  transition: color 0.15s, transform 0.15s;
}

.star-btn:hover,
.star-btn.active {
  color: var(--orange);
}

.star-btn:hover {
  transform: scale(1.1);
}

.btn-submit {
  margin-top: 0.25rem;
  padding: 0.7rem 1.25rem;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 800;
  color: #fff;
  background: var(--blue);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}

.btn-submit:hover:not(:disabled) {
  background: #2563eb;
  transform: translateY(-1px);
}

.btn-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.form-message {
  font-size: 0.9rem;
  font-weight: 700;
  margin-top: 0.5rem;
}

.form-message--success {
  color: var(--green);
}

.form-message--error {
  color: #ef4444;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 1.5rem;
}

.nav-links--footer {
  margin-top: 0.75rem;
}

.nav-links a {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--blue);
  text-decoration: none;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  background: var(--blue-soft);
  transition: background 0.2s, transform 0.15s;
}

.nav-links a:hover {
  background: rgba(59, 130, 246, 0.2);
  transform: translateY(-1px);
}

.page-galeria {
  background:
    radial-gradient(circle at 20% 10%, rgba(249, 115, 22, 0.12), transparent 40%),
    radial-gradient(circle at 80% 90%, rgba(34, 197, 94, 0.12), transparent 40%),
    var(--bg);
}

.page-galeria-layout {
  justify-content: flex-start;
  max-width: 32rem;
  width: 100%;
  gap: 1.25rem;
}

.page-galeria-hub.page-galeria-layout {
  overflow: visible;
  justify-content: flex-start;
}

.view-gallery-card {
  width: 100%;
  max-width: 32rem;
  display: block;
  text-decoration: none;
  color: inherit;
  transition: transform 0.15s, box-shadow 0.15s;
}

.view-gallery-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 44px rgba(59, 130, 246, 0.18);
}

.view-gallery-icon {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 0.5rem;
}

.view-gallery-card h2 {
  font-size: 1.2rem;
  font-weight: 800;
  margin-bottom: 0.35rem;
}

.view-gallery-card p {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--muted);
}

.photo-count {
  display: inline-block;
  margin-top: 0.85rem;
  padding: 0.35rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--blue);
  background: var(--blue-soft);
  border-radius: 999px;
}

.page-fotos {
  min-height: 100vh;
  background: var(--bg);
  padding-bottom: 2rem;
}

.fotos-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 1rem 1rem 0.75rem;
  background: rgba(238, 246, 255, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(59, 130, 246, 0.1);
  text-align: center;
}

.fotos-back {
  display: inline-block;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--blue);
  text-decoration: none;
}

.fotos-topbar h1 {
  font-size: 1.35rem;
  font-weight: 800;
}

.fotos-hint {
  margin-top: 0.25rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

.fotos-admin {
  width: calc(100% - 2rem);
  max-width: 32rem;
  margin: 1rem auto 0.75rem;
  padding: 1rem 1.25rem;
  text-align: left;
}

.fotos-admin-title {
  font-size: 0.95rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.fotos-admin input[type="password"] {
  width: 100%;
  padding: 0.65rem 0.85rem;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  border: 2px solid rgba(59, 130, 246, 0.2);
  border-radius: 0.75rem;
  outline: none;
}

.fotos-admin .gallery-admin-hint {
  margin: 0.5rem 0 0;
  text-align: left;
}

.gallery-grid--full {
  display: grid;
  width: 100%;
  max-width: 48rem;
  margin: 0 auto;
  padding: 0 0.75rem 1rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.35rem;
}

@media (min-width: 600px) {
  .gallery-grid--full {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.5rem;
    padding: 0 1rem 1.5rem;
  }
}

@media (min-width: 900px) {
  .gallery-grid--full {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

.galeria-header {
  text-align: center;
  width: 100%;
}

.galeria-header h1 {
  margin-top: 0.25rem;
}

.upload-panel {
  width: 100%;
  max-width: 32rem;
  text-align: center;
}

.upload-panel h2,
.gallery-section h2 {
  font-size: 1.15rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.upload-hint {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 1rem;
}

.upload-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  text-align: left;
}

.upload-form input[type="password"] {
  width: 100%;
  padding: 0.65rem 0.85rem;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  border: 2px solid rgba(59, 130, 246, 0.2);
  border-radius: 0.75rem;
  outline: none;
}

.upload-form input[type="password"]:focus {
  border-color: var(--blue);
}

.upload-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin: 0.75rem 0;
}

.btn-upload {
  display: block;
  padding: 0.85rem 1rem;
  font-size: 1rem;
  font-weight: 800;
  text-align: center;
  border-radius: 0.85rem;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.15s;
}

.btn-upload:hover {
  transform: translateY(-1px);
}

.btn-upload-camera {
  color: #fff;
  background: var(--orange);
}

.btn-upload-gallery {
  color: var(--text);
  background: var(--blue-soft);
  border: 2px solid rgba(59, 130, 246, 0.2);
}

.upload-preview {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
  text-align: center;
}

.gallery-section {
  width: 100%;
}

.gallery-section h2 {
  text-align: center;
  margin-bottom: 1rem;
}

.gallery-admin-hint {
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  margin: -0.5rem 0 1rem;
}

.gallery-tap-hint {
  text-align: center;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--blue);
  margin: -0.35rem 0 0.75rem;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr));
  gap: 0.5rem;
}

.gallery-cell {
  position: relative;
  min-width: 0;
  overflow: hidden;
}

.gallery-item {
  width: 100%;
  display: block;
  aspect-ratio: 1 / 1;
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 0.5rem;
  overflow: hidden;
  cursor: pointer;
  background: var(--blue-soft);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
  transition: transform 0.15s;
  -webkit-appearance: none;
  appearance: none;
  font: inherit;
  color: inherit;
}

.gallery-item:hover {
  transform: scale(1.03);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  object-fit: cover;
  display: block;
  vertical-align: top;
}

.gallery-delete {
  position: absolute;
  top: 0.35rem;
  right: 0.35rem;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  font-size: 0.85rem;
  font-weight: 800;
  line-height: 1;
  color: #fff;
  background: rgba(239, 68, 68, 0.9);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  z-index: 2;
}

.gallery-delete:hover {
  background: #ef4444;
}

.gallery-empty {
  grid-column: 1 / -1;
  text-align: center;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--muted);
  padding: 2rem 1rem;
}

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

.lightbox[hidden] {
  display: none;
}

.lightbox img {
  max-width: 100%;
  max-height: 90vh;
  border-radius: 0.5rem;
  object-fit: contain;
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2.5rem;
  height: 2.5rem;
  font-size: 1.25rem;
  color: #fff;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  border-radius: 50%;
  cursor: pointer;
}

.lightbox-delete {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.65rem 1.25rem;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 800;
  color: #fff;
  background: #ef4444;
  border: none;
  border-radius: 999px;
  cursor: pointer;
}

.lightbox-delete:hover {
  background: #dc2626;
}

.sports-icons {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.ball {
  position: absolute;
  font-size: clamp(2.5rem, 8vw, 4rem);
  opacity: 0.35;
  animation: float 4s ease-in-out infinite;
}

.ball-basket {
  top: 8%;
  left: 8%;
  animation-delay: 0s;
}

.ball-football {
  bottom: 12%;
  right: 8%;
  animation-delay: 1.5s;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

.card {
  width: 100%;
  max-width: 26rem;
  padding: 2.25rem 1.75rem;
  text-align: center;
  background: var(--card);
  border-radius: 1.5rem;
  box-shadow: var(--shadow);
  border: 3px solid rgba(59, 130, 246, 0.12);
  position: relative;
  z-index: 1;
}

.card-gracias {
  max-width: 28rem;
}

.badge {
  display: inline-block;
  margin-bottom: 1rem;
  padding: 0.4rem 1rem;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 999px;
}

.badge-orange {
  color: var(--orange);
  background: var(--orange-soft);
}

.badge-green {
  color: var(--green);
  background: var(--green-soft);
}

h1 {
  font-size: clamp(1.6rem, 5vw, 2rem);
  font-weight: 800;
  line-height: 1.25;
}

.highlight {
  color: var(--blue);
}

.lead {
  margin-top: 0.85rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--muted);
}

.photo-frame {
  margin: 0 auto 1.25rem;
  width: min(100%, 16rem);
  aspect-ratio: 1;
  border-radius: 1.25rem;
  overflow: hidden;
  border: 4px solid var(--orange);
  box-shadow: 0 8px 24px rgba(249, 115, 22, 0.25);
  background: var(--blue-soft);
}

.photo-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.message {
  margin-top: 0.75rem;
  text-align: center;
  font-size: 1rem;
  font-weight: 600;
  color: var(--muted);
}

.message-main {
  font-size: 1.05rem;
}

.message p + p {
  margin-top: 0.85rem;
}

.message strong {
  color: var(--orange);
}

.sign-off {
  margin-top: 1.25rem !important;
  text-align: center;
  font-size: 1.05rem;
  color: var(--text);
}

.sports-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 1.5rem;
}

.tag {
  padding: 0.35rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 800;
  border-radius: 999px;
}

.tag-basket {
  color: var(--orange);
  background: var(--orange-soft);
}

.tag-football {
  color: var(--green);
  background: var(--green-soft);
}

footer {
  margin-top: 2rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  position: relative;
  z-index: 1;
}

@media (max-width: 768px) {
  .page-gracias-layout {
    flex-direction: column;
    align-items: center;
  }

  .votes-panel {
    max-width: 28rem;
    max-height: none;
    position: static;
  }

  .page-galeria-layout {
    padding-top: 1.25rem;
  }

  .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.4rem;
  }

  .gallery-item {
    border-radius: 0.65rem;
  }

  .gallery-delete {
    width: 1.5rem;
    height: 1.5rem;
    font-size: 0.75rem;
    top: 0.25rem;
    right: 0.25rem;
  }
}

@media (max-width: 480px) {
  .card {
    padding: 1.75rem 1.25rem;
  }

  .ball {
    opacity: 0.25;
  }
}

/* Galería de fotos — miniaturas en móvil */
.page-fotos .gallery-grid--full {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 3px;
  max-width: none;
  padding: 3px;
  margin: 0;
}

.page-fotos .gallery-cell {
  min-width: 0;
  width: 100%;
}

.page-fotos .gallery-item {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 0;
  box-shadow: none;
}

.page-fotos .gallery-item img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  object-fit: cover;
  pointer-events: none;
}

.page-fotos .fotos-admin {
  margin: 0.75rem auto;
  padding: 0.75rem 1rem;
}

.page-fotos .fotos-admin-details summary {
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--muted);
  list-style: none;
}

.page-fotos .fotos-admin-details summary::-webkit-details-marker {
  display: none;
}

.page-fotos .fotos-admin-details[open] summary {
  margin-bottom: 0.75rem;
}

.page-fotos .fotos-admin-details .field-label {
  margin-top: 0.25rem;
}
