:root {
  --bg: #f8f5ef;
  --bg-2: #ece4d8;
  --surface: rgba(255, 255, 255, 0.86);
  --surface-strong: #ffffff;
  --text: #18181b;
  --muted: #5e5d67;
  --brand: #0b6e4f;
  --brand-2: #16a34a;
  --accent: #ea580c;
  --accent-soft: #fff1e8;
  --danger: #b00020;
  --ok: #166534;
  --ring: #ffd166;
  --space-1: 6px;
  --space-2: 10px;
  --space-3: 16px;
  --space-4: 24px;
  --radius-card: 16px;
  --radius-control: 12px;
  --control-height: 48px;
  --border-soft: #cbd5e1;
  --border-strong: rgba(100, 116, 139, 0.28);
  --focus-ring: rgba(250, 204, 21, 0.45);
  --radius: 16px;
  --shadow: 0 16px 36px rgba(25, 22, 40, 0.12);
}

* {
  box-sizing: border-box;
}

img {
  max-width: 100%;
  height: auto;
}

body {
  margin: 0;
  color: var(--text);
  font-family: "Manrope", "Noto Sans", sans-serif;
  background:
    radial-gradient(circle at 8% -2%, rgba(251, 191, 36, 0.2), transparent 32%),
    radial-gradient(circle at 92% 0%, rgba(14, 116, 144, 0.18), transparent 38%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  min-height: 100vh;
}

.booting #authSection,
.booting #appSection {
  display: none !important;
}

.container {
  width: min(1180px, 94vw);
  margin: 1rem auto 4rem;
}

.hero {
  position: relative;
  margin-bottom: 1rem;
  border-radius: 24px;
  background:
    linear-gradient(130deg, rgba(11, 110, 79, 0.95), rgba(6, 95, 70, 0.9)),
    radial-gradient(circle at 80% 30%, rgba(255, 255, 255, 0.16), transparent 48%);
  box-shadow: 0 22px 40px rgba(11, 66, 51, 0.34);
  color: #f9fffc;
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(120deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.03) 7px, transparent 7px, transparent 16px);
  pointer-events: none;
}

.heroTop {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(250px, 320px);
  align-items: center;
  gap: 1rem;
  padding: 0.95rem 4.4rem 0.95rem 1rem;
}

.heroContent {
  display: grid;
  gap: 0.55rem;
  max-width: min(760px, 100%);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.heroQuickActions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-start;
  align-items: center;
  justify-self: stretch;
}

.brandText h1 {
  margin: 0;
  font-family: "Chakra Petch", sans-serif;
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 0.96;
  letter-spacing: 0.02em;
}

.brandHomeLink {
  color: inherit;
  text-decoration: none;
}

.brandLogoLink {
  display: inline-flex;
  text-decoration: none;
}

.brandHomeLink:hover {
  text-decoration: none;
  opacity: 0.96;
}

.heroTagline {
  margin: 0.1rem 0 0;
  color: rgba(244, 255, 250, 0.9);
  font-weight: 600;
}

.heroLead {
  margin: 0;
  font-size: 1.02rem;
  color: rgba(248, 255, 252, 0.92);
}

.questionStamp {
  position: relative;
  justify-self: center;
  width: min(100%, 300px);
  transform: rotate(-6deg) translateY(2px);
  border-radius: 28px;
  padding: 0.26rem;
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.36), rgba(255, 255, 255, 0.12));
  box-shadow: 0 10px 20px rgba(2, 31, 20, 0.26);
  transition: transform 200ms ease, box-shadow 200ms ease;
}

.questionStamp:hover {
  transform: rotate(-3deg) scale(1.02);
  box-shadow: 0 14px 28px rgba(2, 31, 20, 0.3);
}

.questionStampInner {
  position: relative;
  overflow: hidden;
  border-radius: 24px;
  border: 1px solid rgba(21, 61, 40, 0.24);
  background:
    linear-gradient(155deg, #fff7bf 0%, #fde68a 42%, #f8cc63 100%);
  color: #123222;
  padding: 0.74rem 1.08rem 0.7rem;
  text-align: center;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.72),
    inset 0 -1px 0 rgba(84, 52, 3, 0.22),
    0 4px 10px rgba(20, 38, 29, 0.22);
}

.questionStampInner::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 18% 20%, rgba(255, 255, 255, 0.38) 0 1px, transparent 1px),
    radial-gradient(circle at 77% 62%, rgba(255, 255, 255, 0.28) 0 1px, transparent 1px),
    radial-gradient(circle at 38% 78%, rgba(0, 0, 0, 0.06) 0 1px, transparent 1px);
  background-size: 10px 10px, 13px 13px, 12px 12px;
  opacity: 0.26;
  pointer-events: none;
}

.questionStampInner::after {
  content: "✦";
  position: absolute;
  top: 0.26rem;
  right: 0.5rem;
  color: #14532d;
  font-size: 0.76rem;
  transform: rotate(16deg);
  opacity: 0.78;
  pointer-events: none;
}

.questionStampCount {
  position: relative;
  display: block;
  font-size: clamp(1.85rem, 4.4vw, 2.3rem);
  line-height: 1;
  font-weight: 900;
  color: #0b3d2a;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.42);
}

.questionStampLabel {
  position: relative;
  display: block;
  margin-top: 0.1rem;
  font-size: 0.84rem;
  font-weight: 900;
  letter-spacing: 0.17em;
  color: #1f2937;
}

.questionStampMeta {
  position: relative;
  margin: 0.22rem 0 0;
  font-weight: 800;
  font-size: 0.83rem;
  line-height: 1.22;
  letter-spacing: 0.02em;
  color: #22303d;
}

.heroCta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-width: 210px;
  border-radius: 999px;
  padding: 0.76rem 1.05rem;
  color: #0f172a;
  background: linear-gradient(90deg, #ffd166, #fbbf24);
  text-decoration: none;
  font-weight: 800;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  box-shadow: 0 12px 22px rgba(40, 23, 0, 0.25);
}

.heroCta:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 26px rgba(40, 23, 0, 0.3);
}

.backHomeBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 42px;
  border-radius: var(--radius-control);
  border: 1px solid rgba(15, 23, 42, 0.15);
  background: linear-gradient(90deg, #334155, #1f2937);
  color: #ffffff;
  font-weight: 700;
  text-decoration: none;
  padding: 0.56rem 0.95rem;
  transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
}

.backHomeBtn:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.22);
}

.backHomeBtn:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 1px;
}

.siteLogo {
  width: clamp(132px, 19vw, 166px);
  height: clamp(132px, 19vw, 166px);
  object-fit: contain;
  border-radius: 0;
  padding: 0;
  background: transparent;
  border: 0;
  transform: rotate(15deg);
}

#homeIntro {
  border: 1px solid rgba(234, 88, 12, 0.25);
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.95), rgba(255, 245, 238, 0.96));
}

.introBadges {
  margin-top: 0.8rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.introBadge {
  display: inline-flex;
  border-radius: 999px;
  border: 1px solid #fdba74;
  color: #9a3412;
  font-size: 0.83rem;
  font-weight: 700;
  background: #fff7ed;
  padding: 0.34rem 0.65rem;
}

h1,
h2,
h3 {
  font-family: "Chakra Petch", sans-serif;
  margin: 0.2rem 0 0.7rem;
}

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

.themeBadge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  font-size: 0.84rem;
  font-weight: 700;
  padding: 0.28rem 0.64rem;
  border-radius: 999px;
  border: 1px solid transparent;
  letter-spacing: 0.02em;
  margin: 0.15rem 0 0.45rem;
}

.theme-sciences {
  background: #e0f2fe;
  color: #0c4a6e;
  border-color: #7dd3fc;
}

.theme-litterature {
  background: #fdf2f8;
  color: #831843;
  border-color: #f9a8d4;
}

.theme-cinema {
  background: #ede9fe;
  color: #4c1d95;
  border-color: #c4b5fd;
}

.theme-histoire {
  background: #ffedd5;
  color: #7c2d12;
  border-color: #fdba74;
}

.theme-geographie {
  background: #dcfce7;
  color: #14532d;
  border-color: #86efac;
}

.theme-culture-g {
  background: #fef9c3;
  color: #713f12;
  border-color: #fde047;
}

.theme-musique {
  background: #fee2e2;
  color: #7f1d1d;
  border-color: #fca5a5;
}

.theme-aleatoire {
  background: #e2e8f0;
  color: #1e293b;
  border-color: #cbd5e1;
}

ul.stack {
  margin: 0;
  padding-left: 1.1rem;
}

ul.stack li {
  line-height: 1.35;
}

#playerScoreboard {
  list-style: none;
  padding-left: 0;
  margin: 0.3rem 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
  gap: 0.45rem;
}

