/* Colours come from CSS variables set per dle in each page's <head>. */
*,
*::before,
*::after { box-sizing: border-box; }

html { background-color: var(--background); }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--background);
  color: var(--text);
  font: 16px/1.5 var(--font);
  -webkit-text-size-adjust: 100%;
}

a { color: var(--accent); }
h1, h2, h3, .site-header .brand { line-height: 1.2; font-family: var(--headingFont, var(--font)); }
.muted { color: var(--muted); }

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 12px 16px;
  background: var(--surface);
}
.site-header .brand { color: var(--text); font-weight: 700; text-decoration: none; }
.mode-nav { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.mode-nav a {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--background);
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
}
.mode-nav a[aria-current="page"] { background: var(--primary); }

.layout {
  display: grid;
  gap: 24px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px;
}
@media (min-width: 1000px) {
  .layout.with-sidebar { grid-template-columns: minmax(0, 1fr) 300px; }
}
main { min-width: 0; }

.page-title { margin: 8px 0 4px; font-size: clamp(24px, 5vw, 34px); }
.intro { margin-top: 0; }

/* Guess form */
.guess-form { position: relative; display: flex; gap: 8px; margin: 16px 0; }
.guess-input {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  border: 2px solid var(--primary);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 18px;
}
.guess-button, .share-button, .button {
  padding: 12px 18px;
  border: 0;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  text-decoration: none;
}
.guess-form.done { opacity: 0.5; }
.suggestions {
  position: absolute;
  z-index: 5;
  top: 100%;
  left: 0;
  right: 0;
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
  background: var(--surface);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.35);
}
.suggestions li { padding: 10px 14px; cursor: pointer; }
.suggestions li.active, .suggestions li:hover { background: var(--primary); color: #fff; }
.suggestions .suggestion-alias { opacity: 0.7; font-size: 0.9em; }
.suggestions li.empty { color: var(--muted); cursor: default; background: none; }

/* Classic board */
.table-scroll { overflow-x: auto; }
.board { border-collapse: separate; border-spacing: 4px; width: 100%; min-width: 480px; }
.board th[scope="col"] { font-size: 13px; color: var(--muted); font-weight: 600; text-transform: capitalize; }
.cell {
  padding: 10px 6px;
  border-radius: 8px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  animation: flip 0.35s ease both;
  animation-delay: calc(var(--i, 0) * 0.12s);
}
.cell.name { background: var(--surface); color: var(--text); }
.correct { background: var(--correct); }
.close { background: var(--close); }
.wrong { background: var(--wrong); }
@keyframes flip { from { transform: rotateX(90deg); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .cell, .hint-btn.ready { animation: none; } }

.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 0; list-style: none; font-size: 13px; color: var(--muted); }
.swatch { display: inline-block; width: 12px; height: 12px; margin-right: 6px; border-radius: 3px; vertical-align: -1px; }

/* Clue board */
.clue-card { padding: 16px; border-radius: 12px; background: var(--surface); text-align: center; }
.clues { margin: 0; padding: 0; list-style: none; }
.clue { margin: 8px 0; font-size: clamp(22px, 6vw, 40px); }
.guess-chips { display: flex; flex-direction: column; gap: 6px; padding: 0; list-style: none; }
.chip { padding: 10px 14px; border-radius: 8px; color: #fff; font-weight: 600; }

/* Result */
.result { margin: 16px 0; padding: 16px; border: 2px solid var(--correct); border-radius: 12px; background: var(--surface); }
.result h2 { margin-top: 0; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0; text-align: center; }
.stat strong { display: block; font-size: 24px; }
.stat span { font-size: 12px; color: var(--muted); }
.share { display: flex; align-items: center; gap: 12px; }
.share-status { color: var(--correct); font-size: 14px; }
.next-links, .other-links, .card-list { display: grid; gap: 8px; padding: 0; list-style: none; }
.next-links a, .other-links a, .card-list a {
  display: block;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--background);
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
}
.card-list { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.card-list .card-desc { display: block; font-weight: 400; font-size: 14px; color: var(--muted); }
/* Home cards: at most two lines, cut with "…" if longer. */
.card-list .card-tagline { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
.notice { padding: 16px; border-radius: 10px; background: var(--surface); }

/* Hints and answers pages */
.hint-list details { margin: 8px 0; padding: 12px 14px; border-radius: 10px; background: var(--surface); }
.hint-list summary { cursor: pointer; font-weight: 600; }
.hint-list .reveal-answer { border: 2px solid var(--accent); }
.answers-table { width: 100%; border-collapse: collapse; }
.answers-table th, .answers-table td { padding: 8px; border-bottom: 1px solid var(--surface); text-align: left; }

/* Ads: space reserved so the page does not jump when an ad loads. */
.ad { display: block; margin: 24px auto; text-align: center; min-height: 100px; }
.ad--sidebar { position: sticky; top: 16px; min-height: 600px; }
@media (max-width: 999px) { .ad--sidebar { display: none; } }
.ad-label { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }

.site-footer { padding: 24px 16px; text-align: center; font-size: 14px; color: var(--muted); }
.site-footer a { color: var(--muted); margin: 0 8px; }

/* Library panel (modes with "library": true) */
.game-with-library { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.game-main { min-width: 0; }
@media (min-width: 800px) { .game-with-library { grid-template-columns: minmax(0, 1fr) 260px; align-items: start; } }
.library { padding: 12px; border-radius: 12px; background: var(--surface); }
.library-title { margin: 0 0 8px; font-size: 15px; color: var(--muted); }
.library-list { display: flex; flex-direction: column; gap: 4px; max-height: 60vh; margin: 0; padding: 0; overflow-y: auto; list-style: none; }
@media (max-width: 799px) { .library-list { max-height: 260px; } }
.library-item { width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: var(--background); color: var(--text); font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.library-item:hover:not(:disabled) { background: var(--primary); color: #fff; }

/* Image clues */
.clue-image img { display: block; max-width: min(260px, 70vw); height: auto; margin: 0 auto; border-radius: 12px; transition: filter 0.4s ease; user-select: none; }

/* Lives */
.lives { display: flex; align-items: center; gap: 8px; margin: -6px 0 12px; font-size: 14px; color: var(--muted); }
.lives-hearts { letter-spacing: 2px; font-size: 16px; }
.lives-count { font-variant-numeric: tabular-nums; }
.lives-low .lives-hearts { animation: heartbeat 0.9s ease-in-out infinite; }
@keyframes heartbeat { 50% { transform: scale(1.12); } }

/* Lives row: hearts + the single hint button */
.lives-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -6px 0 12px; min-height: 36px; }
.lives-row .lives { margin: 0; }
.hint-btn { margin-left: auto; padding: 6px 14px; border: 2px solid color-mix(in srgb, var(--accent) 50%, transparent); border-radius: 999px; background: var(--surface); color: var(--muted); font: inherit; font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; cursor: default; }
.hint-btn.ready { border-color: var(--accent); color: var(--text); cursor: pointer; animation: hint-ready 0.4s ease-out; }
.hint-btn.ready:hover { background: color-mix(in srgb, var(--accent) 20%, var(--surface)); }
.hint-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@keyframes hint-ready { from { transform: scale(0.85); } to { transform: scale(1); } }

/* Summary bar: what the player knows so far */
.summary-bar { margin: 0 0 14px; }
.summary-cells { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 6px; margin: 0; padding: 0; list-style: none; }
.summary-cell { display: flex; flex-direction: column; justify-content: center; min-height: 54px; padding: 6px 8px; border-radius: 8px; background: var(--surface); border: 1px dashed color-mix(in srgb, var(--muted) 40%, transparent); text-align: center; }
.summary-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.summary-value { font-size: 14px; font-weight: 700; overflow-wrap: anywhere; }
.summary-cell.correct, .summary-cell.hint { background: var(--correct); border: 0; color: #fff; }
.summary-cell.correct .summary-label, .summary-cell.hint .summary-label, .summary-cell.close .summary-label { color: #ffffffcc; }
.summary-cell.close { background: var(--close); border: 0; }

/* Answer reveal (top of the game when it ends) */
.end-slot:empty { display: none; }
.answer-reveal { margin: 8px 0 16px; padding: 20px 16px; border-radius: 14px; text-align: center; background: var(--surface); border: 2px solid var(--correct); }
.reveal-title { margin: 0; font-family: var(--headingFont, var(--font)); font-size: clamp(22px, 5vw, 32px); font-weight: 700; color: var(--correct); }
.reveal-kicker { margin: 8px 0 0; color: var(--muted); text-transform: uppercase; letter-spacing: 0.12em; font-size: 12px; }
.reveal-name { margin: 2px 0 0; font-family: var(--headingFont, var(--font)); font-size: clamp(30px, 8vw, 52px); font-weight: 700; line-height: 1.1; }
.reveal-image { margin: 14px auto 0; max-width: 280px; }
.reveal-image img { display: block; width: 100%; height: auto; border-radius: 10px; }
.reveal-credit { margin-top: 6px; font-size: 11px; color: var(--muted); }
.answer-reveal.lose { border-color: var(--wrong); background: radial-gradient(ellipse at center, color-mix(in srgb, var(--wrong) 28%, var(--surface)), var(--surface)); }
.answer-reveal.lose .reveal-title { color: var(--wrong); }
.answer-reveal.animate.win .reveal-name { animation: reveal-pop 0.6s cubic-bezier(0.2, 1.6, 0.4, 1) both; }
.answer-reveal.animate.lose { animation: reveal-shake 0.6s ease both; }
.answer-reveal.animate.lose .reveal-title { animation: reveal-slam 0.5s cubic-bezier(0.2, 1.4, 0.4, 1) both; }
.answer-reveal.animate.lose .reveal-name { animation: reveal-rise 1.1s 0.35s ease-out both; text-shadow: 0 0 24px var(--wrong); }
.answer-reveal.animate .reveal-image { animation: reveal-rise 0.9s 0.6s ease-out both; }
body.dle-defeat::after { content: ""; position: fixed; inset: 0; z-index: 50; pointer-events: none; background: radial-gradient(circle, transparent 30%, color-mix(in srgb, var(--wrong) 70%, black)); animation: defeat-flash 1.2s ease-out both; }
@keyframes reveal-pop { from { transform: scale(0.6); opacity: 0; } }
@keyframes reveal-slam { from { transform: scale(2.4); opacity: 0; letter-spacing: 0.4em; } }
@keyframes reveal-rise { from { transform: translateY(16px); opacity: 0; filter: blur(6px); } }
@keyframes reveal-shake { 10%, 50%, 90% { transform: translateX(-8px); } 30%, 70% { transform: translateX(8px); } }
@keyframes defeat-flash { from { opacity: 1; } to { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .answer-reveal *, .answer-reveal, body.dle-defeat::after { animation: none !important; } }

/* Thumbnails on guesses (modes with showImages) */
.thumb { display: block; width: 44px; height: 44px; margin: 0 auto 4px; object-fit: cover; border-radius: 50%; }
.chip .thumb { display: inline-block; width: 28px; height: 28px; margin: 0 8px 0 0; vertical-align: middle; }

/* Fourier mode */
.fourier-canvas { display: block; width: min(320px, 80vw); height: auto; aspect-ratio: 1; margin: 0 auto; border-radius: 12px; background: var(--background); }
.fourier-formula { margin: 12px 0 0; font-family: var(--headingFont, monospace); font-size: 13px; overflow-x: auto; white-space: nowrap; }
.fourier-range { margin: 4px 0 0; font-family: var(--headingFont, monospace); font-size: 12px; color: var(--muted); }
.fourier-count { margin: 6px 0 0; font-size: 13px; }

/* Home: search and categories */
.search-box { margin: 16px 0 8px; }
.search-box .guess-input { width: 100%; }
.category-nav { margin: 8px 0 8px; }
.category h2 { margin-bottom: 0; }
.category > .muted, .category summary .muted { margin-top: 4px; }
.category-fold > summary { list-style: none; cursor: pointer; border-radius: 8px; }
.category-fold > summary::-webkit-details-marker { display: none; }
.category-fold > summary h2::before { content: "▾"; display: inline-block; width: 1.1em; color: var(--muted); transition: transform 0.15s; }
.category-fold:not([open]) > summary h2::before { transform: rotate(-90deg); }
.category-fold > summary:hover h2 { color: var(--accent); }
.category-fold > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.category-count { font-size: 0.6em; font-weight: 600; vertical-align: middle; padding: 0.1em 0.55em; border-radius: 999px; background: var(--surface); color: var(--muted); }
[data-search][hidden], .category[hidden] { display: none; }

.page-home .card-list a { background: var(--surface); }

/* Accounts */
.header-actions { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.home-button { display: inline-flex; gap: 6px; align-items: center; color: var(--text); text-decoration: none; font-size: 14px; font-weight: 600; padding: 6px 10px; border-radius: 999px; background: var(--background); transition: transform 0.15s; }
.home-button:hover { transform: translateY(-1px); }
/* Mini Omnidle logo: the brand's red / amber / green tiles (fixed colours, not the dle's theme). */
.tile-logo { display: inline-grid; grid-template-columns: repeat(3, 1fr); gap: 1.5px; width: 16px; height: 16px; flex: none; }
.tile-logo i { border-radius: 1.5px; background: #3dbf62; }
.tile-logo i:nth-child(-n + 2), .tile-logo i:nth-child(6) { background: #e24a5b; }
.tile-logo i:nth-child(3), .tile-logo i:nth-child(4) { background: #f2a531; }
.wordmark-dle { color: #3dbf62; }
.account-link { color: var(--text); text-decoration: none; font-size: 14px; padding: 6px 10px; border-radius: 999px; background: var(--background); }
.account { display: grid; gap: 16px; max-width: 520px; }
.account-form { display: grid; gap: 10px; padding: 16px; border-radius: 12px; background: var(--surface); margin-bottom: 16px; }
.account-form h2 { margin: 0; font-size: 20px; }
.account-form.danger { border: 1px solid var(--wrong); }
.field { display: grid; gap: 4px; font-size: 14px; }
.account-status.error { color: var(--wrong); }

/* Win celebration */
.celebration { position: fixed; inset: 0; z-index: 60; pointer-events: none; overflow: hidden; }
.confetti { position: absolute; top: -48px; animation-name: confetti-fall; animation-timing-function: cubic-bezier(0.25, 0.6, 0.4, 1); animation-fill-mode: both; }
@keyframes confetti-fall { to { transform: translate(var(--drift, 0), 110vh) rotate(var(--spin, 360deg)); opacity: 0.85; } }
@media (prefers-reduced-motion: reduce) { .celebration { display: none; } }

/* Account page */
.account { display: flex; justify-content: center; }
.account-card { width: 100%; max-width: 440px; padding: 24px 20px; border-radius: 16px; background: var(--surface); box-shadow: 0 10px 40px rgb(0 0 0 / 0.25); }
.account-logo { display: block; margin: 0 auto 8px; border-radius: 14px; }
.account-card .page-title, .account-card .intro { text-align: center; }
.account-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin: 8px 0 16px; border-radius: 12px; background: var(--background); }
.account-tab { padding: 10px; border: 0; border-radius: 9px; background: none; color: var(--muted); font: inherit; font-weight: 700; cursor: pointer; }
.account-tab[aria-selected="true"] { background: var(--primary); color: #fff; }
.account-card .account-form { padding: 0; background: none; margin-bottom: 12px; }
.field-input { position: relative; display: flex; }
.field-input .guess-input { width: 100%; }
.reveal-password { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--accent); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.strength { height: 6px; border-radius: 3px; background: var(--background); overflow: hidden; }
.strength-bar { display: block; height: 100%; width: 0; background: var(--wrong); transition: width 0.2s, background 0.2s; }
.strength-bar[data-level="1"] { width: 25%; }
.strength-bar[data-level="2"] { width: 50%; background: var(--close); }
.strength-bar[data-level="3"] { width: 75%; background: var(--correct); }
.strength-bar[data-level="4"] { width: 100%; background: var(--correct); }
.link-button { border: 0; background: none; color: var(--accent); font: inherit; font-weight: 700; cursor: pointer; padding: 0; }
.switch-line { text-align: center; margin: 4px 0 0; }
.benefits { display: grid; gap: 6px; margin: 16px 0 0; padding: 12px 14px; list-style: none; border-radius: 12px; background: var(--background); font-size: 14px; color: var(--muted); }
.account-hello { display: grid; gap: 10px; text-align: center; margin-bottom: 12px; }
.guess-button.secondary { background: var(--background); color: var(--text); }
.back-to-game { text-align: center; }
.account-section { margin: 10px 0; padding: 10px 12px; border-radius: 12px; background: var(--background); }
.account-section summary { cursor: pointer; font-weight: 700; }
.account-section .account-form { margin-top: 10px; }
.account-section.danger { border: 1px solid var(--wrong); }

/* Listen mode (tunes and sounds) */
.listen-card { display: grid; justify-items: center; gap: 10px; text-align: center; }
.play-button {
  width: 96px; height: 96px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--primary); color: #fff; font-size: 18px; font-weight: 700;
  box-shadow: 0 6px 20px color-mix(in srgb, var(--primary) 45%, transparent);
  transition: transform 0.15s;
}
.play-button:hover { transform: scale(1.05); }
.play-button:disabled { opacity: 0.5; cursor: default; }
.listen-card.is-playing .play-button { animation: listen-pulse 1s ease-in-out infinite; }
@keyframes listen-pulse { 50% { transform: scale(1.08); box-shadow: 0 0 0 10px color-mix(in srgb, var(--primary) 25%, transparent); } }
.stage-dots { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.stage-dot {
  width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--muted);
  background: transparent; color: var(--muted); font-weight: 700; cursor: pointer;
}
.stage-dot.unlocked { border-color: var(--primary); color: var(--text); }
.stage-dot.current { background: var(--primary); color: #fff; }
.stage-dot:disabled { opacity: 0.4; cursor: default; }
.listen-stage { margin: 0; font-weight: 700; }
.listen-credit:empty { display: none; }
@media (prefers-reduced-motion: reduce) { .listen-card.is-playing .play-button { animation: none; } }

/* Stats dashboard on /account/ (cards take each game's own colours via --c-* variables) */
.account { flex-direction: column; align-items: center; gap: 28px; max-width: none; }
.dashboard { width: 100%; max-width: 980px; }
.dashboard-title { text-align: center; margin: 0; font-size: clamp(26px, 5vw, 34px); }
.dashboard-source { text-align: center; margin: 4px 0 16px; }
.dashboard-empty { text-align: center; font-weight: 700; }
.dashboard-heading { margin: 26px 0 12px; font-size: 20px; }
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.stat-tile {
  display: grid; justify-items: center; gap: 2px; padding: 16px 10px; border-radius: 16px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--primary) 22%, var(--surface)), var(--surface));
  border: 1px solid color-mix(in srgb, var(--primary) 35%, transparent);
  animation: tile-in 0.45s ease-out both;
}
.stat-tile:nth-child(2) { animation-delay: 0.05s; } .stat-tile:nth-child(3) { animation-delay: 0.1s; }
.stat-tile:nth-child(4) { animation-delay: 0.15s; } .stat-tile:nth-child(5) { animation-delay: 0.2s; } .stat-tile:nth-child(6) { animation-delay: 0.25s; }
@keyframes tile-in { from { opacity: 0; transform: translateY(10px); } }
.stat-icon { font-size: 26px; }
.stat-value { font-size: 34px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-label { color: var(--muted); font-size: 13px; text-align: center; }
.stat-tile.is-hot { border-color: #ff8a3d; box-shadow: 0 0 22px #ff8a3d55; }
.stat-tile.is-hot .stat-icon { animation: flame 1.2s ease-in-out infinite; }
@keyframes flame { 50% { transform: scale(1.18) rotate(-6deg); } }
.badges { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.badge { display: grid; justify-items: center; gap: 2px; padding: 12px 8px; border-radius: 14px; background: var(--surface); text-align: center; opacity: 0.45; filter: grayscale(1); font-size: 13px; }
.badge.earned { opacity: 1; filter: none; border: 1px solid var(--accent); box-shadow: 0 0 16px color-mix(in srgb, var(--accent) 30%, transparent); }
.badge-icon { font-size: 30px; }
/* Earned badges flip over (hover, tap or keyboard focus) to show how they were earned.
   Each side is switched off exactly halfway (when the card is edge-on) with visibility + opacity,
   so it works even in browsers that ignore backface-visibility. */
.badge.earned { display: block; perspective: 700px; cursor: default; outline: none; }
.badge.earned:focus-visible { box-shadow: 0 0 0 2px var(--accent), 0 0 16px color-mix(in srgb, var(--accent) 30%, transparent); }
.badge-flip { --flip-ms: 500ms; display: grid; height: 100%; transform-style: preserve-3d; transition: transform var(--flip-ms) ease-in-out; }
.badge-face {
  grid-area: 1 / 1; display: grid; justify-items: center; align-content: center; gap: 2px;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  transition: opacity 0s linear calc(var(--flip-ms) / 2), visibility 0s linear calc(var(--flip-ms) / 2);
}
.badge-face.back { transform: rotateY(180deg); padding: 0 4px; opacity: 0; visibility: hidden; }
.badge-earned { color: var(--accent); font-weight: 700; }
.badge-how { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); font-weight: 700; }
.badge.earned:hover .badge-flip, .badge.earned:focus .badge-flip { transform: rotateY(180deg); }
.badge.earned:hover .badge-face.front, .badge.earned:focus .badge-face.front { opacity: 0; visibility: hidden; }
.badge.earned:hover .badge-face.back, .badge.earned:focus .badge-face.back { opacity: 1; visibility: visible; }
@media (prefers-reduced-motion: reduce) {
  .badge-flip { transition: none; }
  .badge.earned:hover .badge-flip, .badge.earned:focus .badge-flip { transform: none; }
  .badge-face { transition: opacity 0.2s, visibility 0.2s; }
  .badge-face.back { transform: none; }
}
.dle-stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; }
.dle-stat-card {
  display: grid; gap: 12px; padding: 16px; border-radius: 16px; color: var(--c-text);
  background: linear-gradient(150deg, color-mix(in srgb, var(--c-primary) 30%, var(--c-surface)), var(--c-bg) 85%);
  border: 2px solid color-mix(in srgb, var(--c-primary) 60%, transparent);
  box-shadow: 0 8px 26px color-mix(in srgb, var(--c-primary) 22%, transparent);
  animation: tile-in 0.5s ease-out both;
}
.dle-stat-card header { display: flex; align-items: center; gap: 10px; }
.dle-stat-card h3 { margin: 0; font-size: 20px; flex: 1; }
/* Card title: same size and spacing as plain text; on hover a soft pill in the game's colour and the emoji tilts. */
.dle-stat-card h3 { min-width: 0; }
.dle-stat-emoji { font-size: 30px; }
.dle-stat-title {
  display: inline-flex; align-items: center; gap: 10px; max-width: 100%;
  padding: 2px 8px; margin: -2px -8px; border-radius: 12px;
  color: inherit; text-decoration: none; transition: background 0.18s;
}
.dle-stat-title .dle-stat-emoji { transition: transform 0.18s; }
.dle-stat-title:hover, .dle-stat-title:focus-visible { background: color-mix(in srgb, var(--c-primary) 22%, transparent); outline: none; }
.dle-stat-title:focus-visible { box-shadow: 0 0 0 2px var(--c-accent); }
.dle-stat-title:hover .dle-stat-emoji, .dle-stat-title:focus-visible .dle-stat-emoji { transform: scale(1.1) rotate(-6deg); }
@media (prefers-reduced-motion: reduce) { .dle-stat-title, .dle-stat-title .dle-stat-emoji { transition: none; } }
.streak-flame { flex: none; white-space: nowrap; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: color-mix(in srgb, var(--c-accent) 30%, transparent); }
.dle-stat-summary { display: flex; align-items: center; gap: 16px; }
.dle-stat-summary p { margin: 0; line-height: 1.5; }
.win-ring {
  --size: 76px; width: var(--size); height: var(--size); flex: none; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(var(--c-primary) calc(var(--rate) * 1%), color-mix(in srgb, var(--c-text) 15%, transparent) 0);
}
.win-ring span { width: calc(var(--size) - 16px); height: calc(var(--size) - 16px); border-radius: 50%; display: grid; place-items: center; background: var(--c-bg); font-weight: 700; }
.mode-stats { width: 100%; border-collapse: collapse; font-size: 14px; }
.mode-stats th, .mode-stats td { padding: 5px 4px; text-align: right; border-bottom: 1px solid color-mix(in srgb, var(--c-text) 14%, transparent); }
.mode-stats th:first-child { text-align: left; }
.mode-stats thead th { color: color-mix(in srgb, var(--c-text) 65%, transparent); font-weight: 600; font-size: 12px; }
.mode-stats .hot { color: var(--c-accent); font-weight: 700; }
.dle-stat-play { justify-self: start; padding: 8px 14px; border-radius: 999px; background: var(--c-primary); color: var(--c-on-primary); font-weight: 700; text-decoration: none; }
.dle-stat-play:hover { filter: brightness(1.1); }
.try-chips { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.try-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 4px 4px 14px; border-radius: 999px; background: var(--c-surface); border: 2px solid var(--c-primary); transition: background 0.15s; }
.try-chip > a { padding: 4px 0; text-decoration: none; font-weight: 700; color: var(--c-text); }
.try-chip:hover { background: color-mix(in srgb, var(--c-primary) 30%, var(--c-surface)); }
.fav-button.fav-mini { width: 28px; height: 28px; font-size: 15px; }
@media (prefers-reduced-motion: reduce) { .stat-tile, .dle-stat-card { animation: none; } .stat-tile.is-hot .stat-icon { animation: none; } }

/* Favourite buttons: the same gold on every page and game (never themed) */
:root { --fav: #ffc83d; --fav-ink: #1a1300; }
.page-fav { display: flex; justify-content: flex-end; margin-bottom: -4px; }
.fav-button {
  border: 2px solid var(--fav); background: var(--fav-ink); color: var(--fav);
  padding: 5px 12px; border-radius: 999px; font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.fav-button:hover { box-shadow: 0 0 12px color-mix(in srgb, var(--fav) 45%, transparent); }
.fav-button[aria-pressed="true"] { background: var(--fav); color: var(--fav-ink); }
.fav-button.fav-compact { padding: 0; width: 34px; height: 34px; border-radius: 50%; font-size: 18px; line-height: 1; }
.fav-button.fav-pop { animation: fav-pop 0.35s ease-out; }
@keyframes fav-pop { 40% { transform: scale(1.35) rotate(-12deg); } }
.card-list li.has-fav { position: relative; }
.card-list li.has-fav > a { padding-right: 48px; }
.card-list li.has-fav > .fav-button { position: absolute; top: 8px; right: 8px; }
@media (prefers-reduced-motion: reduce) { .fav-button.fav-pop { animation: none; } }
.dle-stat-done { justify-self: start; margin: 0; padding: 8px 14px; border-radius: 999px; font-weight: 700; border: 2px solid var(--c-accent); color: var(--c-accent); }

/* History: past days to play, finished ones with their answer */
.archive-nav { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; margin: 0 0 0.75rem; }
.archive-banner { margin: 0; padding: 0.25rem 0.8rem; border: 1px solid var(--accent); border-radius: 999px; background: var(--surface); font-weight: 600; text-align: center; }
.archive-step { justify-self: start; padding: 0.35rem 0.8rem; border-radius: 999px; background: var(--surface); color: var(--text); font-weight: 700; text-decoration: none; white-space: nowrap; border: 1px solid color-mix(in srgb, var(--primary) 60%, transparent); transition: transform 0.15s, border-color 0.15s; }
.archive-step.archive-next { justify-self: end; }
.archive-step:hover { transform: translateY(-1px); border-color: var(--primary); }
.archive-step:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
span.archive-step { visibility: hidden; }
@media (max-width: 520px) { .archive-banner { font-size: 13px; } .archive-step { padding: 0.35rem 0.6rem; font-size: 13px; } }
.archive-hide-done { display: inline-flex; gap: 0.4rem; align-items: center; margin-bottom: 12px; cursor: pointer; }
.history-link { display: inline-block; padding: 8px 14px; border-radius: 999px; background: var(--surface); border: 1px solid color-mix(in srgb, var(--primary) 60%, transparent); color: var(--text); text-decoration: none; font-weight: 600; transition: transform 0.15s, border-color 0.15s; }
.history-link:hover { transform: translateY(-1px); border-color: var(--primary); }
.history-list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.history-day { display: grid; grid-template-columns: minmax(150px, auto) 1fr; gap: 8px 16px; align-items: center; padding: 12px 14px; border-radius: 12px; background: var(--surface); }
.history-date { color: var(--muted); font-size: 14px; }
.history-date strong { display: block; color: var(--text); font-size: 18px; }
.history-modes { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.history-button {
  display: flex; flex-direction: column; padding: 8px 12px; border-radius: 10px;
  background: var(--primary); color: var(--text); text-decoration: none; line-height: 1.25;
  border: 1px solid transparent; box-shadow: 0 2px 0 color-mix(in srgb, var(--primary) 55%, #000);
  transition: transform 0.15s, box-shadow 0.15s, filter 0.15s;
}
.history-button:hover { transform: translateY(-2px); filter: brightness(1.08); box-shadow: 0 4px 0 color-mix(in srgb, var(--primary) 55%, #000); }
.history-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.history-mode { font-size: 12px; opacity: 0.85; }
.history-state { font-weight: 700; }
.history-button.history-won, .history-button.history-lost { background: var(--background); box-shadow: none; }
.history-button.history-won { border-color: var(--correct); }
.history-button.history-won .history-state { color: var(--correct); }
.history-button.history-lost { border-color: var(--wrong); }
.history-button.history-lost .history-state { color: var(--wrong); }
@media (max-width: 560px) {
  .history-day { grid-template-columns: 1fr; }
}

/* Hangman: the answer as symbols, letters appear underneath when guessed */
.hm-board { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px 26px; margin: 16px 0; padding: 18px 12px; border-radius: 14px; background: var(--surface); }
.hm-word { display: inline-flex; gap: 6px; }
.hm-cell { display: inline-flex; flex-direction: column; align-items: center; min-width: 30px; }
.hm-symbol { font-size: 30px; line-height: 1.2; min-height: 36px; }
.hm-letter { min-width: 24px; min-height: 26px; margin-top: 4px; border-bottom: 2px solid var(--muted); text-align: center; font-weight: 700; font-size: 18px; }
.hm-cell.revealed .hm-letter { border-color: var(--correct); color: var(--text); }
.hm-cell.missed .hm-letter { border-color: var(--wrong); color: var(--wrong); }
.hm-mark .hm-symbol { color: var(--muted); }
.hm-cell.fresh .hm-letter { animation: hm-pop 0.35s ease; }
.hm-board.shake { animation: hm-shake 0.4s ease; }
@keyframes hm-pop { 0% { transform: scale(0.4); opacity: 0; } 70% { transform: scale(1.2); } 100% { transform: none; opacity: 1; } }
@keyframes hm-shake { 25% { transform: translateX(-6px); } 50% { transform: translateX(5px); } 75% { transform: translateX(-3px); } }
.hm-keys-label { margin: 0 0 6px; font-size: 14px; }
.hm-keys { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 6px; margin-bottom: 8px; }
.hm-key { min-height: 44px; border: 0; border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; font-weight: 700; cursor: pointer; transition: transform 0.1s, background 0.15s; }
.hm-key:hover:not(:disabled) { transform: translateY(-1px); background: var(--primary); }
.hm-key:disabled { cursor: default; opacity: 0.45; }
.hm-key.hit { background: var(--correct); opacity: 1; }
.hm-key.miss { background: var(--wrong); opacity: 0.55; }
.hm-tried { min-height: 1.5em; font-size: 14px; }
@media (prefers-reduced-motion: reduce) { .hm-cell.fresh .hm-letter, .hm-board.shake { animation: none; } }

/* Higher or Lower: two cards, the right one's number hidden */
.hl-round { margin: 4px 0; font-size: 14px; }
.hl-progress { display: flex; gap: 6px; margin: 0 0 14px; padding: 0; list-style: none; }
.hl-progress li { flex: 1; height: 8px; border-radius: 4px; background: var(--surface); }
.hl-progress li.current { background: var(--primary); opacity: 0.5; }
.hl-progress li.right { background: var(--correct); }
.hl-progress li.wrong { background: var(--wrong); }
.hl-arena { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: stretch; margin-bottom: 16px; }
.hl-card { display: flex; flex-direction: column; justify-content: center; gap: 2px; min-height: 230px; padding: 18px 14px; border-radius: 16px; background: var(--surface); text-align: center; border: 2px solid transparent; }
.hl-card p { margin: 0; }
.hl-name { font-family: var(--headingFont, var(--font)); font-size: 22px; font-weight: 700; line-height: 1.2; }
.hl-detail { font-size: 14px; }
.hl-number { margin-top: 10px !important; font-size: 34px; font-weight: 800; font-variant-numeric: tabular-nums; }
.hl-stat { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; }
.hl-card.hidden .hl-number { color: var(--accent); }
.hl-card.revealed .hl-number { animation: hl-pop 0.4s ease; }
.hl-card.right { border-color: var(--correct); }
.hl-card.wrong { border-color: var(--wrong); }
.hl-vs { align-self: center; padding: 8px 10px; border-radius: 999px; background: var(--primary); color: var(--text); font-weight: 800; font-size: 14px; }
.hl-question { margin: 12px 0 8px !important; font-size: 14px; }
.hl-buttons { display: grid; gap: 8px; }
.hl-button { min-height: 48px; border: 0; border-radius: 10px; font: inherit; font-size: 18px; font-weight: 800; color: var(--text); cursor: pointer; transition: transform 0.12s, filter 0.12s; }
.hl-button:hover { transform: translateY(-2px); filter: brightness(1.1); }
.hl-button.higher { background: var(--correct); }
.hl-button.lower { background: var(--wrong); }
@keyframes hl-pop { from { transform: scale(0.6); opacity: 0; } to { transform: none; opacity: 1; } }
@media (max-width: 560px) {
  .hl-arena { grid-template-columns: 1fr; }
  .hl-card { min-height: 0; }
  .hl-vs { justify-self: center; }
}
@media (prefers-reduced-motion: reduce) { .hl-card.revealed .hl-number { animation: none; } }

/* Credits page */
.credits-dle { margin: 24px 0; }
.credits-dle h2 a { color: inherit; text-decoration: none; }
.credits-list { padding-left: 18px; font-size: 14px; line-height: 1.6; }
.credits-list li { margin: 2px 0; overflow-wrap: anywhere; }
.reveal-credit a { color: inherit; }

/* Badge groups on the account page: General + one per category, each a fold with its own count */
.badge-groups { display: grid; gap: 10px; }
.badge-group { border-radius: 14px; background: color-mix(in srgb, var(--surface) 55%, transparent); padding: 4px 12px; }
.badge-group > summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; cursor: pointer; list-style: none; font-weight: 700; }
.badge-group > summary::-webkit-details-marker { display: none; }
.badge-group > summary::before { content: "▾"; color: var(--muted); transition: transform 0.15s; }
.badge-group:not([open]) > summary::before { transform: rotate(-90deg); }
.badge-group-name { flex: 1; }
.badge-count { padding: 2px 10px; border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 13px; }
.badge-count.complete { background: var(--accent); color: #000; }
.badge-group > .badges { margin-bottom: 12px; }
@media (prefers-reduced-motion: reduce) { .badge-group > summary::before { transition: none; } }
