/* Vignettes Thaï — thème « arcade néon » */
:root {
  color-scheme: dark;
  --bg: #0a0918;
  --bg2: #110f27;
  --card: #17153a;
  --card2: #201d4d;
  --line: #2e2a66;
  --ink: #f4f1ff;
  --muted: #9b95c9;
  --gold: #ffc23d;
  --gold2: #ff8a1f;
  --pink: #ff3d7f;
  --violet: #8b5cff;
  --cyan: #2de2e6;
  --green: #3ef08a;
  --red: #ff4d6d;
  --head: "Chakra Petch", "Kanit", system-ui, sans-serif;
  --body: "Kanit", system-ui, -apple-system, "Segoe UI", sans-serif;
  --thai: "Kanit", "Leelawadee UI", "Tahoma", sans-serif;
  --cut: 14px;
  --clip: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut));
  --clip-sm: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
  --glow-gold: 0 0 18px rgba(255, 194, 61, .55);
  --glow-cyan: 0 0 18px rgba(45, 226, 230, .5);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--body);
  font-weight: 300;
  color: var(--ink);
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 60% 40% at 85% 0%, rgba(139, 92, 255, .22), transparent 70%),
    radial-gradient(ellipse 50% 40% at 0% 30%, rgba(255, 61, 127, .12), transparent 70%),
    linear-gradient(rgba(255, 255, 255, .025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .025) 1px, transparent 1px);
  background-size: auto, auto, 48px 48px, 48px 48px;
  background-attachment: fixed;
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { width: 100%; max-width: 1080px; margin: 0 auto; padding: 1.5rem 16px 3rem; flex: 1; }
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--head); line-height: 1.1; margin: 0 0 .5rem; text-transform: uppercase; letter-spacing: .02em; }
a { color: inherit; }
b, strong { font-weight: 600; }
code { background: var(--card2); padding: .1em .35em; }
kbd {
  font-family: var(--head); font-size: .72em; font-weight: 700;
  border: 1px solid currentColor; border-radius: 4px; padding: 0 .35em; opacity: .65;
}
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.center { text-align: center; }
.th { font-family: var(--thai); font-weight: 500; line-height: 1.7; }
.ok { color: var(--green); }
.warn { color: var(--gold); }
.accent {
  background: linear-gradient(90deg, var(--gold), var(--pink));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ---------- En-tête ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: .65rem 16px;
  background: rgba(10, 9, 24, .85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), var(--pink), transparent); opacity: .6;
}
.brand { display: flex; align-items: center; gap: .5rem; text-decoration: none; font-family: var(--head); font-weight: 700; font-size: 1.25rem; text-transform: uppercase; letter-spacing: .04em; }
.logo { width: 2.1rem; height: 2.3rem; flex-shrink: 0; filter: drop-shadow(0 0 8px rgba(255, 61, 127, .45)); transition: transform .3s; }
.brand:hover .logo { transform: translateY(-3px) rotate(-6deg); }
.brand-th { font-family: var(--thai); color: var(--gold); text-shadow: var(--glow-gold); }
.wordmark {
  font-family: var(--head); font-weight: 700; font-size: 1.45rem; letter-spacing: -.01em;
  text-transform: none; color: var(--ink); line-height: 1;
}
.wm-thai {
  background: linear-gradient(90deg, var(--gold), var(--pink));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 8px rgba(255, 61, 127, .35));
}
.wm-dot { color: var(--muted); font-weight: 500; }
.footer .wordmark { font-size: 1.3rem; margin-bottom: .2rem; }
.nav { display: flex; gap: .15rem; flex-wrap: wrap; margin: 0 auto; }
.nav a {
  position: relative; text-decoration: none; font-family: var(--head); font-weight: 600;
  font-size: .92rem; text-transform: uppercase; letter-spacing: .06em;
  padding: .45rem .75rem; color: var(--muted); transition: color .15s;
}
.nav a::after {
  content: ""; position: absolute; left: .75rem; right: .75rem; bottom: .15rem; height: 2px;
  background: var(--gold); box-shadow: var(--glow-gold); transform: scaleX(0); transition: transform .2s;
}
.nav a:hover { color: var(--ink); }
.nav a.on { color: var(--gold); }
.nav a.on::after { transform: scaleX(1); }
.top-right { display: flex; align-items: center; gap: .6rem; }

