/* =========================================================
   ArtDuel — Minimalistický muzejní styl
   Mobile-first, žádné externí závislosti
   ========================================================= */

:root {
  --color-bg:        #fafaf8;
  --color-surface:   #ffffff;
  --color-text:      #1a1a1a;
  --color-muted:     #6b6b6b;
  --color-accent:    #2c2c2c;
  --color-border:    #e0e0de;
  --color-overlay:   rgba(255, 255, 255, 0.92);
  --color-winner:    #1a472a;
  --color-loser:     #999;

  --font-serif:      Georgia, 'Times New Roman', 'Palatino Linotype', serif;
  --font-sans:       'Helvetica Neue', Arial, sans-serif;

  --shadow-card:     0 2px 12px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.04);
  --shadow-hover:    0 8px 32px rgba(0,0,0,0.14), 0 2px 8px rgba(0,0,0,0.06);

  --transition:      0.25s ease;
  --radius:          4px;
}

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

html { height: 100%; scroll-behavior: smooth; }

body {
  min-height: 100%;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }
button { cursor: pointer; font: inherit; border: none; background: none; }

/* ---- Views ---- */
.view { display: none; }
.view.active { display: flex; flex-direction: column; }

/* =========================================================
   ÚVODNÍ OBRAZOVKA
   ========================================================= */
#view-intro {
  min-height: 100dvh;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  animation: fadeIn 0.6s ease both;
}

.intro-content {
  max-width: 480px;
  text-align: center;
}

.logo {
  font-family: var(--font-serif);
  font-size: clamp(2.5rem, 8vw, 4rem);
  font-weight: normal;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.tagline {
  font-family: var(--font-serif);
  font-size: clamp(1rem, 3vw, 1.25rem);
  color: var(--color-muted);
  font-style: italic;
  margin-bottom: 1.5rem;
}

.description {
  font-size: 0.95rem;
  color: var(--color-muted);
  line-height: 1.65;
  margin-bottom: 2.5rem;
}

.btn-primary {
  display: inline-block;
  padding: 0.85rem 2.5rem;
  background: var(--color-accent);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: var(--radius);
  transition: background var(--transition), transform var(--transition);
}
.btn-primary:hover { background: #000; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-primary.small { padding: 0.55rem 1.4rem; font-size: 0.85rem; }

.credit {
  margin-top: 2.5rem;
  font-size: 0.75rem;
  color: var(--color-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* =========================================================
   HLASOVACÍ OBRAZOVKA
   ========================================================= */
#view-vote {
  min-height: 100dvh;
}

.vote-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
  position: sticky;
  top: 0;
  z-index: 10;
}

.app-name {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  letter-spacing: -0.01em;
}

.round-counter {
  font-size: 0.8rem;
  color: var(--color-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-left: auto;
}

.btn-link {
  font-size: 0.8rem;
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  letter-spacing: 0.02em;
  transition: opacity var(--transition);
}
.btn-link:hover { opacity: 0.6; }
.btn-link.hidden { visibility: hidden; pointer-events: none; }

/* Arena */
.vote-arena {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0;
  align-items: stretch;
  min-height: 0;
}

/* Versus divider */
.versus {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  font-family: var(--font-serif);
  font-size: 0.8rem;
  color: var(--color-border);
  letter-spacing: 0.1em;
  pointer-events: none;
  user-select: none;
}

/* Painting card */
.painting-card {
  display: flex;
  flex-direction: column;
  cursor: pointer;
  outline: none;
  background: var(--color-surface);
  transition: background var(--transition);
  position: relative;
  overflow: hidden;
}

.painting-card:focus-visible {
  box-shadow: inset 0 0 0 3px var(--color-accent);
}

.painting-img-wrap {
  flex: 1;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0ede8;
  min-height: 50vw;
}

.painting-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.4s ease, opacity 0.4s ease;
}

/* Hover overlay */
.painting-overlay {
  position: absolute;
  inset: 0;
  background: var(--color-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition);
}
.painting-overlay span {
  font-family: var(--font-serif);
  font-size: clamp(0.9rem, 2.5vw, 1.2rem);
  font-style: italic;
  color: var(--color-accent);
  letter-spacing: 0.02em;
  border-bottom: 1px solid currentColor;
  padding-bottom: 2px;
}

.painting-card:hover .painting-overlay,
.painting-card:focus-visible .painting-overlay {
  opacity: 1;
}

/* Vote animation states */
.painting-card.winner .painting-img { transform: scale(1.02); }
.painting-card.winner .painting-overlay { opacity: 0 !important; }
.painting-card.loser .painting-img { opacity: 0.25; }
.painting-card.loser .painting-overlay { opacity: 0 !important; }

/* Painting info */
.painting-info {
  padding: 0.85rem 1rem;
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
  min-height: 4rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.painting-title {
  font-family: var(--font-serif);
  font-size: clamp(0.8rem, 1.8vw, 1rem);
  line-height: 1.35;
  color: var(--color-text);
}

.painting-meta {
  font-size: clamp(0.7rem, 1.4vw, 0.82rem);
  color: var(--color-muted);
  letter-spacing: 0.01em;
}

/* Fade transition between pairs */
.vote-arena.fading .painting-card {
  opacity: 0;
  transition: opacity 0.3s ease;
}
.vote-arena.fade-in .painting-card {
  opacity: 1;
  transition: opacity 0.35s ease 0.05s;
}

/* =========================================================
   ŽEBŘÍČEK
   ========================================================= */
#view-scores {
  min-height: 100dvh;
}

.scores-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
  position: sticky;
  top: 0;
  z-index: 10;
}

.scores-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem 4rem;
  width: 100%;
}

.scores-title {
  font-family: var(--font-serif);
  font-size: clamp(1.4rem, 4vw, 2rem);
  font-weight: normal;
  margin-bottom: 0.5rem;
}

.scores-note {
  font-size: 0.85rem;
  color: var(--color-muted);
  margin-bottom: 2rem;
}

.scores-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.5rem;
}

.score-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  animation: slideUp 0.4s ease both;
  animation-delay: calc(var(--i, 0) * 40ms);
}

.score-rank {
  font-family: var(--font-serif);
  font-size: 0.7rem;
  color: var(--color-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.6rem 0.75rem 0;
}

.score-img-wrap {
  aspect-ratio: 4/3;
  overflow: hidden;
  background: #f0ede8;
}

.score-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.score-card:hover .score-img { transform: scale(1.03); }

.score-info {
  padding: 0.6rem 0.75rem 0.75rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.score-title {
  font-family: var(--font-serif);
  font-size: 0.88rem;
  line-height: 1.35;
  color: var(--color-text);
}

.score-artist {
  font-size: 0.75rem;
  color: var(--color-muted);
}

.score-stats {
  margin-top: auto;
  padding-top: 0.6rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.score-pct {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: bold;
  color: var(--color-text);
}

.score-votes {
  font-size: 0.7rem;
  color: var(--color-muted);
}

/* =========================================================
   Animace
   ========================================================= */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* =========================================================
   Mobilní layout (portrait)
   ========================================================= */
@media (max-width: 640px) {
  .vote-arena {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto 1fr;
  }
  .versus {
    width: auto;
    height: 2rem;
    border-top: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
  }
  .painting-img-wrap {
    min-height: 42vw;
  }
  .scores-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
  }
}

@media (min-width: 641px) {
  .painting-img-wrap {
    min-height: 55vh;
  }
}
