* {
  box-sizing: border-box;
  scrollbar-color: var(--scrollbar-thumb-color) var(--scrollbar-track-color);
  scrollbar-width: thin;
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-track {
  background-color: var(--scrollbar-track-color);
}

*::-webkit-scrollbar-thumb {
  background-color: var(--scrollbar-thumb-color);
  border: 2px solid var(--scrollbar-track-color);
  border-radius: 999px;
}

*::-webkit-scrollbar-thumb:hover {
  background-color: var(--scrollbar-thumb-hover-color);
}

body {
  margin: 0;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: 'Segoe UI', Arial, sans-serif;
}

body.theme-transition {
  transition: background-color 0.2s ease, color 0.2s ease;
}

/* ---------- General structure (sidebar + topbar + content) ---------- */
.app-shell {
  display: flex;
  flex: 1;
  min-height: 0;
}

.sidebar {
  position: relative;
  width: 220px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  padding-top: 1rem;
  background-color: var(--surface-color);
  border-right: 1px solid var(--border-color);
}

/* Narrow screens only (see the max-width: 1100px block) */
.mobile-topbar {
  position: relative;
  display: none;
  flex-shrink: 0;
  align-items: center;
  gap: 0.75rem;
  height: 3.5rem;
  padding: 0 1rem;
  border-bottom: 1px solid var(--border-color);
  background-color: var(--surface-color);
}

.mobile-topbar-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--text-color);
  font-weight: 600;
  text-decoration: none;
}

.mobile-topbar-logo > i {
  color: var(--primary-color);
  font-size: 1.25rem;
}

.menu-toggle {
  position: relative;
  z-index: 901;
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  background: none;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-color);
  cursor: pointer;
  font-size: 1.25rem;
}

.menu-toggle:hover {
  color: var(--primary-color);
  border-color: var(--primary-color);
}

.menu-icon,
.menu-icon span {
  display: block;
}

.menu-icon {
  width: 1.2rem;
  height: 1rem;
  position: relative;
}

.menu-icon span {
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  border-radius: 2px;
  background-color: currentColor;
  transition: transform 0.2s ease, top 0.2s ease, opacity 0.2s ease;
}

.menu-icon span:nth-child(1) {
  top: 0;
}

.menu-icon span:nth-child(2) {
  top: 0.4rem;
}

.menu-icon span:nth-child(3) {
  top: 0.8rem;
}

.menu-toggle.is-open .menu-icon span:nth-child(1) {
  top: 0.4rem;
  transform: rotate(45deg);
}

.menu-toggle.is-open .menu-icon span:nth-child(2) {
  opacity: 0;
}

.menu-toggle.is-open .menu-icon span:nth-child(3) {
  top: 0.4rem;
  transform: rotate(-45deg);
}

.menu-overlay {
  display: none;
}

.sidebar-games {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  overflow-y: auto;
}

.sidebar-games-heading {
  margin: 0.65rem 0 0.25rem;
  padding: 0 0.7rem;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.7rem;
  border-radius: 8px;
  color: var(--text-color);
  text-decoration: none;
  font-size: 0.95rem;
  cursor: pointer;
}

.sidebar-link:hover {
  background-color: var(--bg-color);
}

.sidebar-link.active {
  background-color: var(--primary-color);
  color: #ffffff;
}

.sidebar-link--disabled {
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: 0.6;
}

.sidebar-link--daily-disabled {
  pointer-events: none;
  cursor: not-allowed;
  opacity: 0.45;
}

.sidebar-settings {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding-left: 0.6rem;
  padding-right: 0.6rem;
  border-top: 1px solid var(--border-color);
  background: none;
  border-left: none;
  border-right: none;
  border-bottom: none;
  color: var(--text-color);
  font-size: 0.95rem;
  cursor: pointer;
  text-align: left;
  border-radius: 0;
}

.sidebar-settings:hover {
  color: var(--primary-color);
}

.sidebar-settings > i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  flex-shrink: 0;
}

.account-nav {
  margin-top: auto;
  display: flex;
  align-items: center;
  padding: 0.4rem 0.6rem;
  border-top: 1px solid var(--border-color);
  background: none;
  border-left: none;
  border-right: none;
  border-bottom: none;
}

.account-nav-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
  flex: 1;
  color: var(--text-color);
  font-size: 0.95rem;
  cursor: pointer;
  text-align: left;
  border-radius: 0;
  text-decoration: none;
}

.account-nav-link > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-logout-form {
  display: flex;
  flex-shrink: 0;
  margin: 0;
}

.sidebar-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid transparent;
  background-color: var(--error-color);
  color: #ffffff;
  cursor: pointer;
  border-radius: 4px;
}

.sidebar-logout:hover {
  background-color: var(--failure-border-color);
  color: #ffffff;
}


.account-nav-link:hover {
  color: var(--primary-color);
}

.account-nav-link > i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  flex-shrink: 0;
}

.account-nav-link--login > i {
  border-radius: 4px;
  background-color: var(--primary-color);
  color: #ffffff;
}

.account-nav-link--login:hover > i {
  background-color: var(--primary-color-hover);
  color: #ffffff;
}

@media (max-width: 1100px) {
  .mobile-topbar {
    display: flex;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .sidebar {
    position: fixed;
    z-index: 900;
    inset: 0 auto 0 0;
    width: min(82vw, 280px);
    padding-top: 4.2rem;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: 4px 0 16px var(--shadow-color);
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .menu-overlay {
    position: fixed;
    z-index: 899;
    inset: 0;
    display: block;
    background-color: var(--modal-overlay);
  }

  .menu-overlay[hidden] {
    display: none;
  }
}

.logo-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  padding: 0 0.7rem 0.8rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-color);
  text-decoration: none;
  font-weight: 600;
}

.app-content {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  padding: 2rem;
}

/* Must come after the base rule */
@media (max-width: 1100px) {
  .app-content {
    padding: 1.25rem;
  }
}

/* ---------- Account ---------- */
.account-page {
  width: min(100%, 880px);
  margin-inline: auto;
  display: flex;
  justify-content: center;
  padding: 2rem 0;
}

.account-card {
  width: min(100%, 30rem);
  padding: 2rem;
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 8px 24px var(--shadow-color);
}

.account-card--wide {
  width: min(100%, 52rem);
}

.account-eyebrow {
  margin: 0 0 0.5rem;
  color: var(--primary-color);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.account-intro {
  color: var(--text-muted);
  line-height: 1.5;
}

.account-form {
  display: grid;
  gap: 0.55rem;
  margin-top: 1.5rem;
}

.account-form input {
  width: 100%;
  margin-bottom: 0.65rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background-color: var(--bg-color);
  color: var(--text-color);
  font: inherit;
}

.account-submit {
  padding: 0.72rem 1rem;
  border: 0;
  border-radius: 6px;
  background-color: var(--primary-color);
  color: #ffffff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.account-submit--secondary {
  margin-top: 1.5rem;
  background-color: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-color);
}

.account-notice {
  padding: 0.75rem;
  border-left: 3px solid var(--primary-color);
  background-color: var(--bg-color);
}

/* Shown on a game page when the difficulty filters had to be widened */
.game-notice {
  margin: 0 0 1rem;
}