.playerScoreCard {
  border-radius: 12px;
  border: 1px solid #d4d4d8;
  background: linear-gradient(145deg, #fafaf9, #f4f4f5);
  padding: 0.5rem 0.55rem;
  display: grid;
  gap: 0.18rem;
  box-shadow: 0 4px 10px rgba(24, 24, 27, 0.08);
}

.playerScoreCard .playerRankRow {
  display: inline-flex;
  align-items: center;
  gap: 0.34rem;
  width: fit-content;
}

.playerScoreCard .rankBadge {
  width: fit-content;
  font-size: 0.76rem;
  font-weight: 800;
  color: #3f3f46;
  background: #e4e4e7;
  border-radius: 999px;
  padding: 0.14rem 0.45rem;
}

.playerScoreCard .playerName {
  font-size: 0.9rem;
  color: #0f172a;
}

.playerScoreCard .playerPoints {
  font-size: 1.35rem;
  line-height: 1;
  color: #14532d;
}

.playerScoreCard .playerMeta {
  font-size: 0.78rem;
  color: #3f3f46;
}

.playerTurnChip {
  width: fit-content;
  font-size: 0.72rem;
  font-weight: 800;
  color: #0c4a6e;
  background: #e0f2fe;
  border: 1px solid #7dd3fc;
  border-radius: 999px;
  padding: 0.12rem 0.45rem;
}

.playerScoreCard.is-active {
  border-color: #0ea5e9;
  background: linear-gradient(145deg, #ecfeff, #cffafe);
  box-shadow: 0 8px 18px rgba(8, 145, 178, 0.2);
}

.playerScoreCard.is-leader {
  border-color: #f59e0b;
  background: linear-gradient(145deg, #fef3c7, #fde68a);
}

#roundSummary {
  background:
    radial-gradient(circle at 10% 10%, rgba(125, 211, 252, 0.22), transparent 45%),
    linear-gradient(145deg, #eff6ff, #dbeafe);
  border: 1px solid #93c5fd;
}

#finalSummary {
  background:
    radial-gradient(circle at 85% 12%, rgba(250, 204, 21, 0.24), transparent 45%),
    linear-gradient(145deg, #ecfeff, #d1fae5);
  border: 1px solid #6ee7b7;
}

#roundStats,
#finalStats,
.statsTiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.6rem;
  margin-bottom: 0.7rem;
}

.resultTile {
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 12px;
  padding: 0.6rem 0.7rem;
}

.resultTile strong {
  display: block;
  font-size: 1.72rem;
  line-height: 1;
  color: #0f172a;
}

.resultTile span {
  font-size: 0.82rem;
  color: #334155;
}

#roundPlayersSummary,
#finalPlayersSummary {
  list-style: none;
  padding-left: 0;
  margin: 0.2rem 0 0.8rem;
  display: grid;
  gap: 0.45rem;
}

#finalGameConfigList {
  list-style: none;
  padding-left: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.4rem;
}

#finalGameConfigList li {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 10px;
  padding: 0.34rem 0.5rem;
  font-size: 0.8rem;
  color: #0f172a;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.4rem;
}

#finalGameConfigList .configKey {
  color: #475569;
  white-space: nowrap;
}

#finalGameConfigList .configVal {
  color: #0f172a;
  font-size: 0.86rem;
  line-height: 1.15;
  text-align: right;
}

#finalRecapList {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.recapCard {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 10px;
  padding: 0.62rem 0.74rem;
}

.recapCard .qText {
  margin: 0 0 0.36rem;
  font-weight: 700;
  color: #0f172a;
}

.recapCard .meta {
  margin: 0.16rem 0;
  font-size: 0.88rem;
  color: #334155;
}

.recapCard .meta.ok {
  color: #166534;
  font-weight: 700;
}

.recapCard .meta.ko {
  color: #b91c1c;
  font-weight: 700;
}

.recapCard .actions {
  margin-top: 0.46rem;
}

.resultPlayerRow {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 10px;
  padding: 0.52rem 0.7rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.resultPlayerRow .left {
  font-weight: 700;
  color: #0f172a;
}

.resultPlayerRow .right {
  font-size: 0.9rem;
  color: #334155;
}

.badgeList {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.miniBadge {
  display: inline-flex;
  align-items: center;
  border: 1px solid #93c5fd;
  background: #eff6ff;
  color: #1e3a8a;
  border-radius: 999px;
  padding: 0.28rem 0.6rem;
  font-size: 0.82rem;
  font-weight: 700;
}

.card {
  background: var(--surface);
  backdrop-filter: blur(6px);
  border-radius: var(--radius);
  border: 1px solid rgba(63, 63, 70, 0.14);
  padding: 1rem;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
  animation: fadeUp 0.3s ease;
}

#authSection > .card:first-child {
  border: 1px solid rgba(245, 158, 11, 0.35);
  background: linear-gradient(145deg, rgba(255, 251, 235, 0.9), rgba(255, 255, 255, 0.95));
}

#authSection > .card:last-child {
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: linear-gradient(145deg, rgba(248, 250, 252, 0.92), rgba(255, 255, 255, 0.96));
}

.grid {
  display: grid;
  gap: 1rem;
}

.grid.two {
  grid-template-columns: 1fr;
}

.stack {
  display: grid;
  gap: 0.6rem;
}

.row {
  display: flex;
  align-items: center;
}

.row.space {
  justify-content: space-between;
}

label {
  display: grid;
  gap: 0.36rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: #27272a;
}

.checkboxRow {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  font-weight: 500;
  font-size: 0.9rem;
  line-height: 1.35;
  color: #27272a;
}

.checkboxRow input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 0.08rem;
  flex: 0 0 auto;
}

input,
textarea,
select,
button {
  width: 100%;
  border-radius: var(--radius-control);
  border: 1px solid var(--border-soft);
  padding: 0.72rem 0.82rem;
  font-size: 1rem;
  font-family: inherit;
}

input,
textarea,
select {
  background: var(--surface-strong);
}

select[multiple] {
  min-height: 110px;
}

.friendRow {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.friendsLayoutTwoCols {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.8rem;
}

.friendsPanel {
  border: 1px solid rgba(148, 163, 184, 0.38);
  border-radius: 14px;
  padding: 0.7rem;
  background: rgba(255, 255, 255, 0.84);
}

.friendsPanel h5 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  color: #0f172a;
}

.friendsInviteGrid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.7rem;
}

.friendsInviteColumn > .small {
  margin: 0 0 0.35rem;
}

#friendList,
#friendIncomingList,
#friendOutgoingList {
  list-style: none;
  padding-left: 0;
  margin: 0;
  display: grid;
  gap: 0.5rem;
}

#profileFriendsSection .friendRow {
  padding: 0.58rem 0.62rem;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: linear-gradient(145deg, #ffffff, #f8fafc);
}

.friendName {
  font-size: 1.02rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: 0.01em;
}

.friendActions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

textarea {
  min-height: 110px;
}

input[type="file"]::file-selector-button {
  border: 0;
  border-radius: 10px;
  padding: 0.55rem 0.8rem;
  margin-right: 0.7rem;
  background: linear-gradient(90deg, #334155, #1f2937);
  color: #ffffff;
  font-weight: 700;
  cursor: pointer;
}

input[type="file"]::-webkit-file-upload-button {
  border: 0;
  border-radius: 10px;
  padding: 0.55rem 0.8rem;
  margin-right: 0.7rem;
  background: linear-gradient(90deg, #334155, #1f2937);
  color: #ffffff;
  font-weight: 700;
  cursor: pointer;
}

#reportStatusFilter,
#adminReportStatusFilter,
.reportStatusSelect {
  width: auto;
  min-width: 150px;
}

#refreshSharedGamesBtn,
#clearSharedGamesBtn {
  width: auto;
  padding: 0.46rem 0.72rem;
  font-size: 0.9rem;
}

button {
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  color: #ffffff;
  border: 0;
  cursor: pointer;
  font-weight: 700;
  transition: transform 0.15s ease, filter 0.15s ease;
}

button:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
}

button.secondary {
  background: linear-gradient(90deg, #334155, #1f2937);
}

button.danger {
  background: linear-gradient(90deg, #b91c1c, #dc2626);
}

#startBtn {
  font-size: 1.03rem;
  min-height: 54px;
  background: linear-gradient(90deg, #ea580c, #f59e0b);
  box-shadow: 0 12px 20px rgba(155, 69, 10, 0.28);
  border-radius: var(--radius-control);
  margin-top: var(--space-2);
}

#sharedGamesCard,
#startGameCard,
#gameCard,
#roundSummary,
#finalSummary {
  border-width: 1px;
  border-style: solid;
  border-color: var(--border-strong);
  border-radius: var(--radius-card);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

#sharedGamesCard,
#startGameCard,
#gameCard {
  background:
    radial-gradient(circle at 88% -10%, rgba(191, 219, 254, 0.22), transparent 42%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(248, 250, 252, 0.92));
}

#sharedGamesCard h3,
#startGameCard h2,
#gameCard #roundLabel,
#roundSummary h3,
#finalSummary h3 {
  letter-spacing: 0.01em;
}

#toggleStartGameBtn.startDisclosureBtn {
  min-height: 30px;
  min-width: 0;
  width: auto;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(248, 250, 252, 0.92);
  color: #475569;
  font-size: 0.8rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  box-shadow: none;
}

#toggleStartGameBtn.startDisclosureBtn .chevron {
  display: inline-block;
  transition: transform 0.18s ease;
}

#toggleStartGameBtn.startDisclosureBtn.is-collapsed .chevron {
  transform: rotate(-90deg);
}

#toggleStartGameBtn.startDisclosureBtn:hover {
  background: rgba(241, 245, 249, 0.98);
  border-color: rgba(100, 116, 139, 0.5);
}

#startGameCard.start-collapsed #startGameContent {
  display: none;
}

#sharedGamesHint {
  margin: 0;
}

#sharedGamesTableWrap {
  margin-top: 0.15rem;
}

#sharedGamesTableWrap .simpleTable {
  min-width: 560px;
}

#sharedGamesTableWrap .simpleTable th,
#sharedGamesTableWrap .simpleTable td {
  text-align: center;
  vertical-align: middle;
}

