/* ═══════════════════════════════════════════════════════════
   WikiRASH — Vandalized Wikipedia Aesthetic
   Clean but looks like someone went crazy with markers
   ═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Permanent+Marker&family=Caveat:wght@400;500;600;700&family=Inter:wght@400;500;600;700;800&family=Patrick+Hand&display=swap');

:root {
  --font: 'Inter', sans-serif;
  --font-marker: 'Permanent Marker', cursive;
  --font-hand: 'Caveat', cursive;
  --font-scribble: 'Patrick Hand', cursive;

  /* Wikipedia-like base */
  --bg: #fafafa;
  --bg-card: #ffffff;
  --bg-highlight-yellow: rgba(255, 255, 0, 0.35);
  --bg-highlight-pink: rgba(255, 0, 127, 0.15);
  --bg-highlight-blue: rgba(0, 150, 255, 0.12);
  --bg-highlight-green: rgba(0, 255, 100, 0.15);

  /* Marker colors */
  --ink-black: #1a1a1a;
  --ink-blue: #2255cc;
  --ink-red: #cc2233;
  --ink-pink: #ff0080;
  --ink-green: #00aa44;
  --ink-orange: #ff6600;
  --ink-purple: #7733cc;

  /* Wikipedia blue */
  --wiki-blue: #0645ad;
  --wiki-border: #a2a9b1;
  --wiki-bg: #f8f9fa;

  /* Borders */
  --border: #ccc;
  --border-accent: #333;

  /* Text */
  --text: #202122;
  --text-dim: #54595d;
  --text-faint: #888;

  /* Radii */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  /* Subtle lined-paper texture */
  background-image:
    repeating-linear-gradient(0deg, transparent, transparent 31px, rgba(0,100,200,0.05) 31px, rgba(0,100,200,0.05) 32px);
  background-size: 100% 32px;
}

/* ── Doodle Icon Base ─────────────────────────────────── */
.doodle-icon {
  display: inline-flex;
  vertical-align: middle;
  flex-shrink: 0;
}

.doodle-btn-icon { display: inline-flex; vertical-align: middle; }

/* ── Scribble Decorations (CSS-only doodles) ──────────── */
.bg-game { display: none; }
.bg-stars {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.star {
  position: absolute;
  font-family: var(--font-hand);
  color: rgba(0, 0, 0, 0.04);
  font-size: 14px;
  transform: rotate(var(--rot, 0deg));
  user-select: none;
}

/* ── Container ───────────────────────────────────────── */
.container {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 60px;
}

/* ── Header ──────────────────────────────────────────── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  border-bottom: 2px solid var(--ink-black);
  position: relative;
}

.header::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--ink-black);
  opacity: 0.15;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}

/* Logo Image (replaces emoji) */
.logo-img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  filter: drop-shadow(2px 2px 0 rgba(0,0,0,0.15));
  transition: transform 0.2s ease;
}

.logo:hover .logo-img {
  transform: rotate(-5deg) scale(1.05);
}

/* Keep old logo-icon class for backwards compat but hide */
.logo-icon { display: none; }

.logo-text {
  font-family: var(--font-marker);
  font-size: 28px;
  color: var(--ink-black);
  position: relative;
}

/* Highlight behind logo text */
.logo-text::before {
  content: '';
  position: absolute;
  bottom: 2px;
  left: -4px;
  right: -4px;
  height: 40%;
  background: var(--bg-highlight-yellow);
  z-index: -1;
  transform: skewX(-2deg);
}

/* ── Buttons ─────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border: 2px solid var(--ink-black);
  border-radius: 2px;
  font-family: var(--font-scribble);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
  background: white;
  color: var(--ink-black);
  box-shadow: 3px 3px 0 var(--ink-black);
  position: relative;
}

.btn:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 var(--ink-black);
}

.btn:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--ink-black);
}

.btn-primary {
  background: var(--ink-blue);
  color: white;
  border-color: var(--ink-blue);
  box-shadow: 3px 3px 0 rgba(0,0,0,0.3);
}

.btn-orange {
  background: var(--ink-orange);
  color: white;
  border-color: #cc5500;
  box-shadow: 4px 4px 0 rgba(0,0,0,0.3);
  font-family: var(--font-marker);
  font-size: 20px;
  padding: 16px 36px;
  letter-spacing: 1px;
  transform: rotate(-1deg);
}

.btn-orange:hover {
  transform: rotate(0deg) translate(-1px, -1px);
}

.btn-secondary {
  background: var(--wiki-bg);
  border-color: var(--border);
  box-shadow: 2px 2px 0 rgba(0,0,0,0.1);
}

.btn-success {
  background: var(--ink-green);
  color: white;
  border-color: #008833;
  box-shadow: 3px 3px 0 rgba(0,0,0,0.3);
}

.btn-danger {
  background: var(--ink-red);
  color: white;
  border-color: #aa1122;
  box-shadow: 3px 3px 0 rgba(0,0,0,0.3);
}

.btn-sm { padding: 6px 14px; font-size: 14px; }
.btn-lg { padding: 14px 28px; font-size: 18px; }

/* ── Inputs ──────────────────────────────────────────── */
.input {
  width: 100%;
  padding: 12px 16px;
  background: white;
  border: 2px solid var(--ink-black);
  border-radius: 2px;
  color: var(--text);
  font-family: var(--font-scribble);
  font-size: 16px;
  outline: none;
  transition: all 0.2s ease;
  box-shadow: inset 2px 2px 0 rgba(0,0,0,0.05);
}

.input:focus {
  border-color: var(--ink-blue);
  box-shadow: 0 0 0 3px rgba(34, 85, 204, 0.15);
}

.input::placeholder { color: var(--text-faint); font-style: italic; }
.input-label { display: block; font-size: 14px; font-weight: 600; color: var(--text-dim); margin-bottom: 6px; font-family: var(--font-scribble); }
.input-group { margin-bottom: 16px; }

.select {
  width: 100%;
  padding: 12px 16px;
  background: white;
  border: 2px solid var(--ink-black);
  border-radius: 2px;
  color: var(--text);
  font-family: var(--font-scribble);
  font-size: 16px;
}

/* ── Game Cards (Wikipedia-style boxes with marker touches) */
.game-card {
  background: var(--bg-card);
  border: 2px solid var(--ink-black);
  border-radius: 2px;
  box-shadow: 4px 4px 0 rgba(0,0,0,0.1);
  overflow: hidden;
  position: relative;
}