.account-actions {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

.account-form--compact {
  max-width: 28rem;
  margin-top: 1rem;
}

.account-export {
  display: inline-block;
  margin-top: 1rem;
  text-decoration: none;
}

.account-submit--danger {
  background-color: #a93226;
}

.account-delete-form {
  margin-top: 2rem;
}

.account-error {
  padding: 0.75rem;
  border-left: 3px solid var(--danger-color, #c0392b);
  background-color: var(--bg-color);
  color: var(--danger-color, #c0392b);
}

.account-switch {
  margin: 1.25rem 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.account-switch a {
  color: var(--primary-color);
}

.account-placeholder {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding: 1rem;
  border: 1px dashed var(--border-color);
  color: var(--text-muted);
}

.account-section-title {
  margin: 0 0 0.75rem;
  font-size: 1.15rem;
}

/* Account dashboard: header, tabs joined to their panel, statistics */
.account-dashboard {
  width: min(100%, 56rem);
}

.account-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.account-avatar {
  display: flex;
  flex: 0 0 3.25rem;
  align-items: center;
  justify-content: center;
  height: 3.25rem;
  border-radius: 50%;
  background-color: color-mix(in srgb, var(--primary-color) 20%, var(--surface-color));
  color: var(--primary-color);
  font-weight: 700;
}

.account-identity {
  flex: 1;
  min-width: 0;
}

.account-identity h1 {
  margin: 0;
  font-size: 1.4rem;
  overflow-wrap: anywhere;
}

.account-identity p {
  margin: 0.15rem 0 0;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.account-logout-button {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.account-dashboard > .account-notice {
  margin: 0 0 1rem;
}

.account-tabs {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  gap: 0.4rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.account-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: -1px;
  padding: 0.6rem 1.1rem;
  border: 1px solid var(--border-color);
  border-radius: 10px 10px 0 0;
  background-color: color-mix(in srgb, var(--surface-color) 45%, var(--bg-color));
  color: var(--text-muted);
  font-size: 0.92rem;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.account-tab i {
  color: var(--primary-color);
  font-size: 1.05rem;
}

.account-tab:hover {
  color: var(--text-color);
  background-color: color-mix(in srgb, var(--surface-color) 75%, var(--bg-color));
}

.account-tab:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: -2px;
}

/* The active tab takes the panel colour and covers the panel's top border: they read as one piece */
.account-tab.is-active {
  padding-top: 0.75rem;
  border-bottom-color: var(--surface-color);
  background-color: var(--surface-color);
  color: var(--text-color);
  font-weight: 600;
}

.account-panel {
  padding: 1.5rem;
  border: 1px solid var(--border-color);
  border-radius: 0 10px 10px 10px;
  background-color: var(--surface-color);
  /* Empty calendar day: visible on the panel in both themes */
  --calendar-empty: color-mix(in srgb, var(--text-color) 9%, var(--surface-color));
}

.account-panel[hidden] {
  display: none;
}

.account-panel > .account-section-title:not(:first-child) {
  margin-top: 1.75rem;
}

.account-section-title small {
  margin-left: 0.4rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 400;
}

.account-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}

.account-kpi {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.9rem 1rem;
  border-radius: 8px;
  background-color: var(--bg-color);
}

.account-kpi strong {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 1.45rem;
}

.account-kpi span {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.account-kpi-flame {
  color: #f97316;
  font-size: 1.2rem;
}

.account-kpi-flame.is-off {
  color: var(--text-muted);
}

.daily-calendar-scroll {
  overflow-x: auto;
}

.daily-calendar {
  display: flex;
  gap: 3px;
  width: max-content;
}

.daily-calendar-week {
  display: grid;
  grid-template-rows: 1rem repeat(7, 12px);
  gap: 3px;
  width: 12px;
}

.daily-calendar-month {
  color: var(--text-muted);
  font-size: 0.7rem;
  white-space: nowrap;
}

.daily-calendar-day {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background-color: var(--calendar-empty);
}

.daily-calendar-day--1 { background-color: color-mix(in srgb, var(--primary-color) 22%, var(--calendar-empty)); }
.daily-calendar-day--2 { background-color: color-mix(in srgb, var(--primary-color) 48%, var(--calendar-empty)); }
.daily-calendar-day--3 { background-color: color-mix(in srgb, var(--primary-color) 74%, var(--calendar-empty)); }
.daily-calendar-day--4 { background-color: var(--primary-color); }
.daily-calendar-day--future { background-color: transparent; }

.daily-calendar-legend {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 0.5rem;
  color: var(--text-muted);
  font-size: 0.75rem;
}

.account-game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
  gap: 0.75rem;
}

.account-game-card {
  padding: 0.85rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

.account-game-card header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.account-game-name {
  font-weight: 600;
  font-size: 0.92rem;
}

.account-game-name i {
  color: var(--primary-color);
}

.account-game-plays,
.account-game-meta,
.attempt-distribution-axis {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.account-game-plays {
  white-space: nowrap;
}

.attempt-distribution {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 2.4rem;
  margin-top: 0.75rem;
}

.attempt-bar {
  flex: 1;
  border-radius: 3px 3px 0 0;
  background-color: color-mix(in srgb, var(--primary-color) 65%, var(--surface-color));
}

.attempt-distribution-axis {
  display: flex;
  justify-content: space-between;
  margin-top: 0.2rem;
}

.account-game-meta {
  margin: 0.35rem 0 0;
}

.account-game-highlight {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  margin: 0.9rem 0 0;
}

.account-game-highlight strong {
  font-size: 1.6rem;
}

.account-game-highlight span {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.account-multiplayer {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 0.92rem;
}

.account-multiplayer-favorite {
  color: var(--text-muted);
}

.account-panel .account-placeholder {
  flex-wrap: wrap;
  margin-top: 0;
  border-radius: 8px;
}

.account-panel .account-placeholder .account-link-button {
  margin-left: auto;
}

.account-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-color);
}

.account-row > div {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.account-row span {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.account-row .account-link-button {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}

.account-danger-zone {
  margin-top: 1.75rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--error-color);
  border-radius: 8px;
}

.account-danger-zone h2 {
  margin: 0 0 0.25rem;
  color: var(--error-color);
  font-size: 1rem;
}

.account-danger-zone p {
  margin: 0 0 0.75rem;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.account-danger-zone .account-delete-form {
  display: grid;
  gap: 0.45rem;
  margin-top: 0;
}

.account-danger-zone label {
  font-size: 0.88rem;
}

.account-delete-row {
  display: flex;
  gap: 0.6rem;
}

.account-delete-row input {
  flex: 1;
  min-width: 0;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background-color: var(--bg-color);
  color: var(--text-color);
  font: inherit;
}

@media (max-width: 640px) {
  .account-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .account-header {
    flex-wrap: wrap;
  }

  /* The logout button goes under the name instead of squeezing it */
  .account-identity {
    flex-basis: calc(100% - 4.25rem);
  }

  /* Inactive tabs keep only their icon so the three tabs fit; the label stays for screen readers */
  .account-tab {
    padding-inline: 0.85rem;
  }

  .account-tab:not(.is-active) span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .account-panel {
    padding: 1.1rem;
  }

  .account-row,
  .account-delete-row {
    flex-direction: column;
    align-items: stretch;
  }
}

/* ---------- Home ---------- */
.home {
  width: min(100%, 880px);
  margin-inline: auto;
}

.home-heading,
.home-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.home-heading {
  margin-bottom: 1.5rem;
}

.home-eyebrow,
.home-date,
.home-section-heading > span {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.home-eyebrow {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 0.35rem;
  color: var(--primary-color);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.home-heading h1 {
  margin: 0;
}

.home-date {
  margin-top: 0.2rem;
}

.home-progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 1.75rem;
  padding: 1.2rem 1.35rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--surface-color);
}

.home-progress h2,
.home-progress p {
  margin: 0;
}

.home-progress h2 {
  margin-bottom: 0.25rem;
  color: var(--primary-color);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
}

.home-progress-count {
  font-size: 1.35rem;
}

.home-progress-count strong {
  font-weight: 700;
}

.home-progress-score,
.home-progress-label {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.home-progress-score {
  margin-top: 0.25rem !important;
}

.home-progress-meter {
  width: min(100%, 12rem);
  flex: 0 0 min(100%, 12rem);
}

.home-progress-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.4rem;
}

.home-progress-track {
  height: 0.45rem;
  overflow: hidden;
  border-radius: 999px;
  background: var(--bg-color);
}

.home-progress-track > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--primary-color);
}

.home-games,
.home-leaderboard {
  margin-top: 1.75rem;
}

.home-section-heading {
  margin-bottom: 0.7rem;
}

.home-section-heading h2 {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
}

.home-game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 0.65rem;
}

.home-game-card {
  display: flex;
  min-width: 0;
  min-height: 8.5rem;
  flex-direction: column;
  align-items: flex-start;
  padding: 0.9rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--surface-color);
}

.home-game-card--disabled {
  opacity: 0.7;
}

.home-game-card-top {
  display: flex;
  width: 100%;
  min-height: 1.6rem;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.home-game-card-top > i {
  color: var(--primary-color);
  font-size: 1.35rem;
}

.home-game-status {
  color: var(--text-muted);
  font-size: 0.7rem;
}

.home-game-status--daily {
  color: var(--primary-color);
}

.home-game-status--free {
  color: var(--text-muted);
}

.home-game-status--complete {
  color: var(--success-color, var(--text-muted));
}

.home-game-card h3 {
  margin: 0.55rem 0 0.35rem;
  font-size: 0.95rem;
}

.home-game-score {
  margin: 0 0 0.4rem;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.home-game-action {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: auto;
  color: var(--primary-color);
  font-size: 0.78rem;
  text-decoration: none;
}

.home-game-action:hover {
  text-decoration: underline;
}

.home-leaderboard-list {
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--surface-color);
  list-style: none;
}

.home-leaderboard-row {
  display: grid;
  min-height: 2.75rem;
  grid-template-columns: 1.5rem 1.5rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.65rem;
  padding: 0.45rem 0.8rem;
}

.home-leaderboard-row + .home-leaderboard-row {
  border-top: 1px solid var(--border-color);
}

.home-leaderboard-rank,
.home-leaderboard-score {
  color: var(--primary-color);
  font-variant-numeric: tabular-nums;
}

.home-leaderboard-rank {
  color: var(--text-muted);
  text-align: center;
}

.home-leaderboard-avatar {
  display: grid;
  width: 1.5rem;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 50%;
  background: var(--primary-color);
  color: #ffffff;
  font-size: 0.72rem;
}

.home-leaderboard-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-leaderboard-empty {
  margin: 0;
  padding: 1rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--surface-color);
  color: var(--text-muted);
}

.daily-challenge {
  margin: 1.5rem 0 2rem;
  padding: 1.2rem 0;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}

.daily-challenge-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.daily-challenge-heading h2,
.daily-challenge-heading p {
  margin: 0;
}

.daily-history-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  max-width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--surface-color);
  color: var(--text-color);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
  text-decoration: none;
  transition: color 0.18s ease, background-color 0.18s ease, border-color 0.18s ease;
}

.daily-history-link .ti {
  flex: 0 0 auto;
  color: var(--primary-color);
}

.daily-history-link:hover {
  border-color: var(--primary-color);
  background: color-mix(in srgb, var(--primary-color) 8%, var(--surface-color));
  color: var(--primary-color);
}

.daily-history-link:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 3px;
}

.daily-challenge-heading p,
.daily-challenge-item p {
  color: var(--text-muted);
}

.daily-challenge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
}

