:root {
  --bg: #ffffff;
  --bg2: #f5f5f5;
  --bg3: #eeeeee;
  --fg: #0a0a0a;
  --fg2: #444444;
  --fg3: #888888;
  --border: #ddd;
  --accent: #111111;
  --accent-inv: #ffffff;
  --danger: #c0392b;
  --success: #27ae60;
  --warning: #e67e22;
  --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  --radius: 3px;
  --font-body: 'DM Sans', 'Computer Modern', 'Latin Modern', 'STIX Two Text', Georgia, serif;
  --font-mono: 'Courier New', monospace;
  --transition: 0.15s ease;
  --ink: #0a0a0a;
  --muted: #888888;
  --text: #0a0a0a;
  --text-muted: #888888;
  --card-bg: #ffffff;
  --tag-bg: #f5f5f5;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  --hover-bg: rgba(0, 0, 0, 0.03);
}

[data-theme="dark"] {
  --bg: #111111;
  --bg2: #1a1a1a;
  --bg3: #222222;
  --fg: #f0f0f0;
  --fg1: #d0d0d0;
  --fg2: #aaaaaa;
  --fg3: #666666;
  --border: #333;
  --accent: #f0f0f0;
  --accent-inv: #111111;
  --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  --ink: #f0f0f0;
  --muted: #666666;
  --text: #f0f0f0;
  --text-muted: #666666;
  --card-bg: #1a1a1a;
  --tag-bg: #222222;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  --hover-bg: rgba(255, 255, 255, 0.04);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--fg);
  min-height: 100vh;
  line-height: 1.6;
  transition: background var(--transition), color var(--transition);
  display: flex;
  flex-direction: column;
}

h1,
h2,
h3,
h4 {
  font-weight: normal;
  letter-spacing: -0.01em;
}

h1 {
  font-size: 2rem;
}

h2 {
  font-size: 1.4rem;
}

h3 {
  font-size: 1.1rem;
}

a {
  color: var(--fg);
  text-decoration: underline;
  text-underline-offset: 3px;
}

a:hover {
  opacity: 0.9;
}

/*  Page transitions  */
.page {
  display: none;
}

.page.active {
  display: block;
}


nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 86px;
  top: 0;
  z-index: 100;
}

.logo {
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  padding: 8px 12px;
}

.nav-links {
  display: flex;
  gap: 28px;
  align-items: center;
}

.nav-links a {
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.06em;
  color: var(--ink);
  text-decoration: none;
  opacity: 0.75;
  transition: opacity 0.15s;
  padding-left: 0.6rem;
}

.nav-links a:hover,
.nav-links a.active {
  opacity: 1;
  color: var(--fg);
}

.nav-right {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.btn-create {
  padding: 8px 20px;
  border: 1.5px solid var(--ink);
  background: transparent;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.04em;
  cursor: pointer;
  color: var(--ink);
  transition: background 0.18s, color 0.18s;
  max-width: 240px;

}

.btn-create:hover {
  background: var(--ink);
  color: var(--bg);
}

.btn-create:hover img[src$=".svg"] {
  filter: invert(1);
}

/*  Nav user row  */
.nav-user-row {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}


#app {
  display: grid;
  grid-template-columns: 200px 1fr;
  grid-template-rows: 1fr;
  min-height: 100vh;
}

#app,
.page.active,
#page-home.active {
  flex: 1;
}

.nav-vertical {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 2rem 1.25rem;
  border-right: 1px solid var(--border);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background: var(--bg);
}

.nav-logo {
  font-size: 1rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-decoration: none;
  font-weight: normal;
  color: var(--fg);
  margin-bottom: 1.5rem;
  padding-left: 0.25rem;
}

.nav-vertical .nav-logo {
  font-size: 1rem;
  text-align: center;
  margin-bottom: 2rem;
}

.nav-links-vertical {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  width: 100%;
  margin-bottom: 0;
}

.nav-links-vertical a {
  display: block;
  padding: 0.6rem 0.75rem;
  font-size: 0.9rem;
  color: var(--fg2);
  text-decoration: none;
  border-radius: var(--radius);
  transition: all var(--transition);
}

.nav-links-vertical a:hover,
.nav-links-vertical a.active {
  color: var(--fg);
  background: var(--bg2);
  border-color: var(--border);
}

.nav-social-links {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  width: 100%;
  margin-top: auto;
  padding-top: 1rem;
}

.nav-social-links a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 1rem;
  font-size: 0.82rem;
  color: var(--fg3);
  text-decoration: none;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: all var(--transition);
}

.nav-social-links a:hover {
  color: var(--fg);
  background: var(--bg2);
  border-color: var(--border);
}

.nav-divider {
  width: 100%;
  border: none;
  border-top: 1px solid var(--border);
  margin: 0.75rem 0;
}

.nav-right-vertical {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  width: 100%;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

#mobileNav {
  display: none !important;
}

/*  Hamburger Menu  */
.hamburger-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  color: var(--fg);
  font-size: 1.5rem;
  line-height: 1;
  z-index: 101;
  transition: opacity var(--transition);
}

.hamburger-btn:hover {
  opacity: 0.7;
}

.nav-mobile {
  display: none;
  position: fixed;
  top: 52px;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg);
  border-right: 1px solid var(--border);
  padding: 1.5rem 1rem;
  overflow-y: auto;
  flex-direction: column;
  justify-content: flex-start;
  z-index: 99;
  width: 100%;
  max-width: 280px;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
  animation: slideInLeft 0.3s ease-out;
}

.nav-mobile.open {
  display: flex;
}

@keyframes slideInLeft {
  from {
    transform: translateX(-100%);
    opacity: 0;
  }

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

.nav-mobile::after {
  content: '';
  position: fixed;
  top: 52px;
  left: 280px;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  display: none;
  z-index: 98;
}

.nav-mobile.open::after {
  display: block;
}

.nav-mobile .nav-logo {
  font-size: 1rem;
  margin-bottom: 1rem;
  text-decoration: none;
}

.nav-mobile .nav-links-vertical {
  margin-bottom: 2rem;
}

.nav-mobile .nav-right-vertical {
  width: 100%;
}

.nav-mobile .flex.flex-col {
  width: 100%;
}

.nav-mobile .btn {
  width: 50%;
  justify-content: center;
  text-align: center;
}

.nav-social {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  position: relative;
}

.nav-icon-btn {
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.35rem 0.45rem;
  border-radius: 8px;
  font-size: 1.1rem;
  color: var(--fg2);
  transition: background 0.15s, color 0.15s;
  line-height: 1;
}

.nav-icon-btn:hover {
  background: var(--bg2);
  color: var(--fg1);
}


.main-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
}

.main-layout>main {
  padding: 2rem 2.5rem;
  overflow-y: auto;
}


.right-panel {
  border-left: 1px solid var(--border);
  padding: 2rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.right-panel-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fg3);
  margin-bottom: 0.25rem;
}

.right-panel .btn {
  border-radius: 999px;
  width: 100%;
  justify-content: center;
}



main {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  max-width: 1160px;
  margin: 0 auto;
  width: 100%;
  padding: 72px 48px;
  align-items: center;
}

.left-col {
  padding-right: 60px;
}

.section-label {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.section-label h2 {
  font-family: 'Playfair Display', serif;
  font-size: 26px;
  font-weight: 400;
  letter-spacing: -0.01em;
}

.streak-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--tag-bg);
  border: 1px solid var(--border);
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
  border-radius: 2px;
}

.streak-badge .flame {
  font-size: 13px;
}

.problem-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 28px 28px 24px;
  position: relative;
  animation: slideUp 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

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

.problem-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.problem-date {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--ink);
}

.problem-meta {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tag {
  background: var(--tag-bg);
  border: 1px solid var(--border);
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.difficulty {
  display: flex;
  gap: 3px;
  align-items: center;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink);
  opacity: 0.25;
}

.dot.filled {
  opacity: 1;
}

.problem-divider {
  height: 1px;
  background: var(--border);
  margin-bottom: 20px;
}

.problem-text {
  font-size: 14.5px;
  font-weight: 300;
  line-height: 1.75;
  color: var(--ink);
  margin-bottom: 6px;
}

.problem-text strong {
  font-weight: 500;
}

.problem-ask {
  font-size: 14.5px;
  font-weight: 400;
  color: var(--ink);
  line-height: 1.7;
  margin-bottom: 24px;
}

.answer-section {
  border-top: 1px solid var(--border);
  padding-top: 20px;
}

.format-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 12px;
}

.format-label span {
  font-weight: 500;
  color: var(--ink);
}

.btn-validate {
  padding: 10px 22px;
  background: var(--ink);
  color: var(--bg);
  border: none;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: opacity 0.18s;
}

.btn-validate:hover {
  opacity: 0.82;
}


.right-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  padding-left: 60px;
  border-left: 1px solid var(--border);
  animation: fadeIn 0.7s ease both 0.1s;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.hero-title {
  font-family: 'Playfair Display', serif;
  font-size: 58px;
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.02em;
  text-align: center;
  color: var(--ink);
  margin-bottom: 1rem;
  max-width: 300px;
}

.hero-sub {
  font-size: 14px;
  font-weight: 300;
  color: var(--muted);
  text-align: center;
  letter-spacing: 0.01em;
  line-height: 1.6;
  max-width: 300px;
  margin-top: -10px;
  margin-bottom: 0.8rem;
}

/* Hero (app layout) */
.hero {
  padding: 4rem 0 2rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
}

.action-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 340px;
}

.action-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  padding: 18px 22px;
  cursor: pointer;
  transition: border-color 0.18s, box-shadow 0.18s, transform 0.18s;
  text-decoration: none;
  color: var(--ink);
  display: block;
}

.action-card:hover {
  border-color: var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
  transform: translate(-2px, -2px);
}

.action-card h3 {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  font-weight: 400;
  margin-bottom: 5px;
}

.action-card p {
  font-size: 12px;
  font-weight: 300;
  color: var(--muted);
  line-height: 1.5;
}


.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1.25rem;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 0.9rem;
  cursor: pointer;
  border-radius: var(--radius);
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover {
  background: var(--bg3);
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-inv);
  border-color: var(--accent);
}

.btn-primary:hover {
  opacity: 0.85;
}

.btn-sm {
  padding: 0.3rem 0.8rem;
  font-size: 0.82rem;
}

.btn-lg {
  padding: 0.75rem 2rem;
  font-size: 1.05rem;
}

.btn-danger {
  border-color: var(--danger);
  color: var(--danger);
}

.btn-danger:hover {
  background: var(--danger);
  color: white;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-full {
  width: 100%;
}

.btn-play-friend {
  background: transparent;
  border: 1.5px solid var(--accent);
  color: var(--accent);
}

.btn-play-friend:hover {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}



.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  margin-bottom: 0.3rem;
  color: var(--fg2);
  font-weight: 600;
}

.form-input,
.form-select {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 0.95rem;
  transition: border-color var(--transition);
  outline: none;
}

.form-input:focus,
.form-select:focus {
  border-color: var(--fg);
}

.form-input::placeholder {
  color: var(--fg3);
}

/*  Answer input  */
.answer-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-top: 1rem;
}

.answer-input {
  flex: 1;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  font-family: 'DM Sans', sans-serif;
  font-size: 13.5px;
  font-weight: 300;
  color: var(--ink);
  outline: none;
  transition: border-color 0.18s;
}

.answer-input::placeholder {
  color: #bbbbb5;
}

.answer-input:focus {
  border-color: var(--accent);
}

.answer-input.correct {
  border-color: var(--success);
}

.answer-input.wrong {
  border-color: var(--danger);
}


.msg-error {
  color: var(--danger);
  font-size: 0.88rem;
  margin-top: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-left: 2px solid var(--danger);
  min-height: 1.1em;
}

.msg-error:empty {
  display: none;
}

.msg-success {
  color: var(--success);
  font-size: 0.88rem;
  margin-top: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-left: 2px solid var(--success);
}

.msg-success:empty {
  display: none;
}

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

.feedback-error {
  color: var(--danger);
}


.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  background: var(--bg);
  box-shadow: var(--card-shadow);
  margin-bottom: 1rem;
}

