/* game.css — Memory-Spiel, Vanilla JS, Pfau-Theme */

html, body {
  margin: 0; padding: 0;
  height: 100%;
  overflow: hidden;
  background: #0A0402;
  font-family: 'Inter', system-ui, sans-serif;
}

/* ── Zurück-Leiste ──────────────────────────────────────── */
.back-bar {
  position: fixed;
  top: 0; left: 0; right: 0; z-index: 200;
  height: 44px;
  background: rgba(10,4,2,.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(62,30,18,.6);
  padding: 0 20px;
  display: flex; align-items: center; justify-content: space-between;
}
.back-link {
  font-size: 11px; font-weight: 500;
  letter-spacing: .1em; text-transform: uppercase;
  color: #EB772D; text-decoration: none;
  display: inline-flex; align-items: center; gap: 4px;
}
.back-link:hover { opacity: .7; }
.back-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 13px; font-weight: 600; color: #C4988A;
}
.back-spacer { width: 60px; }

/* ── Spielbereich ───────────────────────────────────────── */
.game-wrap {
  position: fixed;
  top: 44px; left: 0; right: 0; bottom: 0;
  display: flex; align-items: stretch; justify-content: center;
  overflow: hidden;
}
.game-container {
  width: 100%; max-width: 430px;
  overflow: hidden; background: #1E0C06;
  position: relative;
}
@media (min-width: 480px) {
  .game-wrap { align-items: center; padding: 20px 0; overflow: auto; }
  .game-container {
    height: min(860px, calc(100vh - 44px - 40px));
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,.65);
  }
}

/* ── Screens ────────────────────────────────────────────── */
.screen { display: flex; flex-direction: column; height: 100%; }
.hidden { display: none !important; }

/* ── Start-Screen ───────────────────────────────────────── */
.start-hero {
  height: 44%; position: relative; overflow: hidden; flex-shrink: 0;
}
.start-hero img {
  width: 100%; height: 100%; object-fit: cover; object-position: center;
}
.start-hero-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(30,12,6,.2) 0%, rgba(30,12,6,.55) 60%, #1E0C06 100%);
}
.start-hero-text {
  position: absolute; left: 0; right: 0; bottom: 22px; padding: 0 26px;
}
.start-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 700; font-size: 34px; line-height: 1;
  letter-spacing: -.02em; color: #F0E0D5; margin-top: 8px;
}
.start-sub {
  font-family: 'Playfair Display', Georgia, serif;
  font-style: italic; font-size: 13px; color: #C4988A; margin-top: 6px;
}
.start-body { padding: 22px 22px 0; flex: 1; overflow-y: auto; }

/* ── Typo ───────────────────────────────────────────────── */
.eyebrow {
  font-size: 10px; font-weight: 500;
  letter-spacing: .2em; text-transform: uppercase;
  color: #EB772D; text-align: center;
}

/* ── Level-Buttons ──────────────────────────────────────── */
.level-btns {
  display: flex; gap: 8px; margin: 14px 0 8px; flex-wrap: wrap;
}
.ghost-btn {
  flex: 1; min-width: 0;
  appearance: none; cursor: pointer;
  background: transparent; color: #C4988A;
  padding: 10px 8px; border-radius: 50px;
  border: 1.5px solid #3E1E12;
  font-family: inherit; font-weight: 600; font-size: 12px;
  letter-spacing: .04em;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  transition: all .22s ease;
}
.ghost-btn span { font-size: 10px; font-weight: 400; opacity: .7; }
.ghost-btn.active {
  background: #EB772D; color: #fff; border-color: #EB772D;
}
.ghost-btn.active span { opacity: .85; }