.daily-challenge-item {
  min-width: 0;
  padding: 0.9rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--surface-color);
}

.daily-challenge-item h3,
.daily-challenge-item p {
  margin: 0 0 0.65rem;
}

.daily-challenge-item p:last-child {
  margin: 0.65rem 0 0;
}

.daily-page {
  width: min(100%, 880px);
  margin-inline: auto;
}

.content-page-heading {
  margin: 0 0 1.5rem;
}

.content-page-heading h1 {
  margin: 0;
}

.page-eyebrow {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0 0 0.35rem;
  color: var(--primary-color);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.daily-page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
}

.daily-page-date {
  margin: 1.5rem 0 0.75rem;
}

.daily-history-challenge {
  display: flex;
  min-height: 8.5rem;
  flex-direction: column;
  align-items: flex-start;
}

.daily-history-challenge-top {
  display: flex;
  width: 100%;
  min-height: 1.6rem;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.daily-history-challenge-top > i {
  color: var(--primary-color);
  font-size: 1.35rem;
}

.daily-history-status {
  color: var(--text-muted);
  font-size: 0.7rem;
}

.daily-history-challenge h3 {
  margin-top: 0.55rem;
}

.daily-history-score {
  margin: 0 0 0.4rem;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.daily-history-action {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: auto;
  color: var(--primary-color);
  font-size: 0.78rem;
  text-decoration: none;
}

.daily-history-action:hover {
  text-decoration: underline;
}

.daily-history-section-heading {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 1.75rem 0 0.8rem;
}

.daily-history-section-heading h2 {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
}

.daily-history-count {
  display: inline-grid;
  min-width: 1.6rem;
  height: 1.6rem;
  padding-inline: 0.35rem;
  place-items: center;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  background: var(--surface-color);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.daily-history-list {
  display: grid;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--surface-color);
  list-style: none;
}

.daily-history-list li {
  min-width: 0;
}

.daily-history-entry {
  display: flex;
  min-height: 3.25rem;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0.85rem;
  color: var(--text-color);
  text-decoration: none;
  transition: background-color 0.18s ease, color 0.18s ease;
}

.daily-history-list li + li {
  border-top: 1px solid var(--border-color);
}

.daily-history-entry:hover {
  background: color-mix(in srgb, var(--primary-color) 7%, var(--surface-color));
  color: var(--primary-color);
}

.daily-history-entry--current {
  background: color-mix(in srgb, var(--primary-color) 8%, var(--surface-color));
}

.daily-history-entry:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 3px;
}

.daily-history-entry-date {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 0.65rem;
  font-weight: 600;
}

.daily-history-entry-date .ti {
  flex: 0 0 auto;
  color: var(--primary-color);
}

.daily-history-entry-arrow {
  flex: 0 0 auto;
  color: var(--text-muted);
}

.daily-history-entry:hover .daily-history-entry-arrow {
  color: var(--primary-color);
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0 2rem;
}

.game-card {
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 1.2rem;
  box-shadow: 0 2px 8px var(--shadow-color);
}

.game-card--soon {
  opacity: 0.6;
}

.game-card h3 {
  margin: 0.6rem 0 0.3rem;
  font-size: 1.05rem;
}

.game-card p {
  margin: 0 0 0.8rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.game-card-link {
  display: inline-block;
  padding: 0.4rem 0.9rem;
  background-color: var(--primary-color);
  color: #ffffff;
  border-radius: 6px;
  text-decoration: none;
  font-size: 0.9rem;
}

.game-card-link:hover {
  background-color: var(--primary-color-hover);
}

.changelog ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.changelog li {
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.8rem 1rem;
}

.changelog-date {
  display: block;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.changelog li p {
  margin: 0.3rem 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

h1, h2 {
  color: var(--text-color);
}

#gameContainer {
  width: min(100%, 800px);
  margin-inline: auto;
  text-align: center;
}

#gameContainer[data-completed="true"] #guessForm,
#gameContainer[data-completed="true"] #difficultySettingsBtn,
#gameContainer[data-completed="true"] #difficultyModal,
#gameContainer[data-completed="true"] #playerContainer,
#gameContainer[data-completed="true"] #songsButtonsContainer,
#gameContainer[data-completed="true"] .game-status,
#gameContainer[data-completed="true"] #titleHint,
#gameContainer[data-completed="true"] #refreshButton,
#gameContainer[data-completed="true"] #textLastGuesses,
#gameContainer[data-completed="true"] #guesses,
#gameContainer[data-completed="true"] #hintsBox,
#gameContainer[data-completed="true"] #hintHangmanPanel {
  display: none !important;
}

#gameTitle {
  margin-inline: auto;
  text-align: center;
}

.game-page {
  width: min(100%, 880px);
  margin-inline: auto;
}

.game-page .content-page-heading {
  margin-bottom: 1rem;
}

.game-page-title {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  color: var(--primary-color);
  font-size: 2rem;
  text-align: center;
}

.game-navigation {
  display: flex;
  width: min(100%, 800px);
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  margin: 0 auto 1.15rem;
}

.game-navigation-link {
  display: inline-flex;
  min-width: 0;
  min-height: 2.4rem;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--surface-color);
  color: var(--text-color);
  font-size: 0.85rem;
  line-height: 1.25;
  text-decoration: none;
}

.game-navigation-link:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.game-navigation-link--next {
  margin-left: auto;
  border-color: var(--primary-color);
  background: var(--primary-color);
  color: #ffffff;
}

.game-navigation-link--next:hover {
  background: var(--primary-color-hover);
  color: #ffffff;
}

.game-navigation-link strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.error-page {
  width: min(100%, 880px);
  margin-inline: auto;
}

.error-panel {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  padding: 1.1rem 1.2rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--surface-color);
}

.error-panel > i {
  margin-top: 0.2rem;
  color: var(--error-color);
  font-size: 1.25rem;
}

.error-panel h1,
.error-panel p {
  margin: 0;
}

.error-panel h1 {
  font-size: 1.1rem;
}

.error-panel p {
  margin-top: 0.35rem;
  color: var(--text-muted);
}

#horizontalRule {
    margin-top: 1.25rem;
    margin-bottom: 1.25rem;
    border-width: 0px 0px thin;
    border-style: solid;
    border-color: var(--horizontal-rule)
}

/* Anidle tables: each value is a coloured chip (green = right, red = wrong,
   yellow = close theme), in the same frame as the result card */
.anidle-table, .summary-table {
  width: 100%;
  min-width: 760px;
  border-collapse: separate;
  border-spacing: 0.3rem;
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  box-shadow: 0 5px 16px var(--shadow-color);
}

.anidle-table thead th, .summary-table thead th {
  padding: 0.45rem 0.4rem 0.2rem;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.anidle-table tbody td, .summary-table tbody td {
  padding: 0.3rem;
  background-color: color-mix(in srgb, var(--text-muted) 8%, var(--surface-color));
  border-radius: 8px;
  color: var(--text-color);
  font-size: 0.88rem;
  vertical-align: middle;
}

.difficulty-form {
  margin: 0;
}

.difficulty-settings-button {
  position: fixed;
  z-index: 950;
  right: 1.5rem;
  bottom: 1.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  margin: 0;
  padding: 0;
  appearance: none;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background-color: var(--surface-color);
  color: var(--text-color);
  cursor: pointer;
  font-size: 1.2rem;
  box-shadow: 0 4px 12px var(--shadow-color);
}

.difficulty-settings-button:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.difficulty-icon,
.difficulty-icon span {
  display: block;
}

.difficulty-icon {
  width: 1.35rem;
  height: 1.1rem;
  position: relative;
}

.difficulty-icon span {
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  border-radius: 2px;
  background-color: currentColor;
}

.difficulty-icon span::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 0.35rem;
  height: 0.35rem;
  transform: translate(-50%, -50%);
  border: 2px solid currentColor;
  border-radius: 50%;
  background-color: var(--surface-color);
}

.difficulty-icon span:nth-child(1) {
  top: 0;
}

.difficulty-icon span:nth-child(1)::after {
  left: 30%;
}

.difficulty-icon span:nth-child(2) {
  top: 0.45rem;
}

.difficulty-icon span:nth-child(2)::after {
  left: 70%;
}

.difficulty-icon span:nth-child(3) {
  top: 0.9rem;
}

.difficulty-icon span:nth-child(3)::after {
  left: 45%;
}

.modal.difficulty-modal {
  width: min(94vw, 900px);
}

