/* ══════════════════════════════════════════════════
   Mallorca Hotel Ranker — Stylesheet
   Aesthetic: Warm Mediterranean resort
   Fonts: Cormorant Garamond (display) + Outfit (body)
   ══════════════════════════════════════════════════ */

/* ── Tokens ── */
:root {
  --sand:          #F5EBD4;
  --sand-light:    #FAF3E3;
  --sand-mid:      #E8D9B8;
  --sand-dark:     #D4C090;
  --parchment:     #FFFDF5;
  --terra:         #C05030;
  --terra-light:   #D96A44;
  --terra-dark:    #9E3F24;
  --gold:          #C9982A;
  --gold-light:    #E8B840;
  --gold-pale:     #F5DDA0;
  --agave:         #3E7060;
  --agave-light:   #5A9080;
  --sky:           #5E9EC0;
  --text:          #1A0D06;
  --text-mid:      #6B4E38;
  --text-muted:    #9C7A60;
  --shadow-warm:   rgba(80,30,10,0.12);
  --shadow-strong: rgba(80,30,10,0.22);
  --radius-card:   18px;
  --radius-btn:    12px;
  --transition:    0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Outfit', sans-serif;
  background-color: var(--sand);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Subtle background texture via layered gradient */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 50% at 20% 80%, rgba(192,80,48,0.06) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 20%, rgba(94,158,192,0.07) 0%, transparent 55%),
    radial-gradient(ellipse 50% 60% at 50% 50%, rgba(201,152,42,0.04) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}
body > * { position: relative; z-index: 1; }

/* ── Header ── */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: rgba(255,253,245,0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--sand-mid);
  position: sticky;
  top: 0;
  z-index: 100;
  gap: 16px;
}
.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}
.header-icon {
  font-size: 26px;
  line-height: 1;
}
.header-titles {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.site-title {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  font-size: 22px;
  color: var(--terra);
  letter-spacing: 0.03em;
}
.site-sub {
  font-family: 'Outfit', sans-serif;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.header-center {
  flex: 1;
  text-align: center;
}
.vote-counter {
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--sand);
  padding: 5px 14px;
  border-radius: 20px;
  border: 1px solid var(--sand-mid);
}
.header-right {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}
.stop-btn {
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--terra);
  background: transparent;
  border: 1.5px solid var(--terra);
  border-radius: 24px;
  padding: 7px 18px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition);
  white-space: nowrap;
}
.stop-btn:hover {
  background: var(--terra);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(192,80,48,0.3);
}
.stop-arrow { transition: transform 0.2s; }
.stop-btn:hover .stop-arrow { transform: translateX(3px); }

.reset-btn {
  font-family: 'Outfit', sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--sand-dark);
  border-radius: 20px;
  padding: 6px 14px;
  cursor: pointer;
  transition: var(--transition);
}
.reset-btn:hover {
  color: var(--terra);
  border-color: var(--terra);
}