.card-sm {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  background: var(--bg2);
  margin-bottom: 0.5rem;
}


table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th,
thead th {
  text-align: left;
  font-weight: normal;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg3);
  border-bottom: 1.5px solid var(--border);
  padding: 0.5rem 0.75rem;
  font-weight: 700;
}

td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td,
tbody tr:hover {
  background: var(--hover-bg);
}

tbody a {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
}

tbody a:hover {
  color: var(--accent);
}



.leaderboard-main {
  display: block;
  padding: 2rem;
}

.leaderboard-title {
  margin-bottom: 1.5rem;
}

.leaderboard-table-wrap {
  overflow-x: auto;
}

.leaderboard-loading {
  padding: 1rem;
}

.elo-placement {
  color: var(--accent);
  font-size: 0.8rem;
}

.sidebar h3 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fg3);
  margin-bottom: 1rem;
}

.leaderboard-entry {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  border-radius: 5px;
}

.leaderboard-entry:last-child {
  border-bottom: none;
}

.lb-rank {
  color: var(--fg3);
  width: 18px;
  font-size: 0.78rem;
  text-align: right;
  flex-shrink: 0;
}

.lb-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.lb-elo {
  color: var(--fg3);
  font-size: 0.78rem;
  flex-shrink: 0;
}

.lb-me {
  font-weight: bold;
  color: var(--fg);
}

.sidebar-leaderboard-section {
  margin-top: 1.5rem;
}

.sidebar-see-all {
  font-size: 0.75rem;
  color: var(--fg3);
  text-decoration: none;
}

.sidebar-loading {
  font-size: 0.82rem;
}

/*  League badges  */
.league-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border: 1px solid currentColor;
  background: rgba(0, 0, 0, 0.06);
  color: var(--text-muted);
}

.league-Bronze {
  color: #a0522d;
  border-color: #a0522d;
}

.league-Argent {
  color: var(--fg3);
  border-color: var(--fg3);
}

.league-Or {
  color: #b8860b;
  border-color: #b8860b;
}

.league-Platine {
  color: #5f9ea0;
  border-color: #5f9ea0;
}

.league-Diamant {
  color: #4169e1;
  border-color: #4169e1;
}

.league-Maître {
  color: #8b0000;
  border-color: #8b0000;
}



.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.65rem;
  margin: 1.5rem 0;
}

.stat-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 800;
  display: block;
}

.stat-label {
  font-size: 0.78rem;
  color: var(--fg3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stat-wins {
  color: #22c55e;
}

.stat-losses {
  color: #ef4444;
}

.stat-draws {
  color: var(--fg3);
}

.stat-problems {
  color: var(--accent);
}


.match-arena {
  display: grid;
  grid-template-columns: 1fr 200px 1fr;
  gap: 0;
  min-height: 100vh;
}

.match-panel {
  padding: 1.5rem;
  border: 1px solid var(--border);
}

.match-center {
  padding: 1rem;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.match-arena-wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem;
}

.match-timer-center {
  text-align: center;
}

.match-progress-bar {
  width: 180px;
  margin: 4px auto 0;
}

.match-opp-info {
  text-align: right;
}

.match-grid {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 1.5rem;
  align-items: start;
}

.match-sidebar-label {
  color: var(--fg3);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.25rem;
}

.match-sidebar-divider {
  margin: 0.75rem 0;
  border: none;
  border-top: 1px solid var(--border);
}

.my-solved-count {
  font-size: 1.5rem;
}

.match-forfeit-btn {
  margin-top: 1rem;
  width: 100%;
}

/*  Problem selector  */
.problem-selector {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
}

.prob-btn {
  width: 100%;
  text-align: left;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  background: var(--card-bg);
  cursor: pointer;
  border-radius: 6px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--fg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all var(--transition);
  margin-bottom: 0.35rem;
}

.prob-btn:hover:not(:disabled) {
  border-color: var(--text-muted);
  background: var(--bg3);
}

.prob-btn.active {
  border-color: var(--fg);
}

.prob-btn.solved {
  border-color: var(--success);
  color: var(--success);
}

.prob-btn.failed {
  border-color: var(--danger);
  color: var(--danger);
  opacity: 0.5;
}

.prob-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.lives-display {
  display: flex;
  gap: 3px;
}

.life {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
}

.life.alive {
  background: var(--accent);
}

.problem-category-label {
  font-size: 0.8rem;
  color: var(--fg3);
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.problem-format-hint {
  margin-top: 1rem;
  padding: 0.55rem 0.85rem;
  background: var(--bg2);
  border-left: 3px solid var(--accent);
  border-radius: 0 4px 4px 0;
  font-size: 0.85rem;
  color: var(--fg2);
}

/*  Timer  */
.timer {
  font-size: 1.6rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.05em;
}

.timer.warning {
  color: var(--warning);
}

.timer.danger {
  color: var(--danger);
  animation: blink 0.8s steps(1) infinite;
}

@keyframes blink {
  50% {
    opacity: 0.4;
  }
}

/*  Problem display  */
.problem-display {
  padding: 2rem;
  border: 1px solid var(--border);
  background: var(--bg2);
  border-radius: var(--radius);
    margin: .9rem 0 .6rem;
  line-height: 1.7;
  font-family: 'KaTeX_Main', serif;
  font-size: 1.1rem;
  color: var(--fg)
}


.katex {
  font-size: 1.05em;
}

/*  Progress bar  */
.progress-bar {
  height: 5px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 1s linear;
}

.progress-fill.warning {
  background: var(--warning);
}

.progress-fill.danger {
  background: var(--danger);
}

/*  Difficulty dots  */
.diff-dots {
  display: inline-flex;
  gap: 3px;
}

.diff-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--border);
  display: inline-block;
}

.diff-dot.filled {
  background: var(--accent);
}

/*  Pre-match screen  */
.prematch-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  gap: 1.5rem;
  text-align: center;
  padding: 2rem;
}

.prematch-players {
  display: flex;
  align-items: center;
  gap: 2rem;
  flex-wrap: wrap;
  justify-content: center;
}

.prematch-player-name {
  font-weight: 700;
}

.prematch-vs {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--fg3);
}

.prematch-countdown {
  font-size: 3rem;
  font-weight: 900;
  color: var(--accent);
}

/*  Matchmaking  */
.matchmaking-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  gap: 2rem;
  text-align: center;
  padding: 2rem;
}

.pulse-ring {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 3px solid var(--accent);
  position: relative;
  animation: pulse 1.4s ease-in-out infinite;
}

.pulse-ring::before {
  content: '';
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 1px solid var(--fg);
  opacity: 0;
  animation: pulse-out 1.5s ease-out infinite;
}

@keyframes pulse {

  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }

  50% {
    transform: scale(1.25);
    opacity: 0.35;
  }
}

@keyframes pulse-out {
  0% {
    transform: scale(1);
    opacity: 0.5;
  }

  100% {
    transform: scale(1.6);
    opacity: 0;
  }
}

/*  Result screen  */
.result-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 70vh;
  gap: 1.5rem;
  text-align: center;
  padding: 2rem;
}

.result-title {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.elo-delta {
  font-size: 1.8rem;
  font-weight: 800;
}

.elo-delta.positive {
  color: var(--success);
}

.elo-delta.negative {
  color: var(--danger);
}

.result-stats-grid {
  width: 280px;
  margin-top: 1rem;
}

.result-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
  justify-content: center;
}



.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  width: 100%;
  max-width: 440px;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--fg3);
  font-size: 1.2rem;
  line-height: 1;
}

.modal-box {
  background: var(--card-bg, #fff);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 2rem;
  width: 100%;
  max-width: 460px;
  position: relative;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.18);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-box h2 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
}

.modal-box-md {
  max-width: 500px;
}

.modal-box-sm {
  max-width: 420px;
}

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

.modal-title {
  margin: 0;
}

/* Auth */
.auth-tabs-row {
  display: flex;
  gap: 0;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.auth-tab {
  padding: 0.5rem 1.1rem;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}

.auth-tab.active {
  color: var(--text);
  border-bottom-color: var(--text);
}

.auth-switch-text {
  margin-top: 0.75rem;
  font-size: 0.82rem;
  color: var(--fg3);
  text-align: center;
}

/* Private match modal */
.pm-tabs-row {
  display: flex;
  gap: 0;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
}

.pm-tab {
  opacity: 0.6;
}

.pm-tab.active {
  opacity: 1;
  border-color: var(--accent);
  color: var(--accent);
}

.pm-create-hint {
  font-size: 0.88rem;
  margin-bottom: 1rem;
}

.pm-create-btn-wrap {
  text-align: center;
}

.pm-code-input {
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.pm-waiting-wrap {
  text-align: center;
  padding: 0.75rem 0;
}

.pm-copy-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}

.pm-waiting-indicator {
  margin-top: 1.25rem;
}

.pm-pulse {
  width: 36px;
  height: 36px;
  margin: 0.25rem auto;
}

.pm-waiting-text {
  margin-top: 0.4rem;
}

.pm-cancel-btn {
  margin-top: 0.75rem;
  opacity: 0.55;
}

.pm-code {
  font-family: 'Courier New', Courier, monospace;
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: var(--accent);
  background: var(--bg2);
  border: 2px dashed var(--border);
  border-radius: 6px;
  padding: 0.75rem 1.5rem;
  display: inline-block;
  margin: 0.5rem 0;
  user-select: all;
  word-break: break-all;
}

.private-link-box {
  display: flex;
  gap: 0.5rem;
  margin: 0.75rem 0 1.25rem;
}

.pulse-ring-sm {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid var(--accent);
  animation: pulse-ring 1.4s ease-in-out infinite;
}

@keyframes pulse-ring {
  0% {
    transform: scale(0.9);
    opacity: 0.7;
  }

  50% {
    transform: scale(1.1);
    opacity: 1;
  }

  100% {
    transform: scale(0.9);
    opacity: 0.7;
  }
}



#toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: center;
  pointer-events: none;
}

.toast-item {
  padding: 0.5rem 1.25rem;
  background: var(--fg);
  color: var(--accent-inv);
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  animation: toast-in 0.2s ease;
  max-width: 300px;
  pointer-events: auto;
}

@keyframes toast-in {
  from {
    transform: translateY(6px);
    opacity: 0;
  }

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

.toast-invite {
  border-left: 3px solid var(--accent);
  padding: 0.85rem 1rem;
}



.notif-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: var(--danger, #ef4444);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  pointer-events: none;
}

.notif-badge.hidden {
  display: none;
}

.notif-badge-inline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--danger, #ef4444);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  padding: 0 4px;
  margin-left: 0.35rem;
  vertical-align: middle;
}

.notif-panel {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 300px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  z-index: 200;
  overflow: hidden;
  max-height: 400px;
  overflow-y: auto;
}

.notif-panel.open {
  display: block;
}

#notifPanel {
  display: none;
  padding: 0.6rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.notif-item {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}

.notif-item:last-child {
  border-bottom: none;
}

.notif-item:hover {
  background: var(--bg3);
}

.notif-item.unread {
  background: color-mix(in srgb, var(--accent) 8%, var(--bg2));
}

.notif-item .notif-time {
  font-size: 0.7rem;
  margin-top: 0.2rem;
}

.notif-empty {
  padding: 0.75rem;
  text-align: center;
}

#notifListModal .notif-item-modal {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
  cursor: pointer;
  transition: background 0.1s;
}

#notifListModal .notif-item-modal:last-child {
  border-bottom: none;
}

#notifListModal .notif-item-modal:hover {
  background: var(--bg2);
}

#notifListModal .notif-item-modal.unread {
  background: var(--bg2);
  border-left: 3px solid var(--accent);
}

.notif-modal-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg2);
}


.theme-btn {
  background: none;
  border: 1px solid var(--border);
  cursor: pointer;
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius);
  color: var(--fg);
  font-size: 0.9rem;
  transition: all var(--transition);
  line-height: 1;
}

.theme-btn:hover {
  background: var(--bg3);
}



.profile-content {
  max-width: 640px;
}

.profile-loading {
  padding: 2rem 0;
}

.profile-back-btn {
  margin-bottom: 1.5rem;
}

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

.profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.profile-info {
  flex: 1;
}

.profile-username {
  margin: 0 0 0.3rem;
}

.profile-badges {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.profile-elo {
  font-weight: 600;
}

.profile-since {
  margin-top: 0.25rem;
}

.profile-stats-grid {
  grid-template-columns: repeat(4, 1fr);
  margin-bottom: 1.5rem;
}


.chat-widget {
  position: fixed;
  bottom: 68px;
  right: 18px;
  width: 260px;
  z-index: 50;
}

.chat-widget-inner {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}

.chat-widget-header {
  padding: 0.45rem 0.7rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg3);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-toggle-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--fg3);
}

.chat-messages {
  height: 140px;
  overflow-y: auto;
  padding: 0.55rem;
  font-size: 0.78rem;
}

.chat-input-row {
  display: flex;
  gap: 0.35rem;
  padding: 0.45rem;
  border-top: 1px solid var(--border);
}

.chat-input {
  flex: 1;
  font-size: 0.78rem;
  padding: 0.35rem 0.55rem;
}

.chat-send-btn {
  padding: 0.35rem 0.55rem;
}

.chat-empty {
  font-size: 0.78rem;
}

.chat-msg {
  margin-bottom: 0.3rem;
  line-height: 1.3;
}

.chat-msg-author {
  font-weight: 600;
  color: var(--fg1);
}

.chat-msg-me {
  color: var(--accent);
}

.chat-msg-time {
  font-size: 0.72rem;
  margin-left: 0.3rem;
}

.chat-msg-text {
  color: var(--fg2);
  word-break: break-word;
}



.friends-search-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.friends-search-list {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 1rem;
}

.friends-section {
  margin-top: 1.25rem;
}

.friends-section-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--fg3);
  margin-bottom: 0.6rem;
  display: flex;
  align-items: center;
}

.friend-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg2);
  margin-bottom: 0.4rem;
  gap: 0.5rem;
}

.friend-item:last-child {
  margin-bottom: 0;
}

.friend-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.friend-actions {
  display: flex;
  gap: 0.4rem;
}

.friend-name-cell {
  cursor: pointer;
  flex: 1;
}

.friends-loading {
  font-size: 0.82rem;
}

.friends-empty {
  text-align: center;
  padding: 1rem;
}

.friend-search-results {
  margin-top: 0.5rem;
}

.friend-row-new {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.1s;
}

.friend-row-new:hover {
  background: var(--bg2);
}

.friend-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--bg3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--fg2);
  flex-shrink: 0;
}

.online-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  flex-shrink: 0;
}

#friendsModal .modal-box {
  background: var(--bg);
}


.forum-content {
  max-width: 860px;
}

.forum-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.forum-page-header h1 {
  margin-bottom: 0.15rem;
}

.forum-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  color: var(--fg3);
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.forum-breadcrumb a {
  color: var(--fg2);
  text-decoration: none;
}

.forum-breadcrumb a:hover {
  color: var(--fg);
}

.forum-sep {
  color: var(--fg3);
  font-size: 0.8rem;
}

.forum-category-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.6rem;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), transform var(--transition);
}

.forum-category-card:hover {
  background: var(--bg2);
  border-color: var(--fg3);
  transform: translateX(2px);
}

.forum-cat-body {
  flex: 1;
  min-width: 0;
}

.forum-cat-name {
  font-size: 1rem;
  margin-bottom: 0.12rem;
}

.forum-cat-desc {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.forum-cat-stats {
  display: flex;
  gap: 1.25rem;
  align-items: center;
  flex-shrink: 0;
}

.forum-stat {
  text-align: center;
  min-width: 48px;
}

.forum-stat-value {
  display: block;
  font-size: 1.05rem;
}

.forum-stat-label {
  display: block;
  font-size: 0.68rem;
  color: var(--fg3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.forum-last-post {
  min-width: 110px;
  text-align: right;
}

.forum-cat-arrow {
  color: var(--fg3);
  font-size: 1.2rem;
  flex-shrink: 0;
  transition: transform var(--transition);
}

.forum-category-card:hover .forum-cat-arrow {
  transform: translateX(3px);
}

.forum-thread-list {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.forum-thread-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--transition);
}

.forum-thread-item:last-child {
  border-bottom: none;
}

.forum-thread-item:hover {
  background: var(--bg2);
}

.forum-thread-item.forum-pinned {
  background: var(--bg2);
}

.forum-thread-item-main {
  flex: 1;
  min-width: 0;
}

.forum-thread-item-title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.95rem;
  margin-bottom: 0.2rem;
  flex-wrap: wrap;
}

.forum-thread-item-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
}

.forum-thread-stat {
  text-align: center;
  min-width: 38px;
}

.forum-thread-stat-val {
  display: block;
  font-size: 1rem;
}

.forum-thread-stat-label {
  display: block;
  font-size: 0.68rem;
  color: var(--fg3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.forum-thread-last {
  min-width: 100px;
  text-align: right;
}

.forum-tag {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 2px;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid currentColor;
  flex-shrink: 0;
}

.forum-tag-pin {
  color: #b8860b;
  border-color: #b8860b;
}

.forum-tag-lock {
  color: var(--fg3);
  border-color: var(--fg3);
}

.forum-thread-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.forum-thread-header-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.forum-thread-header-title h1 {
  font-size: 1.5rem;
}

.forum-mod-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.forum-post {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
  overflow: hidden;
  transition: box-shadow var(--transition);
}

.forum-post:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.forum-post-sidebar {
  width: 120px;
  min-width: 120px;
  padding: 1rem 0.75rem;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.3rem;
}

.forum-post-author {
  font-size: 0.88rem;
  font-weight: normal;
  word-break: break-word;
}

.forum-role-badge {
  display: inline-block;
  padding: 0.1rem 0.35rem;
  border-radius: 2px;
  font-size: 0.65rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border: 1px solid currentColor;
}

.forum-post-stats {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  margin-top: 0.25rem;
}

.forum-post-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.forum-post-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.9rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
  font-size: 0.78rem;
  flex-wrap: wrap;
}

.forum-post-actions {
  display: flex;
  gap: 0.35rem;
  margin-left: auto;
}

.forum-edited-badge {
  font-size: 0.7rem;
  color: var(--fg3);
  border: 1px solid var(--border);
  padding: 0.05rem 0.35rem;
  border-radius: 2px;
}

.forum-post-content {
  padding: 1rem;
  line-height: 1.75;
  word-break: break-word;
  font-size: 0.93rem;
}

.forum-post-content p {
  margin-bottom: 0.6rem;
}

.forum-post-content p:last-child {
  margin-bottom: 0;
}

.forum-post-content h1,
.forum-post-content h2,
.forum-post-content h3 {
  margin: 0.8rem 0 0.4rem;
  font-weight: normal;
}

.forum-post-content ul,
.forum-post-content ol {
  margin: 0.4rem 0 0.6rem 1.5rem;
}

.forum-post-content li {
  margin-bottom: 0.2rem;
}

.forum-post-content code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--bg3);
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
}

.forum-post-content pre {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  overflow-x: auto;
  margin: 0.6rem 0;
}

.forum-post-content pre code {
  background: none;
  padding: 0;
  font-size: 0.88em;
}

.forum-post-content blockquote {
  border-left: 3px solid var(--border);
  margin: 0.6rem 0;
  padding: 0.4rem 0.9rem;
  color: var(--fg2);
  font-style: italic;
}

.forum-post-content a {
  color: var(--fg);
}

.forum-post-content table {
  font-size: 0.88rem;
  margin: 0.6rem 0;
}

.forum-post-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0.8rem 0;
}

.forum-spoiler {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 0.6rem 0;
  overflow: hidden;
}

.forum-spoiler-summary {
  padding: 0.55rem 0.9rem;
  background: var(--bg2);
  cursor: pointer;
  user-select: none;
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  list-style: none;
  transition: background var(--transition);
}

.forum-spoiler-summary::-webkit-details-marker {
  display: none;
}

.forum-spoiler-summary::before {
  content: '▸';
  font-size: 0.75rem;
  color: var(--fg3);
  transition: transform 0.2s ease;
}

.forum-spoiler[open] .forum-spoiler-summary::before {
  transform: rotate(90deg);
}

.forum-spoiler-summary:hover {
  background: var(--bg3);
}

.forum-spoiler-body {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.92rem;
  line-height: 1.7;
  animation: spoiler-in 0.2s ease;
}

@keyframes spoiler-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }

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

.forum-toolbar {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  padding: 0.35rem 0.5rem;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  flex-wrap: wrap;
}

.forum-toolbar+.form-input,
.forum-toolbar+textarea {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.forum-toolbar-btn {
  background: none;
  border: 1px solid transparent;
  border-radius: 3px;
  padding: 0.2rem 0.45rem;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.82rem;
  color: var(--fg2);
  transition: all var(--transition);
  line-height: 1.4;
}

.forum-toolbar-btn:hover {
  background: var(--bg3);
  border-color: var(--border);
  color: var(--fg);
}

.forum-toolbar-sep {
  width: 1px;
  height: 16px;
  background: var(--border);
  margin: 0 0.2rem;
  flex-shrink: 0;
}

.forum-preview-box {
  display: none;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 1rem;
  background: var(--bg2);
  min-height: 80px;
  line-height: 1.75;
  font-size: 0.93rem;
}

.forum-editor-hint {
  margin-bottom: 0.35rem;
  line-height: 1.5;
}

.forum-editor-hint code {
  font-family: var(--font-mono);
  font-size: 0.82em;
  background: var(--bg3);
  padding: 0.05rem 0.3rem;
  border-radius: 3px;
}

.forum-reply-box {
  margin-top: 2rem;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}

.forum-reply-box h3 {
  font-size: 1rem;
  margin-bottom: 0.6rem;
}

.forum-reply-input {
  resize: vertical;
  min-height: 120px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

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

.forum-locked-notice {
  margin-top: 1.5rem;
  padding: 0.85rem 1.25rem;
  border-left: 3px solid var(--fg3);
  background: var(--bg2);
  color: var(--fg2);
  font-size: 0.9rem;
  border-radius: 0 var(--radius) var(--radius) 0;
}

.forum-empty {
  padding: 3rem 1rem;
  text-align: center;
  color: var(--fg3);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

a.forum-category-card,
a.forum-thread-item {
  display: block;
  text-decoration: none;
  color: inherit;
}


.admin-tab {
  cursor: pointer;
  color: var(--fg3);
  transition: all var(--transition);
  font-weight: normal;
  background: none !important;
}

.admin-tab:hover {
  color: var(--fg);
}

.admin-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent) !important;
}

.admin-tab-content {
  transition: opacity var(--transition);
}

.admin-tab-content.hidden {
  display: none;
}

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

.admin-actions button {
  padding: 0.25rem 0.75rem;
  font-size: 0.85rem;
}

td.admin-actions {
  white-space: nowrap;
}

td.admin-actions .btn {
  padding: 0.2rem 0.55rem;
  font-size: 0.8rem;
}

.admin-main-tab {
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--fg3);
  padding: 0.65rem 1.5rem 0.65rem 0;
  margin-right: 0.5rem;
  border-bottom: 2px solid transparent;
  transition: color var(--transition), border-color var(--transition);
}

.admin-main-tab:hover {
  color: var(--fg);
}

.admin-main-tab.active {
  color: var(--fg);
  border-bottom-color: var(--fg);
}

.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}

.status-dot.active {
  background: var(--success);
}

.status-dot.inactive {
  background: var(--danger);
}

tr.user-inactive td {
  opacity: 0.5;
}

.badge-admin {
  display: inline-block;
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  border: 1px solid var(--accent);
  border-radius: 2px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  vertical-align: middle;
  margin-left: 0.35rem;
}

.role-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 2px;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border: 1px solid currentColor;
}

.role-admin {
  color: #8b0000;
  border-color: #8b0000;
}

.role-moderator {
  color: #4169e1;
  border-color: #4169e1;
}

.role-creator {
  color: #b8860b;
  border-color: #b8860b;
}

.role-user {
  color: var(--fg3);
  border-color: var(--fg3);
}

