:root {
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --surface2: #242424;
  --border: rgba(255, 255, 255, 0.08);
  --border2: rgba(255, 255, 255, 0.15);
  --text: #f0f0f0;
  --muted: #888;
  --accent: #3ecf6a;
  --green: #3ecf6a;
  --yellow: #f0c040;
  --red: #e05a2b;
  --radius: 12px;
  --radius-sm: 7px;
  --sidebar: 210px;
}

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

/* Scrollbar sombre globale */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #444; }
* { scrollbar-width: thin; scrollbar-color: #333 transparent; }

html, body {
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
}

body {
  display: flex;
  flex-direction: column;
}

/* ════ HEADER ════ */

header {
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  flex-shrink: 0;
  z-index: 50;
  background: var(--bg);
}

.logo {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 32px;
  letter-spacing: 2px;
  color: var(--accent);
  line-height: 1;
  text-decoration: none;
}

.logo span { color: var(--text); }

.header-right { display: flex; align-items: center; gap: 8px; }

.nav-btn {
  background: 0;
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  transition: all .15s;
  text-decoration: none;
}

.nav-btn:hover { border-color: var(--border2); color: var(--text); }

.nav-btn.active {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
  font-weight: 600;
}

/* ════ LAYOUT (NO-SCROLL) ════ */

.app-body {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.sidebar {
  width: var(--sidebar);
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  padding: 1.25rem .75rem;
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow-y: auto;
}

.sidebar-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  padding: 0 8px;
  margin: 10px 0 3px;
}

.side-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 0;
  background: 0;
  color: var(--muted);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  cursor: pointer;
  transition: all .15s;
  text-align: left;
  width: 100%;
  text-decoration: none;
}

.side-btn:hover { background: var(--surface); color: var(--text); }

.side-btn.active { background: var(--surface); color: var(--accent); font-weight: 600; }

.side-btn .icon { font-size: 15px; width: 18px; text-align: center; flex-shrink: 0; }

.main {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ════ GAME COMMON ════ */

.game-wrap {
  max-width: 820px;
  width: 100%;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.game-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 20px;
  letter-spacing: 1px;
  color: var(--muted);
  margin-bottom: .75rem;
  flex-shrink: 0;
}

.img-container {
  position: relative;
  width: 100%;
  aspect-ratio: 4/3;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  margin-bottom: .75rem;
  flex: 0 1 auto;
  max-height: 40vh;
  min-height: 120px;
}

.meme-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.img-error {
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  padding: 2rem;
}

.blur-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.65);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  letter-spacing: .5px;
  text-transform: uppercase;
}

.reveal-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--border);
}

.reveal-bar-fill {
  height: 100%;
  background: var(--accent);
  transition: width .4s ease;
}

/* ════ TRIES ════ */

.tries-counter {
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 4px;
  flex-shrink: 0;
}

.tries-row {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-bottom: .5rem;
  flex-shrink: 0;
}

.try-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--surface2);
  border: 1px solid var(--border2);
  transition: background .2s;
}

.try-dot.used { background: var(--red); border-color: var(--red); }
.try-dot.current { border-color: var(--accent); }

/* ════ HISTORY ════ */

.history {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: .5rem;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.guess-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 13px;
  color: var(--muted);
  animation: fadeIn .2s ease;
  flex-shrink: 0;
}

.guess-row::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red);
  flex-shrink: 0;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ════ INPUT & SUGGESTIONS ════ */

.input-row {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
  flex-shrink: 0;
}
.input-row .input-wrap { flex: 4; margin-bottom: 0; }
.input-row .submit-btn { flex: 1; width: auto; margin: 0; }

.input-wrap {
  position: relative;
  margin-bottom: 6px;
  flex-shrink: 0;
}

.input-wrap input, .classic-input {
  width: 100%;
  padding: 10px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border2);
  background: var(--surface);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  outline: 0;
  transition: border-color .15s;
}

.input-wrap input:focus, .classic-input:focus { border-color: var(--accent); }
.input-wrap input::placeholder, .classic-input::placeholder { color: var(--muted); }

.suggestions {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  overflow: hidden;
  z-index: 20;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}
.suggestions:empty {
  display: none;
}