/* ── Loading / Error screens ── */
.loading-screen {
  position: fixed;
  inset: 0;
  background: rgba(245,235,212,0.7);
  backdrop-filter: blur(6px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 200;
}
.loading-spinner {
  width: 44px;
  height: 44px;
  border: 3px solid var(--sand-mid);
  border-top-color: var(--terra);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text {
  font-family: 'Cormorant Garamond', serif;
  font-size: 18px;
  color: var(--text-mid);
  font-style: italic;
}

.error-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
}
.error-inner {
  text-align: center;
  padding: 48px 40px;
  background: var(--parchment);
  border-radius: var(--radius-card);
  box-shadow: 0 8px 40px var(--shadow-warm);
  max-width: 420px;
}
.error-msg {
  font-family: 'Outfit', sans-serif;
  font-size: 15px;
  color: var(--text-mid);
  margin: 16px 0 24px;
}
.retry-btn {
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  font-weight: 600;
  background: var(--terra);
  color: white;
  border: none;
  border-radius: var(--radius-btn);
  padding: 10px 28px;
  cursor: pointer;
  transition: var(--transition);
}
.retry-btn:hover { background: var(--terra-light); }

/* ═══════════════════════════════════
   COMPARISON ARENA
   ═══════════════════════════════════ */

.arena {
  display: grid;
  grid-template-columns: 1fr 130px 1fr;
  gap: 0 10px;
  align-items: start;
  padding: 24px 20px 40px;
  max-width: 1300px;
  margin: 0 auto;
}

/* ── Hotel card ── */
.hotel-card {
  background: var(--parchment);
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: 0 4px 28px var(--shadow-warm);
  border: 1px solid rgba(255,253,245,0.8);
  transition:
    transform 0.35s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.35s ease,
    opacity 0.35s ease,
    filter 0.35s ease;
}
.hotel-card.entering {
  animation: cardEnter 0.42s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.hotel-card.entering.delay { animation-delay: 0.07s; }
@keyframes cardEnter {
  from { opacity: 0; transform: translateY(22px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}
.hotel-card.winner {
  transform: scale(1.025) translateY(-4px);
  box-shadow: 0 8px 50px rgba(201,152,42,0.45), 0 0 0 2px var(--gold-light);
}
.hotel-card.loser {
  opacity: 0.35;
  filter: blur(1.5px) grayscale(20%);
  transform: scale(0.975);
}
.hotel-card.exiting {
  animation: cardExit 0.32s ease-in both;
}
@keyframes cardExit {
  to { opacity: 0; transform: translateY(16px) scale(0.97); }
}

/* ── Image viewer ── */
.image-viewer {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--sand-mid);
  cursor: default;
}
.main-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.22s ease;
  user-select: none;
}
.main-img.fade { opacity: 0; }

.no-img {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 16px;
  color: var(--text-muted);
}

/* Nav arrows */
.nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  background: rgba(255,253,245,0.85);
  backdrop-filter: blur(6px);
  border: none;
  border-radius: 50%;
  font-size: 22px;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  z-index: 5;
  opacity: 0;
  box-shadow: 0 2px 12px var(--shadow-warm);
  line-height: 1;
  font-family: sans-serif;
}
.image-viewer:hover .nav-btn { opacity: 1; }
.nav-btn:hover {
  background: var(--parchment);
  transform: translateY(-50%) scale(1.08);
}
.prev-btn { left: 10px; }
.next-btn { right: 10px; }

/* Dots */
.dots {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 5px;
  z-index: 5;
}
.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255,253,245,0.5);
  cursor: pointer;
  transition: var(--transition);
  border: none;
  padding: 0;
}
.dot.active {
  background: white;
  transform: scale(1.3);
}
.dot:hover { background: rgba(255,253,245,0.8); }

/* Win overlay */
.win-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(201,152,42,0.18),
    rgba(232,184,64,0.12)
  );
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  opacity: 0;
  pointer-events: none;
  z-index: 8;
  transition: opacity 0.18s;
}
.win-overlay.visible { opacity: 1; }
.win-check {
  font-size: 70px;
  line-height: 1;
  filter: drop-shadow(0 4px 16px rgba(201,152,42,0.6));
  transform: scale(0);
  color: white;
  text-shadow: 0 2px 12px rgba(150,80,20,0.5);
}
.win-overlay.visible .win-check {
  animation: popIn 0.35s cubic-bezier(0.17, 0.89, 0.32, 1.28) 0.05s both;
}
@keyframes popIn {
  from { transform: scale(0) rotate(-20deg); opacity: 0; }
  to   { transform: scale(1) rotate(0deg);  opacity: 1; }
}
.win-label {
  font-family: 'Cormorant Garamond', serif;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: white;
  text-transform: uppercase;
  text-shadow: 0 2px 8px rgba(100,50,10,0.5);
  transform: translateY(6px);
  opacity: 0;
}
.win-overlay.visible .win-label {
  animation: slideUp 0.3s ease 0.15s both;
}
@keyframes slideUp {
  from { transform: translateY(10px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ── Vote button ── */
.vote-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: calc(100% - 32px);
  margin: 14px 16px 16px;
  padding: 15px 20px;
  background: linear-gradient(135deg, var(--terra) 0%, var(--terra-light) 100%);
  color: white;
  border: none;
  border-radius: var(--radius-btn);
  font-family: 'Outfit', sans-serif;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 3px 16px rgba(192,80,48,0.25);
  position: relative;
  overflow: hidden;
}
.vote-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 50%, rgba(255,255,255,0.1));
  opacity: 0;
  transition: opacity 0.2s;
}
.vote-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 28px rgba(192,80,48,0.38);
}
.vote-btn:hover::before { opacity: 1; }
.vote-btn:active {
  transform: scale(0.97);
  box-shadow: 0 2px 10px rgba(192,80,48,0.2);
}
.vote-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.vote-icon {
  font-size: 18px;
  transition: transform 0.2s;
}
.vote-btn:hover .vote-icon { transform: rotate(20deg) scale(1.2); }
.vote-label { text-transform: uppercase; }