td .form-select {
  display: inline-block;
  width: auto;
  padding: 0.2rem 0.5rem;
  font-size: 0.8rem;
}

.format-suggestion {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.25rem 0.7rem;
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--fg2);
  cursor: pointer;
  transition: all var(--transition);
}

.format-suggestion:hover {
  background: var(--bg3);
  color: var(--fg);
}

.format-suggestion.selected {
  background: var(--accent);
  color: var(--accent-inv);
  border-color: var(--accent);
}


.announcements-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.5rem;
  margin: 0;
}

.announcement {
  padding: 1.5rem;
  border-radius: var(--radius);
  border-left: 4px solid;
  animation: slide-in 0.3s ease;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.announcement-body {
  flex: 1;
}

.announcement-close {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: inherit;
  padding: 0;
  opacity: 0.6;
  transition: opacity var(--transition);
}

.announcement-close:hover {
  opacity: 1;
}

.announcement.info {
  background: #e3f2fd;
  border-left-color: #1976d2;
  color: #0d47a1;
}

.announcement.success {
  background: #e8f5e9;
  border-left-color: #388e3c;
  color: #1b5e20;
}

.announcement.warning {
  background: #fff3e0;
  border-left-color: #f57c00;
  color: #e65100;
}

[data-theme="dark"] .announcement.info {
  background: #1a3a52;
  border-left-color: #64b5f6;
  color: #b3e5fc;
}

[data-theme="dark"] .announcement.success {
  background: #1b3a1b;
  border-left-color: #81c784;
  color: #c8e6c9;
}

[data-theme="dark"] .announcement.warning {
  background: #4a3a2a;
  border-left-color: #ffb74d;
  color: #ffe0b2;
}

.announcement.featured {
  padding: 2rem;
  font-size: 1.05rem;
  border: 2px solid;
  border-left-width: 6px;
  background-image: linear-gradient(135deg, rgba(0, 0, 0, 0.02) 0%, rgba(0, 0, 0, 0) 100%);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] .announcement.featured {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.announcement.featured.info {
  border-color: #1976d2;
  background-color: #e3f2fd;
}

.announcement.featured.success {
  border-color: #388e3c;
  background-color: #e8f5e9;
}

.announcement.featured.warning {
  border-color: #f57c00;
  background-color: #fff3e0;
}

[data-theme="dark"] .announcement.featured.info {
  background-color: #1a3a52;
}

[data-theme="dark"] .announcement.featured.success {
  background-color: #1b3a1b;
}

[data-theme="dark"] .announcement.featured.warning {
  background-color: #4a3a2a;
}

.announcement-title {
  font-weight: bold;
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.announcement-text {
  line-height: 1.5;
  margin: 0;
}

@keyframes slide-in {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }

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



.daily-loading {
  font-size: 0.9rem;
}

.daily-solved-msg {
  color: var(--success);
}

.daily-problem-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
}

.daily-problem-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}

.daily-badge {
  display: inline-block;
  background: var(--accent);
  color: var(--bg);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  margin-bottom: 0.4rem;
  letter-spacing: 0.04em;
}

.daily-problem-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0.25rem 0 0.2rem;
}



.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}

.text-muted {
  color: var(--fg3);
}

.text-sm {
  font-size: 0.85rem;
}

.text-center {
  text-align: center;
}

.mt-sm {
  margin-top: 0.75rem;
}

.mt-1 {
  margin-top: 0.5rem;
}

.mt-2 {
  margin-top: 1rem;
}

.mt-3 {
  margin-top: 1.5rem;
}

.mb-1 {
  margin-bottom: 0.5rem;
}

.mb-2 {
  margin-bottom: 1rem;
}

.flex {
  display: flex;
}

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.gap-1 {
  gap: 0.5rem;
}

.gap-2 {
  gap: 1rem;
}

.hidden {
  display: none !important;
}

.flex-col {
  flex-direction: column;
}

#navUsername {
  display: flex;
  align-items: center;
  justify-content: center;
}

[data-theme="dark"] img[src$=".svg"] {
  filter: invert(1);
}

footer {
  bottom: 0;
  left: 0;
  right: 0;
  padding: 10px 28px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  flex-shrink: 0;
  z-index: 90;
  height: 48px;
}

footer a {
  font-size: 11px;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: 0.02em;
  transition: color 0.15s;
  white-space: nowrap;
}

footer a:hover {
  color: var(--ink);
}

@media (max-width: 768px) {
  nav {
    height: auto;
    min-height: 56px;
    padding: 0 14px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .nav-right {
    flex-direction: row;
    width: auto;
    gap: 0.4rem;
    flex-wrap: wrap;
  }

  .nav-user-row {
    flex-wrap: wrap;
    gap: 0.4rem;
  }

  .btn-create {
    padding: 6px 12px;
    font-size: 12px;
  }
}


@media (max-width: 768px) {

  #app {
    grid-template-columns: 1fr;
  }

  .nav-vertical {
    display: none;
  }

  #mobileNav {
    display: flex !important;
  }

  .hamburger-btn {
    display: block;
  }

  .nav-mobile.open {
    display: flex !important;
  }

  .main-layout {
    grid-template-columns: 1fr;
  }

  .right-panel {
    display: none;
  }

  .main-layout>main {
    padding: 1rem;
  }

  .sidebar {
    display: none !important;
  }

  .content {
    padding: 1rem;
    flex: 1;
  }

  .match-arena {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .match-panel {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
  }

  .match-center {
    border-left: none;
    border-right: none;
    padding: 1rem;
  }

  .hero {
    padding: 2rem 0 1.5rem;
  }

  .hero-title {
    font-size: 2rem;
  }

  .hero-sub {
    font-size: 1rem;
  }

  .btn-lg {
    width: 100%;
    justify-content: center;
  }

  h1 {
    font-size: 1.5rem;
  }

  h2 {
    font-size: 1.1rem;
  }

  table {
    font-size: 0.8rem;
  }

  th,
  td {
    padding: 0.4rem 0.5rem;
  }

  table th:nth-child(5),
  table td:nth-child(5),
  table th:nth-child(6),
  table td:nth-child(6) {
    display: none;
  }

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

  .answer-row {
    flex-direction: column;
  }

  .answer-input {
    width: 100%;
  }

  .btn {
    font-size: 0.85rem;
    padding: 0.45rem 1rem;
  }

  .nav-right {
    flex-direction: column;
    width: 100%;
    gap: 0.5rem;
  }

  #toast {
    bottom: 1rem;
    right: 1rem;
    left: 1rem;
  }

  .toast-item {
    max-width: none;
    border-radius: 8px;
  }

  .modal {
    width: 90vw;
    max-width: 90vw;
    padding: 1.5rem;
  }

  .problem-selector {
    gap: 0.35rem;
  }

  .prob-btn {
    padding: 0.5rem 0.6rem;
    font-size: 0.8rem;
  }

  .modal-overlay {
    z-index: 210;
  }

  main {
    grid-template-columns: 1fr;
    padding: 40px 24px;
  }

  .left-col {
    padding-right: 0;
    border-bottom: 1px solid var(--border);
    padding-bottom: 40px;
    margin-bottom: 40px;
  }

  .right-col {
    padding-left: 0;
    border-left: none;
  }

  .hero-title {
    font-size: 42px;
  }

  .forum-cat-stats {
    display: none;
  }

  .forum-thread-item-meta {
    display: none;
  }

  .forum-post {
    flex-direction: column;
  }

  .forum-post-sidebar {
    width: 100%;
    flex-direction: row;
    justify-content: flex-start;
    gap: 0.75rem;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 0.6rem 1rem;
  }

  .forum-post-stats {
    flex-direction: row;
  }

  .chat-widget {
    position: static !important;
    width: 100% !important;
    bottom: auto !important;
    right: auto !important;
    opacity: 1 !important;
    margin-top: 1.5rem;
  }

  .chat-widget-inner {
    border-radius: 8px;
    box-shadow: none;
  }
}

@media (max-width: 768px) {

  .hero-title,
  .hero-sub {
    text-align: left;
  }

  .action-grid {
    max-width: 100%;
  }

  .action-subcard {
    margin-left: 10px;
  }
}

@media (max-width: 768px) {
  .modal-box {
    padding: 1.25rem;
    max-height: 85vh;
    border-radius: 8px;
    width: calc(100vw - 2rem);
  }

  .modal-overlay {
    padding: 0.75rem;
    align-items: flex-end;
  }

  /* Fait monter la modale depuis le bas sur mobile */
  .modal-overlay.open {
    align-items: flex-end;
  }
}

@media (max-width: 768px) {
  footer {
    height: auto;
    min-height: 48px;
    padding: 8px 16px;
    gap: 8px;
  }

  footer a {
    font-size: 10px;
  }

  body {
    padding-bottom: 56px;
  }
}

@media (max-width: 480px) {

  /* Cache la colonne Bilan sur très petits écrans */
  .leaderboard-table-wrap th:nth-child(5),
  .leaderboard-table-wrap td:nth-child(5) {
    display: none;
  }

  .leaderboard-main {
    padding: 1rem;
  }
}

@media (max-width: 480px) {
  html {
    font-size: 14px;
  }

  .content {
    padding: 0.75rem;
  }

  .hero {
    padding: 1.5rem 0 1rem;
  }

  .hero-title {
    font-size: 1.3rem;
  }

  .hero-sub {
    font-size: 0.95rem;
    margin-bottom: 1rem;
  }

  .btn-lg {
    font-size: 0.95rem;
    padding: 0.6rem 1rem;
  }

  h1 {
    font-size: 1.2rem;
  }

  h2 {
    font-size: 1rem;
  }

  h3 {
    font-size: 0.95rem;
  }

  table {
    font-size: 0.75rem;
  }

  th,
  td {
    padding: 0.3rem 0.4rem;
  }

  table th:nth-child(n+4),
  table td:nth-child(n+4) {
    display: none;
  }

  .stats-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .stat-box {
    padding: 0.75rem;
  }

  .card {
    padding: 1rem;
    margin-bottom: 0.75rem;
  }

  .card-sm {
    padding: 0.6rem 0.75rem;
  }

  .form-input,
  .form-select {
    font-size: 16px;
  }

  .problem-display {
    padding: 1rem;
    margin-bottom: 0.75rem;
  }

  #toast {
    bottom: 0.5rem;
    right: 0.5rem;
    left: 0.5rem;
    gap: 0.3rem;
  }

  .toast-item {
    padding: 0.6rem 1rem;
    font-size: 0.8rem;
  }

  .modal {
    width: 95vw;
    max-width: 95vw;
    padding: 1rem;
  }

  .nav-mobile {
    max-width: none;
    width: 100%;
  }

  .nav-links-vertical a {
    padding: 0.5rem 0.5rem;
    font-size: 0.85rem;
  }

  .nav-mobile .btn {
    font-size: 0.8rem;
    padding: 0.4rem 0.75rem;
  }

  .btn-sm {
    padding: 0.25rem 0.6rem;
    font-size: 0.75rem;
  }

  main {
    padding: 28px 16px;
  }
}

@media (max-width: 640px) {
  .forum-cat-stats {
    display: none;
  }

  .forum-thread-item-meta {
    display: none;
  }
}

/*  Legal Modal  */
#legalContent h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--fg);
  margin: 1rem 0 0.35rem;
}

#legalContent h3:first-child {
  margin-top: 0;
}

#legalContent p {
  font-size: 0.88rem;
  line-height: 1.75;
  color: var(--fg2);
}

#legalContent a {
  color: var(--fg);
}

/*  Submit Problem Modal  */
#submitProblemModal .modal-box {
  max-width: 600px;
}

#submitProblemModal textarea.form-input {
  resize: vertical;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  line-height: 1.6;
  min-height: 90px;
}

#submitProblemModal .form-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--fg2);
  letter-spacing: 0.02em;
}

#submitProblemModal .form-label .text-muted {
  font-weight: 400;
  font-size: 0.75rem;
}

.sp-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.sp-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.75rem;
}