/* Random tape effect on cards */
.game-card::before {
  content: '';
  position: absolute;
  top: -6px;
  right: 20px;
  width: 60px;
  height: 18px;
  background: rgba(255, 255, 0, 0.4);
  transform: rotate(2deg);
  z-index: 2;
  border: 1px solid rgba(200,180,0,0.3);
}

.game-card-header {
  padding: 14px 18px;
  background: var(--wiki-bg);
  border-bottom: 2px solid var(--ink-black);
  display: flex;
  align-items: center;
  gap: 8px;
}

.game-card-title {
  font-family: var(--font-marker);
  font-size: 15px;
  color: var(--ink-black);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.game-card-icon { font-size: 18px; display: inline-flex; }

.game-card-body { padding: 16px 18px; }

/* ═══════════════════════════════════════════════════════
   HOME — Vandalized Wikipedia Dashboard
   ═══════════════════════════════════════════════════════ */

.hero-banner {
  text-align: center;
  padding: 36px 0 20px;
  position: relative;
}

.hero-title {
  font-family: var(--font-marker);
  font-size: 64px;
  color: var(--ink-black);
  position: relative;
  display: inline-block;
  letter-spacing: 3px;
}

/* Strikethrough on "Wiki" like it's been vandalized */
.hero-title::before {
  content: 'WIKIPEDIA';
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 14px;
  font-family: var(--font);
  color: var(--text-faint);
  text-decoration: line-through;
  text-decoration-color: var(--ink-red);
  text-decoration-thickness: 2px;
  letter-spacing: 4px;
  white-space: nowrap;
}

/* Pink highlight circle around title */
.hero-title::after {
  content: '';
  position: absolute;
  inset: -12px -24px;
  border: 3px solid var(--ink-pink);
  border-radius: 50% 40% 50% 45%;
  opacity: 0.4;
  transform: rotate(-2deg);
}

.hero-subtitle {
  font-family: var(--font-hand);
  font-size: 22px;
  color: var(--text-dim);
  margin-top: 16px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.4;
}

.hero-cta { margin-top: 28px; }

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 270px 1fr 270px;
  gap: 20px;
  margin-top: 24px;
  padding-bottom: 40px;
}

@media (max-width: 1100px) {
  .dashboard-grid { grid-template-columns: 1fr; }
}

/* ── Leaderboard ─────────────────────────────────────── */
.leaderboard-list { display: flex; flex-direction: column; gap: 4px; }

.leaderboard-header {
  display: grid;
  grid-template-columns: 28px 1fr 70px;
  gap: 8px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-faint);
  text-transform: uppercase;
  font-family: var(--font-scribble);
  border-bottom: 1px dashed var(--border);
}

.leaderboard-row {
  display: grid;
  grid-template-columns: 28px 1fr 70px;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px dashed rgba(0,0,0,0.08);
  font-size: 13px;
  transition: background 0.15s ease;
  font-family: var(--font-scribble);
}

.leaderboard-row:hover { background: var(--bg-highlight-yellow); }
.leaderboard-row.self { background: var(--bg-highlight-blue); }

.lb-rank { font-weight: 800; text-align: center; font-family: var(--font-marker); font-size: 16px; }
.lb-rank.gold { color: #daa520; }
.lb-rank.silver { color: #888; }
.lb-rank.bronze { color: #cd7f32; }
.lb-rank.normal { color: var(--text-dim); }

.lb-player { display: flex; align-items: center; gap: 8px; overflow: hidden; }
.lb-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: white; flex-shrink: 0;
  border: 2px solid var(--ink-black);
  overflow: hidden;
}
.lb-avatar img { width: 100%; height: 100%; object-fit: cover; }
.lb-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: 14px; }
.lb-value { font-size: 14px; font-weight: 800; color: var(--ink-blue); text-align: right; font-family: var(--font-marker); }

/* ── Lobbies ─────────────────────────────────────────── */
.lobby-list-compact { display: flex; flex-direction: column; gap: 8px; }

.lobby-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: white;
  border: 2px solid var(--border);
  border-left: 5px solid var(--ink-blue);
  transition: all 0.2s ease;
  cursor: pointer;
}

.lobby-row:hover {
  border-color: var(--ink-black);
  box-shadow: 3px 3px 0 rgba(0,0,0,0.1);
  transform: translateY(-1px);
}

.lobby-row:nth-child(even) { border-left-color: var(--ink-orange); }
.lobby-row:nth-child(3n) { border-left-color: var(--ink-pink); }

.lobby-row-info { flex: 1; overflow: hidden; }
.lobby-row-name { font-weight: 700; font-size: 14px; font-family: var(--font-scribble); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.lobby-row-meta {
  display: flex; align-items: center; gap: 10px;
  font-size: 12px; color: var(--text-dim); margin-top: 2px; font-family: var(--font-scribble);
}

.lobby-row-tag {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 1px 8px; font-size: 11px; font-weight: 700;
  font-family: var(--font-hand);
}
.lobby-row-tag.casual { color: var(--ink-blue); background: var(--bg-highlight-blue); }
.lobby-row-tag.competitive { color: var(--ink-red); background: var(--bg-highlight-pink); }

.lobby-row-btn {
  padding: 6px 14px;
  background: var(--ink-orange);
  border: 2px solid #cc5500;
  color: white;
  font-family: var(--font-marker);
  font-size: 12px;
  cursor: pointer;
  box-shadow: 2px 2px 0 rgba(0,0,0,0.2);
  transition: all 0.15s ease;
  letter-spacing: 0.5px;
}
.lobby-row-btn:hover { transform: translate(-1px,-1px); box-shadow: 3px 3px 0 rgba(0,0,0,0.3); }

/* ── Profile Panel ───────────────────────────────────── */
.profile-avatar-area {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding-bottom: 14px;
  border-bottom: 2px dashed var(--border);
  margin-bottom: 14px;
}

.profile-avatar {
  width: 60px; height: 60px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 800; color: white;
  border: 3px solid var(--ink-black);
  box-shadow: 3px 3px 0 rgba(0,0,0,0.15);
  font-family: var(--font-marker);
  overflow: hidden;
  position: relative;
}

.profile-avatar img {
  width: 100%; height: 100%; object-fit: cover;
  position: absolute; inset: 0;
}

.profile-name { font-family: var(--font-marker); font-size: 18px; }

.profile-xp-area { width: 100%; margin-top: 4px; }
.profile-xp-label { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 4px; font-family: var(--font-hand); }
.profile-xp-tag { font-weight: 700; color: var(--ink-blue); font-family: var(--font-marker); }

.profile-stats-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }

.profile-stat {
  text-align: center;
  padding: 10px 6px;
  background: var(--wiki-bg);
  border: 1px solid var(--border);
}

.profile-stat-value { font-size: 20px; font-weight: 800; color: var(--ink-black); font-family: var(--font-marker); }
.profile-stat-label { font-size: 10px; color: var(--text-faint); text-transform: uppercase; font-family: var(--font-scribble); letter-spacing: 0.5px; }

.profile-section-title { font-size: 13px; font-weight: 700; color: var(--text-dim); font-family: var(--font-hand); margin-bottom: 8px; font-size: 16px; }

.badges-row { display: flex; gap: 6px; flex-wrap: wrap; }
.badge-item {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  background: white;
  border: 2px solid var(--ink-black);
  font-size: 16px;
  box-shadow: 2px 2px 0 rgba(0,0,0,0.1);
}
.badge-item.achieved { border-color: var(--rank-color, var(--ink-black)); }
.badge-item.locked { opacity: 0.25; filter: grayscale(1); }

/* ═══════════════════════════════════════════════════════
   AVATAR UPLOAD — Profile photo selector
   ═══════════════════════════════════════════════════════ */

.avatar-upload-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}

.avatar-upload-preview {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 3px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.2s ease;
  position: relative;
  background: var(--wiki-bg);
}

.avatar-upload-preview:hover {
  border-color: var(--ink-blue);
  background: var(--bg-highlight-blue);
  transform: scale(1.05);
}

.avatar-upload-preview.has-photo {
  border-style: solid;
  border-color: var(--ink-black);
  box-shadow: 3px 3px 0 rgba(0,0,0,0.15);
}

.avatar-upload-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
}

.avatar-preview-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
}

.avatar-upload-label {
  font-family: var(--font-hand);
  font-size: 15px;
  color: var(--ink-blue);
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dashed;
}

.avatar-upload-label:hover {
  color: var(--ink-pink);
}

.avatar-small {
  width: 50px;
  height: 50px;
}

/* ═══════════════════════════════════════════════════════
   ARTICLE PICKER — Wikipedia search autocomplete
   ═══════════════════════════════════════════════════════ */

.article-picker {
  background: var(--wiki-bg);
  border: 2px solid var(--border);
  padding: 14px;
  margin-bottom: 6px;
}

.article-picker-title {
  font-family: var(--font-marker);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.article-picker-hint {
  font-family: var(--font-hand);
  font-size: 14px;
  color: var(--text-faint);
  margin-bottom: 12px;
}

.article-search-group {
  margin-bottom: 12px;
}

.article-arrow-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 0;
  color: var(--ink-pink);
}

.article-search-wrapper {
  position: relative;
}

.article-search-input {
  font-size: 14px;
  padding: 8px 12px;
}

.article-search-results {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 2px solid var(--ink-black);
  border-top: none;
  box-shadow: 4px 4px 0 rgba(0,0,0,0.1);
  z-index: 50;
  max-height: 240px;
  overflow-y: auto;
}

.article-search-results.visible {
  display: block;
}

.article-search-item {
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px dashed rgba(0,0,0,0.08);
  transition: background 0.1s ease;
}

.article-search-item:hover {
  background: var(--bg-highlight-yellow);
}

.article-search-item-title {
  font-weight: 700;
  font-size: 14px;
  font-family: var(--font-scribble);
  color: var(--ink-blue);
}

.article-search-item-desc {
  font-size: 12px;
  color: var(--text-faint);
  font-family: var(--font-hand);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.article-search-loading {
  padding: 12px;
  text-align: center;
  font-family: var(--font-hand);
  font-size: 14px;
  color: var(--text-faint);
}

.article-selected {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--bg-highlight-blue);
  border: 2px solid var(--ink-blue);
  margin-top: 6px;
}

.article-selected-name {
  flex: 1;
  font-weight: 700;
  font-size: 14px;
  font-family: var(--font-scribble);
  color: var(--ink-blue);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.article-selected-clear {
  background: none;
  border: none;
  font-size: 18px;
  color: var(--ink-red);
  cursor: pointer;
  padding: 0 4px;
  font-weight: 800;
  line-height: 1;
}

.article-selected-clear:hover {
  color: var(--ink-black);
}

/* ═══════════════════════════════════════════════════════
   ACCOUNT SECTION
   ═══════════════════════════════════════════════════════ */

.account-section {
  border-top: 1px dashed var(--border);
  padding-top: 12px;
}

.account-divider {
  text-align: center;
  margin-bottom: 12px;
  position: relative;
}

.account-divider span {
  background: var(--bg-card);
  padding: 0 12px;
  font-family: var(--font-hand);
  font-size: 16px;
  color: var(--text-faint);
  position: relative;
  z-index: 1;
}

.account-divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border);
}

.account-hint {
  font-family: var(--font-hand);
  font-size: 14px;
  color: var(--text-faint);
  text-align: center;
  margin-top: 8px;
  line-height: 1.3;
}

.account-avatar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.nickname-logo-area {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

.nickname-logo {
  width: 100px;
  height: 100px;
  object-fit: contain;
  filter: drop-shadow(3px 3px 0 rgba(0,0,0,0.15));
  animation: wiggle 3s ease-in-out infinite;
}

@keyframes wiggle {
  0%, 100% { transform: rotate(-2deg); }
  50% { transform: rotate(2deg); }
}

/* ═══════════════════════════════════════════════════════
   RANK BADGES — Marker/Sticker style
   ═══════════════════════════════════════════════════════ */

.rank-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px 3px 7px;
  font-size: 12px; font-weight: 700;
  background: white;
  border: 2px solid var(--rank-color, var(--ink-black));
  box-shadow: 2px 2px 0 rgba(0,0,0,0.12);
  transform: rotate(-1deg);
  font-family: var(--font-hand);
  white-space: nowrap;
}

.rank-badge:hover { transform: rotate(0deg) translateY(-1px); }
.rank-icon { display: inline-flex; align-items: center; color: var(--rank-color, currentColor); }
.rank-name { color: var(--rank-color, var(--text)); text-transform: uppercase; letter-spacing: 0.5px; font-size: 11px; font-family: var(--font-marker); }
.rank-level { color: var(--text-faint); font-size: 10px; }