.difficulty-preset-group {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.difficulty-preset {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2.5rem;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  background-color: var(--bg-color);
  color: var(--text-color);
  cursor: pointer;
  font-size: 0.75rem;
  text-align: center;
  transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.difficulty-preset input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.difficulty-preset:has(input:checked) {
  border-color: var(--primary-color);
  background-color: color-mix(in srgb, var(--primary-color) 16%, var(--surface-color));
  color: var(--primary-color);
}

.difficulty-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.difficulty-fields label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.difficulty-fields label span {
  min-height: 2.2em;
}

.difficulty-fields input,
.difficulty-fields select {
  width: 100%;
  padding: 0.5rem;
  background-color: var(--input-bg);
  color: var(--text-color);
  border: 1px solid var(--input-border);
  border-radius: 6px;
}

.format-fieldset {
  grid-column: 1 / -1;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.format-fieldset legend {
  min-height: 2.2em;
  margin-bottom: 0.3rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.format-options {
  display: grid;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  gap: 0.5rem;
}

.format-option {
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 0.35rem !important;
  min-height: auto !important;
  justify-content: center;
  padding: 0.4rem 0.5rem;
  min-width: 0;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background-color: var(--bg-color);
  color: var(--text-color) !important;
  font-size: 0.85rem;
  text-align: center;
  white-space: nowrap;
}

.format-option span {
  min-width: max-content;
  min-height: auto !important;
  overflow: visible;
  text-overflow: clip;
}

.format-option:has(input:checked) {
  border-color: var(--primary-color);
  background-color: var(--primary-color);
  color: #ffffff !important;
}

.format-option input {
  width: auto;
  accent-color: var(--primary-color);
}

.format-fieldset small {
  display: block;
  margin-top: 0.35rem;
  color: var(--text-muted);
  font-size: 0.75rem;
}

.difficulty-form > button {
  margin-top: 0.75rem;
  padding: 0.6rem 1.2rem;
  background-color: var(--primary-color);
  color: #ffffff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
}

.difficulty-form > button:hover {
  background-color: var(--primary-color-hover);
}

@media (max-width: 520px) {
  .difficulty-settings-button {
    right: 1rem;
    bottom: 1rem;
  }

  .difficulty-preset-group {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .difficulty-fields {
    grid-template-columns: 1fr;
  }

  /* One column: no need to keep labels aligned on two lines */
  .difficulty-fields label span,
  .format-fieldset legend {
    min-height: auto;
  }

  .format-options {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .modal-overlay:has(.difficulty-modal) {
    align-items: flex-end;
  }

  /* Phones: the settings take the full width, like a bottom sheet */
  .modal.difficulty-modal {
    width: 100%;
    max-height: calc(100vh - 1rem);
    max-height: calc(100dvh - 1rem);
    padding: 1rem;
    border-radius: 14px 14px 0 0;
  }

  .difficulty-modal .modal-header {
    top: -1rem;
    margin: -1rem -1rem 0.75rem;
    padding: 1rem 1rem 0.6rem;
  }
}

@media (min-width: 521px) and (max-width: 700px) {
  .format-options {
    grid-template-columns: repeat(2, minmax(130px, 1fr));
  }
}

.anime-title-primary {
  margin-bottom: 0.25rem;
  font-weight: 700;
}

.anime-title-secondary {
  margin-top: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-style: italic;
}

img {
  max-width: 100%;
  max-height: 400px;
  border-radius: 8px;
  box-shadow: 0 4px 12px var(--shadow-color);
}

#guessForm {
  display: flex;
  gap: 0.5rem;
  margin: 1rem 0;
}

.autocomplete-container {
  position: relative;
  flex: 1;
  min-width: 0;
}

#guessInput {
  width: 100%;
  padding: 0.6rem 0.8rem;
  background-color: var(--input-bg);
  color: var(--text-color);
  border: 1px solid var(--input-border);
  border-radius: 6px;
  font-size: 1rem;
}

.autocomplete-suggestions {
  position: absolute;
  z-index: 10;
  top: calc(100% + 0.25rem);
  right: 0;
  left: 0;
  max-height: 220px;
  overflow-y: auto;
  padding: 0.25rem;
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  box-shadow: 0 4px 12px var(--shadow-color);
  text-align: left;
}

.autocomplete-suggestion {
  display: block;
  width: 100%;
  padding: 0.55rem 0.65rem;
  overflow: hidden;
  background: none;
  border: none;
  border-radius: 4px;
  color: var(--text-color);
  cursor: pointer;
  font: inherit;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.autocomplete-suggestion:hover,
.autocomplete-suggestion.active {
  background-color: var(--primary-color);
  color: #ffffff;
}

#guessForm > button {
  padding: 0.6rem 1.2rem;
  background-color: var(--primary-color);
  color: #ffffff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
}

#guessForm > button:hover {
  background-color: var(--primary-color-hover);
}

.hints-box {
  margin: 0.85rem 0;
  padding: 0.85rem 1rem;
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  box-shadow: 0 5px 16px var(--shadow-color);
}

.hint-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
  overflow-x: auto;
}

.hint-tab {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  padding: 0.5rem 0.7rem;
  background-color: transparent;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-color);
  cursor: pointer;
  font: inherit;
}

.hint-tab:disabled {
  color: var(--text-muted);
  cursor: default;
  opacity: 0.6;
}

.hint-tab-lock {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.72rem;
}

.hint-tab.is-unlocked .hint-tab-lock {
  display: none;
}

.hint-tab[aria-selected="true"] {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
  color: #ffffff;
}

.hint-tab:not([aria-selected="true"]):not(:disabled):hover {
  background-color: var(--bg-color);
  border-color: var(--border-color);
  color: var(--text-color);
}

.hint-tab[hidden],
.hint-panel[hidden] {
  display: none;
}

.hint-panel {
  min-height: 4rem;
  display: grid;
  place-items: center;
}

#hintSynopsis {
  white-space: pre-line;
}

#hint {
  margin: 0;
}

#hint strong {
  white-space: pre-wrap;
  letter-spacing: 0.1em;
}

.hint-image {
  display: block;
  width: min(100%, 360px);
  max-height: 320px;
  object-fit: contain;
  border-radius: 8px;
}

/* Message of the last guess: a pill in the status bar (partials/game-status.ejs) */
#result.game-success,
#result.game-failure,
#result.game-close {
  border: 1px solid;
  font-weight: 700;
}

#result.game-success {
  background-color: var(--success-bg-color);
  border-color: var(--success-border-color);
  color: var(--success-text-color);
}

#result.game-failure {
  background-color: var(--failure-bg-color);
  border-color: var(--failure-border-color);
  color: var(--failure-text-color);
}

/* "Close" (a related anime) = dashed green outline, "half right", like in the Anidle table */
#result.game-close {
  background-color: transparent;
  border: 1px dashed var(--success-border-color);
  color: var(--text-color);
}

#refreshButton {
  margin-bottom: 1rem;
  margin-inline: auto;
  padding: 0.6rem 1.2rem;
  background-color: var(--primary-color);
  color: #ffffff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
}

#refreshButton:hover {
  background-color: var(--primary-color-hover);
}

#refreshButton:focus-visible {
  outline: 3px solid var(--primary-color-hover);
  outline-offset: 3px;
  box-shadow: 0 0 0 4px rgba(20, 110, 180, 0.2);
}

/* Wrong guesses: chips, struck through; close ones with a dashed green outline, skips in italics */
#guesses {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem;
}

#guesses > div {
  margin: 0;
  padding: 0.2rem 0.7rem;
  background-color: var(--input-bg);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-decoration: line-through;
}

#guesses > div.close-guess {
  background-color: transparent;
  border: 1px dashed var(--success-border-color);
  color: var(--text-color);
  text-decoration: none;
}

#guesses > div.oq-guess--skipped {
  font-style: italic;
  text-decoration: none;
}

#guesses > div.result-guess--win {
  background-color: var(--success-bg-color);
  border-color: var(--success-border-color);
  color: var(--success-text-color);
  text-decoration: none;
}

#textLastGuesses {
  margin: 1rem 0 0.45rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ---------- Settings modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: var(--modal-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-overlay[hidden] {
  display: none;
}

.modal {
  background-color: var(--surface-color);
  color: var(--text-color);
  border-radius: 10px;
  width: min(90vw, 400px);
  /* Long settings forms scroll inside the window instead of overflowing the screen (phones) */
  max-height: calc(100vh - 2rem);
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1.5rem;
  box-shadow: 0 8px 24px var(--shadow-color);
}

/* Title and close button stay visible while the settings scroll */
.difficulty-modal .modal-header {
  position: sticky;
  top: -1.5rem;
  z-index: 2;
  margin: -1.5rem -1.5rem 1rem;
  padding: 1.5rem 1.5rem 0.75rem;
  background-color: var(--surface-color);
  border-bottom: 1px solid var(--border-color);
}

/* "Apply" stays reachable at the bottom */
.difficulty-form > button[type="submit"] {
  position: sticky;
  bottom: 0;
  z-index: 2;
  width: 100%;
  box-shadow: 0 -0.75rem 1rem var(--surface-color);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.2rem;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-color);
  cursor: pointer;
}