.sharedGameActions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
}

.sharedGameActions button {
  width: auto;
  padding: 0.44rem 0.68rem;
}

#gameCard .row.space {
  margin-bottom: 0.2rem;
}

#questionCategoryLabel {
  margin-top: 0.2rem;
}

#questionWrap h3 {
  margin: 0.1rem 0 0.35rem;
  font-size: clamp(1.06rem, 2.2vw, 1.22rem);
  line-height: 1.3;
  color: #0f172a;
}

#questionWrap img {
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

#questionWrap .secondary {
  background: linear-gradient(90deg, #475569, #334155);
}

button:focus,
input:focus,
textarea:focus,
select:focus,
a:focus {
  outline: 3px solid var(--ring);
  outline-offset: 1px;
}

#questionWrap .choiceBtn {
  text-align: left;
  background: #f0fdf4;
  color: #14532d;
  border: 1px solid #bbf7d0;
  transition: transform 0.12s ease, background 0.2s ease, box-shadow 0.2s ease;
  box-shadow: 0 4px 10px rgba(20, 83, 45, 0.08);
}

#questionWrap .choiceBtn:hover {
  transform: translateY(-1px);
  background: #dcfce7;
  box-shadow: 0 7px 14px rgba(20, 83, 45, 0.14);
}

#questionWrap .choiceBtn.is-locked {
  opacity: 0.95;
  cursor: not-allowed;
}

#questionWrap .choiceBtn.is-correct {
  background: #16a34a;
  color: #ffffff;
  border-color: #15803d;
}

#questionWrap .choiceBtn.is-wrong {
  background: #dc2626;
  color: #ffffff;
  border-color: #b91c1c;
}

#feedback {
  margin-top: 0.75rem;
  padding: 0.85rem 0.95rem;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.4;
  background: #e2e8f0;
  color: #0f172a;
  border: 1px solid #cbd5e1;
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.7rem;
}

#feedback .feedbackMessageText {
  flex: 1 1 auto;
}

#feedback .feedbackRevealControls {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

#feedback .feedbackRevealCountdown {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.08);
  color: inherit;
  font-size: 0.82rem;
  font-weight: 900;
  line-height: 1;
}

#feedback .feedbackRevealSkipBtn {
  width: 36px !important;
  min-width: 36px !important;
  height: 36px;
  min-height: 36px;
  border-radius: 999px;
  padding: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  cursor: pointer;
  background: linear-gradient(90deg, #0ea5e9, #0284c7);
  box-shadow: 0 4px 10px rgba(2, 132, 199, 0.3);
}

#feedback .feedbackRevealSkipBtn svg {
  width: 16px;
  height: 16px;
  fill: #ffffff;
}

#feedback.is-correct {
  background: #dcfce7;
  color: #14532d;
  border-color: #86efac;
}

#feedback.is-wrong {
  background: #fee2e2;
  color: #7f1d1d;
  border-color: #fca5a5;
}

.timerWrap {
  height: 10px;
  background: #dde8ec;
  border-radius: 99px;
  overflow: hidden;
  margin: 0.6rem 0 1rem;
}

.timerBar {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #22c55e, #86efac);
  transition: width 0.8s linear;
}

#questionTimerLabel {
  font-size: 1.4rem;
  line-height: 1;
  font-weight: 800;
  min-width: 56px;
  height: 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: #ffffff;
  background: radial-gradient(circle at 30% 30%, #22c55e 0%, #15803d 65%);
  box-shadow: 0 8px 20px rgba(22, 101, 52, 0.35), inset 0 0 0 2px rgba(255, 255, 255, 0.2);
  transition: background 0.25s ease, box-shadow 0.25s ease, transform 0.2s ease;
}

#currentPlayerLabel {
  display: none;
}

#questionTimerLabel.is-warning {
  background: radial-gradient(circle at 30% 30%, #ffd166 0%, #ef8354 65%);
  box-shadow: 0 8px 20px rgba(239, 131, 84, 0.35), inset 0 0 0 2px rgba(255, 255, 255, 0.2);
}

#questionTimerLabel.is-critical {
  background: radial-gradient(circle at 30% 30%, #ff6b6b 0%, #c1121f 65%);
  box-shadow: 0 10px 26px rgba(193, 18, 31, 0.5), inset 0 0 0 2px rgba(255, 255, 255, 0.22);
}

#questionTimerLabel.is-tick {
  animation: timerTickPulse 0.95s ease;
}

@keyframes timerTickPulse {
  0% {
    transform: scale(1);
  }

  25% {
    transform: scale(1.1);
  }

  55% {
    transform: scale(0.96);
  }

  100% {
    transform: scale(1);
  }
}

.hidden {
  display: none !important;
}

.accountToggle {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  background: linear-gradient(90deg, #0f172a, #1f2937);
  color: #fff;
  padding: 0.56rem 0.82rem;
  box-shadow: 0 6px 14px rgba(2, 8, 23, 0.35);
  overflow: visible;
}

.accountIcon {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #facc15;
  color: #111827;
  font-size: 0.8rem;
  font-weight: 800;
}

.accountInviteBadge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background: #ef4444;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.25);
}

.accountPanel {
  position: sticky;
  top: 0.6rem;
  z-index: 10;
}

.accountCloseBtn {
  width: auto;
  padding: 0.45rem 0.7rem;
}

.accountHeaderActions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.35rem;
}

.accountHeaderActions button {
  width: auto;
}

.accountMenuToggle {
  display: none;
  width: auto;
  margin: 0 0 0.6rem;
  padding: 0.46rem 0.72rem;
}

.accountHeaderActions .accountMenuToggle {
  margin: 0;
}

#accountMenuToggleBtn::before {
  content: "";
  width: 14px;
  height: 14px;
  margin-right: 0.38rem;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round'><path d='M4 7h16M4 12h16M4 17h16'/></svg>");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}

#logoutBtn::before,
#confirmLogoutBtn::before {
  content: "";
  width: 14px;
  height: 14px;
  margin-right: 0.38rem;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><path d='M10 17v2a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v2'/><path d='M14 16l5-4-5-4'/><path d='M19 12H9'/></svg>");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}

#accountCloseBtn::before,
#closeForgotModalBtn::before,
#closeDeleteAccountModalBtn::before,
#closeQuitSharedGameModalBtn::before,
#closeLogoutConfirmModalBtn::before,
#closeAdminQuestionEditModalBtn::before {
  content: "";
  width: 14px;
  height: 14px;
  margin-right: 0.38rem;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.4' stroke-linecap='round'><path d='M6 6l12 12M18 6 6 18'/></svg>");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}

#accountMenuToggleBtn::before,
#logoutBtn::before,
#confirmLogoutBtn::before,
#accountCloseBtn::before,
#closeForgotModalBtn::before,
#closeDeleteAccountModalBtn::before,
#closeQuitSharedGameModalBtn::before,
#closeLogoutConfirmModalBtn::before,
#closeAdminQuestionEditModalBtn::before,
#refreshSharedGamesBtn::before,
#adminUsersRefreshBtn::before,
#adminRefreshReportsBtn::before {
  display: inline-block;
  flex: 0 0 auto;
  vertical-align: middle;
  transform: translateY(0);
}

.accountWorkspace {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 0.9rem;
  align-items: start;
}

.accountMenuWrap {
  position: sticky;
  top: 0.4rem;
}

.accountTabs {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.35rem;
  margin: 0;
  padding: 0.35rem;
  border: 1px solid rgba(148, 163, 184, 0.34);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(248, 250, 252, 0.96));
}

.tabBtn {
  width: auto;
  background: #e2e8f0;
  color: #1e293b;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 0.45rem 0.7rem;
  font-weight: 700;
}

.tabBtn:hover {
  background: #dbeafe;
  border-color: #93c5fd;
}

.tabBtn.active {
  background: linear-gradient(90deg, #0f766e, #0ea5a5);
  color: #fff;
  border-color: #0f766e;
}

.accountTabs .tabBtn {
  width: 100%;
  background: transparent;
  color: #334155;
  border: 1px solid transparent;
  border-left: 4px solid transparent;
  border-radius: 10px;
  padding: 0.56rem 0.66rem;
  font-weight: 700;
  text-align: left;
  box-shadow: none;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.accountTabs .tabBtn:hover {
  transform: none;
  background: #f1f5f9;
  color: #0f172a;
  border-color: rgba(148, 163, 184, 0.32);
}

.accountTabs .tabBtn.active {
  background: #ecfeff;
  color: #0f766e;
  border-color: rgba(15, 118, 110, 0.28);
  border-left-color: #0f766e;
  box-shadow: inset 0 0 0 1px rgba(15, 118, 110, 0.06);
}

.accountTabs .tabBtn.active:hover {
  color: #0f766e;
  filter: none;
}

.tabPanel {
  padding-top: 0;
}

.adminTopGrid {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: 1fr;
}

#adminDifficultyList {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.adminDifficultyInline {
  color: #334155;
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow-x: auto;
}

.settingsCompactRow {
  align-items: start;
  gap: var(--space-3);
}

.settingsGrid {
  display: grid;
  gap: var(--space-3);
  align-items: start;
}

.settingsBlock {
  display: grid;
  align-content: start;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-card);
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.85), rgba(248, 250, 252, 0.9));
}

.settingsBlock h3 {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 700;
}

.modeSwitch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
}

.settingsCompactRow label {
  margin: 0;
}