.sug-item {
  padding: 8px 12px;
  font-size: 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sug-item:last-child { border-bottom: 0; }
.sug-item:hover { background: var(--surface); }

.sug-item img {
  width: 48px;
  height: 36px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
  background: var(--surface);
}

.sug-item-name { flex: 1; font-weight: 500; }

/* ════ BUTTONS ════ */

.submit-btn {
  width: 100%;
  padding: 11px;
  border-radius: var(--radius);
  border: 0;
  background: var(--accent);
  color: #000;
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
  flex-shrink: 0;
}

.submit-btn:hover { opacity: .9; }
.submit-btn:active { transform: scale(0.98); }

/* ════ QCM ════ */

.qcm-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 6px;
  flex-shrink: 0;
}

.qcm-btn {
  padding: 14px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border2);
  background: var(--surface);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  transition: all .15s;
  line-height: 1.3;
}

.qcm-btn:hover:not(:disabled) { border-color: var(--accent); background: var(--surface2); }

/* ════ CLASSIQUE ════ */

.classic-row {
  display: flex;
  gap: 8px;
  margin-bottom: .75rem;
  position: relative;
  flex-shrink: 0;
}

.classic-row .classic-input { flex: 4; }

.classic-row .submit-btn { flex: 1; width: auto; margin: 0; flex-shrink: 0; }

.classic-sug {
  position: absolute;
  left: 0;
  right: 120px;
  top: calc(100% + 4px);
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  overflow: hidden;
  z-index: 20;
}

.classic-table-wrap {
  overflow: auto;
  flex: 1;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}

.classic-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 600px;
}

.classic-table th {
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  text-align: center;
  white-space: nowrap;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 2;
}

.th-inner { display: inline-flex; align-items: center; gap: 5px; }

.classic-table td {
  padding: 13px 14px;
  text-align: center;
  font-size: 15px;
  font-weight: 500;
  border-bottom: 1px solid var(--border);
}

.classic-table tr:last-child td { border-bottom: 0; }

.cell-name { text-align: left !important; font-weight: 600; }

.cell-name-inner { display: flex; align-items: center; gap: 10px; min-width: 160px; }

.cell-name img {
  width: 64px;
  height: 48px;
  object-fit: cover;
  border-radius: 5px;
  flex-shrink: 0;
}

.cell-name-text { font-weight: 600; line-height: 1.3; word-break: break-word; }

/* ════ CELL COLORS ════ */

.c-green {
  background: rgba(62, 207, 106, 0.18);
  color: var(--green);
  padding: 4px 12px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
}

.c-yellow {
  background: rgba(240, 192, 64, 0.2);
  color: var(--yellow);
  padding: 4px 12px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
}

.c-red {
  background: rgba(224, 90, 43, 0.18);
  color: var(--red);
  padding: 4px 12px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
}

.c-arrow { font-size: 16px; font-weight: 700; line-height: 1; }

/* ════ TOOLTIP ════ */

.tooltip-wrap { position: relative; display: inline-flex; align-items: center; }

.tooltip-icon {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--surface2);
  border: 1px solid var(--border2);
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: help;
  flex-shrink: 0;
}

.tooltip-box {
  display: none;
  position: fixed;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 12px;
  color: var(--text);
  width: 220px;
  text-align: left;
  z-index: 9999;
  line-height: 1.5;
  pointer-events: none;
  white-space: pre-line;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.tooltip-wrap:hover .tooltip-box { display: block; }

/* ════ RESULT ════ */

.result-box {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 1.5rem 1.25rem;
  text-align: center;
  animation: fadeIn .3s ease;
  margin-bottom: .75rem;
  flex-shrink: 0;
  overflow-y: auto;
}

.result-emoji { font-size: 36px; margin-bottom: 6px; }

.result-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 30px;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.result-title.won { color: var(--green); }
.result-title.lost { color: var(--red); }

.result-answer {
  font-size: 18px;
  font-weight: 600;
  color: var(--accent);
  margin: 6px 0 4px;
}

.next-btn {
  padding: 10px 24px;
  border-radius: 30px;
  border: 1px solid var(--border2);
  background: 0;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
}

.next-btn:hover { background: var(--surface2); border-color: var(--accent); color: var(--accent); }

/* ════ SPOT ════ */

.spot-container {
  position: relative;
  width: 100%;
  aspect-ratio: 4/3;
  border-radius: var(--radius);
  overflow: hidden;
  background: #111;
  border: 1px solid var(--border);
  margin-bottom: .75rem;
  flex: 0 1 auto;
  max-height: 40vh;
  min-height: 120px;
}

.spot-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ════ DATABASE ════ */

.db-wrap {
  width: 100%;
  padding: 1rem 1.5rem;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.db-search-wrap {
  position: relative;
  margin-bottom: 1rem;
  flex-shrink: 0;
}

.db-search-wrap input {
  width: 100%;
  padding: 12px 16px 12px 44px;
  border-radius: var(--radius);
  border: 1px solid var(--border2);
  background: var(--surface);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  outline: 0;
  transition: border-color .15s;
}

.db-search-wrap input:focus { border-color: var(--accent); }
.db-search-wrap input::placeholder { color: var(--muted); }

.db-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 16px;
  pointer-events: none;
}

.db-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  align-content: start;
}