.xp-badge { display: flex; align-items: center; gap: .5rem; }
.xp-badge .lvl {
  display: grid; place-items: center; width: 2.4rem; height: 2.4rem;
  font-family: var(--head); font-weight: 700; font-size: 1.05rem; color: #1a1300;
  background: linear-gradient(135deg, var(--gold), var(--gold2));
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}
.xp-info { display: flex; flex-direction: column; gap: .2rem; min-width: 6.5rem; }
.xp-text { font-family: var(--head); font-size: .72rem; color: var(--muted); letter-spacing: .05em; }
.xp-bar { display: block; height: 6px; background: var(--card2); overflow: hidden; }
.xp-bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), var(--pink)); box-shadow: var(--glow-gold); transition: width .6s cubic-bezier(.2, .8, .2, 1); }
.xp-badge.bump .lvl { animation: bump .5s; }
@keyframes bump { 40% { transform: scale(1.25); } }

.lang { display: inline-flex; border: 1px solid var(--line); }
.lang button {
  font-family: var(--head); font-weight: 700; font-size: .8rem; cursor: pointer;
  border: 0; background: transparent; color: var(--muted); padding: .35rem .6rem; letter-spacing: .05em;
}
.lang button.on { background: var(--gold); color: #1a1300; }

@media (max-width: 900px) {
  .top-right { margin-left: auto; }
  .nav { order: 3; margin: 0; width: 100%; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .nav a { white-space: nowrap; }
}
@media (max-width: 420px) { .xp-info { display: none; } }

/* ---------- Boutons ---------- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font-family: var(--head); font-weight: 700; font-size: .98rem; text-transform: uppercase; letter-spacing: .08em;
  text-decoration: none; cursor: pointer; border: 0;
  color: #1a1300; background: linear-gradient(135deg, var(--gold), var(--gold2));
  padding: .8rem 1.5rem; clip-path: var(--clip-sm);
  transition: transform .15s ease, filter .15s ease;
}
.btn:hover { transform: translateY(-2px); filter: brightness(1.1) drop-shadow(0 0 10px rgba(255, 194, 61, .6)); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: default; transform: none; filter: none; }
.btn .arrow { transition: transform .2s; }
.btn:hover .arrow { transform: translateX(4px); }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 2px var(--line); }
.btn.ghost:hover { box-shadow: inset 0 0 0 2px var(--cyan); color: var(--cyan); filter: none; }
.btn.small { padding: .5rem 1rem; font-size: .82rem; }
.btn.good { background: linear-gradient(135deg, var(--green), #19b866); color: #03210f; }
.btn.bad { background: linear-gradient(135deg, var(--red), var(--pink)); color: #fff; }
.big-btn { font-size: 1.15rem; padding: 1rem 2.4rem; }

.row { display: flex; gap: .7rem; flex-wrap: wrap; align-items: center; }
.row.center { justify-content: center; margin-top: 1.1rem; }

/* ---------- Titres de section ---------- */
.sec-head { text-align: center; margin: 3rem 0 1.4rem; }
.sec-head.left { text-align: left; margin: 0 0 1rem; }
.sec-label {
  display: inline-block; margin: 0 0 .3rem;
  font-family: var(--head); font-weight: 600; font-size: .85rem;
  text-transform: uppercase; letter-spacing: .2em; color: var(--cyan); text-shadow: var(--glow-cyan);
}
.sec-title { font-size: clamp(1.7rem, 4vw, 2.5rem); font-weight: 700; margin: 0; }
.sec-title.small-title { font-size: 1.4rem; }
.page-head { text-align: center; margin: 1rem 0 1.5rem; }
.page-head .seg { margin-top: 0; }
.page-head .row.center { margin-top: 1rem; }

/* Bouton « Phonétique » */
.toggle-phon {
  display: inline-flex; align-items: center; gap: .55rem; cursor: pointer;
  font-family: var(--head); font-weight: 600; font-size: .88rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); background: var(--bg2); border: 1px solid var(--line); padding: .55rem 1rem;
}
.tg-dot { position: relative; width: 2rem; height: 1.05rem; border-radius: 999px; background: var(--card2); transition: background .2s; }
.tg-dot::after {
  content: ""; position: absolute; top: .15rem; left: .15rem; width: .75rem; height: .75rem; border-radius: 50%;
  background: var(--muted); transition: transform .2s, background .2s;
}
.toggle-phon.on { color: var(--cyan); border-color: var(--cyan); }
.toggle-phon.on .tg-dot { background: rgba(45, 226, 230, .25); }
.toggle-phon.on .tg-dot::after { transform: translateX(.95rem); background: var(--cyan); box-shadow: var(--glow-cyan); }
.hide-phon .phon-hint { display: none !important; }
.phon-hint { color: var(--cyan); font-style: italic; }
.prompt .phon-hint { font-size: 1.35rem; margin-top: .2rem; }
.page-head p.muted { margin: .6rem 0 0; }

/* ---------- Panneaux ---------- */
.panel {
  position: relative;
  background: linear-gradient(160deg, var(--card), var(--bg2));
  padding: 1.6rem; margin: 1rem 0;
  clip-path: var(--clip);
  box-shadow: inset 0 0 0 1px var(--line);
}
.panel::before {
  content: ""; position: absolute; top: 0; left: var(--cut); width: 60px; height: 3px;
  background: var(--gold); box-shadow: var(--glow-gold);
}
.big { font-family: var(--head); font-size: 1.35rem; font-weight: 600; margin: .3rem 0; }

.seg { display: inline-flex; flex-wrap: wrap; gap: 0; border: 1px solid var(--line); background: var(--bg2); }
.seg button {
  font-family: var(--head); font-weight: 600; font-size: .88rem; text-transform: uppercase; letter-spacing: .05em;
  cursor: pointer; border: 0; background: transparent; color: var(--muted); padding: .55rem 1rem;
}
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--card2); color: var(--gold); box-shadow: inset 0 -2px 0 var(--gold); }
.panel .seg { margin: .9rem 0; }