/* ── Middle column ── */
.middle-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding-top: 36px;
  position: sticky;
  top: 80px;
}
.vs-badge {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 32px;
  font-weight: 700;
  color: var(--terra);
  line-height: 1;
  margin-bottom: 6px;
  letter-spacing: -0.02em;
  text-shadow: 0 2px 8px rgba(192,80,48,0.2);
}
.cat-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}
.cat-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  width: 100%;
  padding: 10px 4px;
  background: var(--parchment);
  border: 1.5px solid var(--sand-mid);
  border-radius: 12px;
  cursor: pointer;
  transition: var(--transition);
  font-family: 'Outfit', sans-serif;
  color: var(--text-mid);
  box-shadow: 0 2px 8px var(--shadow-warm);
}
.cat-btn:hover {
  border-color: var(--terra);
  color: var(--terra);
  transform: scaleX(1.04);
  box-shadow: 0 4px 14px rgba(192,80,48,0.18);
}
.cat-btn.active {
  background: var(--terra);
  border-color: var(--terra);
  color: white;
  box-shadow: 0 4px 16px rgba(192,80,48,0.35);
  transform: scaleX(1.04);
}
.cat-icon { font-size: 20px; line-height: 1; }
.cat-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ── Particles ── */
.particles-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 300;
  overflow: hidden;
}
.particle {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  animation: particleFly 0.75s ease-out both;
}
@keyframes particleFly {
  0%   { transform: translate(0, 0) scale(1);   opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(0); opacity: 0; }
}
/* Star shaped particles */
.particle.star {
  border-radius: 0;
  clip-path: polygon(50% 0%,61% 35%,98% 35%,68% 57%,79% 91%,50% 70%,21% 91%,32% 57%,2% 35%,39% 35%);
}

/* ═══════════════════════════════════
   RANKING PAGE
   ═══════════════════════════════════ */

.ranking-page { background: var(--sand); }

.ranking-content {
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 24px 80px;
}
.ranking-header {
  text-align: center;
  margin-bottom: 44px;
}
.ranking-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 52px;
  font-weight: 700;
  color: var(--terra);
  line-height: 1;
  margin-bottom: 10px;
}
.ranking-subtitle {
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 400;
}

/* Podium — top 3 */
.podium-row {
  display: grid;
  grid-template-columns: 1fr 1.12fr 1fr;
  gap: 12px;
  margin-bottom: 32px;
  align-items: end;
}
.podium-card {
  background: var(--parchment);
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: 0 6px 32px var(--shadow-warm);
  border: 1px solid var(--sand-mid);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  animation: rankEnter 0.5s cubic-bezier(0.22,1,0.36,1) both;
}
.podium-card:nth-child(1) { animation-delay: 0.08s; }
.podium-card:nth-child(2) { animation-delay: 0s; }
.podium-card:nth-child(3) { animation-delay: 0.16s; }
@keyframes rankEnter {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: none; }
}
.podium-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 44px var(--shadow-strong);
}
.podium-card.rank-1 {
  border-color: var(--gold-light);
  box-shadow: 0 6px 32px rgba(201,152,42,0.25), 0 0 0 1px var(--gold-light);
}
.podium-thumb {
  width: 100%;
  aspect-ratio: 16/10;
  object-fit: cover;
  background: var(--sand-mid);
  display: block;
}
.podium-body {
  padding: 14px 16px 16px;
}
.podium-medal {
  font-size: 26px;
  line-height: 1;
  margin-bottom: 6px;
}
.podium-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  line-height: 1.2;
}
.podium-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.podium-elo {
  font-family: 'Outfit', sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--sand);
  padding: 2px 8px;
  border-radius: 10px;
}
.podium-price {
  font-family: 'Outfit', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--terra);
}