.rank-badge-sm { padding: 2px 7px 2px 5px; gap: 3px; font-size: 11px; }
.rank-badge-sm .rank-icon { font-size: 11px; }
.rank-badge-sm .rank-name { font-size: 9px; }

.rank-badge-lg { padding: 6px 16px 6px 10px; gap: 8px; }
.rank-badge-lg .rank-icon { font-size: 22px; }
.rank-badge-lg .rank-name { font-size: 14px; }
.rank-badge-lg .rank-level { font-size: 12px; }

/* ═══════════════════════════════════════════════════════
   XP BAR — Marker fill style
   ═══════════════════════════════════════════════════════ */

.xp-bar-container { width: 100%; }
.xp-bar-label { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; font-size: 12px; font-family: var(--font-hand); }
.xp-bar-level { font-weight: 700; color: var(--ink-blue); font-family: var(--font-marker); }
.xp-bar-amount { color: var(--text-faint); }

.xp-bar-track {
  position: relative; height: 10px;
  background: #eee;
  border: 2px solid var(--ink-black);
  overflow: hidden;
}

.xp-bar-fill {
  position: absolute; top: 0; left: 0; height: 100%;
  background: repeating-linear-gradient(90deg, var(--ink-blue), var(--ink-purple) 30%, var(--ink-pink) 60%, var(--ink-orange) 100%);
  transition: width 0.8s ease;
}

.xp-bar-glow { display: none; }

/* ═══════════════════════════════════════════════════════
   XP GAIN OVERLAY
   ═══════════════════════════════════════════════════════ */

.xp-gain-card {
  background: white;
  border: 2px solid var(--ink-black);
  padding: 20px;
  margin-top: 16px;
  box-shadow: 4px 4px 0 rgba(0,0,0,0.1);
  animation: slideUp 0.4s ease;
}

@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

.xp-gain-header { text-align: center; margin-bottom: 14px; }
.xp-gain-total {
  font-size: 36px; font-weight: 900;
  font-family: var(--font-marker);
  color: var(--ink-green);
}

.xp-level-up {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 6px; padding: 3px 14px;
  background: var(--bg-highlight-green); color: var(--ink-green);
  border: 2px solid var(--ink-green);
  font-family: var(--font-marker); font-size: 14px;
  transform: rotate(-2deg);
}

.xp-rank-up {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 6px; padding: 4px 16px;
  background: var(--bg-highlight-pink); color: var(--ink-pink);
  border: 2px solid var(--ink-pink);
  font-family: var(--font-marker); font-size: 14px;
  transform: rotate(1deg);
}

.xp-gain-breakdown { display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }
.xp-gain-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px;
  border-bottom: 1px dashed rgba(0,0,0,0.1);
  font-family: var(--font-scribble);
  animation: xpRowSlide 0.3s ease backwards;
}
.xp-gain-row:nth-child(1) { animation-delay: 0.1s; }
.xp-gain-row:nth-child(2) { animation-delay: 0.15s; }
.xp-gain-row:nth-child(3) { animation-delay: 0.2s; }
.xp-gain-row:nth-child(4) { animation-delay: 0.25s; }
.xp-gain-row:nth-child(5) { animation-delay: 0.3s; }
@keyframes xpRowSlide { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: translateX(0); } }

.xp-gain-icon { display: inline-flex; color: var(--ink-blue); }
.xp-gain-label { flex: 1; font-size: 14px; color: var(--text-dim); }
.xp-gain-value { font-size: 14px; font-weight: 800; color: var(--ink-green); font-family: var(--font-marker); }
.xp-gain-bar { display: flex; align-items: center; gap: 8px; }
.xp-gain-next { font-size: 12px; color: var(--text-faint); font-family: var(--font-hand); }

/* ═══════════════════════════════════════════════════════
   STATS CARD
   ═══════════════════════════════════════════════════════ */

.stats-card { padding: 20px; }
.stats-rank-display { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 20px; padding-bottom: 20px; border-bottom: 2px dashed var(--border); }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat-item { text-align: center; padding: 10px 6px; background: var(--wiki-bg); border: 1px solid var(--border); }
.stat-item:hover { background: var(--bg-highlight-yellow); }
.stat-value { font-size: 18px; font-weight: 800; font-family: var(--font-marker); }
.stat-label { font-size: 10px; color: var(--text-faint); text-transform: uppercase; font-family: var(--font-scribble); }

.ranks-preview { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 12px; }
.rank-preview-item {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 10px 6px; background: white; border: 1px solid var(--border); opacity: 0.3;
}
.rank-preview-item.achieved { opacity: 1; border-color: var(--rank-color, var(--border)); }
.rank-preview-item.current { opacity: 1; border-width: 2px; border-color: var(--rank-color, var(--ink-black)); }
.rank-preview-icon { font-size: 22px; display: inline-flex; color: var(--rank-color, var(--text-dim)); }
.rank-preview-name { font-size: 10px; font-weight: 700; font-family: var(--font-marker); text-transform: uppercase; color: var(--rank-color, var(--text-dim)); }
.rank-preview-level { font-size: 9px; color: var(--text-faint); font-family: var(--font-hand); }

/* ═══════════════════════════════════════════════════════
   MODAL — Wikipedia popup style
   ═══════════════════════════════════════════════════════ */

.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 100; align-items: center; justify-content: center;
}
.modal-overlay.active { display: flex; }

.modal {
  background: white;
  border: 3px solid var(--ink-black);
  min-width: 400px; max-width: 90vw; max-height: 85vh; overflow-y: auto;
  box-shadow: 8px 8px 0 rgba(0,0,0,0.15);
  animation: slideUp 0.3s ease;
}

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 2px solid var(--ink-black);
  background: var(--wiki-bg);
}

.modal-title { font-family: var(--font-marker); font-size: 16px; display: flex; align-items: center; gap: 6px; }

.modal-close {
  width: 28px; height: 28px;
  border: 2px solid var(--ink-black); background: white; color: var(--ink-black);
  font-size: 14px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 2px 2px 0 rgba(0,0,0,0.1);
  font-weight: 800;
}
.modal-close:hover { background: var(--ink-red); color: white; }

.modal-body { padding: 20px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--border); }

/* ═══════════════════════════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════════════════════════ */

.empty-state { text-align: center; padding: 28px 20px; }
.empty-state-icon { margin-bottom: 8px; display: flex; justify-content: center; color: var(--text-faint); }
.empty-state-text { font-size: 16px; font-family: var(--font-hand); color: var(--text-dim); }
.empty-state-sub { font-size: 14px; color: var(--text-faint); margin-top: 4px; font-family: var(--font-hand); }

