:root {
  --bg: #f2e9d8;
  --paper: #faf3e6;
  --ink: #2b1f16;
  --ink-72: rgba(43, 31, 22, .72);
  --ink-50: rgba(43, 31, 22, .5);
  --ink-45: rgba(43, 31, 22, .45);
  --ink-38: rgba(43, 31, 22, .38);
  --ink-35: rgba(43, 31, 22, .35);
  --ink-25: rgba(43, 31, 22, .25);
  --ink-16: rgba(43, 31, 22, .16);
  --ink-13: rgba(43, 31, 22, .13);
  --ink-07: rgba(43, 31, 22, .07);
  --accent: oklch(0.55 0.12 50);
  --accent-hover: oklch(0.48 0.12 50);
  --accent-light: oklch(0.72 0.12 50);
  --link: oklch(0.5 0.12 50);
  --link-hover: oklch(0.42 0.12 50);
  --olive: oklch(0.55 0.12 110);
  --olive-dark: oklch(0.45 0.1 110);
  --olive-bg: oklch(0.97 0.02 110);
  --error: oklch(0.5 0.16 30);
  --dark: #241a11;
  --dark-text: #f4ead7;
  --dark-text-muted: rgba(244, 234, 215, .75);
  --dark-border: rgba(246, 237, 221, .25);
  --cream: #f6eddd;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; background: var(--bg); }

body {
  font-family: Karla, Helvetica, sans-serif;
  color: var(--ink);
  min-height: 100vh;
}

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); }

input::placeholder { color: var(--ink-38); }

button { font-family: inherit; }

@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }

.mono { font-family: 'Courier Prime', monospace; }

.label {
  font-family: 'Courier Prime', monospace;
  letter-spacing: 2px;
  color: var(--ink-50);
}

.vinyl {
  border-radius: 50%;
  position: relative;
  flex-shrink: 0;
  background:
    repeating-radial-gradient(circle at 50% 50%, rgba(246, 237, 221, .06) 0px, rgba(246, 237, 221, .06) 1px, transparent 1px, transparent 4px),
    radial-gradient(circle at 50% 50%, var(--accent) 0% 30%, #17100a 31% 100%);
  animation: spin 2.6s linear infinite;
  animation-play-state: paused;
}
.vinyl.playing { animation-play-state: running; }
.vinyl .vinyl-num {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Courier Prime', monospace;
  font-weight: 700;
  color: var(--cream);
}

.btn-primary {
  font-family: Karla, sans-serif;
  font-weight: 700;
  background: var(--ink);
  color: var(--cream);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s;
}
.btn-primary:hover { background: #3d2c1e; }

.btn-accent {
  font-family: Karla, sans-serif;
  font-weight: 700;
  background: var(--accent);
  color: #fdf7ea;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background .15s;
}
.btn-accent:hover { background: var(--accent-hover); }

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid rgba(43, 31, 22, .3);
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s;
}
.btn-ghost:hover { background: var(--ink-07); }

.btn-outline-pill {
  font-family: Karla, sans-serif;
  font-weight: 700;
  font-size: 14px;
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--ink-25);
  border-radius: 999px;
  padding: 10px 22px;
  cursor: pointer;
  transition: background .15s;
  margin-top: 4px;
}
.btn-outline-pill:hover { background: var(--ink-07); }

.reset-link {
  cursor: pointer;
  text-decoration: underline;
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
}

/* ---------- Intro ---------- */
.screen-intro {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 24px;
  gap: 22px;
  animation: fadeUp .7s ease both;
}
.screen-intro .eyebrow {
  font-family: 'Courier Prime', monospace;
  font-size: 13px;
  letter-spacing: 3px;
  color: var(--accent);
}
.screen-intro .vinyl-hero {
  width: 170px;
  height: 170px;
  animation-duration: 9s;
  animation-play-state: running;
  box-shadow: 0 10px 30px rgba(43, 31, 22, .25);
}
.screen-intro .vinyl-hero .vinyl-num { font-size: 26px; }
.screen-intro h1 {
  font-family: 'Young Serif', serif;
  font-weight: 400;
  font-size: clamp(36px, 7vw, 58px);
  line-height: 1.08;
  margin: 0;
  max-width: 640px;
  text-wrap: balance;
}
.screen-intro p {
  font-size: 17px;
  line-height: 1.65;
  max-width: 480px;
  margin: 0;
  color: var(--ink-72);
  text-wrap: pretty;
}
.screen-intro .cta {
  font-size: 17px;
  padding: 14px 32px;
  margin-top: 6px;
}
.screen-intro footer {
  font-family: 'Courier Prime', monospace;
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--ink-45);
  margin-top: 14px;
}

/* ---------- Jeu ---------- */
.screen-game { max-width: 1000px; margin: 0 auto; padding: 26px 20px 56px; }
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--ink-16);
  padding-bottom: 14px;
}
.game-header .who {
  font-family: 'Courier Prime', monospace;
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--accent);
}
.game-header .track {
  font-family: 'Courier Prime', monospace;
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--ink-50);
}
.game-header .header-right {
  display: flex;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
}
.game-header .header-reset {
  font-family: 'Courier Prime', monospace;
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--ink-45);
}