#startGameCard label {
  display: grid;
  gap: var(--space-1);
  font-size: 0.9rem;
  margin: 0;
}

.form-control {
  min-height: var(--control-height);
  width: 100%;
  font-size: 0.95rem;
  padding: 0.6rem 0.72rem;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-control);
  background: #fff;
}

.form-control:focus {
  outline: 3px solid var(--focus-ring);
  outline-offset: 1px;
  border-color: #f59e0b;
}

.form-control.is-disabled {
  opacity: 0.62;
  cursor: not-allowed;
}

#startGameCard #friendPlayersSelect {
  min-height: 108px;
  display: none;
}

#startGameCard #customCategorySelect {
  min-height: 108px;
  display: none;
}

.friendPlayersCheckboxes {
  border: 2px solid #7dd3fc;
  border-radius: var(--radius-control);
  background: linear-gradient(180deg, #f8fbff, #ffffff);
  padding: 0.55rem 0.65rem;
  min-height: 124px;
  max-height: 180px;
  overflow: auto;
}

.friendPlayersCheckboxes.is-disabled {
  opacity: 0.62;
}

.friendPlayerOption {
  width: 100%;
  text-align: left;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #0f172a;
  border-radius: 10px;
  padding: 0.48rem 0.62rem;
  cursor: pointer;
}

.friendPlayerOption:hover {
  background: #eef2ff;
}

.friendPlayerOption.is-selected {
  border-color: #0f766e;
  background: #d1fae5;
  color: #065f46;
  font-weight: 700;
}

.friendPlayerOption.is-disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background: #e5e7eb;
  color: #6b7280;
  border-color: #cbd5e1;
}

#friendPlayersHint,
#questionPlan {
  margin: 0;
  font-size: 0.88rem;
  color: #475569;
}

#questionPlan {
  margin-top: var(--space-2);
}

#gameCard #questionWrap {
  gap: 0.5rem;
}

#gameCard #questionWrap .choiceBtn {
  font-size: 0.95rem;
  padding: 0.62rem 0.7rem;
}

#leaderboard {
  display: grid;
  gap: 0.5rem;
  margin: 0;
  padding-left: 1.1rem;
}

.podiumWrap {
  margin: 0.6rem 0 1rem;
  padding: 0.75rem;
  border-radius: 14px;
  border: 1px solid rgba(161, 98, 7, 0.25);
  background: linear-gradient(140deg, #fffbeb, #fefce8);
}

.podiumStage {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
  align-items: end;
}

.podiumSlot {
  display: grid;
  gap: 0.25rem;
  text-align: center;
}

.podiumMedal {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.podiumName {
  font-size: 0.93rem;
  overflow-wrap: anywhere;
}

.podiumScore {
  font-size: 0.8rem;
  color: #475569;
}

.podiumBlock {
  border-radius: 10px 10px 0 0;
  border: 1px solid rgba(24, 24, 27, 0.15);
}

.podiumSlot.bronze .podiumMedal {
  color: #92400e;
}

.podiumSlot.bronze .podiumBlock {
  min-height: 64px;
  background: linear-gradient(180deg, #fdba74, #ea580c);
}

.podiumSlot.gold .podiumMedal {
  color: #854d0e;
}

.podiumSlot.gold .podiumBlock {
  min-height: 104px;
  background: linear-gradient(180deg, #fde047, #eab308);
}

.podiumSlot.silver .podiumMedal {
  color: #475569;
}

.podiumSlot.silver .podiumBlock {
  min-height: 82px;
  background: linear-gradient(180deg, #cbd5e1, #94a3b8);
}

.modal {
  width: min(92vw, 480px);
  border: 0;
  border-radius: 18px;
  padding: 0;
  overflow: hidden;
  background: transparent;
  z-index: 2100;
}

.modal::backdrop {
  background: rgba(15, 23, 42, 0.52);
  backdrop-filter: none;
}

.modalCard {
  position: relative;
  z-index: 1;
  padding: 1rem;
  background: #ffffff;
  border: 1px solid rgba(148, 163, 184, 0.45);
}

.deleteAccountZone {
  margin-top: 0.35rem;
  padding-top: 0.7rem;
  border-top: 1px dashed rgba(185, 28, 28, 0.35);
}

#profileDifficultyList li,
#profileThemeList li,
#leaderboard li {
  overflow-wrap: anywhere;
}

.tableWrap {
  overflow-x: auto;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 10px;
  background: #fff;
}

.adminScreenshotsGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.65rem;
}

.adminScreenshotCard {
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  padding: 0.45rem;
  display: grid;
  gap: 0.35rem;
}

.adminScreenshotCard img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.06);
}

.adminScreenshotCard a {
  font-size: 0.82rem;
  overflow-wrap: anywhere;
}

.simpleTable {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

#profileStatsSection .grid.two > * {
  min-width: 0;
}

#profileDifficultyTable,
#profileThemeTable {
  min-width: 420px;
  table-layout: fixed;
}

#profileDifficultyTable th,
#profileDifficultyTable td,
#profileThemeTable th,
#profileThemeTable td {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.simpleTable th,
.simpleTable td {
  text-align: left;
  padding: 0.52rem 0.62rem;
  border-bottom: 1px solid rgba(226, 232, 240, 0.9);
  font-size: 0.88rem;
  color: #1f2937;
}

.simpleTable th {
  font-weight: 700;
  color: #0f172a;
  background: #f8fafc;
  position: sticky;
  top: 0;
  z-index: 1;
}

.simpleTable tbody tr:last-child td {
  border-bottom: 0;
}

.siteFooter {
  margin: 1rem 0 0.4rem;
  padding: 0.8rem 0.2rem 0.2rem;
  border-top: 1px solid rgba(100, 116, 139, 0.35);
}

.footerNav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1rem;
  justify-content: center;
  text-align: center;
  font-size: 0.9rem;
}

.footerNav a {
  color: #1d4ed8;
  font-weight: 600;
  text-decoration: none;
}

.footerNav a:hover {
  text-decoration: underline;
}

.legalPage .card ul {
  margin: 0;
  padding-left: 1.2rem;
}

.legalPage .card li {
  margin-bottom: 0.34rem;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%);
  background: #0f172a;
  color: #fff;
  padding: 0.65rem 0.9rem;
  border-radius: 8px;
  min-width: 220px;
  text-align: center;
  font-weight: 600;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 10px 24px rgba(2, 8, 23, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 2000;
  backdrop-filter: none;
}

.toast.show {
  opacity: 1;
}

.toast.err {
  background: #fee2e2;
  color: #7f1d1d;
  border-color: #fecaca;
}

.ok {
  color: var(--ok);
}

.err {
  color: var(--danger);
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (min-width: 760px) {
  .grid.two {
    grid-template-columns: 1fr 1fr;
  }

  .friendsLayoutTwoCols {
    grid-template-columns: 1fr 1fr;
  }

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

  .adminTopGrid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 1080px) {
  .settingsGrid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  #finalGameConfigList {
    grid-template-columns: 1fr;
  }
  .container {
    width: min(100%, 96vw);
    margin: 0.6rem auto 3rem;
  }

  .heroTop {
    grid-template-columns: 1fr;
    align-items: start;
    padding: 0.82rem;
    gap: 0.55rem;
  }

  .heroLead {
    font-size: 0.95rem;
  }

  .questionStamp {
    justify-self: center;
    transform: rotate(-3deg);
    width: min(88vw, 320px);
    margin-top: 0.2rem;
  }

  .questionStampInner {
    padding: 0.64rem 0.96rem;
  }

  .heroCta {
    min-width: 100%;
  }

  .brand {
    align-items: flex-start;
  }

  .accountPanel {
    position: static;
  }

  .accountToggle {
    position: absolute;
    top: 0.8rem;
    right: 0.8rem;
    align-self: auto;
  }

  .heroQuickActions {
    margin-top: 0.1rem;
    margin-left: 0;
    width: 100%;
    justify-content: flex-end;
  }

  .heroQuickActions .accountToggle,
  .heroQuickActions .themeToggleFloating {
    position: static;
    top: auto;
    right: auto;
  }

  .heroQuickActions .accountToggle,
  .heroQuickActions .themeToggleFloating,
  .heroQuickActions .themeToggleBtn {
    width: 60px !important;
    min-width: 60px !important;
    height: 60px !important;
    min-height: 60px !important;
    padding: 0 !important;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .heroQuickActions .accountIcon {
    width: 24px;
    height: 24px;
  }

  .heroContent {
    max-width: 100%;
  }

  #homeIntro {
    display: none;
  }

  .card {
    padding: 0.88rem;
  }

  input,
  textarea,
  select,
  button {
    min-height: 44px;
  }

  #startGameCard input,
  #startGameCard select {
    font-size: 0.94rem;
    min-height: 44px;
  }

  #questionTimerLabel {
    min-width: 52px;
    height: 52px;
    font-size: 1.2rem;
  }

  .resultPlayerRow {
    flex-direction: column;
    align-items: flex-start;
  }

  .row.space {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .accountHeaderActions {
    width: 100%;
    justify-content: stretch;
    flex-wrap: wrap;
  }

  .accountHeaderActions button {
    flex: 1 1 calc(50% - 0.25rem);
    text-align: center;
  }

  #accountMenuToggleBtn,
  #logoutBtn,
  #accountCloseBtn {
    flex: 0 0 auto;
    width: 40px;
    min-width: 40px;
    height: 40px;
    min-height: 40px;
    padding: 0;
    font-size: 0;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  #accountMenuToggleBtn::before,
  #logoutBtn::before,
  #accountCloseBtn::before {
    margin-right: 0;
  }

  .accountWorkspace {
    grid-template-columns: 1fr;
    gap: 0.7rem;
  }

  .accountMenuWrap {
    position: static;
    display: none;
  }

  .accountWorkspace.menu-open .accountMenuWrap {
    display: block;
  }

  .accountTabs {
    grid-template-columns: 1fr;
  }

  .accountTabs .tabBtn {
    width: 100%;
    border-left-width: 4px;
  }

  #profileStatsSection .grid.two {
    grid-template-columns: 1fr;
  }

  .accountMenuToggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .row {
    flex-wrap: wrap;
    align-items: stretch;
    gap: 0.5rem;
  }

  .row > button {
    width: auto;
    flex: 1 1 140px;
  }

  #sharedGamesCard .row.space > .row {
    flex-wrap: nowrap;
    align-items: center;
  }

  #sharedGamesCard .row.space > .row > button {
    flex: 0 0 auto;
  }

  #refreshSharedGamesBtn,
  #clearSharedGamesBtn,
  #adminUsersRefreshBtn,
  #adminRefreshReportsBtn {
    flex: 0 0 auto;
    width: auto;
    min-width: 40px;
  }

  #startBtn {
    min-height: 52px;
  }

  #reportStatusFilter,
  #adminReportStatusFilter,
  .reportStatusSelect {
    width: 100%;
    min-width: 0;
  }

  .footerNav {
    gap: 0.45rem 0.8rem;
    font-size: 0.84rem;
  }

  .podiumName {
    font-size: 0.84rem;
  }

  .podiumSlot.bronze .podiumBlock {
    min-height: 54px;
  }

  .podiumSlot.gold .podiumBlock {
    min-height: 86px;
  }

  .podiumSlot.silver .podiumBlock {
    min-height: 68px;
  }
}