.db-card {
  position: relative;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color .15s;
  cursor: pointer;
  height: 200px;
}

.db-card:hover { border-color: var(--border2); }

.db-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.db-card-name {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 500;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  backdrop-filter: blur(4px);
}

.db-empty {
  text-align: center;
  color: var(--muted);
  padding: 3rem;
  font-size: 14px;
  grid-column: 1 / -1;
}

/* ════ DB POPUP ════ */

.db-popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}

.db-popup-overlay.open { opacity: 1; pointer-events: all; }

.db-popup {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
}

.db-popup img { width: 100%; border-radius: var(--radius-sm); margin-bottom: 1rem; }

.db-popup-name { font-size: 24px; font-weight: 600; margin-bottom: 1rem; color: var(--text); }

.db-popup-trait {
  display: flex;
  justify-content: space-between;
  padding: .5rem 0;
  border-bottom: 1px solid var(--border);
}

.db-popup-trait:last-child { border-bottom: 0; }
.db-popup-trait-name { color: var(--muted); font-size: 13px; }
.db-popup-trait-val { color: var(--text); font-size: 13px; }

.db-popup-tags { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }

.db-popup-tag {
  background: var(--surface2);
  padding: .25rem .75rem;
  border-radius: 20px;
  font-size: 12px;
  color: var(--muted);
}

.db-popup-close {
  margin-top: 1.5rem;
  padding: .5rem 1rem;
  background: var(--accent);
  color: #000;
  border: 0;
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  cursor: pointer;
}

/* ════ HOME ════ */

.home-wrap {
  max-width: 860px;
  margin: 0 auto;
  padding: 1.5rem 1.5rem;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
}

.home-hero { text-align: center; margin-bottom: 2rem; flex-shrink: 0; }

.home-logo {
  font-family: 'Bebas Neue', sans-serif;
  font-size: clamp(52px, 10vw, 100px);
  letter-spacing: 6px;
  color: var(--accent);
  line-height: 1;
  margin-bottom: .25rem;
}

.home-logo span { color: var(--text); }

.home-tagline { font-size: 15px; color: var(--muted); font-weight: 400; }

.home-modes {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-bottom: 1.5rem;
  flex-shrink: 0;
}

.home-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.25rem;
  cursor: pointer;
  transition: all .2s;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}

.home-card:hover { border-color: var(--accent); background: var(--surface2); transform: translateY(-2px); }
.home-card:active { transform: scale(0.98); }

.home-card-icon { font-size: 36px; line-height: 1; }

.home-card-name {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 20px;
  letter-spacing: 1px;
  color: var(--text);
}

.home-card-desc { font-size: 11px; color: var(--muted); line-height: 1.4; }

.home-db-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: 0;
  color: var(--muted);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  cursor: pointer;
  transition: all .15s;
  flex-shrink: 0;
  text-decoration: none;
}

.home-db-btn:hover { border-color: var(--border2); color: var(--text); }

/* ════ ADMIN ════ */

.admin-layout {
  width: 100%;
  padding: 1rem 2rem 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.admin-tabs {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}

.admin-tab {
  padding: 10px 24px;
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--muted);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  margin-bottom: -1px;
}

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

.admin-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

.admin-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.admin-panel-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}

.admin-wrap {
  width: 100%;
  padding: 1.5rem 1.5rem;
  height: 100%;
  overflow-y: auto;
}

.admin-section { margin-bottom: 2rem; }

.admin-section-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 20px;
  letter-spacing: 1px;
  color: var(--accent);
  margin-bottom: 1rem;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

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

.admin-top .admin-section-title { margin-bottom: 0; border-bottom: 0; padding-bottom: 0; }