.music-toggle-btn {
  font-family: 'Courier Prime', monospace;
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--ink-45);
  background: none;
  border: 1px solid var(--ink-16);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
}
.music-toggle-btn:hover { color: var(--ink); border-color: var(--ink-25); }

.game-row { display: flex; flex-wrap: wrap; gap: 22px; margin-top: 26px; align-items: stretch; }

.card-paper {
  background: var(--paper);
  border: 1px solid var(--ink-16);
  border-radius: 16px;
  box-shadow: 0 2px 0 rgba(43, 31, 22, .07);
}

.player-card {
  flex: 1 1 300px;
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.player-card .label { font-size: 11px; }
.vinyl-player {
  width: 210px;
  height: 210px;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(43, 31, 22, .28);
}
.vinyl-player .vinyl-num { font-size: 24px; }
.player-controls { display: flex; gap: 10px; align-items: center; }
.player-controls .btn-primary { font-size: 15px; padding: 11px 24px; }
.replay-btn {
  font-size: 17px;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.progress-track {
  width: 100%;
  height: 5px;
  border-radius: 99px;
  background: var(--ink-13);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--accent);
  width: 0%;
  transition: width .2s linear;
}
.status-line {
  font-family: 'Courier Prime', monospace;
  font-size: 11px;
  color: var(--ink-50);
  min-height: 14px;
  text-align: center;
}

.guess-card { flex: 1 1 340px; padding: 26px 24px; display: flex; flex-direction: column; }
.guess-card .label { font-size: 11px; }
.guess-form { display: flex; gap: 10px; margin-top: 16px; }
.guess-form input {
  flex: 1;
  min-width: 0;
  font-family: Karla, sans-serif;
  font-size: 17px;
  padding: 12px 14px;
  border: 1px solid var(--ink-25);
  border-radius: 10px;
  background: #fffdf7;
  color: var(--ink);
  outline: none;
}
.guess-form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px oklch(0.55 0.12 50 / .15);
}
.guess-form button {
  font-family: Karla, sans-serif;
  font-weight: 700;
  font-size: 15px;
  padding: 0 20px;
}
.guess-form-dual {
  flex-direction: column;
  align-items: stretch;
}
.guess-form-dual button {
  padding: 12px 20px;
}
.input-locked {
  font-family: Karla, sans-serif;
  font-size: 17px;
  padding: 12px 14px;
  border: 1px solid var(--olive);
  border-radius: 10px;
  background: var(--olive-bg);
  color: var(--olive-dark);
  display: flex;
  align-items: center;
  gap: 8px;
}
.locked-check {
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}
.joker-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--ink-16);
}
.joker-label {
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--ink-50);
  flex-shrink: 0;
}
.joker-icons { display: flex; gap: 6px; }
.joker-icon {
  height: 48px;
  width: auto;
  padding: 0;
  border: none;
  background: transparent;
  border-radius: 0;
  cursor: pointer;
  overflow: visible;
  transition: transform .1s, filter .1s;
}
.joker-icon:hover:not(:disabled) { transform: scale(1.12); filter: brightness(1.15); }
.joker-icon img.joker-face {
  height: 100%;
  width: auto;
  display: block;
}
.joker-icon.joker-used { opacity: 0.18; cursor: default; }

.feedback-line { min-height: 24px; margin-top: 12px; font-size: 15px; }
.attempts-line {
  font-family: 'Courier Prime', monospace;
  font-size: 12px;
  color: var(--ink-50);
  min-height: 16px;
}
.hint-box {
  margin-top: 12px;
  border: 1px dashed var(--olive);
  border-radius: 10px;
  padding: 12px 14px;
  background: var(--olive-bg);
}
.hint-box .label { font-size: 11px; color: var(--olive-dark); letter-spacing: 2px; }
.hint-box .hint-text { font-size: 15px; margin-top: 4px; }

.reveal-card {
  flex: 1 1 340px;
  background: var(--dark);
  color: var(--dark-text);
  border-radius: 16px;
  padding: 26px 24px;
  animation: fadeUp .5s ease both;
  box-shadow: 0 10px 26px rgba(43, 31, 22, .25);
  display: flex;
  flex-direction: column;
}
.reveal-card .found-label {
  font-family: 'Courier Prime', monospace;
  font-size: 11px;
  letter-spacing: 3px;
  color: var(--accent-light);
}
.reveal-head { display: flex; gap: 16px; align-items: center; margin-top: 14px; }
.reveal-artwork {
  width: 84px;
  height: 84px;
  border-radius: 8px;
  border: 1px solid var(--dark-border);
  flex-shrink: 0;
  background-color: #3a2c1e;
  background-size: cover;
  background-position: center;
}
.reveal-info { min-width: 0; }
.reveal-info .artist { font-family: 'Young Serif', serif; font-size: 26px; line-height: 1.15; }
.reveal-info .title { font-style: italic; font-size: 15px; opacity: .75; margin-top: 4px; }
.photo-slot {
  margin-top: 16px;
  width: 100%;
  height: 170px;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
}
.photo-slot img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
.photo-slot img:focus-visible { outline: 2px solid var(--accent-light); outline-offset: -2px; }
.photo-slot .placeholder {
  width: 100%;
  height: 100%;
  border: 1px dashed var(--dark-border);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--dark-text-muted);
  font-size: 13px;
}
.photo-caption {
  font-style: italic;
  font-size: 13px;
  opacity: .75;
  margin-top: 8px;
}
.next-btn { width: 100%; margin-top: 16px; font-size: 16px; padding: 13px; }