@media (max-width: 640px) {
  .hero {
    border-radius: 18px;
  }

  .heroTop {
    padding: 0.74rem;
  }

  .siteLogo {
    width: 118px;
    height: 118px;
    border-radius: 0;
  }

  .brandText h1 {
    font-size: clamp(1.8rem, 9vw, 2.25rem);
  }

  .heroTagline,
  .heroLead {
    font-size: 0.9rem;
  }

  .questionStampCount {
    font-size: 1.82rem;
  }

  .questionStampLabel {
    font-size: 0.78rem;
    letter-spacing: 0.15em;
  }

  .questionStampMeta {
    font-size: 0.78rem;
  }

  .card {
    border-radius: 14px;
    padding: 0.8rem;
  }

  .accountPanel h3 {
    font-size: 1.18rem;
  }

  .accountPanel h4 {
    font-size: 1.04rem;
  }

  .accountPanel .small {
    font-size: 0.94rem;
  }

  .accountTabs {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.35rem;
    overflow: visible;
    padding-bottom: 0.35rem;
    scroll-snap-type: none;
  }

  .accountTabs .tabBtn {
    flex: initial;
    width: 100%;
    min-width: 0;
    border-radius: 10px;
    scroll-snap-align: none;
    font-size: 0.98rem;
    padding: 0.68rem 0.74rem;
  }

  .accountPanel input,
  .accountPanel textarea,
  .accountPanel select,
  .accountPanel button {
    font-size: 0.98rem;
  }

  button:not(#refreshSharedGamesBtn):not(#clearSharedGamesBtn):not(#adminUsersRefreshBtn):not(#adminRefreshReportsBtn) {
    min-height: 40px;
    padding: 0.5rem 0.66rem;
  }

  .accountPanel .row > button {
    min-height: 46px;
  }

  .accountHeaderActions button {
    min-height: 46px;
  }

  .friendsPanel {
    padding: 0.8rem;
    border-radius: 12px;
  }

  #profileFriendsSection .friendRow {
    padding: 0.66rem 0.68rem;
  }

  .friendName {
    font-size: 1.06rem;
  }

  .tableWrap {
    border-radius: 8px;
  }

  .simpleTable th,
  .simpleTable td {
    padding: 0.54rem 0.56rem;
    font-size: 0.86rem;
  }

  .sharedGameActions .sharedGameJoinBtn,
  .sharedGameActions .sharedGameQuitBtn {
    width: 34px;
    min-width: 34px;
    height: 34px;
    min-height: 34px;
    padding: 0;
    font-size: 0;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  #sharedGamesTableWrap .sharedGameActions {
    flex-wrap: nowrap;
    justify-content: center;
    align-items: center;
    gap: 0.32rem;
  }

  .sharedGameActions .sharedGameJoinBtn::before,
  .sharedGameActions .sharedGameQuitBtn::before {
    content: "";
    width: 16px;
    height: 16px;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
  }

  .sharedGameActions .sharedGameJoinBtn::before {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'><path d='M8 5v14l11-7z'/></svg>");
  }

  .sharedGameActions .sharedGameQuitBtn::before {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.1' stroke-linecap='round' stroke-linejoin='round'><path d='M3 6h18'/><path d='M8 6V4h8v2'/><path d='M19 6l-1 14H6L5 6'/><path d='M10 11v6'/><path d='M14 11v6'/></svg>");
  }

  #refreshSharedGamesBtn,
  #clearSharedGamesBtn,
  #adminUsersRefreshBtn,
  #adminRefreshReportsBtn {
    width: 34px;
    min-width: 34px;
    height: 34px;
    min-height: 34px;
    padding: 0;
    font-size: 0;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  #refreshSharedGamesBtn::before,
  #adminUsersRefreshBtn::before,
  #adminRefreshReportsBtn::before {
    content: "";
    width: 16px;
    height: 16px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><path d='M21 12a9 9 0 1 1-2.64-6.36'/><polyline points='21 3 21 9 15 9'/></svg>");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
  }

  #clearSharedGamesBtn::before {
    content: "";
    width: 16px;
    height: 16px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.1' stroke-linecap='round' stroke-linejoin='round'><path d='M3 6h18'/><path d='M8 6V4h8v2'/><path d='M19 6l-1 14H6L5 6'/><path d='M10 11v6'/><path d='M14 11v6'/></svg>");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
  }

  #accountMenuToggleBtn,
  #logoutBtn,
  #accountCloseBtn,
  #refreshSharedGamesBtn,
  #clearSharedGamesBtn,
  #adminUsersRefreshBtn,
  #adminRefreshReportsBtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  #accountMenuToggleBtn,
  #logoutBtn,
  #accountCloseBtn {
    width: 40px;
    min-width: 40px;
    height: 40px;
    min-height: 40px !important;
    padding: 0;
  }

  #accountMenuToggleBtn::before,
  #logoutBtn::before,
  #accountCloseBtn::before {
    width: 16px;
    height: 16px;
    margin: 0;
  }

  button.danger::before {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><path d='M12 3 2.4 20.5h19.2z'/><path d='M12 9v5'/><circle cx='12' cy='17' r='1.1' fill='white' stroke='none'/></svg>");
  }

  #startBtn::before {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'><polygon points='8,5 19,12 8,19'/></svg>");
  }

  #logoutBtn::before,
  #confirmLogoutBtn::before {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><path d='M10 17v2a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v2'/><path d='M14 16l5-4-5-4'/><path d='M19 12H9'/></svg>");
  }

  #accountCloseBtn::before,
  #closeForgotModalBtn::before,
  #closeDeleteAccountModalBtn::before,
  #closeQuitSharedGameModalBtn::before,
  #closeLogoutConfirmModalBtn::before,
  #closeAdminQuestionEditModalBtn::before {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.4' stroke-linecap='round'><path d='M6 6l12 12M18 6 6 18'/></svg>");
  }

  #questionTimerLabel {
    min-width: 48px;
    height: 48px;
    font-size: 1.05rem;
  }

  .podiumStage {
    grid-template-columns: 1fr;
    gap: 0.8rem;
  }

  .podiumSlot {
    text-align: left;
  }

  .podiumBlock {
    min-height: 18px !important;
    border-radius: 8px;
  }

  .modal {
    width: min(96vw, 480px);
  }
}

/* Theme toggle + cinematic moon/sun logo (restored after rollback) */
.themeToggleBtn,
.themeToggleFloating {
  width: 60px !important;
  min-width: 60px !important;
  height: 60px !important;
  min-height: 60px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.themeToggleFloating {
  position: absolute;
  top: 4.05rem;
  right: 0.78rem;
  z-index: 3;
}

.logoMorph {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(180deg, #020617 0%, #0f172a 60%, #1e293b 100%);
  box-shadow: inset 0 -8px 0 rgba(2, 6, 23, 0.52);
}

.logoMorph::before {
  content: "";
  position: absolute;
  left: 8px;
  bottom: 8px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #e2e8f0;
  box-shadow: 0 0 10px rgba(148, 163, 184, 0.45);
  transform: translateY(-2px);
  transition: transform 700ms ease, background 500ms ease, box-shadow 500ms ease;
  z-index: 2;
}

.logoMorph::after {
  content: "";
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: 6px;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.95), rgba(2, 6, 23, 0.95));
  z-index: 4;
}