/* ── Primary-Button ─────────────────────────────────────── */
.primary-btn {
  display: block; width: 100%;
  appearance: none; cursor: pointer;
  background: #EB772D; color: #fff;
  padding: 14px 28px; border-radius: 50px; border: none;
  font-family: inherit; font-weight: 600; font-size: 13px;
  letter-spacing: .04em; margin-top: 18px;
  transition: background .22s, transform .15s;
}
.primary-btn:hover { background: #EB982D; transform: translateY(-1px); }

/* ── Nav-Liste ──────────────────────────────────────────── */
.nav-list {
  margin-top: 18px;
  background: #2C1208; border-radius: 12px;
  border: 1px solid #3E1E12; overflow: hidden;
}
.nav-row {
  appearance: none; border: none; cursor: pointer;
  background: transparent; text-align: left;
  width: 100%; padding: 13px 16px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid #3E1E12;
  color: inherit;
}
.nav-row:last-child { border-bottom: none; }
.nav-row strong {
  display: block;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 14px; color: #F0E0D5; font-weight: 600;
}
.nav-row span:not(.nav-arrow) {
  font-size: 11px; color: #8A5E52; margin-top: 2px; display: block;
}
.nav-arrow { color: #EB772D; font-size: 16px; }

/* ── App-Header ─────────────────────────────────────────── */
.app-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 18px 10px;
  border-bottom: 1px solid #3E1E12;
  background: #1E0C06; flex-shrink: 0;
}
.header-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 15px; font-weight: 600; color: #F0E0D5;
}
.back-btn, .reset-btn {
  appearance: none; border: none; background: transparent;
  color: #EB772D; cursor: pointer;
  font-family: inherit; font-size: 11px; font-weight: 500;
  letter-spacing: .06em; text-transform: uppercase; padding: 0;
}

/* ── Stats ──────────────────────────────────────────────── */
.stats-bar {
  display: flex; justify-content: space-around;
  padding: 12px 18px;
  background: #2C1208; border-bottom: 1px solid #3E1E12;
  flex-shrink: 0;
}
.stat { text-align: center; }
.stat-label {
  display: block; font-size: 9px; font-weight: 500;
  letter-spacing: .2em; text-transform: uppercase; color: #8A5E52; margin-bottom: 3px;
}
.stat-val {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 17px; font-weight: 600; color: #F0E0D5;
  font-variant-numeric: tabular-nums;
}
.progress-bar {
  height: 2px; background: #3E1E12; position: relative; flex-shrink: 0;
}
.progress-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: #EB772D; width: 0%; transition: width .4s ease;
}

/* ── Scores-Tabs (eigener Abstand) ──────────────────────── */
.scores-tabs { margin: 18px 24px 0; }

/* ── Win-Home-Button ────────────────────────────────────── */
.win-home-btn { width: 100%; margin-top: 10px; }

/* ── Karten-Grid ────────────────────────────────────────── */
.card-grid {
  flex: 1; padding: 14px 16px;
  display: grid; gap: 8px;
  align-content: center; justify-content: center;
  overflow: hidden;
}
.card {
  perspective: 600px; cursor: pointer;
}
.card-inner {
  width: 100%; height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform .45s ease;
}
.card.flipped .card-inner,
.card.matched .card-inner { transform: rotateY(180deg); }