.add-btn {
  padding: 8px 16px;
  border-radius: 30px;
  border: 0;
  background: var(--accent);
  color: #000;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

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

.stats-bar { display: flex; gap: 12px; margin-bottom: 1.5rem; }

.stat-card {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  min-width: 0;
}

.stat-val { font-size: 28px; font-weight: 600; color: var(--accent); line-height: 1; }

.stat-label {
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
  text-transform: uppercase;
  letter-spacing: .5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ════ MEME LIST ════ */

.meme-list {
  position: relative;
  overflow-y: auto;
  contain: strict;
  flex: 1;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--surface2) var(--bg);
}

.meme-list::-webkit-scrollbar { width: 8px; }
.meme-list::-webkit-scrollbar-track { background: var(--bg); border-radius: 4px; }
.meme-list::-webkit-scrollbar-thumb { background: var(--surface2); border-radius: 4px; }
.meme-list::-webkit-scrollbar-thumb:hover { background: var(--muted); }

.meme-list > div { position: relative; width: 100%; }

.meme-card.virtual {
  position: absolute;
  left: 0;
  right: 0;
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 10px;
}

.meme-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.meme-card-thumb {
  width: 80px;
  height: 60px;
  border-radius: var(--radius-sm);
  background: var(--surface2);
  border: 1px solid var(--border);
  flex-shrink: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.meme-card-thumb img { width: 100%; height: 100%; object-fit: cover; }

.meme-card-info { flex: 1; min-width: 0; }
.meme-card-name { font-weight: 600; font-size: 15px; margin-bottom: 3px; }
.meme-card-meta { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.meme-card-tags { display: flex; flex-wrap: wrap; gap: 4px; }

.tag-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
}

.card-actions { display: flex; gap: 6px; flex-shrink: 0; align-self: center; }

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: 0;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all .15s;
}

.icon-btn:hover { border-color: var(--border2); color: var(--text); }
.icon-btn.del:hover { border-color: var(--red); color: var(--red); }

/* ════ TRAITS ════ */

.trait-list { display: flex; flex-direction: column; gap: 8px; }

.trait-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.trait-card-info { flex: 1; }

.trait-card-name {
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.trait-type-badge {
  font-size: 11px;
  color: var(--accent);
  background: rgba(62, 207, 106, 0.1);
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 400;
}

.trait-card-desc { font-size: 12px; color: var(--muted); margin-top: 3px; white-space: pre-line; }

/* ════ SETTINGS ════ */

.mode-names-grid { display: flex; flex-direction: column; gap: 8px; }

.mode-name-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}

.mode-name-row label { font-size: 13px; color: var(--muted); width: 130px; flex-shrink: 0; }

.mode-name-row input {
  flex: 1;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border2);
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  outline: 0;
}

.mode-name-row input:focus { border-color: var(--accent); }

.save-btn {
  margin-top: 10px;
  padding: 9px 20px;
  border-radius: 20px;
  border: 0;
  background: var(--accent);
  color: #000;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

/* ════ EXPORT ════ */

.export-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
}

.export-box h4 {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 8px;
}

.export-box textarea {
  width: 100%;
  height: 80px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-family: monospace;
  font-size: 11px;
  padding: 10px;
  resize: none;
  outline: 0;
}

.export-copy-btn {
  margin-top: 8px;
  padding: 7px 16px;
  border-radius: 20px;
  border: 1px solid var(--border2);
  background: 0;
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  cursor: pointer;
}

/* ════ CONTINENTS ════ */

.continent-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
}

.continent-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.continent-name { font-weight: 600; font-size: 15px; color: var(--text); }
.continent-actions { display: flex; gap: 6px; }

.country-tags { display: flex; flex-wrap: wrap; gap: 6px; }

.country-tag {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--surface2);
  border: 1px solid var(--border2);
  color: var(--text);
  cursor: pointer;
  transition: all .15s;
  display: flex;
  align-items: center;
  gap: 5px;
}

.country-tag:hover { border-color: var(--red); color: var(--red); }
.country-tag:hover .ctag-x { opacity: 1; }
.ctag-x { opacity: 0; font-size: 11px; transition: opacity .15s; }

.add-country-row { display: flex; gap: 6px; margin-top: 10px; }

.add-country-row input {
  flex: 1;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border2);
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  outline: 0;
}

.add-country-row input:focus { border-color: var(--accent); }

.add-country-row button {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  border: 0;
  background: var(--accent);
  color: #000;
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

/* ════ MODAL ════ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  z-index: 200;
  padding: 2rem 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
  overflow-y: auto;
}

.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 1.75rem;
  width: 100%;
  max-width: 500px;
  transform: translateY(12px);
  transition: transform .2s;
}

.modal-overlay.open .modal { transform: translateY(0); }

.modal h3 {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 24px;
  letter-spacing: 1px;
  color: var(--accent);
  margin-bottom: 1.25rem;
}

/* ════ FORM ════ */

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

.form-group label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
  margin-bottom: 5px;
}