.logoRays {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, rgba(253, 224, 71, 0.9) 0deg 10deg, transparent 10deg 30deg);
  -webkit-mask: radial-gradient(circle, transparent 47%, #000 49%);
  mask: radial-gradient(circle, transparent 47%, #000 49%);
  opacity: 0;
  transform: scale(0.45);
  transition: opacity 420ms ease, transform 700ms ease;
  z-index: 1;
}

.logoStars {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.logoStars::before,
.logoStars::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 22%, rgba(226, 232, 240, 0.95) 0 1px, transparent 1.5px),
    radial-gradient(circle at 74% 18%, rgba(248, 250, 252, 0.9) 0 1px, transparent 1.5px),
    radial-gradient(circle at 62% 40%, rgba(203, 213, 225, 0.82) 0 1px, transparent 1.5px);
  opacity: 0.9;
}

.logoStars::after {
  opacity: 0.45;
  animation: twinkle 2.6s ease-in-out infinite alternate;
}

.logoClouds {
  position: absolute;
  left: 3px;
  right: 3px;
  bottom: 11px;
  height: 12px;
  z-index: 3;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 500ms ease, transform 700ms ease;
}

.logoClouds::before,
.logoClouds::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  background: rgba(240, 249, 255, 0.88);
}

.logoClouds::before {
  left: 2px;
  width: 20px;
  height: 8px;
  bottom: 2px;
}

.logoClouds::after {
  right: 1px;
  width: 22px;
  height: 9px;
  bottom: 0;
}

body.theme-light .logoMorph {
  background: linear-gradient(180deg, #67e8f9 0%, #38bdf8 52%, #0ea5e9 100%);
}

body.theme-light .logoMorph::before {
  left: 22px;
  bottom: 7px;
  background: #fde047;
  box-shadow: 0 0 12px rgba(250, 204, 21, 0.75);
  transform: translateY(-24px);
}

body.theme-light .logoRays {
  opacity: 0.92;
  transform: scale(1);
  animation: spinRays 10s linear infinite;
}

body.theme-light .logoClouds {
  opacity: 1;
  transform: translateY(0);
}

body.theme-light .logoStars::before,
body.theme-light .logoStars::after {
  opacity: 0;
}

body.theme-dark {
  color: #e2e8f0;
  background:
    radial-gradient(circle at 12% -8%, rgba(56, 189, 248, 0.16), transparent 36%),
    radial-gradient(circle at 92% 2%, rgba(96, 165, 250, 0.14), transparent 44%),
    linear-gradient(180deg, #020617 0%, #0f172a 62%, #111827 100%);
}

body.theme-dark .card {
  background: rgba(15, 23, 42, 0.8);
  border-color: rgba(96, 165, 250, 0.22);
  box-shadow: 0 14px 30px rgba(2, 6, 23, 0.38);
}

body.theme-dark h1,
body.theme-dark h2,
body.theme-dark h3,
body.theme-dark h4,
body.theme-dark h5,
body.theme-dark label,
body.theme-dark .friendName {
  color: #f8fafc;
}

body.theme-dark p,
body.theme-dark li,
body.theme-dark .small {
  color: #93a4bc;
}

body.theme-dark input,
body.theme-dark textarea,
body.theme-dark select {
  background: rgba(15, 23, 42, 0.9);
  border-color: rgba(148, 163, 184, 0.3);
  color: #e2e8f0;
}

@media (max-width: 640px) {
  .themeToggleBtn,
  .themeToggleFloating {
    width: 60px !important;
    min-width: 60px !important;
    height: 60px !important;
    min-height: 60px !important;
  }
  .themeToggleFloating {
    top: 4.05rem;
    right: 0.74rem;
  }
}

@keyframes twinkle {
  0% { opacity: 0.28; }
  100% { opacity: 0.74; }
}

@keyframes spinRays {
  to { transform: scale(1) rotate(360deg); }
}

/* ===== Kouiz.in-inspired light theme ===== */
body.theme-kouizin.theme-light {
  color: #111827;
  background:
    radial-gradient(circle at 8% -4%, rgba(56, 189, 248, 0.14), transparent 34%),
    radial-gradient(circle at 96% 0%, rgba(59, 130, 246, 0.12), transparent 38%),
    linear-gradient(180deg, #f7f9ff 0%, #eef3ff 100%);
}

body.theme-kouizin.theme-light .container {
  width: min(1160px, 94vw);
}

body.theme-kouizin.theme-light .hero {
  background:
    radial-gradient(circle at 86% 18%, rgba(56, 189, 248, 0.2), transparent 46%),
    linear-gradient(145deg, #ffffff 0%, #f8fbff 54%, #eef6ff 100%);
  color: #0f172a;
  border: 1px solid rgba(59, 130, 246, 0.22);
  box-shadow: 0 20px 36px rgba(37, 99, 235, 0.16);
}

body.theme-kouizin.theme-light .hero::after {
  background: linear-gradient(125deg, rgba(59, 130, 246, 0.06), transparent 36%);
}

body.theme-kouizin.theme-light .brandText h1 {
  color: #0f172a;
  letter-spacing: 0.01em;
}

body.theme-kouizin.theme-light .heroTagline {
  color: #334155;
}

body.theme-kouizin.theme-light .heroLead {
  color: #334155;
}

body.theme-kouizin.theme-light .heroCta,
body.theme-kouizin.theme-light button:not(.secondary):not(.danger) {
  background: linear-gradient(90deg, #2563eb, #0ea5e9);
  color: #0b1220;
  border: 0;
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.24);
}

body.theme-kouizin.theme-light .heroCta {
  color: #0b1220 !important;
}

body.theme-kouizin.theme-dark .heroCta {
  color: #ffffff !important;
}

body.theme-kouizin.theme-dark #questionBankLevelMeta,
body.theme-kouizin.theme-dark #questionBankCategoryMeta {
  color: #000000 !important;
}

body.theme-kouizin.theme-light .heroCta:hover,
body.theme-kouizin.theme-light button:not(.secondary):not(.danger):hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

body.theme-kouizin.theme-light button.secondary,
body.theme-kouizin.theme-light .backHomeBtn {
  background: linear-gradient(90deg, #334155, #1f2937);
  color: #fff;
  border-color: rgba(51, 65, 85, 0.35);
}

body.theme-kouizin.theme-light #clearSharedGamesBtn {
  background: linear-gradient(90deg, #b91c1c, #dc2626);
  color: #fff;
  border-color: rgba(185, 28, 28, 0.35);
}

body.theme-kouizin.theme-light .questionStamp {
  transform: rotate(-4deg) translate(-12px, 2px);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.7), rgba(224, 242, 254, 0.48));
}

body.theme-kouizin.theme-light .questionStamp:hover {
  transform: rotate(-2deg) translate(-12px, 2px) scale(1.02);
}

body.theme-kouizin.theme-light .questionStampInner {
  border-color: rgba(59, 130, 246, 0.22);
  background: linear-gradient(145deg, #ffffff, #eef6ff);
}

body.theme-kouizin.theme-light .questionStampCount {
  color: #0f172a;
}

body.theme-kouizin.theme-light .questionStampLabel,
body.theme-kouizin.theme-light .questionStampMeta {
  color: #334155;
}

body.theme-kouizin.theme-light .card,
body.theme-kouizin.theme-light .friendsPanel,
body.theme-kouizin.theme-light #profileFriendsSection .friendRow,
body.theme-kouizin.theme-light .tableWrap,
body.theme-kouizin.theme-light .modalCard {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.24);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.09);
}

body.theme-kouizin.theme-light #authSection > .card:first-child,
body.theme-kouizin.theme-light #authSection > .card:last-child {
  background: rgba(255, 255, 255, 0.92) !important;
  border: 1px solid rgba(148, 163, 184, 0.24) !important;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.09) !important;
}

body.theme-kouizin.theme-light input,
body.theme-kouizin.theme-light textarea,
body.theme-kouizin.theme-light select {
  background: #ffffff;
  border: 1px solid rgba(148, 163, 184, 0.45);
  color: #0f172a;
}

body.theme-kouizin.theme-light input:focus,
body.theme-kouizin.theme-light textarea:focus,
body.theme-kouizin.theme-light select:focus,
body.theme-kouizin.theme-light button:focus {
  outline: 3px solid rgba(59, 130, 246, 0.25);
  outline-offset: 1px;
}