.collection { margin-top: 32px; }
.collection .label { font-size: 11px; }
.collection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.collection-tile {
  aspect-ratio: 1;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  outline-offset: 2px;
  border: none;
  padding: 0;
  font: inherit;
  cursor: default;
}
.collection-tile.found {
  cursor: pointer;
  transition: transform .12s ease, filter .12s ease;
}
.collection-tile.found:hover,
.collection-tile.found:focus-visible {
  transform: scale(1.06);
  filter: brightness(1.12);
}
.collection-tile.found:focus-visible { outline: 2px solid var(--accent); }
.collection-tile .tile-img {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
}
.collection-tile span {
  font-family: 'Courier Prime', monospace;
  font-size: 13px;
  position: relative;
}

/* ---------- Final ---------- */
.screen-final {
  min-height: 100vh;
  max-width: 660px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 56px 24px;
  gap: 20px;
  animation: fadeUp .9s ease both;
}
.final-header { align-self: stretch; display: flex; justify-content: flex-end; }
.vinyl-final {
  width: 90px;
  height: 90px;
  animation-duration: 11s;
  animation-play-state: running;
  background:
    repeating-radial-gradient(circle at 50% 50%, rgba(246, 237, 221, .06) 0px, rgba(246, 237, 221, .06) 1px, transparent 1px, transparent 4px),
    radial-gradient(circle at 50% 50%, var(--olive) 0% 30%, #17100a 31% 100%);
  box-shadow: 0 8px 22px rgba(43, 31, 22, .25);
}
.vinyl-final .dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  margin: -4px 0 0 -4px;
  border-radius: 50%;
  background: var(--bg);
}
.screen-final .eyebrow {
  font-family: 'Courier Prime', monospace;
  font-size: 12px;
  letter-spacing: 3px;
  color: var(--accent);
}
.screen-final h2 {
  font-family: 'Young Serif', serif;
  font-weight: 400;
  font-size: clamp(32px, 6vw, 46px);
  line-height: 1.1;
  margin: 0;
  text-wrap: balance;
}
.stats-row { display: flex; gap: 34px; justify-content: center; margin: 6px 0; }
.stat-num { font-family: 'Young Serif', serif; font-size: 28px; }
.stat-label {
  font-family: 'Courier Prime', monospace;
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--ink-50);
  margin-top: 4px;
}
.message-card {
  background: var(--paper);
  border: 1px solid var(--ink-16);
  border-radius: 16px;
  padding: 32px 30px;
  width: 100%;
  text-align: left;
  box-shadow: 0 2px 0 rgba(43, 31, 22, .07);
}
.message-card .label {
  font-family: 'Courier Prime', monospace;
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--accent);
}
.message-card .message { font-size: 17px; line-height: 1.7; margin-top: 14px; white-space: pre-line; }
.message-card .signature { font-family: 'Young Serif', serif; font-size: 22px; margin-top: 20px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 8px; }
.chip {
  font-family: 'Courier Prime', monospace;
  font-size: 11px;
  color: rgba(43, 31, 22, .55);
  border: 1px solid var(--ink-16);
  border-radius: 999px;
  padding: 6px 12px;
  background: var(--paper);
}
.playlist-link {
  font-size: 12px;
  letter-spacing: 1px;
  color: var(--accent);
  margin-top: 10px;
}
.playlist-link:hover { color: var(--accent-hover); }
.screen-final footer {
  font-family: 'Courier Prime', monospace;
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--ink-45);
  margin-top: 10px;
}

@media (max-width: 700px) {
  .game-row { flex-direction: column; }
}

/* ---------- Modale piste retrouvée ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(43, 31, 22, .55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 50;
  animation: fadeUp .18s ease both;
}
.modal-card {
  max-width: 420px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  flex: none;
  animation: none;
}
.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--dark-border);
  background: transparent;
  color: var(--dark-text);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-close:hover { background: rgba(246, 237, 221, .1); }

/* ---------- Photo plein écran ---------- */
.lightbox-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 7, 4, .88);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  z-index: 100;
  animation: fadeUp .15s ease both;
  cursor: zoom-out;
}
.lightbox-backdrop img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
  cursor: default;
}
.lightbox-close {
  position: fixed;
  top: 20px;
  right: 24px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .3);
  background: rgba(0, 0, 0, .3);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox-close:hover { background: rgba(255, 255, 255, .15); }