.modal-body p {
  margin: 0 0 0.5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.theme-options {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.theme-option {
  padding: 0.6rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background-color: var(--bg-color);
  color: var(--text-color);
  cursor: pointer;
  text-align: left;
  font-size: 1rem;
}

.theme-option:hover {
  border-color: var(--primary-color);
}

.theme-option.active {
  border-color: var(--primary-color);
  background-color: var(--primary-color);
  color: #ffffff;
}

.modal-field-label {
  margin: 1.25rem 0 0.5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.lang-select {
  width: 100%;
  padding: 0.6rem 0.8rem;
  background-color: var(--input-bg);
  color: var(--text-color);
  border: 1px solid var(--input-border);
  border-radius: 6px;
  font: inherit;
  cursor: pointer;
}

.lang-select:hover {
  border-color: var(--primary-color);
}

.lang-select:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

.lang-select option {
  background-color: var(--surface-color);
  color: var(--text-color);
}

.language-settings {
  margin-top: 15px;
}

.title-language-settings {
  margin-top: 15px;
}

.Link {
  width: 1.5rem;
  height: 1.5rem;
  margin-right: 0.5rem;
  text-decoration: none;
}

#links a {
  text-decoration: none;
}

#anidleTable td p, #summaryTable td p {
  display: inline-block;
  margin: 0.12rem;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  line-height: 1.35;
}

/* Palette: right = filled green, close theme = dashed green outline ("half right"),
   wrong = grey (the date and score keep their arrow) */
#anidleTable .goodAnswer, #summaryTable .goodAnswer,
#anidleTable .tag-rank-high, #summaryTable .tag-rank-high {
  background-color: var(--success-bg-color);
  box-shadow: inset 0 0 0 1px var(--success-border-color);
  color: var(--success-text-color);
}

#anidleTable .wrongAnswer, #summaryTable .wrongAnswer {
  background-color: color-mix(in srgb, var(--text-muted) 14%, var(--surface-color));
  color: var(--text-muted);
}

#anidleTable .tag-rank-medium, #summaryTable .tag-rank-medium {
  background-color: transparent;
  outline: 1px dashed var(--success-border-color);
  outline-offset: -1px;
  color: var(--text-color);
}

.external-connections {
  display: grid;
  gap: 0.65rem;
  max-width: 32rem;
  margin-top: 1rem;
}

.external-connection {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
}

.external-connection > div {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.external-connection span {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.external-connection-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(7.5rem, max-content);
  align-items: center;
  gap: 0.55rem;
}

.external-connection-actions form {
  display: contents;
}

.external-connection-actions .anime-source-toggle {
  grid-column: 1;
  min-width: 0;
}

.external-connection-actions form:first-child .account-link-button,
.external-connection-actions form:last-child .account-link-button {
  grid-column: 2;
  width: 100%;
  text-align: center;
}

.anime-source-toggle,
.anime-list-status-option,
.personal-list-setting label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.anime-source-toggle,
.anime-list-status-option,
.personal-list-setting label {
  color: var(--text-color);
  font-size: 0.9rem;
}

.account-subsection-title {
  margin: 1.4rem 0 0.25rem;
  font-size: 1rem;
}

.anime-list-status-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-top: 0.75rem;
}

.anime-list-status-option input,
.anime-source-toggle input,
.personal-list-setting input {
  accent-color: var(--primary-color);
}

.personal-list-setting {
  display: grid;
  gap: 0.4rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--border-color);
}

.personal-list-setting small {
  color: var(--text-muted);
}

.account-link-button {
  display: inline-block;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--border-color);
  border-radius: 5px;
  background: transparent;
  color: var(--primary-color);
  font: inherit;
  font-size: 0.85rem;
  text-decoration: none;
  cursor: pointer;
}

.account-link-button:hover {
  border-color: var(--primary-color);
}

@media (max-width: 640px) {
  .external-connection {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 0.75rem;
  }

  .external-connection-actions {
    width: 100%;
  }

  .daily-challenge-heading {
    align-items: flex-start;
    flex-direction: column;
  }
}
/* ===== Higher or Lower ===== */
.hl-options {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem 1.5rem;
  margin-bottom: 1.25rem;
}

.hl-option-group {
  display: inline-flex;
  padding: 0.25rem;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  background-color: var(--surface-color);
}

.hl-option {
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-decoration: none;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.hl-option:hover {
  color: var(--text-color);
}

.hl-option--active {
  background-color: color-mix(in srgb, var(--primary-color) 18%, var(--surface-color));
  color: var(--primary-color);
  font-weight: 600;
}

.hl-scorebar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1.75rem;
  margin-bottom: 0.75rem;
  color: var(--text-muted);
}

.hl-scorebar strong {
  color: var(--text-color);
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
}

.hl-scorebar strong.hl-streak--target {
  color: var(--success-color);
}

.hl-question {
  margin: 0 auto 1rem;
  color: var(--text-color);
  font-weight: 600;
}

.hl-arena {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: stretch;
  gap: 1rem;
}

.hl-versus {
  align-self: center;
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border: 1px solid var(--border-color);
  border-radius: 50%;
  background-color: var(--surface-color);
  color: var(--text-muted);
  font-weight: 700;
}

.hl-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 2px solid var(--border-color);
  border-radius: 10px;
  background-color: var(--surface-color);
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.hl-card--correct {
  border-color: var(--success-border-color);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--success-border-color) 25%, transparent);
}

.hl-card--wrong {
  border-color: var(--failure-border-color);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--failure-border-color) 25%, transparent);
}

.hl-card-media {
  position: relative;
  overflow: hidden;
  height: 260px;
  background-color: var(--input-bg);
}

.hl-card-media::before {
  content: "";
  position: absolute;
  inset: -20px;
  background: var(--hl-cover) center / cover no-repeat;
  filter: blur(18px) brightness(0.6);
}

.hl-card-image {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.hl-card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.85rem 1rem 1rem;
}