.progress { height: 6px; background: var(--card2); overflow: hidden; margin: .5rem 0; }
.progress > div { height: 100%; background: linear-gradient(90deg, var(--violet), var(--cyan)); box-shadow: var(--glow-cyan); transition: width .3s ease; }
.progress.time > div { background: linear-gradient(90deg, var(--green), var(--cyan)); transition: width .1s linear; }
.progress.time > div.low { background: linear-gradient(90deg, var(--red), var(--pink)); }

/* ---------- Accueil : hero ---------- */
.hero { display: grid; grid-template-columns: 1.15fr .85fr; gap: 2rem; align-items: center; padding: 2.5rem 0 1rem; }
.kicker { font-family: var(--head); font-weight: 600; color: var(--cyan); text-transform: uppercase; letter-spacing: .2em; font-size: .85rem; margin: 0 0 .6rem; text-shadow: var(--glow-cyan); }
.hero h1 { font-size: clamp(2.4rem, 6.5vw, 4.4rem); font-weight: 700; line-height: 1; margin-bottom: 1rem; }
.hero-sub { color: var(--muted); font-size: 1.08rem; max-width: 34rem; margin: 0 0 1.6rem; }
.hero-art { position: relative; height: 340px; display: grid; place-items: center; }
.hero-art::before {
  content: ""; position: absolute; width: 280px; height: 280px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 61, 127, .35), rgba(139, 92, 255, .15) 50%, transparent 70%);
  filter: blur(10px);
}
.hero-card {
  position: relative; width: 240px; height: 300px; cursor: pointer; border: 0; color: inherit; font: inherit;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .3rem;
  background: linear-gradient(160deg, var(--card2), var(--card));
  clip-path: var(--clip); box-shadow: inset 0 0 0 1px var(--line);
  transform: rotate(-6deg); animation: hover 5s ease-in-out infinite;
}
.hero-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: linear-gradient(90deg, var(--gold), var(--pink)); }
.hc-th { font-family: var(--thai); font-size: 3.2rem; font-weight: 600; color: var(--gold); text-shadow: var(--glow-gold); }
.hc-phon { color: var(--cyan); font-style: italic; }
.hc-tr { font-family: var(--head); text-transform: uppercase; letter-spacing: .1em; }
.hc-play {
  margin-top: 1rem; width: 3rem; height: 3rem; display: grid; place-items: center; border-radius: 50%;
  background: var(--pink); color: #fff; box-shadow: 0 0 0 6px rgba(255, 61, 127, .25), 0 0 24px rgba(255, 61, 127, .6);
  animation: pulse 2s infinite;
}
@keyframes hover { 50% { transform: rotate(-4deg) translateY(-10px); } }
@keyframes pulse { 50% { box-shadow: 0 0 0 12px rgba(255, 61, 127, 0), 0 0 24px rgba(255, 61, 127, .6); } }
.float { position: absolute; font-family: var(--thai); font-weight: 600; opacity: .55; animation: drift 7s ease-in-out infinite; }
.f1 { top: 6%; left: 8%; font-size: 2.6rem; color: var(--cyan); text-shadow: var(--glow-cyan); }
.f2 { top: 14%; right: 6%; font-size: 2rem; color: var(--pink); animation-delay: -2s; }
.f3 { bottom: 8%; left: 14%; font-size: 1.8rem; color: var(--violet); animation-delay: -4s; }
.f4 { bottom: 14%; right: 12%; font-size: 2.8rem; color: var(--gold); text-shadow: var(--glow-gold); animation-delay: -1s; }
@keyframes drift { 50% { transform: translateY(-14px) rotate(8deg); } }
@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; text-align: center; padding-top: 1.5rem; }
  .hero .row { justify-content: center; }
  .hero-sub { margin-left: auto; margin-right: auto; }
  .hero-art { height: 280px; }
  .hero-card { width: 200px; height: 250px; }
}