.card-back, .card-front {
  position: absolute; inset: 0;
  border-radius: 5px; overflow: hidden;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
.card-back {
  background: linear-gradient(160deg, #2C1208 0%, #1E0C06 60%, #120804 100%);
  border: 1px solid #3E1E12;
  box-shadow: 0 3px 10px rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center;
}
.card-mark {
  width: 36%; height: 36%;
  border: 1.5px solid rgba(235,119,45,.5);
}
.card-front {
  transform: rotateY(180deg);
  background: #2C1208;
  border: 1px solid #3E1E12;
  box-shadow: 0 3px 10px rgba(0,0,0,.35);
}
.card-front img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card.matched .card-front {
  box-shadow: 0 0 0 1.5px #EB772D, 0 4px 16px rgba(235,119,45,.25);
  opacity: .88;
}

/* ── Letztes Paar ───────────────────────────────────────── */
.last-match {
  height: 50px; flex-shrink: 0;
  padding: 6px 20px; text-align: center;
  border-top: 1px solid #3E1E12;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 13px; color: #F0E0D5;
  overflow: hidden;
  opacity: 0; transition: opacity .35s ease;
}
.last-match.visible { opacity: 1; }
.last-match .lm-label {
  display: block; font-family: 'Inter', sans-serif;
  font-size: 9px; font-weight: 500; letter-spacing: .2em;
  text-transform: uppercase; color: #EB772D; margin-bottom: 2px;
}
.last-match em { font-size: 11px; color: #8A5E52; font-style: italic; margin-left: 4px; }

/* ── Galerie ────────────────────────────────────────────── */
.scroll-area { flex: 1; overflow-y: auto; padding-bottom: 24px; }
.gallery-eyebrow { padding: 18px 24px 8px; text-align: center; }
.art-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px; padding: 8px 16px 16px;
}
.art-card {
  appearance: none; border: 1px solid #3E1E12; padding: 0;
  cursor: pointer; background: #2C1208;
  border-radius: 8px; overflow: hidden; text-align: left;
}
.art-card img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.art-card-info {
  padding: 7px 10px 9px;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 11px; color: #F0E0D5;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.art-card-info em { display: block; font-size: 10px; color: #8A5E52; margin-top: 2px; }

/* ── Lightbox ───────────────────────────────────────────── */
.lightbox {
  position: absolute; inset: 0; z-index: 50;
  background: rgba(10,4,2,.93);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 24px; gap: 16px;
  animation: fadeIn .2s ease;
}
.lightbox img {
  max-width: 100%; max-height: 65%;
  object-fit: contain; border-radius: 6px;
  box-shadow: 0 12px 40px rgba(0,0,0,.55);
}
.lightbox-caption {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 15px; color: #F0E0D5; text-align: center;
}
.lightbox-caption em { font-size: 11px; color: #C4988A; margin-left: 6px; }
.lightbox-hint {
  font-size: 10px; letter-spacing: .18em; text-transform: uppercase;
  color: #8A5E52;
}

/* ── Scores ─────────────────────────────────────────────── */
.scores-list { padding: 16px 24px; }
.score-row {
  display: grid; grid-template-columns: 26px 1fr auto auto;
  gap: 12px; align-items: center;
  padding: 13px 0; border-bottom: 1px solid #3E1E12;
}
.score-rank {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 17px; font-style: italic; color: #8A5E52; text-align: center;
}
.score-rank.gold { color: #EB772D; font-style: normal; }
.score-name strong { display: block; font-size: 13px; color: #F0E0D5; }
.score-name small { font-size: 9px; letter-spacing: .12em; text-transform: uppercase; color: #8A5E52; }
.score-time {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 13px; color: #F0E0D5; font-variant-numeric: tabular-nums;
}
.score-moves { font-size: 11px; color: #8A5E52; }
.no-scores {
  text-align: center; padding: 40px 0;
  font-family: 'Playfair Display', Georgia, serif;
  font-style: italic; color: #8A5E52; font-size: 13px;
}

/* ── Win-Overlay ────────────────────────────────────────── */
.win-overlay {
  position: absolute; inset: 0; z-index: 100;
  background: rgba(10,4,2,.80);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn .3s ease;
}
.win-card {
  background: #2C1208; border-radius: 16px;
  padding: 30px 26px; margin: 24px;
  border: 1px solid #3E1E12;
  text-align: center; max-width: 320px; width: 100%;
  box-shadow: 0 16px 50px rgba(0,0,0,.5);
}
.win-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 700; font-size: 30px; color: #F0E0D5;
  margin-top: 12px; letter-spacing: -.02em;
}
.win-sub {
  font-family: 'Playfair Display', Georgia, serif;
  font-style: italic; font-size: 12px; color: #C4988A;
  margin-top: 8px; line-height: 1.55;
}
.win-stats {
  display: flex; justify-content: space-around;
  margin: 20px 0 6px; padding: 14px 0;
  border-top: 1px solid #3E1E12; border-bottom: 1px solid #3E1E12;
}

@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