.form-group input, .form-group textarea, .form-group select {
  width: 100%;
  padding: 9px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border2);
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  outline: 0;
  transition: border-color .15s;
  resize: vertical;
}

.form-group input:focus, .form-group textarea:focus, .form-group select:focus { border-color: var(--accent); }
.form-group select option { background: var(--surface2); }

.hint-label { font-size: 11px; color: var(--muted); margin-top: 4px; }

.preview-img {
  margin-top: 8px;
  width: 100%;
  max-height: 120px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  display: none;
}

.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 1.25rem; }

.btn-cancel {
  padding: 9px 18px;
  border-radius: 30px;
  border: 1px solid var(--border2);
  background: 0;
  color: var(--muted);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  cursor: pointer;
}

.btn-save {
  padding: 9px 22px;
  border-radius: 30px;
  border: 0;
  background: var(--accent);
  color: #000;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

/* ════ IMAGE SOURCE ════ */

.img-source-tabs { display: flex; gap: 6px; margin-bottom: 8px; }

.img-tab {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border2);
  background: 0;
  color: var(--muted);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  cursor: pointer;
  transition: all .15s;
}

.img-tab.active { background: var(--accent); color: #000; border-color: var(--accent); font-weight: 600; }

.upload-zone {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 76px;
  border: 1.5px dashed var(--border2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  padding: 14px;
  transition: border-color .15s;
  background: var(--bg);
}

.upload-zone:hover { border-color: var(--accent); background: rgba(62, 207, 106, 0.04); color: var(--text); }
.upload-zone.has-file { border-color: var(--accent); color: var(--accent); }
.upload-zone small { display: block; font-size: 11px; margin-top: 3px; opacity: .6; }

/* ════ TRAIT FIELDS ════ */

.trait-fields { display: flex; flex-direction: column; gap: 7px; }

.trait-field-row { display: flex; align-items: center; gap: 8px; }

.trait-field-row label {
  font-size: 13px;
  color: var(--muted);
  width: 130px;
  flex-shrink: 0;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
}

.trait-field-row input {
  flex: 1;
  padding: 7px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border2);
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  outline: 0;
}

.trait-field-row input:focus { border-color: var(--accent); }

.trait-field-select {
  flex: 1;
  padding: 7px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border2);
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  outline: 0;
  appearance: auto;
}

.trait-field-select:focus { border-color: var(--accent); }

/* ════ SIDEBAR TOGGLE ════ */

.sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: 0;
  color: var(--text);
  cursor: pointer;
  font-size: 16px;
  flex-direction: column;
  gap: 4px;
  padding: 8px 7px;
}

.sidebar-toggle:hover { border-color: var(--border2); background: var(--surface); }

.sidebar-toggle span {
  display: block;
  width: 16px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: all .2s;
}

/* ════ OVERLAY (login/setup) ════ */

.overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
}

.overlay-box {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 2rem;
  width: 100%;
  max-width: 400px;
}

.overlay-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 24px;
  color: var(--accent);
  margin-bottom: 1.25rem;
  letter-spacing: 1px;
}

.overlay-input {
  width: 100%;
  padding: 10px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border2);
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  outline: none;
  margin-bottom: .75rem;
}

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

.overlay-err { color: var(--red); font-size: 13px; margin-bottom: .75rem; display: none; }

.overlay-btn {
  width: 100%;
  padding: 12px;
  border-radius: var(--radius);
  border: none;
  background: var(--accent);
  color: #000;
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

/* ════ RESPONSIVE ════ */

@media (max-width: 640px) {
  html, body {
    height: auto;
    overflow: auto;
  }

  .main {
    overflow: auto;
    height: auto;
  }

  .game-wrap, .db-wrap, .home-wrap {
    height: auto;
    overflow: visible;
  }

  .img-container, .spot-container {
    max-height: none;
  }

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

  .sidebar {
    position: fixed;
    top: 56px;
    left: 0;
    z-index: 100;
    height: calc(100vh - 56px);
    transform: translateX(-100%);
    transition: transform .25s ease;
    background: var(--bg);
    border-right: 1px solid var(--border2);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4);
  }

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

  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    top: 56px;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
  }

  .sidebar-overlay.visible { display: block; }
  .sidebar-toggle { display: flex !important; }

  .home-modes { grid-template-columns: 1fr; }

  .admin-layout {
    height: calc(100vh - 56px);
    padding: 1rem 1rem 0;
    overflow: hidden;
  }

  .qcm-grid { grid-template-columns: 1fr; }
  .db-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}