/* HUD de statistiques */
.hud-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); margin: 1.5rem 0; clip-path: var(--clip); }
.stat { background: var(--bg2); padding: 1.1rem; text-align: center; display: flex; flex-direction: column; align-items: center; }
.stat-ico { font-size: 1.3rem; }
.stat b { font-family: var(--head); font-size: 2rem; font-weight: 700; color: var(--gold); text-shadow: var(--glow-gold); line-height: 1.2; }
.stat span:last-child { color: var(--muted); font-size: .82rem; text-transform: uppercase; letter-spacing: .08em; }
@media (max-width: 640px) { .hud-stats { grid-template-columns: repeat(2, 1fr); } }

/* Cartes des modes de jeu */
.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.2rem; }
.mode-card {
  display: flex; flex-direction: column; text-decoration: none;
  background: var(--card); clip-path: var(--clip); box-shadow: inset 0 0 0 1px var(--line);
  transition: transform .2s ease;
}
.mode-card:hover { transform: translateY(-6px); }
.mode-art { position: relative; height: 150px; display: grid; place-items: center; overflow: hidden; }
.m-cards .mode-art { background: linear-gradient(135deg, #3b1d8f, #8b5cff); }
.m-quiz .mode-art { background: linear-gradient(135deg, #8f1d4f, #ff3d7f); }
.m-memory .mode-art { background: linear-gradient(135deg, #0e5f6b, #2de2e6); }
.mode-art::after {
  content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(-45deg, transparent 0 14px, rgba(255, 255, 255, .06) 14px 28px);
}
.mode-glyph { font-family: var(--thai); font-size: 5.5rem; font-weight: 600; color: rgba(255, 255, 255, .25); transition: transform .3s; }
.mode-card:hover .mode-glyph { transform: scale(1.15) rotate(-6deg); }
.play-btn {
  position: absolute; z-index: 1; width: 3.4rem; height: 3.4rem; border-radius: 50%; display: grid; place-items: center;
  background: rgba(10, 9, 24, .75); color: var(--gold); font-size: 1.1rem; border: 2px solid var(--gold);
  box-shadow: var(--glow-gold); transition: transform .2s, background .2s;
}
.mode-card:hover .play-btn { transform: scale(1.12); background: var(--gold); color: #1a1300; }
.mode-body { padding: 1.2rem 1.3rem 1.4rem; display: flex; flex-direction: column; gap: .35rem; flex: 1; }
.mode-tag { align-self: flex-start; font-family: var(--head); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--cyan); border: 1px solid currentColor; padding: .05rem .5rem; }
.mode-body h3 { font-size: 1.35rem; margin: .2rem 0 0; }
.mode-body p { color: var(--muted); margin: 0; font-size: .95rem; flex: 1; }
.mode-cta { font-family: var(--head); font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--gold); margin-top: .6rem; }
@media (max-width: 760px) { .modes { grid-template-columns: 1fr; } }

.home-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; margin-top: 2.5rem; }
.home-grid .panel { margin: 0; }
@media (max-width: 760px) { .home-grid { grid-template-columns: 1fr; } }

.mini-board { list-style: none; padding: 0; margin: 0 0 1rem; }
.mini-board li { display: flex; align-items: center; gap: .75rem; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.mb-rank { font-family: var(--head); font-weight: 700; width: 1.4rem; color: var(--muted); }
.mb-avatar { width: 2.1rem; height: 2.1rem; display: grid; place-items: center; font-family: var(--head); font-weight: 700; background: var(--card2); clip-path: var(--clip-sm); }
.mb-name { flex: 1; font-weight: 500; }
.mb-score { font-family: var(--head); font-weight: 700; color: var(--gold); }
.mini-board .top1 .mb-avatar { background: var(--gold); color: #1a1300; }
.mini-board .top2 .mb-avatar { background: #cfd6e6; color: #1a1300; }
.mini-board .top3 .mb-avatar { background: #d9894a; color: #1a1300; }
.link-arrow { font-family: var(--head); font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--cyan); text-decoration: none; }
.link-arrow:hover { text-shadow: var(--glow-cyan); }

.voice-panel p { margin-top: 0; }
.rate { display: flex; gap: .6rem; align-items: center; font-family: var(--head); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; margin: 1rem 0; }
.rate input { accent-color: var(--gold); flex: 1; max-width: 200px; }
.rate select {
  flex: 1; min-width: 0; max-width: 100%; font: inherit; font-family: var(--body); text-transform: none; letter-spacing: 0;
  color: var(--ink); background: var(--bg); border: 1px solid var(--line); padding: .45rem .6rem; cursor: pointer;
}
.rate select:focus { outline: none; border-color: var(--gold); }
.toast.warn { color: var(--ink); background: rgba(255, 77, 109, .25); text-transform: none; letter-spacing: 0; font-weight: 600; }

/* ---------- Leçons ---------- */
.lesson {
  display: flex; gap: .9rem; align-items: flex-start;
  background: var(--card); padding: 1rem 1.2rem; margin: .8rem 0;
  clip-path: var(--clip); box-shadow: inset 0 0 0 1px var(--line);
  opacity: .6; transition: opacity .15s, box-shadow .15s;
}
.lesson.sel { opacity: 1; box-shadow: inset 0 0 0 1px var(--line), inset 4px 0 0 var(--gold); }
.check input { width: 1.3rem; height: 1.3rem; accent-color: var(--gold); margin-top: .25rem; cursor: pointer; }
.lesson details { flex: 1; min-width: 0; }
.lesson summary { cursor: pointer; display: flex; flex-wrap: wrap; gap: .2rem .9rem; align-items: baseline; list-style: none; }
.lesson summary::-webkit-details-marker { display: none; }
.lesson summary::after { content: "▾"; margin-left: auto; color: var(--gold); }
.lesson details[open] summary::after { content: "▴"; }
.lesson-title { font-family: var(--head); font-weight: 700; font-size: 1.15rem; text-transform: uppercase; letter-spacing: .03em; }

.words { list-style: none; padding: 0; margin: .8rem 0 0; }
.words li {
  display: grid; grid-template-columns: 2.4rem minmax(5rem, 1fr) minmax(5rem, 1fr) 1.4fr;
  gap: .7rem; align-items: center; padding: .4rem 0; border-top: 1px solid var(--line);
}
.words .th { font-size: 1.3rem; color: var(--gold); }
.words .phon { color: var(--cyan); font-style: italic; }
.words.compact { max-width: 600px; margin: .6rem auto; text-align: left; }
.play {
  width: 2.2rem; height: 2.2rem; border: 1px solid var(--line); background: var(--card2);
  cursor: pointer; font-size: .95rem; clip-path: var(--clip-sm); transition: background .15s;
}
.play:hover { background: var(--pink); }
@media (max-width: 560px) {
  .words li { grid-template-columns: 2.4rem 1fr 1fr; }
  .words .fr { grid-column: 2 / -1; margin-top: -.4rem; }
}

/* ---------- Vignette retournable ---------- */
.flip { perspective: 1200px; width: min(460px, 100%); height: 300px; margin: 1.2rem auto; cursor: pointer; outline: none; }
.flip-inner { position: relative; width: 100%; height: 100%; transition: transform .6s cubic-bezier(.2, .8, .2, 1); transform-style: preserve-3d; }
.flip.flipped .flip-inner { transform: rotateY(180deg); }
.face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .35rem; padding: 1.5rem; text-align: center;
  background: linear-gradient(160deg, var(--card2), var(--card));
  border: 1px solid var(--line); border-radius: 6px;
}
.face.front { box-shadow: inset 0 4px 0 var(--gold), 0 20px 50px rgba(0, 0, 0, .4); }
.face.back { transform: rotateY(180deg); box-shadow: inset 0 4px 0 var(--cyan), 0 20px 50px rgba(0, 0, 0, .4); }
.flip:focus-visible .face { border-color: var(--gold); }
.hint { position: absolute; bottom: .9rem; font-family: var(--head); font-size: .75rem; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.xl { font-size: clamp(2.8rem, 9vw, 4rem); color: var(--gold); text-shadow: var(--glow-gold); }
.lg { font-size: 2.5rem; color: var(--gold); text-shadow: var(--glow-gold); }
.fr-big { font-family: var(--head); font-size: clamp(1.5rem, 5vw, 2.1rem); font-weight: 700; }
.face .phon { color: var(--cyan); font-size: 1.45rem; font-style: italic; text-shadow: var(--glow-cyan); }
.face .fr { font-family: var(--head); font-size: 1.3rem; font-weight: 600; }
.note { color: var(--muted); font-size: .9rem; margin-top: .4rem; }

/* ---------- Quiz ---------- */
.hud { display: flex; justify-content: space-between; gap: .5rem; font-family: var(--head); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.hud b { color: var(--gold); font-size: 1.35rem; text-shadow: var(--glow-gold); }
.prompt { text-align: center; min-height: 10rem; display: flex; flex-direction: column; align-items: center; justify-content: center; margin: 1rem 0; }
.listen-big {
  width: 6.5rem; height: 6.5rem; border-radius: 50%; font-size: 2.6rem; cursor: pointer;
  background: rgba(255, 61, 127, .15); border: 2px solid var(--pink); color: var(--ink);
  box-shadow: 0 0 30px rgba(255, 61, 127, .45); animation: pulse 2s infinite;
}
.listen-big:hover { transform: scale(1.06); }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.choice {
  position: relative; font-family: var(--body); font-weight: 400; font-size: 1.08rem; cursor: pointer;
  background: var(--card); color: var(--ink); border: 0; clip-path: var(--clip-sm);
  box-shadow: inset 0 0 0 1px var(--line);
  padding: 1rem 1rem 1rem 2.8rem; min-height: 4.4rem; text-align: left;
  display: flex; flex-direction: column; justify-content: center;
  transition: box-shadow .12s, background .12s, transform .12s;
}
.choice:hover { box-shadow: inset 0 0 0 2px var(--cyan); transform: translateY(-2px); }
.choice kbd { position: absolute; left: .9rem; top: 50%; transform: translateY(-50%); color: var(--cyan); }
.choice .th { font-size: 1.45rem; color: var(--gold); }
.choice .phon { font-size: .85rem; color: var(--muted); font-style: italic; }
.choice.good { background: rgba(62, 240, 138, .14); box-shadow: inset 0 0 0 2px var(--green), 0 0 20px rgba(62, 240, 138, .3); }
.choice.bad { background: rgba(255, 77, 109, .14); box-shadow: inset 0 0 0 2px var(--red); animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@media (max-width: 560px) { .choices { grid-template-columns: 1fr; } }

/* ---------- Résultat ---------- */
.result .hero-th, .panel .hero-th { font-family: var(--thai); font-size: 1.5rem; font-weight: 600; color: var(--pink); margin: 0; }
.score-big { font-family: var(--head); font-size: 4.2rem; font-weight: 700; margin: 0; line-height: 1.1; color: var(--gold); text-shadow: 0 0 30px rgba(255, 194, 61, .6); }
.badge { display: inline-block; font-family: var(--head); text-transform: uppercase; letter-spacing: .08em; background: rgba(255, 194, 61, .15); color: var(--gold); font-weight: 700; padding: .3rem .9rem; clip-path: var(--clip-sm); }
.save-form { display: flex; gap: .5rem; justify-content: center; flex-wrap: wrap; margin: 1.3rem 0 .3rem; }
.save-form input {
  font: inherit; padding: .7rem 1rem; border: 1px solid var(--line); background: var(--bg);
  color: var(--ink); min-width: 0; width: 15rem; max-width: 100%; clip-path: var(--clip-sm);
}
.save-form input:focus { outline: none; border-color: var(--gold); }

/* ---------- Memory ---------- */
.memory-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .8rem; margin-top: 1.2rem; }
.tile { aspect-ratio: 4 / 3; perspective: 800px; border: 0; padding: 0; background: none; cursor: pointer; font: inherit; color: inherit; }
.tile-inner { position: relative; display: block; width: 100%; height: 100%; transition: transform .45s ease; transform-style: preserve-3d; }
.tile.open .tile-inner, .tile.done .tile-inner { transform: rotateY(180deg); }
.tile-face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  display: flex; align-items: center; justify-content: center; text-align: center; padding: .4rem;
  border-radius: 6px; font-weight: 400;
}
.tile-back {
  font-family: var(--thai); font-size: 2.2rem; color: rgba(255, 255, 255, .55);
  background: linear-gradient(135deg, var(--violet), var(--pink));
  background-image: repeating-linear-gradient(-45deg, transparent 0 10px, rgba(255, 255, 255, .07) 10px 20px), linear-gradient(135deg, var(--violet), var(--pink));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .15);
}
.tile:hover:not(.open):not(.done) .tile-back { filter: brightness(1.2); box-shadow: 0 0 18px rgba(255, 61, 127, .5); }
.tile-front { flex-direction: column; background: var(--card2); transform: rotateY(180deg); font-size: .95rem; box-shadow: inset 0 0 0 1px var(--line); }
.tile-front .phon { font-size: .8rem; line-height: 1.2; }
.tile-front.th .th { font-size: 1.55rem; color: var(--gold); }
.tile.done .tile-front { background: rgba(62, 240, 138, .12); box-shadow: inset 0 0 0 2px var(--green), 0 0 16px rgba(62, 240, 138, .3); }
@media (max-width: 560px) {
  .memory-grid { grid-template-columns: repeat(3, 1fr); gap: .5rem; }
  .tile-front { font-size: .8rem; }
  .tile-front.th .th { font-size: 1.2rem; }
}

/* ---------- Classement ---------- */
.podium { display: flex; justify-content: center; align-items: flex-end; gap: .8rem; margin: 1rem 0 2rem; }
.podium-step { display: flex; flex-direction: column; align-items: center; gap: .25rem; width: min(9rem, 30%); }
.p-medal { font-size: 1.8rem; }
.p-avatar {
  width: 3.4rem; height: 3.4rem; display: grid; place-items: center; font-family: var(--head); font-weight: 700; font-size: 1.4rem;
  background: var(--card2); clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}
.p1 .p-avatar { background: linear-gradient(135deg, var(--gold), var(--gold2)); color: #1a1300; }
.p-name { font-weight: 500; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-score { font-family: var(--head); font-weight: 700; color: var(--gold); }
.p-block {
  width: 100%; display: grid; place-items: center; font-family: var(--head); font-size: 2rem; font-weight: 700;
  color: rgba(255, 255, 255, .5); background: linear-gradient(180deg, var(--card2), var(--bg2));
  clip-path: polygon(10% 0, 90% 0, 100% 100%, 0 100%); margin-top: .3rem;
}
.p1 .p-block { height: 7rem; background: linear-gradient(180deg, rgba(255, 194, 61, .45), var(--bg2)); color: var(--gold); }
.p2 .p-block { height: 5rem; }
.p3 .p-block { height: 3.6rem; }

.board { width: 100%; border-collapse: collapse; background: var(--card); clip-path: var(--clip); }
.board th, .board td { padding: .75rem 1rem; text-align: left; border-bottom: 1px solid var(--line); }
.board th { font-family: var(--head); font-size: .8rem; font-weight: 600; color: var(--cyan); text-transform: uppercase; letter-spacing: .12em; background: var(--bg2); }
.board tr:last-child td { border-bottom: 0; }
.board td b { font-family: var(--head); color: var(--gold); font-size: 1.1rem; }
.board .rank { font-family: var(--head); font-size: 1.2rem; width: 3rem; text-align: center; }
.board tr.me td { background: rgba(255, 194, 61, .1); }
@media (max-width: 560px) { .hide-sm { display: none; } }

/* ---------- Notifications ---------- */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 50; display: flex; flex-direction: column; gap: .5rem; align-items: flex-end; pointer-events: none; }
.toast {
  font-family: var(--head); font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
  padding: .6rem 1.1rem; background: var(--card2); color: var(--ink); clip-path: var(--clip-sm);
  box-shadow: inset 0 0 0 1px var(--line); animation: toastIn .35s cubic-bezier(.2, .8, .2, 1);
  transition: opacity .4s, transform .4s;
}
.toast.xp { color: var(--gold); }
.toast.level { background: linear-gradient(135deg, var(--gold), var(--pink)); color: #1a1300; font-size: 1.05rem; }
.toast.out { opacity: 0; transform: translateY(10px); }
@keyframes toastIn { from { opacity: 0; transform: translateX(30px); } }

/* ---------- Pied de page ---------- */
.footer { display: flex; flex-direction: column; align-items: center; gap: .2rem; text-align: center; padding: 2rem 16px; border-top: 1px solid var(--line); font-size: .9rem; }
.footer .brand-th { font-size: 1.3rem; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
