@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600&family=Crimson+Pro:ital,wght=0,300;0,400;1,300&display=swap');

:root {
  --ink:       #1a0f2e;
  --parchment: #f5ede0;
  --gold:      #c9a84c; 
  --rose:      #d4607a;
  --text-muted: #5a4a6a;
  --mist:      #e8dff5;
  --shadow:    rgba(26,15,46,0.18);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--parchment);
  color: var(--ink);
  font-family: 'Crimson Pro', Georgia, serif;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Pergament-Textur via noise */
body::before {
  content: '';
  position: fixed; inset: 0;
  background-image:
    url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  background-size: 200px 200px;
  pointer-events: none;
  z-index: 0;
  opacity: 0.6;
}

/* ── Header ── */
header {
  position: relative; z-index: 5;
  text-align: center;
  padding: 3rem 2rem 1.5rem;
  border-bottom: 1px solid rgba(201,168,76,0.3);
}

.title-ornament {
  font-size: 0.8rem;
  letter-spacing: 0.4em;
  color: var(--gold);
  text-transform: uppercase;
  margin-bottom: 0.6rem;
  font-family: 'Cinzel', serif;
}

h1 {
  font-family: 'Cinzel', serif;
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: 400;
  letter-spacing: 0.05em;
  line-height: 1.1;
}

h1 span { color: var(--rose); font-style: italic; }

.subtitle {
  margin-top: 0.6rem;
  font-size: 1.05rem;
  font-weight: 300;
  font-style: italic;
  color: var(--text-muted);
  opacity: 0.85;
}

/* ── Fortschrittsanzeige ── */
#progress-section {
  position: relative; z-index: 15;
  text-align: center;
  padding: 1rem 2rem 0.5rem;
}

#progress-text {
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  color: var(--gold);
  text-transform: uppercase;
}

.progress-bar-wrap {
  margin: 0.5rem auto;
  max-width: 320px;
  height: 3px;
  background: rgba(201,168,76,0.2);
  border-radius: 2px;
  overflow: hidden;
}

#progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--rose));
  width: 0%;
  transition: width 0.6s ease;
}

/* ── Haupt-Grid (Voting) ── */
#voting-section {
  position: relative; z-index: 15;
  padding: 2rem 1.5rem 1rem;
}

#instruction {
  text-align: center;
  font-size: 1.1rem;
  font-style: italic;
  color: var(--text-muted);
  margin-bottom: 1.8rem;
}

#instruction strong {
  font-style: normal;
  font-weight: 600;
  color: var(--rose);
}

#skin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
  max-width: 1000px;
  margin: 0 auto;
}

/* ── Einhorn-Karte ── */
.skin-card, .naming-card {
  position: relative;
  background: white;
  border: 1.5px solid rgba(201,168,76,0.35);
  border-radius: 4px;
  padding: 1rem 1rem 1.2rem;
  box-shadow: 0 2px 12px var(--shadow);
  user-select: none;
}

.skin-card {
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.skin-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px var(--shadow);
  border-color: rgba(201,168,76,0.7);
}

.skin-card.selected {
  border-color: var(--rose);
  background: #fff8fa;
  box-shadow: 0 0 0 3px rgba(212,96,122,0.15), 0 6px 20px var(--shadow);
}

.skin-card.selected::after {
  content: '💖';
  position: absolute;
  top: 0.6rem; right: 0.8rem;
  font-size: 1.1rem;
  color: var(--rose);
  animation: pop 0.2s ease;
}