body.theme-kouizin.theme-light .resultTile {
  background: linear-gradient(145deg, #ffffff, #f0f7ff);
  border-color: rgba(96, 165, 250, 0.3);
}

body.theme-kouizin.theme-light .simpleTable th {
  background: #eff6ff;
  color: #1e3a8a;
}

body.theme-kouizin.theme-light .simpleTable td {
  color: #1f2937;
}

body.theme-kouizin.theme-light .footerNav a {
  color: #1d4ed8;
}

body.theme-kouizin.theme-light .footerNav a:hover {
  color: #0ea5e9;
}

@media (max-width: 860px) {
  body.theme-kouizin.theme-light .questionStamp {
    transform: rotate(-2deg) translateX(-8px);
  }
}

/* ===== Kouiz.in-inspired pass 2 (refinement) ===== */
body.theme-kouizin.theme-light {
  --radius-card: 20px;
  --radius-control: 12px;
}

body.theme-kouizin.theme-light .container {
  width: min(1140px, 93vw);
  margin-top: 0.9rem;
}

body.theme-kouizin.theme-light .hero {
  border-radius: 26px;
  padding: 0.1rem;
  border-color: rgba(59, 130, 246, 0.24);
  box-shadow: 0 22px 42px rgba(37, 99, 235, 0.15);
}

body.theme-kouizin.theme-light .heroTop {
  grid-template-columns: minmax(0, 1.2fr) minmax(250px, 0.8fr);
  gap: 1.25rem;
  padding: 1rem 4.6rem 1rem 1.05rem;
}

body.theme-kouizin.theme-light .brand {
  gap: 0.7rem;
}

body.theme-kouizin.theme-light .brandText h1 {
  font-size: clamp(2.05rem, 5vw, 3.05rem);
  font-weight: 800;
  letter-spacing: -0.01em;
}

body.theme-kouizin.theme-light .heroTagline {
  font-size: 0.98rem;
}

body.theme-kouizin.theme-light .heroLead {
  font-size: 1rem;
  max-width: 58ch;
}

body.theme-kouizin.theme-light .heroCta {
  border-radius: 999px;
  min-height: 46px;
  padding: 0.72rem 1.12rem;
  font-weight: 800;
}

body.theme-kouizin.theme-light .questionStamp {
  width: min(100%, 292px);
  border-radius: 24px;
  transform: rotate(-3deg) translate(-16px, 2px);
}

body.theme-kouizin.theme-light .questionStampInner {
  border-radius: 20px;
  padding: 0.72rem 1rem 0.66rem;
}

body.theme-kouizin.theme-light .questionStampCount {
  font-size: clamp(1.82rem, 4.2vw, 2.24rem);
}

body.theme-kouizin.theme-light #homeIntro {
  border-color: rgba(96, 165, 250, 0.35);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(243, 249, 255, 0.98));
}

body.theme-kouizin.theme-light .card,
body.theme-kouizin.theme-light .friendsPanel,
body.theme-kouizin.theme-light #profileFriendsSection .friendRow,
body.theme-kouizin.theme-light .tableWrap,
body.theme-kouizin.theme-light .modalCard {
  border-radius: 16px;
  border-color: rgba(148, 163, 184, 0.22);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.07);
}

body.theme-kouizin.theme-light input,
body.theme-kouizin.theme-light textarea,
body.theme-kouizin.theme-light select,
body.theme-kouizin.theme-light button {
  border-radius: 12px;
}

body.theme-kouizin.theme-light .accountToggle {
  background: linear-gradient(90deg, #0f172a, #1e293b);
  border: 1px solid rgba(30, 41, 59, 0.35);
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.25);
}

body.theme-kouizin.theme-light .resultTile strong {
  font-size: 1.62rem;
}

body.theme-kouizin.theme-light .footerNav {
  gap: 0.5rem 0.9rem;
}

@media (max-width: 860px) {
  body.theme-kouizin.theme-light .heroTop {
    grid-template-columns: 1fr;
    padding: 0.85rem 0.88rem;
    gap: 0.66rem;
  }

  body.theme-kouizin.theme-light .questionStamp {
    width: min(90vw, 306px);
    transform: rotate(-2deg) translateX(-8px);
  }

  body.theme-kouizin.theme-light .heroCta {
    min-width: 100%;
  }
}

/* ===== Fix readability for Kouizin dark mode ===== */
body.theme-kouizin.theme-dark {
  color: #e2e8f0;
  background:
    radial-gradient(circle at 10% -6%, rgba(56, 189, 248, 0.18), transparent 34%),
    radial-gradient(circle at 95% 0%, rgba(59, 130, 246, 0.16), transparent 38%),
    linear-gradient(180deg, #020617 0%, #0b1220 62%, #111827 100%);
}

body.theme-kouizin.theme-dark .hero {
  color: #e2e8f0;
  border-color: rgba(56, 189, 248, 0.28);
  background:
    radial-gradient(circle at 86% 20%, rgba(56, 189, 248, 0.25), transparent 46%),
    linear-gradient(145deg, #0b1220 0%, #0f172a 50%, #1e3a8a 100%);
  box-shadow: 0 24px 44px rgba(2, 6, 23, 0.5);
}

body.theme-kouizin.theme-dark .hero::after {
  background: linear-gradient(125deg, rgba(148, 197, 255, 0.08), transparent 38%);
}

body.theme-kouizin.theme-dark .brandText h1,
body.theme-kouizin.theme-dark h1,
body.theme-kouizin.theme-dark h2,
body.theme-kouizin.theme-dark h3,
body.theme-kouizin.theme-dark h4,
body.theme-kouizin.theme-dark h5,
body.theme-kouizin.theme-dark label,
body.theme-kouizin.theme-dark .friendName {
  color: #f8fafc;
}

body.theme-kouizin.theme-dark .heroTagline,
body.theme-kouizin.theme-dark .heroLead,
body.theme-kouizin.theme-dark p,
body.theme-kouizin.theme-dark li,
body.theme-kouizin.theme-dark .small {
  color: #cbd5e1;
}

body.theme-kouizin.theme-dark .card,
body.theme-kouizin.theme-dark .friendsPanel,
body.theme-kouizin.theme-dark #profileFriendsSection .friendRow,
body.theme-kouizin.theme-dark .tableWrap,
body.theme-kouizin.theme-dark .modalCard,
body.theme-kouizin.theme-dark .resultTile {
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(148, 163, 184, 0.28);
  box-shadow: 0 14px 30px rgba(2, 6, 23, 0.35);
}

body.theme-kouizin.theme-dark input,
body.theme-kouizin.theme-dark textarea,
body.theme-kouizin.theme-dark select {
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.32);
  color: #e2e8f0;
}

body.theme-kouizin.theme-dark input::placeholder,
body.theme-kouizin.theme-dark textarea::placeholder {
  color: #94a3b8;
}

body.theme-kouizin.theme-dark .simpleTable th {
  background: rgba(30, 41, 59, 0.9);
  color: #dbeafe;
}

body.theme-kouizin.theme-dark .simpleTable td {
  color: #cbd5e1;
  border-bottom-color: rgba(148, 163, 184, 0.24);
}

body.theme-kouizin.theme-dark .footerNav a {
  color: #7dd3fc;
}

body.theme-kouizin.theme-dark .accountPanel,
body.theme-kouizin.theme-dark .accountWorkspace,
body.theme-kouizin.theme-dark .accountContentWrap,
body.theme-kouizin.theme-dark .tabPanel,
body.theme-kouizin.theme-dark .accountMenuWrap,
body.theme-kouizin.theme-dark .accountTabs {
  background: rgba(15, 23, 42, 0.88);
  color: #e2e8f0;
}

body.theme-kouizin.theme-dark .tabBtn {
  background: rgba(30, 41, 59, 0.9);
  color: #dbeafe;
  border: 1px solid rgba(148, 163, 184, 0.28);
}

body.theme-kouizin.theme-dark .tabBtn.active {
  background: linear-gradient(90deg, #1d4ed8, #0ea5e9);
  color: #ffffff;
  border-color: transparent;
}

body.theme-kouizin.theme-dark .accountMenuWrap {
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 12px;
}

body.theme-kouizin.theme-dark a,
body.theme-kouizin.theme-dark .brandHomeLink {
  color: #93c5fd;
}

body.theme-kouizin.theme-dark .brandHomeLink {
  color: inherit;
}

body.theme-kouizin.theme-dark .questionStampInner {
  background: linear-gradient(145deg, #f8fbff, #e9f2ff);
}

/* ===== Hero explicitly blue in Kouizin light mode ===== */
body.theme-kouizin.theme-light .hero {
  color: #eaf3ff;
  border-color: rgba(37, 99, 235, 0.24);
  background:
    radial-gradient(circle at 88% 20%, rgba(125, 211, 252, 0.35), transparent 48%),
    linear-gradient(145deg, #0f172a 0%, #1d4ed8 56%, #0ea5e9 100%);
  box-shadow: 0 22px 40px rgba(30, 64, 175, 0.28);
}

body.theme-kouizin.theme-light .brandText h1,
body.theme-kouizin.theme-light .heroTagline,
body.theme-kouizin.theme-light .heroLead {
  color: #eaf3ff;
}

/* ===== Kouizin unified layout (same geometry in light/dark) ===== */
body.theme-kouizin .container {
  width: min(1140px, 93vw);
  margin-top: 0.9rem;
}

body.theme-kouizin .hero {
  border-radius: 26px;
}

body.theme-kouizin .heroTop {
  grid-template-columns: minmax(0, 1.2fr) minmax(250px, 0.8fr);
  gap: 1.25rem;
  padding: 1rem 4.6rem 1rem 1.05rem;
}

body.theme-kouizin .brand {
  gap: 0.7rem;
}

body.theme-kouizin .brandText h1 {
  font-size: clamp(2.05rem, 5vw, 3.05rem);
  font-weight: 800;
  letter-spacing: -0.01em;
}

body.theme-kouizin .heroTagline {
  font-size: 0.98rem;
}

body.theme-kouizin .heroLead {
  font-size: 1rem;
  max-width: 58ch;
}

body.theme-kouizin .heroCta {
  border-radius: 999px;
  min-height: 46px;
  padding: 0.72rem 1.12rem;
  font-weight: 800;
}

body.theme-kouizin .questionStamp {
  width: min(100%, 292px);
  border-radius: 24px;
  transform: rotate(-3deg) translate(-16px, 2px);
}

body.theme-kouizin .questionStamp:hover {
  transform: rotate(-2deg) translate(-16px, 2px) scale(1.02);
}

body.theme-kouizin .questionStampInner {
  border-radius: 20px;
  padding: 0.72rem 1rem 0.66rem;
}

body.theme-kouizin .questionStampCount {
  font-size: clamp(1.82rem, 4.2vw, 2.24rem);
}

body.theme-kouizin .themeToggleFloating {
  top: 4.05rem;
  right: 0.78rem;
}

body.theme-kouizin .accountToggle {
  top: 1rem;
  right: 1rem;
}

@media (max-width: 860px) {
  body.theme-kouizin .heroTop {
    grid-template-columns: 1fr;
    padding: 0.85rem 0.88rem;
    gap: 0.66rem;
  }

  body.theme-kouizin .questionStamp {
    width: min(90vw, 306px);
    transform: rotate(-2deg) translateX(-8px);
  }

  body.theme-kouizin .heroCta {
    min-width: 100%;
  }

  body.theme-kouizin .accountToggle {
    top: 0.8rem;
    right: 0.8rem;
  }

  body.theme-kouizin .themeToggleFloating {
    top: 4.05rem;
    right: 0.8rem;
  }

  body.theme-kouizin .heroQuickActions .accountToggle,
  body.theme-kouizin .heroQuickActions .themeToggleFloating {
    top: auto;
    right: auto;
  }
}

/* ===== Hard dark override for Kouizin (fix remaining light blocks) ===== */
body.theme-kouizin.theme-dark,
body.theme-kouizin.theme-dark .small,
body.theme-kouizin.theme-dark p,
body.theme-kouizin.theme-dark li,
body.theme-kouizin.theme-dark td,
body.theme-kouizin.theme-dark th,
body.theme-kouizin.theme-dark label,
body.theme-kouizin.theme-dark h1,
body.theme-kouizin.theme-dark h2,
body.theme-kouizin.theme-dark h3,
body.theme-kouizin.theme-dark h4,
body.theme-kouizin.theme-dark h5 {
  color: #cbd5e1 !important;
}

body.theme-kouizin.theme-dark h1,
body.theme-kouizin.theme-dark h2,
body.theme-kouizin.theme-dark h3,
body.theme-kouizin.theme-dark h4,
body.theme-kouizin.theme-dark h5,
body.theme-kouizin.theme-dark .friendName,
body.theme-kouizin.theme-dark .brandText h1 {
  color: #f1f5f9 !important;
}

body.theme-kouizin.theme-dark .card,
body.theme-kouizin.theme-dark #authSection > .card:first-child,
body.theme-kouizin.theme-dark #authSection > .card:last-child,
body.theme-kouizin.theme-dark #homeIntro,
body.theme-kouizin.theme-dark #sharedGamesCard,
body.theme-kouizin.theme-dark #startGameCard,
body.theme-kouizin.theme-dark #gameCard,
body.theme-kouizin.theme-dark #roundSummary,
body.theme-kouizin.theme-dark #finalSummary,
body.theme-kouizin.theme-dark .accountPanel,
body.theme-kouizin.theme-dark .accountWorkspace,
body.theme-kouizin.theme-dark .accountContentWrap,
body.theme-kouizin.theme-dark .friendsPanel,
body.theme-kouizin.theme-dark #profileFriendsSection .friendRow,
body.theme-kouizin.theme-dark .tableWrap,
body.theme-kouizin.theme-dark .modalCard,
body.theme-kouizin.theme-dark .resultTile {
  background: rgba(15, 23, 42, 0.94) !important;
  border-color: rgba(148, 163, 184, 0.28) !important;
  box-shadow: 0 14px 30px rgba(2, 6, 23, 0.42) !important;
}

body.theme-kouizin.theme-dark .resultTile strong {
  color: #f8fafc !important;
}

body.theme-kouizin.theme-dark .resultTile span {
  color: #e2e8f0 !important;
}

body.theme-kouizin.theme-dark #registerForm,
body.theme-kouizin.theme-dark #resendForm {
  color: #e2e8f0 !important;
}

body.theme-kouizin.theme-dark #registerForm input,
body.theme-kouizin.theme-dark #resendForm input {
  background: rgba(15, 23, 42, 0.96) !important;
  border-color: rgba(148, 163, 184, 0.34) !important;
  color: #f8fafc !important;
}

body.theme-kouizin.theme-dark #registerForm input::placeholder,
body.theme-kouizin.theme-dark #resendForm input::placeholder {
  color: #94a3b8 !important;
}

body.theme-kouizin.theme-dark #registerForm .checkboxRow {
  color: #cbd5e1 !important;
}