/*  Responsive  */
@media (max-width: 768px) {

  .sp-grid-2,
  .sp-grid-3 {
    grid-template-columns: 1fr;
  }

  footer {
    justify-content: center;
    padding: 8px 16px;
    gap: 10px;
  }

  body {
    padding-bottom: 48px;
  }
}

/* ─── Play submenu ─────────────────────────────────────────── */
.play-submenu {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.4s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.3s ease;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.play-submenu.open {
  max-height: 500px;
  opacity: 1;
}

.action-subcard {
  border-left: 3px solid var(--accent);
  margin-left: 16px;
}

.action-subcard h3 {
  font-size: 17px;
}

.play-arrow {
  display: inline-block;
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  font-style: normal;
  margin-left: 4px;
}

.ranked-lock {
  font-size: 13px;
  opacity: 0.6;
}

#leaderboardCard {
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

#leaderboardCard.pushed-down {
  transform: translateY(4px);
}


.footer-social {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-right: auto;
}

.footer-social a {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  color: var(--muted);
  opacity: 0.5;
  transition: opacity 0.18s;
  text-decoration: none;
}

.footer-social a:hover {
  opacity: 1;
  color: var(--ink);
}

@media (max-width: 768px) {
  .footer-social {
    margin-right: 0;
    justify-content: center;
    width: 100%;
    order: -1;
  }
}

/* ── Profile redesign ────────────────────────────────────────────── */

.profile-wrap {
  max-width: 680px;
  margin: 0 auto;
  padding: 2.5rem 2rem 4rem;
}

.profile-back {
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--fg3);
  padding: 0;
  margin-bottom: 2rem;
  display: inline-block;
  transition: color var(--transition);
  text-decoration: none;
}

.profile-back:hover {
  color: var(--fg);
}

/* Hero row */
.profile-hero {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 2.5rem;
  flex-wrap: wrap;
}

.profile-avatar-lg {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 700;
  flex-shrink: 0;
  letter-spacing: -0.02em;
}

.profile-hero-info {
  flex: 1;
}

.profile-name {
  font-family: 'Playfair Display', serif;
  font-size: 1.9rem;
  font-weight: 400;
  margin: 0 0 0.5rem;
  letter-spacing: -0.01em;
}

.profile-badges-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.35rem;
}

.profile-elo-chip {
  background: var(--tag-bg);
  border: 1px solid var(--border);
  padding: 2px 10px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink);
  border-radius: 2px;
}

.profile-since {
  font-size: 0.8rem;
  color: var(--fg3);
  margin: 0;
}

.profile-own-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: flex-end;
  margin-left: auto;
}

/* Stats row */
.profile-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.75rem;
}

.profile-stat-card {
  border: 1px solid var(--border);
  padding: 1.1rem 0.75rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.profile-stat-card:hover {
  border-color: var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  transform: translate(-1px, -1px);
}

.profile-stat-val {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
}

.profile-stat-lbl {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg3);
}

.stat-win .profile-stat-val {
  color: var(--success);
}

.stat-loss .profile-stat-val {
  color: var(--danger);
}

.stat-draw .profile-stat-val {
  color: var(--fg3);
}

.stat-solved .profile-stat-val {
  color: var(--ink);
}

/* WR bar */
.profile-wr-bar-wrap {
  margin-bottom: 1.75rem;
}

.profile-wr-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--fg2);
  margin-bottom: 0.4rem;
}

.profile-wr-bar {
  height: 6px;
  background: var(--bg3);
  border-radius: 3px;
  overflow: hidden;
}

.profile-wr-fill {
  height: 100%;
  background: var(--success);
  border-radius: 3px;
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Section title */
.profile-section-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--fg3);
  margin: 0 0 0.75rem;
  font-weight: 600;
}

/* Recent matches */
.profile-match-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.profile-match-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--border);
  font-size: 0.88rem;
}

.pm-result-label {
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  min-width: 60px;
}

.profile-match-item.win .pm-result-label {
  color: var(--success);
}

.profile-match-item.loss .pm-result-label {
  color: var(--danger);
}

.profile-match-item.draw .pm-result-label {
  color: var(--fg3);
}

.pm-opp {
  color: var(--fg2);
}

/* btn-outline variant */
.btn-validate.btn-outline {
  background: transparent;
  color: var(--ink);
  border: 1.5px solid var(--ink);
}

.btn-validate.btn-outline:hover {
  background: var(--ink);
  color: var(--bg);
}

/* Password input wrapper */
.pw-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.pw-input-wrap .form-input {
  padding-right: 2.5rem;
}

.pw-eye-btn {
  position: absolute;
  right: 0.5rem;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0.25rem;
  color: var(--fg3);
  transition: opacity var(--transition);
}

.pw-eye-btn:hover {
  opacity: 0.8;
}

/* Responsive */
@media (max-width: 640px) {
  .profile-stats-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .profile-own-actions {
    flex-direction: row;
    margin-left: 0;
    width: 100%;
    flex-wrap: wrap;
  }

  .profile-hero {
    flex-wrap: wrap;
  }
}

@media (max-width: 480px) {
  .profile-wrap {
    padding: 1.5rem 1rem 4rem;
  }

  .profile-name {
    font-size: 1.5rem;
  }
}

.submission-item {
  padding: .6rem .85rem;
  border: 1px solid var(--border);
  margin-bottom: .4rem;
  background: var(--bg);
}

.submission-title {
  font-weight: 500;
  font-size: .88rem;
}

.submission-meta {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-top: .25rem;
}

.status-pending {
  color: var(--warning, #f59e0b);
  font-size: .8rem;
}

.status-approved {
  color: var(--success);
  font-size: .8rem;
}

.status-rejected {
  color: var(--danger);
  font-size: .8rem;
}

.submission-note {
  color: var(--fg3);
  margin-top: .3rem;
  font-style: italic;
}

.format-suggestion {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .25rem .7rem;
  font-family: var(--font-body);
  font-size: .8rem;
  color: var(--fg2);
  cursor: pointer;
  transition: all var(--transition);
}

.format-suggestion:hover {
  background: var(--bg3);
  color: var(--fg);
}

.format-suggestion.selected {
  background: var(--accent);
  color: var(--accent-inv);
  border-color: var(--accent);
}


.dailies-wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 4rem
}

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

.dailies-title {
  font-family: 'Playfair Display', serif;
  font-size: 2rem;
  font-weight: 700;
  margin: 0 0 .2rem
}

.dailies-sub {
  color: var(--fg3);
  font-size: .88rem;
  margin: 0
}

.streak-card {
  display: flex;
  align-items: center;
  gap: .75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .85rem 1.25rem;
  transition: border-color .3s
}

.streak-card.active {
  border-color: #f59e0b
}

.streak-flame {
  font-size: 2rem;
  line-height: 1
}

.streak-num {
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums
}

.streak-lbl {
  font-size: .72rem;
  color: var(--fg3);
  text-transform: uppercase;
  letter-spacing: .06em
}

.cal-section-label {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--fg3);
  font-weight: 600;
  margin-bottom: .75rem
}

.cal-grid {
  display: flex;
  gap: .35rem;
  flex-wrap: wrap;
  margin-bottom: 2.5rem
}

.cal-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .2rem
}

.cal-day {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .8rem;
  font-weight: 600;
  border: 1px solid var(--border);
  color: var(--fg3);
  background: var(--bg);
  transition: transform .12s, box-shadow .12s;
  cursor: pointer
}

.cal-day:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, .1)
}

.cal-day.solved {
  background: #22c55e;
  border-color: #22c55e;
  color: #fff
}

.cal-day.failed {
  background: #ef4444;
  border-color: #ef4444;
  color: #fff;
  opacity: .6
}

.cal-day.today {
  box-shadow: 0 0 0 2px var(--accent, #3b82f6)
}

.cal-day.selected {
  box-shadow: 0 0 0 2px #f59e0b;
  transform: translateY(-2px)
}

.cal-day-lbl {
  font-size: .6rem;
  color: var(--fg3);
  text-align: center
}

.section-divider {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1.25rem
}

.section-divider span {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--fg3);
  font-weight: 600;
  white-space: nowrap
}

.section-divider hr {
  flex: 1;
  border: none;
  border-top: 1px solid var(--border)
}


.archive-panel {
  margin-top: 1.5rem;
  animation: fadeSlideIn .18s ease
}

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

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

.archive-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .75rem
}

.archive-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--fg3);
  font-size: 1.1rem;
  line-height: 1;
  padding: .2rem .4rem
}

.archive-close:hover {
  color: var(--fg)
}

.cal-day.no-problem {
  opacity: .32;
  cursor: default;
  pointer-events: none;
}

.biblio-wrap {
  max-width: 860px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

.biblio-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
}

.biblio-title {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  font-weight: 700;
  line-height: 1.1;
  color: var(--fg);
  margin: 0;
}

.biblio-title span {
  color: var(--accent);
}


.streak-card {
  max-width: 240px;
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
  flex-shrink: 0;
  transition: box-shadow .2s, border-color .2s;
}

.streak-card.active {
  border-color: #f97316;
  box-shadow: 0 0 0 3px rgba(249, 115, 22, .12);
}

.streak-num {
  font-family: 'Playfair Display', serif;
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
  color: var(--fg);
}

.streak-lbl {
  font-size: .72rem;
  color: var(--fg3);
  text-transform: uppercase;
  letter-spacing: .07em;
}

.biblio-tabs {
  display: flex;
  gap: .25rem;
  border-bottom: 2px solid var(--border);
  margin-bottom: 2rem;
}

.biblio-tab {
  padding: .55rem 1.1rem;
  font-size: .88rem;
  font-weight: 500;
  color: var(--fg3);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: color .15s, border-color .15s;
  font-family: inherit;
}

.biblio-tab:hover {
  color: var(--fg);
}

.biblio-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.biblio-panel {
  display: none;
}

.biblio-panel.active {
  display: block;
}


.cal-section-label {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--fg3);
  margin-bottom: .75rem;
  font-weight: 500;
}

.cal-grid {
  display: flex;
  gap: .35rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.cal-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .25rem;
}

.cal-day {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .78rem;
  font-weight: 500;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--fg2);
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .1s;
  user-select: none;
}

.cal-day:hover:not(.no-problem) {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.cal-day.solved {
  background: var(--success, #22c55e);
  border-color: var(--success, #22c55e);
  color: #fff;
}

.cal-day.today {
  border-color: var(--accent);
  font-weight: 700;
}

.cal-day.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.cal-day.no-problem {
  opacity: .3;
  cursor: default;
}

.cal-day-lbl {
  font-size: .62rem;
  color: var(--fg3);
  white-space: nowrap;
}

.section-divider {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin: 1.75rem 0 1.25rem;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--fg3);
  font-weight: 500;
}

.section-divider hr {
  flex: 1;
  border: none;
  border-top: 1px solid var(--border);
}


.archive-panel {
  margin-bottom: 1rem;
}


.problem-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem 1.4rem;
  background: var(--bg-card);
  margin-bottom: 1rem;
}

.problem-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: .75rem;
}

.problem-date {
  font-size: .78rem;
  color: var(--fg3);
  font-weight: 500;
}

.problem-meta {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.problem-divider {
  height: 1px;
  background: var(--border);
  margin: .75rem 0;
}

.problem-text {
  font-size: .95rem;
  line-height: 1.7;
  color: var(--fg);
}

.answer-section {
  margin-top: 1rem;
}

.answer-row {
  display: flex;
  gap: .5rem;
  align-items: center;
}

.answer-input {
  flex: 1;
  padding: .55rem .85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--fg);
  font-size: .9rem;
  font-family: inherit;
  transition: border-color .15s;
}

.answer-input:focus {
  outline: none;
  border-color: var(--accent);
}

.answer-input.wrong {
  border-color: var(--danger, #ef4444);
  animation: shake .25s;
}

.answer-input.correct {
  border-color: var(--success, #22c55e);
}

@keyframes shake {

  0%,
  100% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-4px);
  }

  75% {
    transform: translateX(4px);
  }
}

.format-label {
  font-size: .78rem;
  color: var(--fg3);
  margin-bottom: .4rem;
}

.format-label span {
  color: var(--fg2);
  font-weight: 500;
}