/* Rest of ranking list */
.ranking-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.rank-row {
  display: grid;
  grid-template-columns: 48px 64px 1fr auto auto;
  align-items: center;
  gap: 14px;
  background: var(--parchment);
  border-radius: 14px;
  padding: 12px 18px 12px 14px;
  border: 1px solid var(--sand-mid);
  box-shadow: 0 2px 12px var(--shadow-warm);
  transition: transform 0.2s, box-shadow 0.2s;
  animation: rankEnter 0.4s cubic-bezier(0.22,1,0.36,1) both;
}
.rank-row:hover {
  transform: translateX(4px);
  box-shadow: 0 4px 20px var(--shadow-warm);
}
.rank-num {
  font-family: 'Cormorant Garamond', serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--sand-dark);
  text-align: center;
  line-height: 1;
}
.rank-thumb {
  width: 64px;
  height: 44px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--sand-mid);
  display: block;
}
.rank-name {
  font-family: 'Cormorant Garamond', serif;
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
}
.rank-elo {
  font-family: 'Outfit', sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--sand);
  padding: 3px 10px;
  border-radius: 10px;
  white-space: nowrap;
}
.rank-price {
  font-family: 'Outfit', sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--terra);
  white-space: nowrap;
  min-width: 80px;
  text-align: right;
}

/* ── Reset modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26,13,6,0.45);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-box {
  background: var(--parchment);
  border-radius: 20px;
  padding: 36px 40px;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(26,13,6,0.3);
  border: 1px solid var(--sand-mid);
  animation: modalIn 0.25s cubic-bezier(0.22,1,0.36,1);
}
@keyframes modalIn {
  from { transform: scale(0.93) translateY(12px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}
.modal-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
}
.modal-text {
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  color: var(--text-mid);
  margin-bottom: 28px;
  line-height: 1.6;
}
.modal-btns {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}
.modal-cancel {
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  font-weight: 500;
  background: var(--sand);
  color: var(--text-mid);
  border: 1px solid var(--sand-mid);
  border-radius: var(--radius-btn);
  padding: 9px 22px;
  cursor: pointer;
  transition: var(--transition);
}
.modal-cancel:hover { background: var(--sand-mid); }
.modal-confirm {
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  font-weight: 600;
  background: var(--terra);
  color: white;
  border: none;
  border-radius: var(--radius-btn);
  padding: 9px 22px;
  cursor: pointer;
  transition: var(--transition);
}
.modal-confirm:hover {
  background: var(--terra-light);
  transform: translateY(-1px);
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .arena {
    grid-template-columns: 1fr 110px 1fr;
    gap: 0 8px;
    padding: 16px 12px 32px;
  }
  .vs-badge { font-size: 26px; }
  .cat-icon { font-size: 18px; }
  .vote-label { display: none; }
  .vote-btn { justify-content: center; }
}

@media (max-width: 640px) {
  .arena {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
  }
  .middle-col {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    padding: 0 0 8px;
    gap: 6px;
  }
  .cat-group {
    flex-direction: row;
    gap: 6px;
    width: auto;
  }
  .vs-badge { display: none; }
  .cat-btn { width: 60px; }

  .podium-row {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
  }
  .podium-card:nth-child(2) { order: -1; }

  .rank-row {
    grid-template-columns: 36px 1fr auto;
    grid-template-rows: auto auto;
  }
  .rank-thumb { display: none; }
  .rank-elo { grid-column: 2; }
}