.hl-card-title {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.hl-card-meta {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.hl-card-value {
  display: flex;
  flex-direction: column;
  margin: auto 0 0;
  padding-top: 0.5rem;
}

.hl-value {
  color: var(--primary-color);
  font-size: 1.9rem;
  font-variant-numeric: tabular-nums;
}

.hl-unit {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.hl-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.hl-choices--placeholder {
  visibility: hidden;
}

.hl-game-over[hidden],
.hl-keyboard-hint[hidden] {
  display: none;
}

.hl-choice {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.65rem 0.5rem;
  border: none;
  border-radius: 6px;
  background-color: var(--primary-color);
  color: #ffffff;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
}

.hl-choice:hover:not(:disabled) {
  background-color: var(--primary-color-hover);
}

.hl-choice:disabled {
  cursor: wait;
  opacity: 0.6;
}

.hl-choice:focus-visible {
  outline: 3px solid var(--primary-color-hover);
  outline-offset: 2px;
}

.hl-keyboard-hint {
  margin: 0.9rem 0 0;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.hl-game-over {
  margin: 1.25rem auto 0;
  padding: 1rem;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background-color: var(--surface-color);
}

.hl-game-over h2 {
  margin: 0 0 0.5rem;
}

.hl-game-over p {
  margin: 0 0 0.75rem;
}

.hl-login-hint {
  color: var(--text-muted);
  font-size: 0.9rem;
}

@media (max-width: 640px) {
  .hl-arena {
    grid-template-columns: 1fr;
    gap: 0.6rem;
  }

  .hl-versus {
    justify-self: center;
    width: 2.4rem;
    height: 2.4rem;
    font-size: 0.85rem;
  }

  .hl-card {
    flex-direction: row;
  }

  .hl-card-media {
    width: 110px;
    height: auto;
    min-height: 160px;
    flex-shrink: 0;
  }

  .hl-card-body {
    text-align: left;
  }

  .hl-value {
    font-size: 1.5rem;
  }

  .hl-keyboard-hint,
  #hlLeft .hl-choices--placeholder {
    display: none;
  }
}

/* ---------- Home: daily challenge vs free play ---------- */
.home-mode {
  margin-top: 1.5rem;
  padding: 1.2rem 1.25rem 1.3rem;
  border: 1px solid var(--border-color);
  border-radius: 12px;
}

.home-mode--daily {
  border-color: color-mix(in srgb, var(--primary-color) 45%, var(--border-color));
  background: color-mix(in srgb, var(--primary-color) 8%, var(--bg-color));
}

.home-mode--free {
  background: var(--bg-color);
}

.home-mode-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.home-mode-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  font-size: 1.2rem;
}

.home-mode-title > i {
  color: var(--primary-color);
  font-size: 1.35rem;
}

.home-mode-description {
  max-width: 48rem;
  margin: 0.3rem 0 0;
  color: var(--text-muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.home-mode .home-progress {
  margin-bottom: 0.9rem;
  padding: 0.85rem 1rem;
}

.home-mode .home-game-card {
  min-height: 7.5rem;
}

.home-game-card--daily {
  border-color: color-mix(in srgb, var(--primary-color) 30%, var(--border-color));
}

.home-game-card--done {
  border-color: color-mix(in srgb, var(--success-color) 40%, var(--border-color));
}

.home-game-status--complete {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}

.home-game-action--primary {
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: var(--primary-color);
  color: #ffffff;
  font-weight: 600;
}

.home-game-action--primary:hover {
  background: var(--primary-color-hover);
  text-decoration: none;
}

.home-game-description {
  margin: 0 0 0.75rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  line-height: 1.4;
}

.home-upcoming {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin: 0.9rem 0 0;
  color: var(--text-muted);
  font-size: 0.8rem;
}

@media (max-width: 640px) {
  .home-mode {
    padding: 1rem 0.9rem 1.1rem;
  }

  .home-mode-heading {
    flex-direction: column;
  }

  .home-progress {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .home-progress-meter {
    width: 100%;
    flex-basis: auto;
  }
}

.home-mode--free .home-game-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
}

/* Leaderboard inside the daily challenge panel */
.home-mode .home-leaderboard {
  margin-top: 1.25rem;
}

@media (min-width: 700px) {
  .home-leaderboard-list--split {
    display: grid;
    grid-auto-flow: column;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(5, auto);
  }

  .home-leaderboard-list--split .home-leaderboard-row:nth-child(-n + 5) {
    border-right: 1px solid var(--border-color);
  }

  .home-leaderboard-list--split .home-leaderboard-row:nth-child(6) {
    border-top: 0;
  }
}

/* The logged-in player's own line in the daily leaderboard */
.home-leaderboard-row--me {
  background: color-mix(in srgb, var(--primary-color) 14%, var(--surface-color));
}

.home-leaderboard-you {
  color: var(--primary-color);
  font-size: 0.8rem;
  font-weight: 600;
}

.home-leaderboard-gap {
  margin: 0.15rem 0;
  color: var(--text-muted);
  line-height: 1;
  text-align: center;
}

/* ---------- Guess the Opening ---------- */
.oq-rules {
  max-width: 34rem;
  margin: 0 auto 1.25rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.oq-game {
  max-width: 40rem;
  margin: 0 auto;
}

.oq-screen {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  margin-bottom: 0.75rem;
  background-color: #000000;
  border-radius: 14px;
  box-shadow: 0 5px 16px var(--shadow-color);
}

.oq-screen[hidden] {
  display: none;
}

.oq-screen video {
  cursor: pointer;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: filter 0.6s ease, transform 0.6s ease;
}

/* Scaled up a little so the blurred edges stay out of the frame */
.oq-screen--blur video {
  filter: blur(var(--oq-blur, 30px)) saturate(1.2);
  transform: scale(1.15);
}

.oq-player {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  box-shadow: 0 5px 16px var(--shadow-color);
}

.oq-play {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
  padding: 0;
  background-color: var(--primary-color);
  border: none;
  border-radius: 50%;
  color: #ffffff;
  cursor: pointer;
  font-size: 1.5rem;
  transition: background-color 0.2s ease, transform 0.15s ease;
}

.oq-play:hover {
  background-color: var(--primary-color-hover);
  transform: scale(1.05);
}

.oq-play:focus-visible {
  outline: 3px solid var(--primary-color-hover);
  outline-offset: 3px;
}

.oq-play--playing {
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--primary-color) 25%, transparent);
}

.oq-player-body {
  flex: 1;
  min-width: 0;
}

.oq-progress {
  position: relative;
  height: 0.6rem;
  overflow: hidden;
  background-color: color-mix(in srgb, var(--text-muted) 22%, transparent);
  border-radius: 999px;
  cursor: pointer;
}

.oq-progress--snippet {
  cursor: default;
}

.oq-progress-unlocked,
.oq-progress-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
}

.oq-progress-unlocked {
  background-color: color-mix(in srgb, var(--primary-color) 30%, var(--input-bg));
  transition: width 0.3s ease;
}

.oq-progress-fill {
  background-color: var(--primary-color);
}

.oq-progress-mark {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background-color: var(--surface-color);
}

.oq-player-meta {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.45rem;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

.oq-loading[hidden] {
  display: none;
}

.oq-volume {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-muted);
}

.oq-volume input {
  width: 5.5rem;
  accent-color: var(--primary-color);
}

#guessForm > button.oq-skip {
  background-color: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-color);
  white-space: nowrap;
}

#guessForm > button.oq-skip:hover {
  background-color: var(--input-bg);
  border-color: var(--primary-color);
}

@media (max-width: 640px) {
  .oq-player {
    flex-wrap: wrap;
    padding: 0.85rem;
  }

  .oq-volume {
    width: 100%;
    justify-content: flex-end;
  }

  #guessForm:has(.oq-skip) {
    flex-wrap: wrap;
  }

  #guessForm:has(.oq-skip) .autocomplete-container {
    flex-basis: 100%;
  }
}

/* Snippet steps only make sense while the progressive rule applies */
.oq-progress:not(.oq-progress--snippet) .oq-progress-mark {
  display: none;
}

.oq-settings-title {
  margin: 1.25rem 0 0.6rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.difficulty-fields input:disabled {
  opacity: 0.5;
}

/* Timed rule: countdown above the player */
.oq-countdown {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  width: fit-content;
  margin: 0 auto 0.75rem;
  padding: 0.35rem 1rem;
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.oq-countdown strong {
  color: var(--text-color);
  font-size: 1.4rem;
}

.oq-countdown--running {
  border-color: var(--primary-color);
}

.oq-countdown--running strong {
  color: var(--primary-color);
}

.oq-countdown--urgent {
  border-color: var(--error-color);
}

.oq-countdown--urgent strong {
  color: var(--error-color);
}

/* ---------- Guess the Opening: mode badge and settings by mode ---------- */
.oq-mode-badge {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto 0.75rem;
  padding: 0.45rem 1rem;
  background-color: color-mix(in srgb, var(--primary-color) 12%, var(--surface-color));
  border: 1px solid color-mix(in srgb, var(--primary-color) 45%, var(--border-color));
  border-radius: 999px;
  color: var(--text-color);
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
}

.oq-mode-badge:hover {
  border-color: var(--primary-color);
}

.oq-mode-badge > .ti:first-child,
.oq-mode-badge strong {
  color: var(--primary-color);
}

.oq-mode-badge-edit {
  margin-left: 0.25rem;
  color: var(--text-muted);
}

.oq-mode-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
}

.oq-mode-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.85rem 0.5rem;
  background-color: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.oq-mode-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.oq-mode-card .ti {
  color: var(--primary-color);
  font-size: 1.5rem;
}

.oq-mode-card strong {
  color: var(--text-color);
  font-size: 0.9rem;
}

.oq-mode-card small {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.oq-mode-card:has(input:checked) {
  background-color: color-mix(in srgb, var(--primary-color) 14%, var(--surface-color));
  border: 2px solid var(--primary-color);
}

.oq-mode-card:has(input:focus-visible) {
  outline: 3px solid var(--primary-color-hover);
  outline-offset: 2px;
}

.oq-mode-panel {
  margin-top: 0.6rem;
  padding: 0.75rem 0.9rem;
  background-color: var(--bg-color);
  border-radius: 10px;
}

.oq-mode-panel[hidden],
.oq-blur-field[hidden] {
  display: none;
}

.oq-mode-panel small {
  display: block;
  margin-top: 0.5rem;
  color: var(--text-muted);
  font-size: 0.75rem;
}

.oq-field-label {
  margin: 0.75rem 0 0.4rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.oq-mode-panel .oq-field-label:first-child {
  margin-top: 0;
}

.oq-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
}

.oq-chips .difficulty-preset {
  position: relative;
  min-height: 2.1rem;
  padding: 0.35rem 0.85rem;
  font-size: 0.8rem;
}

.oq-blur-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-top: 0.6rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.oq-range {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.oq-range input {
  flex: 1;
  accent-color: var(--primary-color);
}

.oq-range output {
  min-width: 1.5rem;
  color: var(--text-color);
  font-weight: 600;
  text-align: right;
}

.oq-advanced {
  margin-top: 1.25rem;
  padding: 0.6rem 0.9rem;
  border: 1px solid var(--border-color);
  border-radius: 10px;
}

.oq-advanced summary {
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
}

.oq-advanced[open] summary {
  margin-bottom: 0.75rem;
}

@media (max-width: 520px) {
  .oq-mode-card {
    padding: 0.65rem 0.3rem;
  }

  .oq-mode-card small {
    display: none;
  }
}

/* Visually hidden, still read by screen readers */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Multiplayer ---------- */
.mp-intro {
  max-width: 36rem;
  margin: 0 auto 1.5rem;
  color: var(--text-muted);
}

.mp-error {
  max-width: 36rem;
  margin: 0 auto 1rem;
}

.mp-home-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  max-width: 44rem;
  margin: 0 auto;
}

.mp-home-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1.5rem;
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  box-shadow: 0 5px 16px var(--shadow-color);
  text-align: center;
}

.mp-home-card > .ti {
  color: var(--primary-color);
  font-size: 2rem;
}

.mp-home-card h2 {
  margin: 0;
  font-size: 1.15rem;
}

.mp-home-card p {
  margin: 0 0 0.5rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.mp-join-form {
  display: flex;
  gap: 0.5rem;
  width: 100%;
}

.mp-join-form input {
  flex: 1;
  min-width: 0;
  padding: 0.6rem 0.8rem;
  background-color: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 6px;
  color: var(--text-color);
  font-size: 1.1rem;
  letter-spacing: 0.2em;
  text-align: center;
  text-transform: uppercase;
}

.mp-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1.1rem;
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-color);
  cursor: pointer;
  font: inherit;
  font-size: 0.95rem;
  text-decoration: none;
}