.hist-section-title {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--fg3);
  font-weight: 600;
  margin: 1.5rem 0 .6rem;
}

.hist-summary {
  font-size: .85rem;
  color: var(--fg3);
  margin-bottom: 1.25rem;
}

.hist-summary strong {
  color: var(--fg);
}

.hist-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
  margin-bottom: .6rem;
  overflow: hidden;
  transition: border-color .15s;
}

.hist-card:hover {
  border-color: color-mix(in srgb, var(--accent) 50%, var(--border));
}

.hist-card-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .85rem 1.1rem;
  cursor: pointer;
  user-select: none;
}

.hist-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.hist-status-dot.solved {
  background: var(--success, #22c55e);
}

.hist-status-dot.failed {
  background: var(--danger, #ef4444);
}

.hist-card-info {
  flex: 1;
  min-width: 0;
}

.hist-card-title {
  font-size: .9rem;
  font-weight: 500;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hist-card-meta {
  font-size: .73rem;
  color: var(--fg3);
  margin-top: .15rem;
}

.hist-card-right {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-shrink: 0;
}

.hist-badge {
  font-size: .7rem;
  padding: .2rem .55rem;
  border-radius: 20px;
  font-weight: 600;
  letter-spacing: .03em;
}

.hist-badge.solved {
  background: color-mix(in srgb, var(--success, #22c55e) 15%, transparent);
  color: var(--success, #22c55e);
}

.hist-badge.failed {
  background: color-mix(in srgb, var(--danger, #ef4444) 12%, transparent);
  color: var(--danger, #ef4444);
}

.hist-expand-icon {
  font-size: .85rem;
  color: var(--fg3);
  transition: transform .2s;
  flex-shrink: 0;
}

.hist-card.open .hist-expand-icon {
  transform: rotate(90deg);
}

.hist-card-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height .3s cubic-bezier(.4, 0, .2, 1);
}

.hist-card.open .hist-card-body {
  max-height: 1200px;
}

.hist-card-body-inner {
  padding: 0 1.1rem 1.1rem;
  border-top: 1px solid var(--border);
}

.hist-enonce {
  margin: .9rem 0 .6rem;
  font-size: .93rem;
  line-height: 1.7;
  color: var(--fg);
}

.hist-answer-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin: .75rem 0 .35rem;
  flex-wrap: wrap;
}

.hist-answer-label {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--fg3);
  font-weight: 600;
}

.hist-answer-value {
  font-family: 'Playfair Display', serif;
  font-size: .95rem;
  color: var(--success, #22c55e);
  font-weight: 700;
}

.hist-correction-block {
  margin-top: .9rem;
  padding: .85rem 1.5rem;
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 6%, var(--bg));
  border-left: 3px solid var(--accent);
}

.hist-correction-label {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: .5rem;
}

.hist-correction-text {
  font-size: .88rem;
  line-height: 1.7;
  color: var(--fg2);
}

.hist-no-correction {
  font-size: .8rem;
  color: var(--fg3);
  font-style: italic;
  margin-top: .75rem;
}


.difficulty {
  display: flex;
  gap: 3px;
  align-items: center;
}

.diff-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--border);
}

.diff-dot.filled {
  background: var(--accent);
}


.tag {
  font-size: .72rem;
  padding: .2rem .55rem;
  border-radius: 20px;
  background: color-mix(in srgb, var(--accent) 12%, var(--bg));
  color: var(--accent);
  font-weight: 500;
}

/* ── Feedback ─────────────────────────────────────────── */
.feedback-success {
  color: var(--success, #22c55e);
  font-size: .85rem;
  font-weight: 500;
}

.feedback-error {
  color: var(--danger, #ef4444);
  font-size: .85rem;
  font-weight: 500;
}

.text-muted {
  color: var(--fg3);
}

.mt-1 {
  margin-top: .35rem;
}

.text-sm {
  font-size: .82rem;
}


.btn-validate {
  padding: .55rem 1.1rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: .88rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: opacity .15s, transform .1s;
  white-space: nowrap;
}

.btn-validate:hover {
  opacity: .88;
}

.btn-validate:active {
  transform: scale(.97);
}

.btn-validate:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--fg3);
}

.empty-state-icon {
  font-size: 2.5rem;
  margin-bottom: .75rem;
  opacity: .5;
}

.empty-state p {
  font-size: .88rem;
  margin: 0;
}

/* ── Loading skeleton ────────────────────────────────── */
.skeleton-line {
  height: 14px;
  border-radius: 4px;
  background: var(--border);
  margin-bottom: .5rem;
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: .4;
  }
}

/* ── Auth modal prompt ───────────────────────────────── */
.auth-prompt {
  text-align: center;
  padding: 2.5rem 1rem;
  border: 1px dashed var(--border);
  border-radius: 12px;
}

.auth-prompt p {
  font-size: .9rem;
  color: var(--fg3);
  margin: 0 0 1rem;
}

.btn-cta {
  padding: .55rem 1.25rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: .88rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
}

@media (max-width: 480px) {
  .biblio-hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .cal-grid {
    gap: .25rem;
  }

  .cal-day {
    width: 30px;
    height: 30px;
    font-size: .72rem;
  }
}

/* ================================================================
   MOBILE FIXES — à ajouter à la fin de style.css
   ================================================================ */

@media (max-width: 768px) {

  /* ── Nav ─────────────────────────────────────────────────────── */
  nav {
    height: 48px;
    min-height: 48px;
    padding: 0 12px;
    gap: 4px;
    flex-wrap: nowrap;
  }

  .logo {
    font-size: 11px;
    padding: 4px 6px;
    letter-spacing: 0.12em;
    flex-shrink: 0;
  }

  .nav-right {
    flex-direction: row;
    gap: 3px;
    flex-wrap: nowrap;
    align-items: center;
    min-width: 0;
  }

  /* Cache "Créer un problème" — trop large */
  .btn-create[onclick*="openSubmitProblem"] {
    display: none !important;
  }

  .btn-create {
    padding: 5px 8px;
    font-size: 11px;
    white-space: nowrap;
  }

  .btn-create img[src$=".svg"] {
    width: 14px;
    height: 14px;
  }

  [data-username] {
    max-width: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 11px;
  }

  /* ── Match arena wrap ────────────────────────────────────────── */
  .match-arena-wrap {
    padding: 0.6rem 0.75rem 0;
  }

  /* ── Match header : tout sur une seule ligne ─────────────────── */
  .match-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 0.3rem;
    margin-bottom: 0.6rem;
  }

  /* Colonne gauche : mon pseudo */
  .match-header > div:first-child {
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Colonne centre : timer */
  .match-timer-center {
    text-align: center;
    order: 0;
  }

  .timer {
    font-size: 1.15rem;
    font-weight: 700;
  }

  .match-progress-bar {
    width: 80px;
    margin: 2px auto 0;
  }

  /* Colonne droite : adversaire */
  .match-opp-info {
    text-align: right;
    font-size: 0.78rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .match-opp-info strong {
    display: block;
    font-size: 0.8rem;
  }

  /* ── Match grid : une seule colonne ─────────────────────────── */
  .match-grid {
    grid-template-columns: 1fr;
    gap: 0.6rem;
  }

  /* ── Sidebar → barre horizontale compacte ───────────────────── */
  .match-sidebar {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--border);
    flex-wrap: nowrap;
  }

  .match-sidebar-label {
    display: none; /* "Problèmes" — inutile sur mobile */
  }

  #probSelector {
    display: flex;
    flex-direction: row;
    gap: 0.35rem;
    flex: 1;
  }

  .prob-btn {
    flex: 1;
    padding: 0.35rem 0.4rem;
    font-size: 0.75rem;
    margin-bottom: 0;
    justify-content: center;
    gap: 0.25rem;
  }

  /* Cache les éléments non-essentiels de la sidebar */
  .match-sidebar .match-sidebar-divider,
  .match-sidebar > .text-muted,
  .match-sidebar .my-solved-count {
    display: none;
  }

  .match-forfeit-btn {
    margin-top: 0;
    width: auto;
    padding: 0.3rem 0.65rem;
    font-size: 0.72rem;
    flex-shrink: 0;
  }

  /* ── Zone problème ───────────────────────────────────────────── */
  #problemArea {
    min-height: 0;
  }

  .problem-display {
    padding: 0.85rem;
    font-size: 1rem;
    margin: 0 0 0.6rem;
  }

  .answer-row {
    flex-direction: column;
    gap: 0.4rem;
  }

  .answer-input {
    width: 100%;
    font-size: 16px; /* évite le zoom iOS au focus */
  }

  /* Bouton Valider pleine largeur */
  #problemArea .btn-validate,
  #problemArea button.btn-primary,
  .match-arena-wrap .btn-validate {
    width: 100%;
    padding: 0.65rem;
    font-size: 0.9rem;
  }

  /* ── Footer : caché pendant un match ────────────────────────── */
  .match-arena-wrap ~ footer,
  #page-match footer {
    display: none !important;
  }

  /* Règle générale : footer masqué sur la page match */
  body:has(.match-arena-wrap) footer {
    display: none !important;
  }

  /* ── Chat : dock fixe en bas, replié par défaut ──────────────── */
  .chat-widget {
    position: fixed !important;
    bottom: 0 !important;
    right: 0 !important;
    left: 0 !important;
    width: 100% !important;
    border-radius: 0 !important;
    z-index: 60;
    /* safe-area pour iPhone avec barre home */
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .chat-widget-inner {
    border-radius: 0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.15);
  }

  .chat-widget-header {
    padding: 0.4rem 0.7rem;
    font-size: 0.7rem;
  }

  .chat-messages {
    height: 100px;
  }

  .chat-input-row {
    /* safe-area pour ne pas se faire couvrir par la barre Safari */
    padding-bottom: calc(0.45rem + env(safe-area-inset-bottom, 8px));
  }

  /* Espace sous le contenu du match pour que le chat ne cache rien */
  #page-match .match-arena-wrap {
    padding-bottom: 8rem;
  }

  /* ── Résultats ───────────────────────────────────────────────── */
  .result-actions {
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
  }

  .result-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .result-title  { font-size: 1.8rem; }
  .elo-delta     { font-size: 1.4rem; }
  .result-stats-grid { width: 100%; }

  /* ── Pre-match ───────────────────────────────────────────────── */
  .prematch-screen    { min-height: 50vh; gap: 1.25rem; }
  .prematch-players   { gap: 1rem; }
  .prematch-countdown { font-size: 2.5rem; }

  /* ── Matchmaking ─────────────────────────────────────────────── */
  .matchmaking-screen { min-height: 50vh; gap: 1.25rem; }
}

/* ── Très petits écrans (SE, mini) ──────────────────────────────── */
@media (max-width: 390px) {
  .timer        { font-size: 1rem; }
  .prob-btn     { font-size: 0.7rem; padding: 0.3rem 0.35rem; }
  .problem-display { font-size: 0.93rem; padding: 0.65rem; }
  .match-arena-wrap { padding-left: 0.5rem; padding-right: 0.5rem; }

  .match-header > div:first-child,
  .match-opp-info { font-size: 0.72rem; }
}/* ================================================================
   MOBILE FIXES — à ajouter à la fin de style.css
   ================================================================ */