/* ═══════════════════════════════════════════════════════
   NICKNAME CARD
   ═══════════════════════════════════════════════════════ */

.nickname-container { max-width: 440px; margin: 0 auto; padding: 60px 0; text-align: center; }
.nickname-title { font-family: var(--font-marker); font-size: 26px; margin-bottom: 8px; }
.nickname-sub { font-size: 16px; color: var(--text-dim); margin-bottom: 24px; font-family: var(--font-hand); }

/* ═══════════════════════════════════════════════════════
   LOBBY PAGE
   ═══════════════════════════════════════════════════════ */

.lobby-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; max-width: 900px; margin: 0 auto; }
@media (max-width: 768px) { .lobby-layout { grid-template-columns: 1fr; } }

.lobby-panel { padding: 0; }
.lobby-panel-title { font-family: var(--font-marker); font-size: 15px; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; padding: 14px 18px; }

.lobby-header { text-align: center; padding: 28px 0; }
.lobby-header-name { font-family: var(--font-marker); font-size: 28px; }
.lobby-header-mode {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 12px; font-size: 14px; font-family: var(--font-hand);
  color: var(--ink-blue); background: var(--bg-highlight-blue);
  border: 1px solid var(--ink-blue); margin-top: 8px;
}

.section-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 6px;
  background: var(--bg-highlight-yellow);
  border: 1px solid #cca800;
  font-size: 11px; font-weight: 700; color: var(--ink-black);
  font-family: var(--font-marker);
}

.player-list { display: flex; flex-direction: column; gap: 4px; padding: 0 18px 18px; }
.player-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-bottom: 1px dashed var(--border);
}
.player-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: white; flex-shrink: 0;
  border: 2px solid var(--ink-black);
  overflow: hidden;
}
.player-avatar img { width: 100%; height: 100%; object-fit: cover; }
.player-name { font-weight: 600; flex: 1; font-family: var(--font-scribble); font-size: 15px; }
.player-tag { padding: 2px 8px; font-size: 11px; font-weight: 700; font-family: var(--font-marker); }
.player-tag.host { background: var(--bg-highlight-yellow); color: #aa8800; border: 1px solid #cca800; display: inline-flex; align-items: center; gap: 4px; }
.player-rank-info { display: flex; align-items: center; gap: 4px; margin-left: auto; }

.chat-container { display: flex; flex-direction: column; height: 320px; }
.chat-messages { flex: 1; overflow-y: auto; padding: 12px 16px; display: flex; flex-direction: column; gap: 4px; }
.chat-msg { font-size: 14px; color: var(--text-dim); font-family: var(--font-scribble); }
.chat-msg-author { font-weight: 700; color: var(--ink-blue); }
.chat-msg-system { font-size: 13px; color: var(--text-faint); font-style: italic; text-align: center; padding: 4px 0; font-family: var(--font-hand); }
.chat-input-row { display: flex; gap: 8px; padding: 12px 16px; border-top: 2px solid var(--ink-black); }

.copy-link {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; background: var(--wiki-bg);
  border: 1px solid var(--border); cursor: pointer;
}
.copy-link:hover { background: var(--bg-highlight-blue); }
.copy-link-text { flex: 1; font-size: 12px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: monospace; }
.copy-link-icon { color: var(--ink-blue); font-size: 14px; display: inline-flex; }

/* ═══════════════════════════════════════════════════════
   GAME PAGE
   ═══════════════════════════════════════════════════════ */

.game-layout { display: flex; flex-direction: column; height: 100vh; background: var(--bg); }

.game-top-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 16px;
  background: white;
  border-bottom: 3px solid var(--ink-black);
  gap: 12px; flex-shrink: 0; z-index: 10;
}

.game-info { display: flex; align-items: center; gap: 16px; }
.game-stat { display: flex; align-items: center; gap: 6px; font-size: 14px; font-family: var(--font-scribble); }
.game-stat-icon { display: inline-flex; color: var(--text-dim); }
.game-stat-value { font-weight: 700; color: var(--ink-blue); font-family: var(--font-marker); font-size: 16px; }
.game-stat-label { color: var(--text-dim); font-size: 12px; }

.game-target {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 14px;
  background: var(--bg-highlight-pink);
  border: 2px solid var(--ink-pink);
}
.game-target-label { font-size: 11px; color: var(--ink-pink); font-weight: 700; text-transform: uppercase; font-family: var(--font-marker); display: flex; align-items: center; gap: 4px; }
.game-target-title { font-weight: 700; font-size: 14px; color: var(--ink-black); font-family: var(--font-scribble); }

.game-content-area { display: flex; flex: 1; overflow: hidden; }
.game-main { flex: 1; overflow-y: auto; background: white; }

.game-sidebar {
  width: 280px; background: white;
  border-left: 3px solid var(--ink-black);
  display: flex; flex-direction: column; overflow-y: auto; flex-shrink: 0;
}

.sidebar-section {
  padding: 10px;
  border-bottom: 2px dashed var(--border);
}
.sidebar-section:last-child { border-bottom: none; }
.sidebar-section-title {
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  color: var(--text-dim); font-family: var(--font-marker);
  letter-spacing: 0.5px; margin-bottom: 6px;
  display: flex; align-items: center; gap: 4px;
}

.path-list { display: flex; flex-direction: column; gap: 3px; max-height: 180px; overflow-y: auto; }
.path-item { display: flex; align-items: center; gap: 6px; padding: 4px 8px; font-size: 12px; color: var(--text-dim); font-family: var(--font-scribble); }
.path-item-number {
  width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 800; color: var(--ink-blue);
  border: 2px solid var(--ink-blue); flex-shrink: 0;
  font-family: var(--font-marker);
}
.path-item-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.path-item.start { background: var(--bg-highlight-blue); }
.path-item.current { background: var(--bg-highlight-yellow); }

.progress-list { display: flex; flex-direction: column; gap: 4px; }
.progress-player-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 8px; border: 1px solid var(--border);
  font-size: 12px; font-family: var(--font-scribble); cursor: default;
  transition: background 0.15s;
}
.progress-player-item:hover { background: var(--bg-highlight-yellow); }
.progress-player-item.finished { background: var(--bg-highlight-green); }
.progress-player-item.gave-up { background: var(--bg-highlight-pink); opacity: 0.6; }
.progress-nickname { font-weight: 600; }
.progress-status { font-size: 11px; color: var(--text-faint); }