@keyframes pop {
  from { transform: scale(0.5); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

.skin-card.eliminated {
  opacity: 0.25;
  pointer-events: none;
  transform: scale(0.96);
}

/* Three.js Canvas */
.canvas-wrap {
  width: 100%;
  aspect-ratio: 1;
  background: linear-gradient(160deg, #f0eaf8 0%, #e8dff0 100%);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}

.canvas-wrap canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.card-label {
  margin-top: 0.7rem;
  text-align: center;
  font-family: 'Cinzel', serif;
  font-size: 0.72rem;
  letter-spacing: 0.15em;
  color: var(--gold);
  text-transform: uppercase;
}

/* ── Naming Section (Einzelkarten-Stapel) ── */
#naming-section {
  display: none; /* Erst versteckt */
  position: relative; z-index: 15;
  padding: 1rem 1.5rem 0rem;
}

#naming-card-container {
  display: flex;
  justify-content: center;
  max-width: 420px;
  margin: 0 auto;
  animation: fadeInCard 0.5s ease forwards;
}

@keyframes fadeInCard {
  from { opacity: 0; transform: translateY(15px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.naming-card {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.naming-columns {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin-top: 0.5rem;
}

.naming-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.naming-column h4 {
  font-family: 'Cinzel', serif;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  color: var(--gold);
  text-transform: uppercase;
  margin-bottom: 0.3rem;
  border-bottom: 1px solid rgba(201,168,76,0.2);
  padding-bottom: 0.2rem;
  text-align: center;
}

.btn-container {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.custom-name-input {
  background: #fffcf7;
  border: 1px dashed rgba(201,168,76,0.6);
  border-radius: 4px;
  padding: 0.5rem 0.6rem;
  font-family: 'Crimson Pro', serif;
  font-size: 0.95rem;
  color: var(--ink);
  width: 100%;
  text-align: center;
  transition: all 0.2s ease;
  margin-top: 0.2rem;
}

.custom-name-input:focus {
  outline: none;
  border-color: var(--rose);
  border-style: solid;
  background: #fff;
  box-shadow: 0 0 0 2px rgba(212,96,122,0.1);
}

.custom-name-input::placeholder {
  color: #b0a4c0;
  font-style: italic;
}

.plaque-preview {
  background: #fffcf7;
  border: 1.5px dashed var(--gold);
  border-radius: 4px;
  padding: 0.8rem;
  margin: 0.5rem 0;
  font-family: 'Cinzel', serif;
  font-size: 1.1rem;
  color: var(--rose);
  text-align: center;
  font-weight: 600;
  box-shadow: inset 0 2px 6px rgba(0,0,0,0.02);
  transition: all 0.2s ease;
}

.plaque-container {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.2rem;
}

.plaque-btn {
  background: #faf6f0;
  border: 1px solid rgba(201,168,76,0.4);
  border-radius: 4px;
  padding: 0.5rem 0.6rem;
  font-family: 'Crimson Pro', serif;
  font-size: 0.95rem;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  width: 100%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}

.plaque-btn:hover {
  border-color: var(--gold);
  transform: translateY(-1px);
  box-shadow: 0 2px 5px rgba(0,0,0,0.08);
}

.plaque-btn.selected {
  background: linear-gradient(135deg, var(--rose), #e87b92);
  color: white;
  border-color: var(--rose);
  box-shadow: 0 3px 10px rgba(212,96,122,0.3);
  font-weight: 600;
}

.refresh-names-btn {
  background: transparent;
  border: none;
  color: #8a7a9a;
  font-family: 'Crimson Pro', serif;
  font-size: 0.95rem;
  font-style: italic;
  cursor: pointer;
  margin-top: 0.4rem;
  padding: 0.4rem;
  transition: color 0.2s ease;
  text-align: center;
  width: 100%;
}
 
.refresh-names-btn:hover {
  color: var(--rose);
}

/* ── Allgemeine Buttons ── */
.action-btn {
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--parchment);
  background: var(--ink);
  border: none;
  padding: 0.9rem 3rem;
  cursor: pointer;
  border-radius: 2px;
  transition: background 0.2s, transform 0.15s;
  display: inline-block;
}

.action-btn:hover:not(:disabled) {
  background: var(--rose);
  transform: translateY(-1px);
}

.action-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

#vote-wrap, #naming-wrap {
  position: relative; z-index: 15;
  text-align: center;
  padding: 1.5rem 2rem 3rem;
}

#naming-wrap {
  display: none;
  padding-top: 1.5rem;
}

#naming-counter {
  font-family: 'Cinzel', serif;
  color: var(--gold);
  font-size: 0.8rem;
  margin-bottom: 1rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

#vote-hint, #naming-hint {
  margin-top: 0.8rem;
  font-size: 0.9rem;
  font-style: italic;
  color: #8a7a9a;
  min-height: 1.4em;
}

/* ── Done-Screen & Parade ── */
#done-screen {
  display: none;
  position: relative; 
  z-index: 15;
  text-align: center;
  padding: 10vh 2rem 0;
}

#done-screen h2 {
  font-family: 'Cinzel', serif;
  font-size: 3rem;
  font-weight: 400;
  margin-bottom: 1rem;
  color: var(--ink);
}

.thank-you-msg {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--rose);
  margin-bottom: 0.8rem;
}

.topmodel-note {
  font-size: 1.15rem;
  font-style: italic;
  color: var(--text-muted);
  max-width: 650px;
  margin: 0 auto;
  line-height: 1.6;
}

.consolation-note {
  font-size: 1.05rem;
  font-style: italic;
  color: #8a7a9a;
  max-width: 600px;
  margin: 1.5rem auto 0;
  line-height: 1.6;
  border-top: 1px dashed rgba(201, 168, 76, 0.25);
  padding-top: 1.2rem;
}

/* Der 3D Laufsteg für die Einhörner */
#parade-container {
  position: absolute;
  top: 0; 
  left: 0;
  width: 100%;
  height: 250px; 
  z-index: 8; 
  pointer-events: none; 
  display: none; 
}

.ornament {
  font-size: 2.5rem;
  color: var(--rose);
  margin-bottom: 1rem;
  display: block;
  animation: bounce 2s infinite;
}
 
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* ── Loading overlay ── */
#loading {
  position: fixed; inset: 0;
  background: var(--parchment);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1rem;
  z-index: 100;
  transition: opacity 0.5s ease;
}

#loading.hidden {
  opacity: 0;
  pointer-events: none;
}

.spinner {
  width: 36px; height: 36px;
  border: 2px solid rgba(201,168,76,0.3);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

#loading p {
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  color: var(--gold);
  text-transform: uppercase;
}