@media (max-width: 768px) {

  /* ── Nav ─────────────────────────────────────────────────────── */
  nav {
    height: 48px;
    min-height: 48px;
    padding: 0 12px;
    gap: 4px;
    flex-wrap: nowrap;
  }

  .logo {
    font-size: 11px;
    padding: 4px 6px;
    letter-spacing: 0.12em;
    flex-shrink: 0;
  }

  .nav-right {
    flex-direction: row;
    gap: 3px;
    flex-wrap: nowrap;
    align-items: center;
    min-width: 0;
    margin-left: auto; /* pousse tout vers la droite */
  }

  /* Cache "Créer un problème" — trop large */
  .btn-create[onclick*="openSubmitProblem"] {
    display: none !important;
  }

  .btn-create {
    padding: 5px 8px;
    font-size: 11px;
    white-space: nowrap;
  }

  .btn-create img[src$=".svg"] {
    width: 14px;
    height: 14px;
  }

  [data-username] {
    max-width: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 11px;
  }

  /* ── Match arena wrap ────────────────────────────────────────── */
  .match-arena-wrap {
    padding: 0.6rem 0.75rem 0;
  }

  /* ── Match header : tout sur une seule ligne ─────────────────── */
  .match-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 0.3rem;
    margin-bottom: 0.6rem;
  }

  /* Colonne gauche : mon pseudo */
  .match-header > div:first-child {
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Colonne centre : timer */
  .match-timer-center {
    text-align: center;
    order: 0;
  }

  .timer {
    font-size: 1.15rem;
    font-weight: 700;
  }

  .match-progress-bar {
    width: 80px;
    margin: 2px auto 0;
  }

  /* Colonne droite : adversaire */
  .match-opp-info {
    text-align: right;
    font-size: 0.78rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .match-opp-info strong {
    display: block;
    font-size: 0.8rem;
  }

  /* ── Match grid : une seule colonne ─────────────────────────── */
  .match-grid {
    grid-template-columns: 1fr;
    gap: 0.6rem;
  }

  /* ── Sidebar → barre horizontale compacte ───────────────────── */
  .match-sidebar {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--border);
    flex-wrap: nowrap;
  }

  .match-sidebar-label {
    display: none; /* "Problèmes" — inutile sur mobile */
  }

  #probSelector {
    display: flex;
    flex-direction: row;
    gap: 0.35rem;
    flex: 1;
  }

  .prob-btn {
    flex: 1;
    padding: 0.35rem 0.4rem;
    font-size: 0.75rem;
    margin-bottom: 0;
    justify-content: center;
    gap: 0.25rem;
  }

  /* Cache les éléments non-essentiels de la sidebar */
  .match-sidebar .match-sidebar-divider,
  .match-sidebar > .text-muted,
  .match-sidebar .my-solved-count {
    display: none;
  }

  .match-forfeit-btn {
    margin-top: 0;
    width: auto;
    padding: 0.3rem 0.65rem;
    font-size: 0.72rem;
    flex-shrink: 0;
  }

  /* ── Zone problème ───────────────────────────────────────────── */
  #problemArea {
    min-height: 0;
  }

  .problem-display {
    padding: 0.85rem;
    font-size: 1rem;
    margin: 0 0 0.6rem;
  }

  .answer-row {
    flex-direction: column;
    gap: 0.4rem;
  }

  .answer-input {
    width: 100%;
    font-size: 16px; /* évite le zoom iOS au focus */
  }

  /* Bouton Valider pleine largeur */
  #problemArea .btn-validate,
  #problemArea button.btn-primary,
  .match-arena-wrap .btn-validate {
    width: 100%;
    padding: 0.65rem;
    font-size: 0.9rem;
  }

  /* ── Footer : caché pendant un match ────────────────────────── */
  .match-arena-wrap ~ footer,
  #page-match footer {
    display: none !important;
  }

  /* Règle générale : footer masqué sur la page match */
  body:has(.match-arena-wrap) footer {
    display: none !important;
  }

  /* ── Chat : dock fixe en bas, replié par défaut ──────────────── */
  .chat-widget {
    position: fixed !important;
    bottom: 0 !important;
    right: 0 !important;
    left: 0 !important;
    width: 100% !important;
    border-radius: 0 !important;
    z-index: 60;
    /* safe-area pour iPhone avec barre home */
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .chat-widget-inner {
    border-radius: 0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.15);
  }

  .chat-widget-header {
    padding: 0.4rem 0.7rem;
    font-size: 0.7rem;
  }

  .chat-messages {
    height: 100px;
  }

  .chat-input-row {
    /* safe-area pour ne pas se faire couvrir par la barre Safari */
    padding-bottom: calc(0.45rem + env(safe-area-inset-bottom, 8px));
  }

  /* Espace sous le contenu du match pour que le chat ne cache rien */
  #page-match .match-arena-wrap {
    padding-bottom: 8rem;
  }

  /* ── Résultats ───────────────────────────────────────────────── */
  .result-actions {
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
  }

  .result-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .result-title  { font-size: 1.8rem; }
  .elo-delta     { font-size: 1.4rem; }
  .result-stats-grid { width: 100%; }

  /* ── Pre-match ───────────────────────────────────────────────── */
  .prematch-screen    { min-height: 50vh; gap: 1.25rem; }
  .prematch-players   { gap: 1rem; }
  .prematch-countdown { font-size: 2.5rem; }

  /* ── Matchmaking ─────────────────────────────────────────────── */
  .matchmaking-screen { min-height: 50vh; gap: 1.25rem; }
}

/* ── Très petits écrans (SE, mini) ──────────────────────────────── */
@media (max-width: 390px) {
  .timer        { font-size: 1rem; }
  .prob-btn     { font-size: 0.7rem; padding: 0.3rem 0.35rem; }
  .problem-display { font-size: 0.93rem; padding: 0.65rem; }
  .match-arena-wrap { padding-left: 0.5rem; padding-right: 0.5rem; }

  .match-header > div:first-child,
  .match-opp-info { font-size: 0.72rem; }
}

/* ================================================================
   MOBILE FIXES — à ajouter à la fin de style.css
   ================================================================ */

@media (max-width: 768px) {

  /* ── Nav ─────────────────────────────────────────────────────── */
  nav {
    height: 48px;
    min-height: 48px;
    padding: 0 12px;
    gap: 4px;
    flex-wrap: nowrap;
  }

  .logo {
    font-size: 11px;
    padding: 4px 6px;
    letter-spacing: 0.12em;
    flex-shrink: 0;
  }

  .nav-right {
    flex-direction: row;
    gap: 3px;
    flex-wrap: nowrap;
    align-items: center;
    min-width: 0;
    margin-left: auto; /* pousse tout vers la droite */
  }

  /* Cache "Créer un problème" — trop large */
  .btn-create[onclick*="openSubmitProblem"] {
    display: none !important;
  }

  .btn-create {
    padding: 5px 8px;
    font-size: 11px;
    white-space: nowrap;
  }

  .btn-create img[src$=".svg"] {
    width: 14px;
    height: 14px;
  }

  [data-username] {
    max-width: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 11px;
  }

  /* ── Match arena wrap ────────────────────────────────────────── */
  .match-arena-wrap {
    padding: 0.6rem 0.75rem 0;
  }

  /* ── Match header : tout sur une seule ligne ─────────────────── */
  .match-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 0.3rem;
    margin-bottom: 0.6rem;
  }

  /* Colonne gauche : mon pseudo */
  .match-header > div:first-child {
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Colonne centre : timer */
  .match-timer-center {
    text-align: center;
    order: 0;
  }

  .timer {
    font-size: 1.15rem;
    font-weight: 700;
  }

  .match-progress-bar {
    width: 80px;
    margin: 2px auto 0;
  }

  /* Colonne droite : adversaire */
  .match-opp-info {
    text-align: right;
    font-size: 0.78rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .match-opp-info strong {
    display: block;
    font-size: 0.8rem;
  }

  /* ── Match grid : une seule colonne ─────────────────────────── */
  .match-grid {
    grid-template-columns: 1fr;
    gap: 0.6rem;
  }

  /* ── Sidebar → barre horizontale compacte ───────────────────── */
  .match-sidebar {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--border);
    flex-wrap: nowrap;
  }

  .match-sidebar-label {
    display: none; /* "Problèmes" — inutile sur mobile */
  }

  #probSelector {
    display: flex;
    flex-direction: row;
    gap: 0.35rem;
    flex: 1;
  }

  .prob-btn {
    flex: 1;
    padding: 0.35rem 0.4rem;
    font-size: 0.75rem;
    margin-bottom: 0;
    justify-content: center;
    gap: 0.25rem;
  }

  /* Cache les éléments non-essentiels de la sidebar */
  .match-sidebar .match-sidebar-divider,
  .match-sidebar > .text-muted,
  .match-sidebar .my-solved-count {
    display: none;
  }

  .match-forfeit-btn {
    margin-top: 0;
    width: auto;
    padding: 0.3rem 0.65rem;
    font-size: 0.72rem;
    flex-shrink: 0;
  }

  /* ── Zone problème ───────────────────────────────────────────── */
  #problemArea {
    min-height: 0;
  }

  .problem-display {
    padding: 0.85rem;
    font-size: 1rem;
    margin: 0 0 0.6rem;
  }

  .answer-row {
    flex-direction: column;
    gap: 0.4rem;
  }

  .answer-input {
    width: 100%;
    font-size: 16px; /* évite le zoom iOS au focus */
  }

  /* Bouton Valider pleine largeur */
  #problemArea .btn-validate,
  #problemArea button.btn-primary,
  .match-arena-wrap .btn-validate {
    width: 100%;
    padding: 0.65rem;
    font-size: 0.9rem;
  }

  /* ── Footer : caché pendant un match ────────────────────────── */
  .match-arena-wrap ~ footer,
  #page-match footer {
    display: none !important;
  }

  /* Règle générale : footer masqué sur la page match */
  body:has(.match-arena-wrap) footer {
    display: none !important;
  }

  /* ── Chat : dock fixe en bas, replié par défaut ──────────────── */
  .chat-widget {
    position: fixed !important;
    bottom: 0 !important;
    right: 0 !important;
    left: 0 !important;
    width: 100% !important;
    border-radius: 0 !important;
    z-index: 60;
    /* safe-area pour iPhone avec barre home */
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .chat-widget-inner {
    border-radius: 0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.15);
  }

  .chat-widget-header {
    padding: 0.4rem 0.7rem;
    font-size: 0.7rem;
  }

  .chat-messages {
    height: 100px;
  }

  .chat-input-row {
    /* safe-area pour ne pas se faire couvrir par la barre Safari */
    padding-bottom: calc(0.45rem + env(safe-area-inset-bottom, 8px));
  }

  /* Espace sous le contenu du match pour que le chat ne cache rien */
  #page-match .match-arena-wrap {
    padding-bottom: 8rem;
  }

  /* ── Résultats ───────────────────────────────────────────────── */
  .result-actions {
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
  }

  .result-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .result-title  { font-size: 1.8rem; }
  .elo-delta     { font-size: 1.4rem; }
  .result-stats-grid { width: 100%; }

  /* ── Pre-match ───────────────────────────────────────────────── */
  .prematch-screen    { min-height: 50vh; gap: 1.25rem; }
  .prematch-players   { gap: 1rem; }
  .prematch-countdown { font-size: 2.5rem; }

  /* ── Matchmaking ─────────────────────────────────────────────── */
  .matchmaking-screen { min-height: 50vh; gap: 1.25rem; }
}

/* ── Très petits écrans (SE, mini) ──────────────────────────────── */
@media (max-width: 390px) {
  .timer        { font-size: 1rem; }
  .prob-btn     { font-size: 0.7rem; padding: 0.3rem 0.35rem; }
  .problem-display { font-size: 0.93rem; padding: 0.65rem; }
  .match-arena-wrap { padding-left: 0.5rem; padding-right: 0.5rem; }

  .match-header > div:first-child,
  .match-opp-info { font-size: 0.72rem; }
}/* ================================================================
   MOBILE FIXES — à ajouter à la fin de style.css
   ================================================================ */