/* ── Points Display ────────────────────────── */
.points-stat {
  background: var(--bg-highlight-yellow);
  padding: 2px 8px;
  border: 2px solid #cc9900;
}
.points-value { font-weight: 900; color: #cc9900; font-family: var(--font-marker); }

.points-toast-container {
  position: fixed; top: 60px; right: 20px; z-index: 200;
  display: flex; flex-direction: column; gap: 4px;
}
.points-toast {
  background: var(--bg-highlight-yellow);
  border: 2px solid #cc9900;
  padding: 4px 12px;
  font-family: var(--font-marker);
  font-size: 14px;
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.3s ease;
}
.points-toast.visible { opacity: 1; transform: translateY(0); }
.points-toast-amount { color: #cc9900; font-weight: 900; }
.points-toast-reason { color: var(--text-dim); font-size: 12px; }

/* ── Powers Panel ──────────────────────────── */
.powers-panel { display: flex; flex-direction: column; gap: 8px; }
.powers-section-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  color: var(--text-faint); font-family: var(--font-marker);
  display: flex; align-items: center; gap: 4px;
  margin-bottom: 4px;
}
.powers-grid { display: flex; flex-wrap: wrap; gap: 4px; }

.power-btn {
  display: flex; align-items: center; gap: 4px;
  padding: 4px 8px;
  border: 2px solid var(--border);
  background: white;
  cursor: pointer;
  font-family: var(--font-scribble);
  font-size: 11px;
  transition: all 0.15s;
  flex-shrink: 0;
}
.power-btn:hover { border-color: var(--ink-blue); background: var(--bg-highlight-blue); }
.power-btn.power-btn-attack:hover { border-color: var(--ink-red); background: var(--bg-highlight-pink); }
.power-btn.disabled { opacity: 0.35; cursor: not-allowed; }
.power-btn.disabled:hover { border-color: var(--border); background: white; }
.power-icon { display: inline-flex; }
.power-name { font-weight: 600; white-space: nowrap; }
.power-cost {
  background: var(--bg-highlight-yellow);
  padding: 1px 4px;
  font-size: 10px;
  font-weight: 800;
  color: #cc9900;
  font-family: var(--font-marker);
  border: 1px solid #eebb00;
}

/* ── Attack Menu ───────────────────────────── */
.attack-menu {
  position: fixed; z-index: 300;
  background: white; border: 3px solid var(--ink-black);
  box-shadow: 6px 6px 0 rgba(0,0,0,0.15);
  min-width: 220px;
  animation: slideUp 0.15s ease;
}
.attack-menu-header {
  padding: 10px 14px;
  font-family: var(--font-marker);
  font-size: 14px;
  font-weight: 700;
  border-bottom: 2px solid var(--ink-black);
  background: var(--bg-highlight-pink);
  display: flex; align-items: center; gap: 6px;
}
.attack-menu-item {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 8px 14px;
  border: none; background: white;
  font-family: var(--font-scribble);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  border-bottom: 1px dashed var(--border);
  transition: background 0.1s;
}
.attack-menu-item:hover { background: var(--bg-highlight-yellow); }
.attack-menu-item.attack-random { background: var(--bg-highlight-pink); }
.attack-menu-item.attack-random:hover { background: #ffd6e0; }
.attack-menu-item.attack-cancel { color: var(--text-faint); }
.attack-menu-warning { font-size: 10px; color: var(--ink-red); font-family: var(--font-hand); margin-left: auto; }

/* ── Player Context Menu ───────────────────── */
.player-context-menu {
  position: fixed; z-index: 300;
  background: white; border: 3px solid var(--ink-black);
  box-shadow: 6px 6px 0 rgba(0,0,0,0.15);
  min-width: 200px;
  animation: slideUp 0.15s ease;
}
.context-menu-header {
  padding: 8px 14px; font-family: var(--font-marker);
  font-size: 13px; font-weight: 700;
  border-bottom: 2px solid var(--ink-black);
  background: var(--wiki-bg);
  display: flex; align-items: center; gap: 6px;
}
.context-menu-item {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 6px 14px;
  border: none; background: white;
  font-family: var(--font-scribble); font-size: 12px;
  cursor: pointer; text-align: left;
  border-bottom: 1px dashed var(--border);
  transition: background 0.1s;
}
.context-menu-item:hover { background: var(--bg-highlight-yellow); }
.context-menu-item.disabled { opacity: 0.35; cursor: not-allowed; }
.context-menu-cost { margin-left: auto; font-size: 11px; color: #cc9900; font-weight: 700; font-family: var(--font-marker); }

/* ── Power Overlays ────────────────────────── */
.power-overlay {
  position: fixed; inset: 0; z-index: 500;
  display: flex; align-items: center; justify-content: center;
}
.freeze-overlay {
  background: rgba(100, 200, 255, 0.3);
  backdrop-filter: blur(2px);
  cursor: none !important;
  pointer-events: all;
}
.freeze-text {
  text-align: center; color: #00aaff;
  font-family: var(--font-marker);
  font-size: 28px; font-weight: 900;
  text-shadow: 2px 2px 0 white;
  animation: pulse 1s infinite;
}
.blackout-overlay {
  background: rgba(0, 0, 0, 0.95);
}
.blackout-text {
  text-align: center; color: #ffffff;
  font-family: var(--font-marker);
  font-size: 32px; font-weight: 900;
  opacity: 0.5;
}

/* ── Effect Banners ────────────────────────── */
.effect-banner {
  position: fixed; top: 50px; left: 50%; transform: translateX(-50%) translateY(-20px);
  z-index: 400;
  padding: 10px 24px;
  font-family: var(--font-marker);
  font-size: 16px; font-weight: 900;
  border: 3px solid var(--ink-black);
  box-shadow: 4px 4px 0 rgba(0,0,0,0.15);
  opacity: 0;
  transition: all 0.3s ease;
}
.effect-banner.visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.effect-crazyFont { background: var(--bg-highlight-pink); color: var(--ink-pink); }
.effect-scramble { background: var(--bg-highlight-yellow); color: #886600; }
.effect-fog { background: #e0e8f0; color: #667788; }
.effect-freeze { background: #d0f0ff; color: #0088cc; }
.effect-blackout { background: #222; color: white; }
.effect-rewind { background: var(--bg-highlight-blue); color: var(--ink-blue); }

/* ── Spy / AI Modals ───────────────────────── */
.spy-modal {
  position: fixed; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 350;
  background: white;
  border: 3px solid var(--ink-black);
  box-shadow: 8px 8px 0 rgba(0,0,0,0.15);
  min-width: 300px; max-width: 420px;
  animation: slideUp 0.2s ease;
}
.spy-header {
  padding: 12px 16px;
  font-family: var(--font-marker);
  font-size: 15px; font-weight: 700;
  border-bottom: 2px solid var(--ink-black);
  background: var(--bg-highlight-blue);
  display: flex; align-items: center; gap: 6px;
}
.spy-list { padding: 8px 0; max-height: 300px; overflow-y: auto; }
.spy-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px;
  border-bottom: 1px dashed var(--border);
  font-size: 13px; font-family: var(--font-scribble);
}
.spy-name { font-weight: 700; min-width: 80px; }
.spy-page { flex: 1; color: var(--ink-blue); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spy-clicks { color: var(--text-faint); font-size: 11px; font-family: var(--font-marker); }
.spy-close { margin: 10px 16px; }

.ai-modal .spy-header { background: var(--bg-highlight-green); }
.ai-advice-text {
  padding: 16px;
  font-size: 14px;
  line-height: 1.6;
  font-family: var(--font-hand);
  color: var(--ink-black);
}

/* ── Search Bar ────────────────────────────── */
.power-search-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 16px;
  background: var(--bg-highlight-yellow);
  border-bottom: 2px solid #cc9900;
  z-index: 15;
}
.power-search-bar input { flex: 1; }

/* Results */
.result-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border: 2px solid var(--border);
  margin-bottom: 6px; background: white;
}
.result-rank {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 800; flex-shrink: 0;
  border: 2px solid var(--ink-black);
  font-family: var(--font-marker);
}
.result-rank.gold { background: var(--bg-highlight-yellow); color: #aa8800; }
.result-rank.silver { background: #eee; }
.result-rank.bronze { background: #f0dcc0; color: #886633; }
.result-rank.other { background: white; color: var(--text-dim); }
.result-info { flex: 1; }
.result-name { font-weight: 700; font-size: 15px; font-family: var(--font-scribble); }
.result-stats { font-size: 12px; color: var(--text-dim); font-family: var(--font-hand); }
.result-path-toggle { font-size: 12px; color: var(--ink-blue); cursor: pointer; background: none; border: none; font-family: var(--font-hand); font-weight: 600; padding: 4px 8px; font-size: 14px; }
.result-path { display: none; padding: 6px 14px 6px 56px; font-size: 12px; color: var(--text-faint); font-family: var(--font-hand); }
.result-path.visible { display: block; }
.results-xp-section { margin-top: 14px; padding-top: 14px; border-top: 2px dashed var(--border); }

.confetti { position: fixed; width: 10px; height: 10px; z-index: 1000; animation: confettiFall 3s ease-in forwards; }
@keyframes confettiFall { 0% { opacity: 1; transform: translateY(-100vh) rotate(0deg); } 100% { opacity: 0; transform: translateY(100vh) rotate(720deg); } }

/* ═══════════════════════════════════════════════════════
   TOAST & MISC
   ═══════════════════════════════════════════════════════ */

.toast {
  position: fixed; bottom: 24px; right: 24px;
  padding: 10px 18px; background: white;
  border: 2px solid var(--ink-black);
  font-size: 14px; color: var(--text); z-index: 9999;
  transform: translateY(100px); opacity: 0;
  transition: all 0.3s ease;
  box-shadow: 4px 4px 0 rgba(0,0,0,0.15);
  font-family: var(--font-scribble);
}
.toast.visible { transform: translateY(0); opacity: 1; }

.spinner {
  width: 24px; height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--ink-blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-text { font-size: 15px; color: var(--text-dim); font-family: var(--font-hand); }

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #f5f5f5; }
::-webkit-scrollbar-thumb { background: #ccc; }
::-webkit-scrollbar-thumb:hover { background: #aaa; }

/* ── Bottom Nav ──────────────────────────────────────── */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: center; gap: 24px;
  padding: 8px 20px;
  background: white;
  border-top: 3px solid var(--ink-black);
  z-index: 50;
}

.nav-item {
  display: flex; align-items: center; gap: 5px;
  padding: 5px 12px; color: var(--text-dim);
  font-size: 12px; font-weight: 600;
  cursor: pointer; border: none; background: none;
  font-family: var(--font-scribble);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.nav-item:hover { color: var(--ink-black); background: var(--bg-highlight-yellow); }
.nav-item-icon { display: inline-flex; }

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 768px) {
  .hero-title { font-size: 40px; }
  .game-sidebar { display: none; }
  .game-top-bar { flex-direction: column; gap: 6px; padding: 6px 10px; }
  .modal { min-width: unset; margin: 16px; }
  .bottom-nav { gap: 12px; }
}

.user-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: white; flex-shrink: 0;
  border: 2px solid var(--ink-black);
  overflow: hidden;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* Highlighted marker annotations */
.highlight-yellow { background: var(--bg-highlight-yellow); padding: 0 4px; }
.highlight-pink { background: var(--bg-highlight-pink); padding: 0 4px; }
.highlight-blue { background: var(--bg-highlight-blue); padding: 0 4px; }
.strikethrough { text-decoration: line-through; text-decoration-color: var(--ink-red); }

/* Glass card (used in lobby) */
.glass-card {
  background: var(--bg-card);
  border: 2px solid var(--ink-black);
  box-shadow: 4px 4px 0 rgba(0,0,0,0.1);
}

/* ── Debuff Bar (active effects) ────────────── */
.debuff-bar {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 4px 16px;
  background: #fff0f0;
  border-bottom: 2px solid var(--ink-red);
  z-index: 12;
}
.debuff-item {
  display: flex; align-items: center; gap: 4px;
  padding: 3px 8px;
  border: 1.5px solid var(--ink-red);
  background: white;
  font-family: var(--font-scribble);
  font-size: 11px;
  animation: pulse 2s infinite;
}
.debuff-icon { display: inline-flex; color: var(--ink-red); }
.debuff-name { font-weight: 700; color: var(--ink-red); }
.debuff-from { color: var(--text-faint); font-size: 10px; font-style: italic; }
.debuff-timer {
  background: var(--ink-red);
  color: white;
  padding: 1px 5px;
  font-size: 10px;
  font-weight: 900;
  font-family: var(--font-marker);
}
.debuff-cleanse {
  background: none;
  border: 1.5px solid var(--ink-red);
  color: var(--ink-red);
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  font-family: var(--font-marker);
  transition: all 0.2s;
}
.debuff-cleanse:hover {
  background: var(--ink-red);
  color: white;
  transform: scale(1.1);
}
.debuff-cleanse.disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ── Power Search Bar ──────────────────────── */
.power-search-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 16px;
  background: var(--bg-highlight-yellow);
  border-bottom: 2px solid #cc9900;
  z-index: 15;
}
.power-search-bar input { flex: 1; }

/* ── Power Overlays ────────────────────────── */
.power-overlay {
  position: fixed; inset: 0; z-index: 500;
  display: flex; align-items: center; justify-content: center;
}
.freeze-overlay {
  background: rgba(100, 200, 255, 0.3);
  backdrop-filter: blur(2px);
  cursor: none !important;
  pointer-events: all;
}
.freeze-text {
  text-align: center; color: #00aaff;
  font-family: var(--font-marker);
  font-size: 28px; font-weight: 900;
  text-shadow: 2px 2px 0 white;
  animation: pulse 1s infinite;
}

/* ── Effect Banners ────────────────────────── */
.effect-banner {
  position: fixed; top: 50px; left: 50%; transform: translateX(-50%) translateY(-20px);
  z-index: 400;
  padding: 10px 24px;
  font-family: var(--font-marker);
  font-size: 16px; font-weight: 900;
  border: 3px solid var(--ink-black);
  box-shadow: 4px 4px 0 rgba(0,0,0,0.15);
  opacity: 0;
  transition: all 0.3s ease;
}
.effect-banner.visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.effect-crazyFont { background: var(--bg-highlight-pink); color: var(--ink-pink); }
.effect-scramble { background: var(--bg-highlight-yellow); color: #886600; }
.effect-mirror { background: #e0e8f0; color: #5577aa; }
.effect-freeze { background: #d0f0ff; color: #0088cc; }
.effect-hideLinks { background: #333; color: #ff6600; }
.effect-rewind { background: var(--bg-highlight-blue); color: var(--ink-blue); }

/* ── Spy / AI Modals ───────────────────────── */
.spy-modal {
  position: fixed; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 350;
  background: white;
  border: 3px solid var(--ink-black);
  box-shadow: 8px 8px 0 rgba(0,0,0,0.15);
  min-width: 300px; max-width: 420px;
  animation: slideUp 0.2s ease;
}
.spy-header {
  padding: 12px 16px;
  font-family: var(--font-marker);
  font-size: 15px; font-weight: 700;
  border-bottom: 2px solid var(--ink-black);
  background: var(--bg-highlight-blue);
  display: flex; align-items: center; gap: 6px;
}
.spy-list { padding: 8px 0; max-height: 300px; overflow-y: auto; }
.spy-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px;
  border-bottom: 1px dashed var(--border);
  font-size: 13px; font-family: var(--font-scribble);
}
.spy-name { font-weight: 700; min-width: 80px; }
.spy-page { flex: 1; color: var(--ink-blue); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spy-clicks { color: var(--text-faint); font-size: 11px; font-family: var(--font-marker); }
.spy-close { margin: 10px 16px; }
.ai-modal .spy-header { background: var(--bg-highlight-green); }
.ai-advice-text {
  padding: 16px;
  font-size: 14px;
  line-height: 1.6;
  font-family: var(--font-hand);
  color: var(--ink-black);
}

.progress-powers-row { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.progress-power-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 6px; background: #fff0f0; border: 1px solid var(--ink-red); border-radius: 4px; font-size: 10px; color: var(--ink-red); font-weight: 700; font-family: var(--font-scribble); animation: debuff-pulse 1.5s infinite ease-in-out; }

/* Profile Edit */
.profile-name-row { display: flex; align-items: center; gap: 6px; justify-content: center; }
.profile-edit-btn { background: none; border: 1px solid var(--border); width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; cursor: pointer; border-radius: 50%; color: var(--text-faint); transition: all 0.15s; }
.profile-edit-btn:hover { border-color: var(--ink-blue); color: var(--ink-blue); background: var(--bg-highlight-blue); }
.profile-avatar-editable:hover .profile-avatar-overlay { opacity: 1; }
.profile-avatar-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.45); display: flex; align-items: center; justify-content: center; border-radius: 50%; opacity: 0; transition: opacity 0.2s; color: white; }

/* ═══════════════════════════════════════════════════════
   AD BANNER — Solo en lobby y pantalla de fin de partida
   ═══════════════════════════════════════════════════════ */

.ad-banner-wrap {
  position: relative;
  width: 100%;
  margin: 18px 0 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.ad-banner-label {
  font-family: var(--font-hand);
  font-size: 10px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  text-align: center;
  opacity: 0.7;
}

.ad-banner-inner {
  width: 100%;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--wiki-bg);
  border: 2px dashed var(--border);
  overflow: hidden;
  padding: 2px;
  position: relative;
}

/* Tape decoration on top */
.ad-banner-inner::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 50%;
  width: 48px;
  height: 16px;
  background: rgba(255,255,0,0.45);
  border: 1px solid rgba(200,180,0,0.3);
  transform: translateX(-50%) rotate(-1deg);
  z-index: 1;
  pointer-events: none;
}

/* Variant used inside modals (results / victory) */
.ad-banner-wrap.ad-modal {
  margin: 16px 0 0;
  border-top: 1px dashed var(--border);
  padding-top: 16px;
}

.ad-banner-wrap.ad-modal .ad-banner-inner {
  min-height: 80px;
}

/* ── Floating Side Ads (Skyscrapers) ─────────────────── */
.side-ad-wrap {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 160px;
  z-index: 900;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.side-ad-wrap.right { right: 20px; }
.side-ad-wrap.left { left: 20px; }

.side-ad-label {
  font-size: 10px;
  color: var(--text-faint);
  text-transform: uppercase;
  margin-bottom: 4px;
  font-family: var(--font-scribble);
  letter-spacing: 1px;
}

.side-ad-inner {
  width: 160px;
  min-height: 600px;
  background: var(--bg-card);
  border: 2px dashed var(--border);
  display: flex;
  justify-content: center;
  align-items: center;
}

@media (max-width: 1360px) {
  .side-ad-wrap { display: none !important; }
}