.mp-button:hover {
  border-color: var(--primary-color);
}

.mp-button--primary {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
  color: #ffffff;
}

.mp-button--primary:hover {
  background-color: var(--primary-color-hover);
}

.mp-button--ghost {
  background-color: transparent;
}

.mp-button--wide {
  width: 100%;
  margin-top: 1rem;
}

.mp-button[hidden] {
  display: none;
}

.mp-muted {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.mp-room {
  max-width: 64rem;
  margin: 0 auto;
}

.mp-room-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
  text-align: left;
}

.mp-room-eyebrow {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.mp-room-code {
  margin: 0;
  color: var(--primary-color);
  font-size: 2rem;
  letter-spacing: 0.15em;
}

.mp-room-actions {
  display: flex;
  gap: 0.5rem;
}

.mp-status {
  margin: 0 0 1rem;
  padding: 0.6rem 1rem;
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

.mp-status[hidden] {
  display: none;
}

.mp-status--error {
  border-color: var(--failure-border-color);
  color: var(--error-color);
}

.mp-lobby {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  text-align: left;
}

.mp-lobby[hidden],
.mp-starting[hidden],
.mp-game[hidden],
.mp-podium[hidden],
.mp-reveal[hidden],
#mpPlayArea[hidden] {
  display: none;
}

.mp-panel {
  padding: 1.25rem;
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 14px;
}

.mp-panel h2 {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
}

.mp-players {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.mp-player {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.6rem;
  background-color: var(--bg-color);
  border-radius: 10px;
}

.mp-player--you {
  outline: 1px solid color-mix(in srgb, var(--primary-color) 50%, transparent);
}

.mp-player--offline {
  opacity: 0.5;
}

.mp-avatar {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  background-color: hsl(var(--mp-hue, 250) 55% 45%);
  border-radius: 50%;
  color: #ffffff;
  font-weight: 700;
}

.mp-player-name {
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mp-badge {
  display: inline-flex;
  color: var(--text-muted);
}

.mp-badge--host {
  color: #eab308;
}

.mp-badge--found {
  color: var(--success-color);
}

.mp-badge--out {
  color: var(--error-color);
}

.mp-ready {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.mp-ready--yes {
  color: var(--success-color);
  font-weight: 600;
}

.mp-kick {
  padding: 0.2rem;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
}

.mp-kick:hover {
  color: var(--error-color);
}

.mp-settings {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.mp-settings label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.mp-settings select {
  padding: 0.5rem;
  background-color: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 6px;
  color: var(--text-color);
}

.mp-settings select:disabled {
  opacity: 0.8;
  cursor: default;
}

.mp-starting {
  padding: 3rem 1rem;
}

.mp-starting-label {
  margin: 0;
  color: var(--text-muted);
  font-size: 1.1rem;
}

.mp-starting-count {
  margin: 0.5rem 0 0;
  color: var(--primary-color);
  font-size: 4rem;
  font-weight: 800;
}

.mp-game {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 16rem;
  gap: 1rem;
  align-items: start;
}

.mp-round-bar {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.4rem;
  font-weight: 600;
}

.mp-round-timer strong {
  color: var(--primary-color);
  font-variant-numeric: tabular-nums;
}

.mp-timer-track {
  height: 0.35rem;
  margin-bottom: 0.75rem;
  overflow: hidden;
  background-color: color-mix(in srgb, var(--text-muted) 22%, transparent);
  border-radius: 999px;
}

.mp-timer-fill {
  height: 100%;
  background-color: var(--primary-color);
  transition: width 0.2s linear;
}

.mp-timer-fill--urgent {
  background-color: var(--error-color);
}

.mp-screen video {
  cursor: default;
}

.mp-audio-only {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-color);
  font-size: 4rem;
}

.mp-audio-only[hidden] {
  display: none;
}

.mp-media-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.mp-media-controls .oq-volume {
  margin-left: auto;
}

.mp-feedback {
  min-height: 1.5em;
  margin: 0.25rem 0;
  font-weight: 600;
}

.mp-feedback--success {
  color: var(--success-color);
}

.mp-feedback--wrong,
.mp-feedback--error {
  color: var(--error-color);
}

.mp-feedback--close {
  color: #e0a800;
}

.mp-history {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
}

.mp-history li {
  padding: 0.25rem 0.6rem;
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  font-size: 0.85rem;
  text-decoration: line-through;
}

.mp-history li.close-guess {
  text-decoration: none;
}

.mp-reveal-body {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
  align-items: flex-start;
}

.mp-reveal-body img {
  width: 9rem;
  max-height: 13rem;
  object-fit: cover;
}

.mp-round-results {
  flex: 1;
  min-width: 12rem;
  margin: 0;
  padding: 0;
  list-style: none;
  text-align: left;
}

.mp-round-results li,
.mp-score,
.mp-rank {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.6rem;
  border-bottom: 1px solid var(--border-color);
}

.mp-round-results li span,
.mp-score-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mp-round-results small {
  color: var(--text-muted);
  font-weight: 400;
}

.mp-side {
  position: sticky;
  top: 1rem;
  padding: 1rem;
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  text-align: left;
}

.mp-side h2 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.mp-scoreboard,
.mp-ranking {
  margin: 0;
  padding: 0;
  list-style: none;
}

.mp-score--you {
  background-color: color-mix(in srgb, var(--primary-color) 12%, transparent);
  border-radius: 6px;
}

.mp-score strong,
.mp-rank strong {
  font-variant-numeric: tabular-nums;
}

.mp-feed {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  max-height: 14rem;
  margin: 0.75rem 0 0;
  padding: 0;
  overflow-y: auto;
  color: var(--text-muted);
  font-size: 0.8rem;
  list-style: none;
}

.mp-feed--found {
  color: var(--success-color);
}

.mp-podium {
  max-width: 30rem;
  margin: 0 auto;
}

.mp-rank {
  font-size: 1.05rem;
}

.mp-rank-position {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  background-color: var(--bg-color);
  border-radius: 50%;
  font-weight: 700;
}

.mp-rank--gold .mp-rank-position {
  background-color: #eab308;
  color: #1a1a1a;
}

.mp-rank--silver .mp-rank-position {
  background-color: #cbd5e1;
  color: #1a1a1a;
}

.mp-rank--bronze .mp-rank-position {
  background-color: #d97706;
  color: #ffffff;
}

.mp-rank--gold {
  font-size: 1.25rem;
}

.mp-podium-actions {
  margin-top: 1.25rem;
}

.mp-podium-actions p[hidden] {
  display: none;
}

@media (max-width: 800px) {
  .mp-game {
    grid-template-columns: 1fr;
  }

  .mp-side {
    position: static;
  }
}

@media (max-width: 520px) {
  .mp-settings {
    grid-template-columns: 1fr;
  }

  .mp-room-code {
    font-size: 1.6rem;
  }
}

/* Multiplayer: BlurGuess image and Blindtest tracks */
.mp-screen video[hidden],
.mp-image[hidden],
.mp-tracks[hidden] {
  display: none;
}

.mp-image {
  display: block;
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: contain;
  border-radius: 0;
  box-shadow: none;
}

.mp-tracks {
  position: absolute;
  right: 0;
  bottom: 0.75rem;
  left: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem;
}

.mp-track {
  padding: 0.3rem 0.75rem;
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.mp-track--current {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
  color: #ffffff;
}

.mp-track--done {
  color: var(--text-color);
}

.mp-hint-letters {
  min-height: 1.4em;
  margin: 0.4rem 0;
  font-family: monospace;
  font-size: 1.2rem;
  letter-spacing: 0.15em;
}

.mp-games {
  grid-column: 1 / -1;
}

.mp-games .format-options {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

/* Shared settings window: a range field takes the whole row */
.difficulty-field--wide {
  grid-column: 1 / -1;
}

/* Multiplayer: players with a linked anime list, anime source setting */
.mp-badge--list {
  color: var(--primary-color);
}

.mp-setting--wide {
  grid-column: 1 / -1;
}

.mp-setting--wide small[hidden] {
  display: none;
}

/* ---------- End-of-game result card (partials/result-card.ejs) ----------
   Layout "A": the game's picture or video (.result-media) on the left, the card on the
   right. One column on phones, with the "play again" button kept at the bottom of the
   screen. Games without a picture (Anidle) show the card alone, as a banner. */
.result-layout {
  display: block;
}

.result-card {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  margin: 1rem 0;
  padding: 1rem 1.15rem;
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  box-shadow: 0 5px 16px var(--shadow-color);
  text-align: left;
}

.result-card[hidden],
.result-stat[hidden],
.result-guesses-slot[hidden],
.result-detail[hidden] {
  display: none;
}

.result-card--cover {
  flex-direction: row;
  align-items: flex-start;
}

.result-card .result-card-cover {
  flex-shrink: 0;
  width: 6rem;
  aspect-ratio: 2 / 3;
  max-height: none;
  object-fit: cover;
  border-radius: 10px;
}

.result-card-cover:not([src]) {
  display: none;
}

.result-card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.result-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.result-verdict {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  padding: 0.25rem 0.8rem;
  border: 1px solid;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 700;
}

.result-verdict--won {
  background-color: var(--success-bg-color);
  border-color: var(--success-border-color);
  color: var(--success-text-color);
}

.result-verdict--lost {
  background-color: var(--failure-bg-color);
  border-color: var(--failure-border-color);
  color: var(--failure-text-color);
}

.result-links {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.result-links .Link {
  margin: 0;
  box-shadow: none;
}

.result-card-titles .anime-title-primary {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.25;
}

.result-card-titles .anime-title-secondary {
  margin: 0.2rem 0 0;
}

.result-detail {
  margin: 0.45rem 0 0;
  font-size: 0.95rem;
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(5.5rem, 1fr));
  gap: 0.5rem;
  margin: 0;
}

.result-stat {
  padding: 0.5rem 0.75rem;
  background-color: color-mix(in srgb, var(--text-muted) 12%, var(--surface-color));
  border-radius: 10px;
}

.result-stat dt {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.result-stat dd {
  margin: 0.1rem 0 0;
  font-size: 1.35rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.result-stat .result-stat-score {
  color: var(--primary-color);
}

.result-guesses-label {
  margin: 0 0 0.4rem;
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* In the card the chips start on the left (they are centered under the game) */
.result-guesses-slot #guesses {
  justify-content: flex-start;
}

.result-card-actions {
  display: flex;
}

.result-card #refreshButton {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
}

/* Game over: the result card replaces the form, the messages and the guess list */
.game-over #guessForm,
.game-over #result,
.game-over .game-status,
.game-over #textLastGuesses,
.game-over #titleHint,
.game-over #hintsBox,
.game-over #hintHangmanPanel,
.game-page.is-over .oq-rules {
  display: none !important;
}

.result-media > :first-child {
  margin-top: 0;
}

/* Room between the result and the buttons under the game (daily challenge navigation) */
.game-over .result-layout {
  margin-bottom: 1.5rem;
}

@media (min-width: 760px) {
  .game-over .result-layout:has(> .result-media) {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
  }

  .game-over .result-layout:has(> .result-media) > .result-card {
    margin: 0;
  }

  .oq-game.game-over {
    max-width: none;
  }

  .game-over .result-media #animeImage {
    display: block;
    max-height: 28rem;
    margin-inline: auto;
  }

  /* Card alone (Anidle, daily challenge already played): titles and stats side by side */
  .result-layout:not(:has(> .result-media)) .result-card-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(12rem, auto);
    align-items: start;
    gap: 0.9rem 1.5rem;
  }

  .result-layout:not(:has(> .result-media)) .result-card-body > :not(.result-card-titles, .result-stats) {
    grid-column: 1 / -1;
  }
}

@media (max-width: 759px) {
  .result-card {
    padding: 0.9rem;
  }

  .result-card .result-card-cover {
    width: 4.5rem;
  }

  /* The button stays reachable while the player scrolls through the card */
  .result-card-actions {
    position: sticky;
    bottom: 0;
    margin: 0 -0.9rem -0.9rem;
    padding: 0.75rem 0.9rem;
    background-color: var(--surface-color);
    border-top: 1px solid var(--border-color);
    border-radius: 0 0 14px 14px;
  }

  .result-card #refreshButton {
    flex: 1;
    justify-content: center;
  }

  /* Blindtest: the cover and the tracks come after the card, which would else be below the fold */
  .game-over .result-layout--card-first {
    display: flex;
    flex-direction: column;
  }

  .game-over .result-layout--card-first > .result-card {
    order: -1;
    margin-top: 0;
  }

  /* The settings button floats above the "play again" bar instead of covering it */
  .game-over .difficulty-settings-button {
    bottom: 5.25rem;
  }
}

/* ---------- In-game status bar (partials/game-status.ejs) ---------- */
.game-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  margin: 0.85rem 0;
}

.status-pill,
.status-message {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  padding: 0.25rem 0.8rem;
  border-radius: 999px;
  font-size: 0.85rem;
}

.status-pill {
  background-color: color-mix(in srgb, var(--text-muted) 12%, var(--surface-color));
  color: var(--text-muted);
}

.status-pill strong {
  color: var(--text-color);
  font-variant-numeric: tabular-nums;
}

.status-pill[hidden],
.status-message:empty {
  display: none;
}

.status-message {
  border: 1px solid var(--border-color);
  color: var(--text-color);
}

/* ---------- "Revealed title" hint (partials/title-hint.ejs) ---------- */
.hint-card {
  margin: 0.85rem 0;
  padding: 0.75rem 1rem;
  background-color: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  text-align: center;
}

/* Inside the Anidle hints box: no second frame */
.hints-box .hint-card {
  margin: 0 0 0.85rem;
  padding: 0 0 0.85rem;
  border: none;
  border-bottom: 1px solid var(--border-color);
  border-radius: 0;
}

/* Centered: the title, then when the next letter comes */
.hint-card-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.15rem 0.75rem;
  margin: 0;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.hint-next {
  color: var(--primary-color);
}

.hint-title {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-top: 0.55rem;
}

.hint-title[hidden],
.hint-title-row[hidden] {
  display: none;
}

/* One title per row: its language above, the tiles centered under it */
.hint-title-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
}

.hint-lang {
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 700;
}

.hint-tiles {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.3rem 0.65rem;
  min-width: 0;
}

/* A word never breaks between two lines */
.hint-word {
  display: inline-flex;
  gap: 0.18rem;
}

.hint-tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.65rem;
  background-color: color-mix(in srgb, var(--text-muted) 12%, var(--surface-color));
  border: 1px solid var(--border-color);
  border-radius: 5px;
  font-size: 0.9rem;
  font-weight: 700;
}

.hint-tile.is-revealed {
  background-color: color-mix(in srgb, var(--primary-color) 18%, var(--surface-color));
  border-color: var(--primary-color);
  color: var(--text-color);
}

@media (max-width: 520px) {
  .hint-tile {
    width: 1.15rem;
    height: 1.45rem;
    font-size: 0.8rem;
  }
}

/* ---------- Progressive Blindtest: screen and tracks ---------- */
/* The screen shows the video track; at the end of the game, the cover for an audio track */
.bt-screen video[hidden],
.bt-screen-cover[hidden] {
  display: none;
}

.bt-screen .bt-screen-cover {
  display: block;
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: contain;
  border-radius: 0;
  box-shadow: none;
}

.bt-tracks {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

/* A track: its name and lock, and what unlocking it costs */
.bt-track {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  margin: 0;
  padding: 0.55rem 0.4rem;
  background-color: color-mix(in srgb, var(--text-muted) 8%, var(--surface-color));
  border: 1px solid var(--border-color);
  border-radius: 10px;
  color: var(--text-muted);
  cursor: pointer;
  font: inherit;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.bt-track:hover {
  border-color: var(--primary-color);
}

.bt-track:focus-visible {
  outline: 3px solid var(--primary-color-hover);
  outline-offset: 2px;
}

.bt-track.is-unlocked {
  color: var(--text-color);
}

.bt-track.is-current {
  background-color: color-mix(in srgb, var(--primary-color) 18%, var(--surface-color));
  border-color: var(--primary-color);
  color: var(--text-color);
}

.bt-track-name {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.bt-track-cost {
  color: var(--text-muted);
  font-size: 0.75rem;
}

/* Game over: every track can be replayed, no lock or cost any more */
.game-over .bt-track-cost,
.game-over .bt-track .ti {
  display: none;
}

/* Anidle on phones: hint tabs on two columns, tables scroll inside their frame */
@media (max-width: 800px) {
  .anidle-table, .summary-table {
    display: block;
    min-width: 0;
    overflow-x: auto;
  }
}

@media (max-width: 520px) {
  .hint-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hint-tab {
    padding: 0.45rem 0.5rem;
    font-size: 0.82rem;
    overflow-wrap: anywhere;
  }
}

/* Anidle: legend of the table colours, shown once the tables are there */
.anidle-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.4rem 1.1rem;
  margin: 0.85rem 0 0.6rem;
  color: var(--text-muted);
  font-size: 0.8rem;
}

#gameContainer:not(:has(#summaryTable)) .anidle-legend {
  display: none;
}

.anidle-legend > span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

/* Same look as the table cells (see #anidleTable .goodAnswer…) */
.anidle-legend-chip {
  display: inline-block;
  width: 1.1rem;
  height: 0.8rem;
  border-radius: 4px;
}

.anidle-legend-chip--right {
  background-color: var(--success-bg-color);
  box-shadow: inset 0 0 0 1px var(--success-border-color);
}

.anidle-legend-chip--close {
  outline: 1px dashed var(--success-border-color);
  outline-offset: -1px;
}

.anidle-legend-chip--wrong {
  background-color: color-mix(in srgb, var(--text-muted) 14%, var(--surface-color));
}

/* Title hint before it starts: a padlock and one muted sentence with the countdown */
.hint-lock-icon {
  display: none;
}

.hint-card.is-locked .hint-lock-icon {
  display: inline-block;
}

.hint-card.is-locked .hint-card-title {
  display: none;
}

.hint-card.is-locked .hint-card-head {
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
}

.hint-card.is-locked .hint-next {
  color: var(--text-muted);
}