@media (max-width: 768px) {

  /* ── Nav ─────────────────────────────────────────────────────── */
  nav {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: space-between !important;
    height: 48px !important;
    min-height: 48px !important;
    padding: 0 12px !important;
    gap: 0 !important;
  }

  .logo {
    font-size: 11px !important;
    padding: 4px 6px !important;
    letter-spacing: 0.12em !important;
    flex-shrink: 0 !important;
  }

  .nav-right {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 4px !important;
    width: auto !important;
    margin-left: auto !important;
    min-width: 0;
  }

  .nav-links {
    display: flex !important;
    flex-direction: row !important;
    gap: 4px !important;
    align-items: center !important;
  }

  /* Cache "Créer un problème" — trop large */
  .btn-create[onclick*="openSubmitProblem"] {
    display: none !important;
  }

  .btn-create {
    padding: 5px 8px !important;
    font-size: 11px !important;
    white-space: nowrap;
  }

  .btn-create img[src$=".svg"] {
    width: 14px !important;
    height: 14px !important;
  }

  [data-username] {
    max-width: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 11px;
  }

  /* ── Match arena wrap ────────────────────────────────────────── */
  .match-arena-wrap {
    padding: 0.6rem 0.75rem 0;
  }

  /* ── Match header : tout sur une seule ligne ─────────────────── */
  .match-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 0.3rem;
    margin-bottom: 0.6rem;
  }

  /* Colonne gauche : mon pseudo */
  .match-header > div:first-child {
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Colonne centre : timer */
  .match-timer-center {
    text-align: center;
    order: 0;
  }

  .timer {
    font-size: 1.15rem;
    font-weight: 700;
  }

  .match-progress-bar {
    width: 80px;
    margin: 2px auto 0;
  }

  /* Colonne droite : adversaire */
  .match-opp-info {
    text-align: right;
    font-size: 0.78rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .match-opp-info strong {
    display: block;
    font-size: 0.8rem;
  }

  /* ── Match grid : une seule colonne ─────────────────────────── */
  .match-grid {
    grid-template-columns: 1fr;
    gap: 0.6rem;
  }

  /* ── Sidebar → barre horizontale compacte ───────────────────── */
  .match-sidebar {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--border);
    flex-wrap: nowrap;
  }

  .match-sidebar-label {
    display: none; /* "Problèmes" — inutile sur mobile */
  }

  #probSelector {
    display: flex;
    flex-direction: row;
    gap: 0.35rem;
    flex: 1;
  }

  .prob-btn {
    flex: 1;
    padding: 0.35rem 0.4rem;
    font-size: 0.75rem;
    margin-bottom: 0;
    justify-content: center;
    gap: 0.25rem;
  }

  /* Cache les éléments non-essentiels de la sidebar */
  .match-sidebar .match-sidebar-divider,
  .match-sidebar > .text-muted,
  .match-sidebar .my-solved-count {
    display: none;
  }

  .match-forfeit-btn {
    margin-top: 0;
    width: auto;
    padding: 0.3rem 0.65rem;
    font-size: 0.72rem;
    flex-shrink: 0;
  }

  /* ── Zone problème ───────────────────────────────────────────── */
  #problemArea {
    min-height: 0;
  }

  .problem-display {
    padding: 0.85rem;
    font-size: 1rem;
    margin: 0 0 0.6rem;
  }

  .answer-row {
    flex-direction: column;
    gap: 0.4rem;
  }

  .answer-input {
    width: 100%;
    font-size: 16px; /* évite le zoom iOS au focus */
  }

  /* Bouton Valider pleine largeur */
  #problemArea .btn-validate,
  #problemArea button.btn-primary,
  .match-arena-wrap .btn-validate {
    width: 100%;
    padding: 0.65rem;
    font-size: 0.9rem;
  }

  /* ── Footer : caché pendant un match ────────────────────────── */
  .match-arena-wrap ~ footer,
  #page-match footer {
    display: none !important;
  }

  /* Règle générale : footer masqué sur la page match */
  body:has(.match-arena-wrap) footer {
    display: none !important;
  }

  /* ── Chat : dock fixe en bas, replié par défaut ──────────────── */
  .chat-widget {
    position: fixed !important;
    bottom: 0 !important;
    right: 0 !important;
    left: 0 !important;
    width: 100% !important;
    border-radius: 0 !important;
    z-index: 60;
    /* safe-area pour iPhone avec barre home */
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .chat-widget-inner {
    border-radius: 0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.15);
  }

  .chat-widget-header {
    padding: 0.4rem 0.7rem;
    font-size: 0.7rem;
  }

  .chat-messages {
    height: 100px;
  }

  .chat-input-row {
    /* safe-area pour ne pas se faire couvrir par la barre Safari */
    padding-bottom: calc(0.45rem + env(safe-area-inset-bottom, 8px));
  }

  /* Espace sous le contenu du match pour que le chat ne cache rien */
  #page-match .match-arena-wrap {
    padding-bottom: 8rem;
  }

  /* ── Résultats ───────────────────────────────────────────────── */
  .result-actions {
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
  }

  .result-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .result-title  { font-size: 1.8rem; }
  .elo-delta     { font-size: 1.4rem; }
  .result-stats-grid { width: 100%; }

  /* ── Pre-match ───────────────────────────────────────────────── */
  .prematch-screen    { min-height: 50vh; gap: 1.25rem; }
  .prematch-players   { gap: 1rem; }
  .prematch-countdown { font-size: 2.5rem; }

  /* ── Matchmaking ─────────────────────────────────────────────── */
  .matchmaking-screen { min-height: 50vh; gap: 1.25rem; }
}

/* ── Très petits écrans (SE, mini) ──────────────────────────────── */
@media (max-width: 390px) {
  .timer        { font-size: 1rem; }
  .prob-btn     { font-size: 0.7rem; padding: 0.3rem 0.35rem; }
  .problem-display { font-size: 0.93rem; padding: 0.65rem; }
  .match-arena-wrap { padding-left: 0.5rem; padding-right: 0.5rem; }

  .match-header > div:first-child,
  .match-opp-info { font-size: 0.72rem; }
}/* ================================================================
   MOBILE FIXES — à ajouter à la fin de style.css
   ================================================================ */

@media (max-width: 768px) {

  /* ── Nav ─────────────────────────────────────────────────────── */
  nav {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: space-between !important;
    height: 48px !important;
    min-height: 48px !important;
    padding: 0 12px !important;
    gap: 0 !important;
  }

  .logo {
    font-size: 11px !important;
    padding: 4px 6px !important;
    letter-spacing: 0.12em !important;
    flex-shrink: 0 !important;
  }

  .nav-right {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    gap: 4px !important;
    width: auto !important;
    margin-left: auto !important;
    min-width: 0;
  }

  .nav-links {
    display: flex !important;
    flex-direction: row !important;
    gap: 4px !important;
    align-items: center !important;
  }

  /* Cache "Créer un problème" — trop large */
  .btn-create[onclick*="openSubmitProblem"] {
    display: none !important;
  }

  .btn-create {
    padding: 5px 8px !important;
    font-size: 11px !important;
    white-space: nowrap;
  }

  .btn-create img[src$=".svg"] {
    width: 14px !important;
    height: 14px !important;
  }

  [data-username] {
    max-width: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 11px;
  }

  /* ── Match arena wrap ────────────────────────────────────────── */
  .match-arena-wrap {
    padding: 0.6rem 0.75rem 0;
  }

  /* ── Match header : tout sur une seule ligne ─────────────────── */
  .match-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 0.3rem;
    margin-bottom: 0.6rem;
  }

  /* Colonne gauche : mon pseudo */
  .match-header>div:first-child {
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Colonne centre : timer */
  .match-timer-center {
    text-align: center;
    order: 0;
  }

  .timer {
    font-size: 1.15rem;
    font-weight: 700;
  }

  .match-progress-bar {
    width: 80px;
    margin: 2px auto 0;
  }

  /* Colonne droite : adversaire */
  .match-opp-info {
    text-align: right;
    font-size: 0.78rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .match-opp-info strong {
    display: block;
    font-size: 0.8rem;
  }

  /* ── Match grid : une seule colonne ─────────────────────────── */
  .match-grid {
    grid-template-columns: 1fr;
    gap: 0.6rem;
  }

  /* ── Sidebar → barre horizontale compacte ───────────────────── */
  .match-sidebar {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--border);
    flex-wrap: nowrap;
  }

  .match-sidebar-label {
    display: none;
    /* "Problèmes" — inutile sur mobile */
  }

  #probSelector {
    display: flex;
    flex-direction: row;
    gap: 0.35rem;
    flex: 1;
  }

  .prob-btn {
    flex: 1;
    padding: 0.35rem 0.4rem;
    font-size: 0.75rem;
    margin-bottom: 0;
    justify-content: center;
    gap: 0.25rem;
  }

  /* Cache les éléments non-essentiels de la sidebar */
  .match-sidebar .match-sidebar-divider,
  .match-sidebar>.text-muted,
  .match-sidebar .my-solved-count {
    display: none;
  }

  .match-forfeit-btn {
    margin-top: 0;
    width: auto;
    padding: 0.3rem 0.65rem;
    font-size: 0.72rem;
    flex-shrink: 0;
  }

  /* ── Zone problème ───────────────────────────────────────────── */
  #problemArea {
    min-height: 0;
  }

  .problem-display {
    padding: 0.85rem;
    font-size: 1rem;
    margin: 0 0 0.6rem;
  }

  .answer-row {
    flex-direction: column;
    gap: 0.4rem;
  }

  .answer-input {
    width: 100%;
    font-size: 16px;
    /* évite le zoom iOS au focus */
  }

  /* Bouton Valider pleine largeur */
  #problemArea .btn-validate,
  #problemArea button.btn-primary,
  .match-arena-wrap .btn-validate {
    width: 100%;
    padding: 0.65rem;
    font-size: 0.9rem;
  }

  /* ── Footer : caché pendant un match ────────────────────────── */
  .match-arena-wrap~footer,
  #page-match footer {
    display: none !important;
  }

  /* Règle générale : footer masqué sur la page match */
  body:has(.match-arena-wrap) footer {
    display: none !important;
  }

  /* ── Chat : caché par défaut, ouvert via bouton flottant ────── */
  .chat-widget {
    position: fixed !important;
    bottom: 0 !important;
    right: 0 !important;
    left: 0 !important;
    width: 100% !important;
    border-radius: 0 !important;
    z-index: 60;
    /* masqué par défaut sur mobile — JS ajoute .chat-mobile-open */
    display: none !important;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .chat-widget.chat-mobile-open {
    display: block !important;
  }

  .chat-widget-inner {
    border-radius: 0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.15);
  }

  .chat-widget-header {
    padding: 0.5rem 0.85rem;
    font-size: 0.75rem;
  }

  /* Quand le chat est ouvert, le collapsible est toujours visible */
  .chat-widget.chat-mobile-open #chatCollapsible {
    display: block !important;
  }

  .chat-messages {
    height: 140px;
  }

  .chat-input-row {
    padding-bottom: calc(0.45rem + env(safe-area-inset-bottom, 8px));
  }

  /* Bouton flottant chat */
  .chat-fab {
    position: fixed !important;
    bottom: calc(1rem + env(safe-area-inset-bottom, 0px)) !important;
    right: 1rem !important;
    width: 44px !important;
    height: 44px !important;
    border-radius: 50% !important;
    background: var(--ink) !important;
    color: var(--bg) !important;
    border: none !important;
    font-size: 1.1rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    z-index: 61 !important;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.25) !important;
    transition: transform 0.15s !important;
  }

  .chat-fab:active {
    transform: scale(0.92) !important;
  }

  /* Cache le FAB quand le chat est ouvert */
  .chat-fab.hidden {
    display: none !important;
  }

  /* Espace sous le contenu du match */
  #page-match .match-arena-wrap {
    padding-bottom: 5rem;
  }

  /* ── Résultats ───────────────────────────────────────────────── */
  .result-actions {
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
  }

  .result-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .result-title {
    font-size: 1.8rem;
  }

  .elo-delta {
    font-size: 1.4rem;
  }

  .result-stats-grid {
    width: 100%;
  }

  /* ── Pre-match ───────────────────────────────────────────────── */
  .prematch-screen {
    min-height: 50vh;
    gap: 1.25rem;
  }

  .prematch-players {
    gap: 1rem;
  }

  .prematch-countdown {
    font-size: 2.5rem;
  }

  /* ── Matchmaking ─────────────────────────────────────────────── */
  .matchmaking-screen {
    min-height: 50vh;
    gap: 1.25rem;
  }
}

/* ── Très petits écrans (SE, mini) ──────────────────────────────── */
@media (max-width: 390px) {
  .timer {
    font-size: 1rem;
  }

  .prob-btn {
    font-size: 0.7rem;
    padding: 0.3rem 0.35rem;
  }

  .problem-display {
    font-size: 0.93rem;
    padding: 0.65rem;
  }

  .match-arena-wrap {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }

  .match-header>div:first-child,
  .match-opp-info {
    font-size: 0.72rem;
  }
}