body.theme-kouizin.theme-dark #registerForm .checkboxRow a {
  color: #93c5fd !important;
}

body.theme-kouizin.theme-dark #registerForm .checkboxRow a:hover {
  color: #bae6fd !important;
}

body.theme-kouizin.theme-dark .tabBtn {
  background: rgba(30, 41, 59, 0.95) !important;
  color: #dbeafe !important;
  border-color: rgba(148, 163, 184, 0.32) !important;
}

body.theme-kouizin.theme-dark .tabBtn.active {
  background: linear-gradient(90deg, #1d4ed8, #0ea5e9) !important;
  color: #ffffff !important;
  border-color: transparent !important;
}

body.theme-kouizin.theme-dark input,
body.theme-kouizin.theme-dark textarea,
body.theme-kouizin.theme-dark select {
  background: rgba(15, 23, 42, 0.96) !important;
  color: #e2e8f0 !important;
  border-color: rgba(148, 163, 184, 0.34) !important;
}

body.theme-kouizin.theme-dark .simpleTable th {
  background: rgba(30, 41, 59, 0.96) !important;
  color: #dbeafe !important;
}

body.theme-kouizin.theme-dark .simpleTable td {
  color: #cbd5e1 !important;
  border-bottom-color: rgba(148, 163, 184, 0.24) !important;
}

body.theme-kouizin.theme-dark #homeIntro .introBadges {
  gap: 0.5rem;
}

body.theme-kouizin.theme-dark #homeIntro .introBadge {
  background: linear-gradient(145deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.95)) !important;
  color: #dbeafe !important;
  border: 1px solid rgba(125, 211, 252, 0.35) !important;
}

body.theme-kouizin.theme-dark .settingsBlock,
body.theme-kouizin.theme-dark #startGameCard .settingsBlock,
body.theme-kouizin.theme-dark .settingsBlock.stack {
  background: linear-gradient(155deg, rgba(15, 23, 42, 0.94), rgba(30, 41, 59, 0.92)) !important;
  border-color: rgba(148, 163, 184, 0.28) !important;
}

body.theme-kouizin.theme-dark .settingsBlock h3,
body.theme-kouizin.theme-dark #startGameCard label,
body.theme-kouizin.theme-dark .settingsCompactRow label {
  color: #e2e8f0 !important;
}

body.theme-kouizin.theme-dark .form-control,
body.theme-kouizin.theme-dark select.form-control,
body.theme-kouizin.theme-dark input.form-control {
  background: rgba(15, 23, 42, 0.96) !important;
  border-color: rgba(148, 163, 184, 0.34) !important;
  color: #e2e8f0 !important;
}

body.theme-kouizin.theme-dark #questionCategoryLabel,
body.theme-kouizin.theme-dark .themeBadge {
  background: rgba(15, 23, 42, 0.92) !important;
  color: #cbd5e1 !important;
  border-color: rgba(148, 163, 184, 0.34) !important;
}

/* Keep friend selection visibly highlighted regardless of generic button themes */
body.theme-kouizin.theme-light .friendPlayerOption {
  background: #f8fafc !important;
  color: #0f172a !important;
  border: 1px solid #cbd5e1 !important;
}

body.theme-kouizin.theme-light .friendPlayerOption.is-selected,
body.theme-kouizin.theme-light .friendPlayerOption[aria-pressed="true"] {
  border-color: #0f766e !important;
  background: #d1fae5 !important;
  color: #065f46 !important;
  font-weight: 700 !important;
}

body.theme-kouizin.theme-dark .friendPlayerOption {
  background: rgba(30, 41, 59, 0.9) !important;
  color: #e2e8f0 !important;
  border: 1px solid rgba(148, 163, 184, 0.4) !important;
}

body.theme-kouizin.theme-dark .friendPlayerOption.is-selected,
body.theme-kouizin.theme-dark .friendPlayerOption[aria-pressed="true"] {
  border-color: #34d399 !important;
  background: rgba(6, 95, 70, 0.35) !important;
  color: #bbf7d0 !important;
  font-weight: 700 !important;
}

/* Mobile override for hero quick actions:
   keep both buttons visually identical and aligned to the right. */
@media (max-width: 860px) {
  .heroQuickActions {
    width: 100%;
    justify-content: flex-end;
  }

  .heroQuickActions #accountToggleBtn,
  .heroQuickActions #themeToggleBtn {
    width: 60px !important;
    min-width: 60px !important;
    height: 60px !important;
    min-height: 60px !important;
    padding: 0 !important;
  }

  .heroQuickActions #accountToggleBtn {
    gap: 0 !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    border-radius: 12px !important;
  }

  .heroQuickActions #accountToggleBtn .accountIcon {
    width: 44px !important;
    height: 44px !important;
    border-radius: 14px !important;
    font-size: 0.95rem;
  }

  .heroQuickActions .accountToggle,
  .heroQuickActions .themeToggleBtn,
  .heroQuickActions .themeToggleFloating {
    width: 60px !important;
    min-width: 60px !important;
    height: 60px !important;
    min-height: 60px !important;
    padding: 0 !important;
  }

  .heroQuickActions .accountToggle {
    border-radius: 12px;
  }
}
