/* ═══════════════════════════════════════════════════
   SHEER LUCK DETECTIVE GAMES - Detective Noir Theme
   ═══════════════════════════════════════════════════ */

:root {
  --bg-darkest: #06060f;
  --bg-dark: #0a0a1a;
  --bg-card: #12122a;
  --bg-card-hover: #1a1a3a;
  --bg-surface: #161630;
  --border: #2a2a50;
  --border-light: #3a3a60;
  --gold: #d4a574;
  --gold-bright: #f0c878;
  --gold-dim: #a07848;
  --red: #8b2020;
  --red-bright: #c43030;
  --green: #2a7a3a;
  --green-bright: #3ab54a;
  --text-primary: #e8e0d4;
  --text-secondary: #9a8c7a;
  --text-muted: #5a5470;
  --parchment: #f4e8c1;
  --parchment-dark: #d4c8a1;
  --shadow: 0 4px 24px rgba(0,0,0,0.5);
  --shadow-gold: 0 0 20px rgba(212,165,116,0.15);
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-typewriter: 'Special Elite', 'Courier New', monospace;
  --radius: 8px;
  --radius-lg: 16px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg-darkest);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(212,165,116,0.03) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(139,32,32,0.03) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

a { color: var(--gold); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--gold-bright); }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-darkest); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold-dim); }

/* ═══ NAVBAR ═══ */
#navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: rgba(6,6,15,0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 1000;
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--gold) !important;
  letter-spacing: 0.5px;
}

.logo-icon { font-size: 1.6rem; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-links a, .nav-links button {
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.2s;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
}

.nav-links a:hover, .nav-links button:hover {
  color: var(--text-primary);
  background: rgba(212,165,116,0.1);
}

.nav-links a.active {
  color: var(--gold);
  background: rgba(212,165,116,0.1);
}

.nav-links .btn-nav-primary {
  background: var(--gold);
  color: var(--bg-darkest);
  font-weight: 600;
}

.nav-links .btn-nav-primary:hover {
  background: var(--gold-bright);
  color: var(--bg-darkest);
}

.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}

.hamburger span {
  width: 24px;
  height: 2px;
  background: var(--gold);
  transition: all 0.3s;
}

/* ═══ MAIN CONTENT ═══ */
#app {
  min-height: calc(100vh - 64px - 80px);
  padding-top: 64px;
  position: relative;
  z-index: 1;
}

/* ═══ FOOTER ═══ */
#footer {
  border-top: 1px solid var(--border);
  padding: 24px;
  text-align: center;
  position: relative;
  z-index: 1;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.footer-tagline {
  font-family: var(--font-typewriter);
  color: var(--gold-dim);
  margin-top: 4px;
  font-size: 0.8rem;
}

/* ═══ BUTTONS ═══ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s;
  line-height: 1;
}

.btn-primary {
  background: linear-gradient(135deg, var(--gold), var(--gold-dim));
  color: var(--bg-darkest);
  box-shadow: 0 2px 12px rgba(212,165,116,0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--gold-bright), var(--gold));
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(212,165,116,0.4);
}

.btn-secondary {
  background: transparent;
  color: var(--gold);
  border: 1px solid var(--gold-dim);
}

.btn-secondary:hover {
  background: rgba(212,165,116,0.1);
  border-color: var(--gold);
}

.btn-danger {
  background: var(--red);
  color: white;
}

.btn-danger:hover {
  background: var(--red-bright);
}

.btn-sm { padding: 8px 16px; font-size: 0.85rem; }
.btn-lg { padding: 16px 36px; font-size: 1.1rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }
.filter-btn { background: var(--clr-surface-alt, #1a1a2e); border: 1px solid var(--clr-border, #333); color: var(--text-muted); }
.filter-btn:hover { border-color: var(--gold); color: var(--gold); }
.filter-btn.active { background: var(--gold); color: #000; border-color: var(--gold); font-weight: 600; }

/* ═══ FORMS ═══ */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: var(--font-body);
  transition: border-color 0.2s;
}

.form-input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212,165,116,0.15);
}

textarea.form-input { resize: vertical; min-height: 100px; }
select.form-input { cursor: pointer; }

.form-error { color: var(--red-bright); font-size: 0.85rem; margin-top: 4px; }

/* ═══ CARDS ═══ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all 0.3s;
}

.card:hover {
  border-color: var(--gold-dim);
  box-shadow: var(--shadow-gold);
  transform: translateY(-2px);
}

.card-body { padding: 24px; }

/* ═══ HERO SECTION ═══ */
.hero {
  padding: 80px 24px;
  text-align: center;
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(180deg, transparent 0%, var(--bg-darkest) 100%),
    radial-gradient(ellipse at center top, rgba(212,165,116,0.08) 0%, transparent 60%);
}

.hero::before {
  content: '';
  position: absolute;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(212,165,116,0.1) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 900;
  color: var(--gold);
  line-height: 1.1;
  margin-bottom: 16px;
  text-shadow: 0 2px 20px rgba(212,165,116,0.3);
}

.hero-subtitle {
  font-family: var(--font-typewriter);
  font-size: clamp(1rem, 2.5vw, 1.3rem);
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 40px;
  line-height: 1.6;
}

.hero-cta { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }

/* Crime scene tape decoration */
.tape {
  position: relative;
  left: 50%;
  width: 110vw;
  transform: translateX(-50%) rotate(-2deg);
  z-index: 2;
  margin: 28px 0;
  filter: drop-shadow(0 6px 20px rgba(0,0,0,0.7));
  pointer-events: none;
  user-select: none;
}

.tape-inner {
  position: relative;
  background: #FFD700;
  padding: 11px 0;
  font-family: 'Arial Black', Impact, Arial, sans-serif;
  font-size: clamp(12px, 1.6vw, 20px);
  font-weight: 900;
  color: #000;
  letter-spacing: 0.1em;
  white-space: nowrap;
  overflow: hidden;
  text-align: center;
}

.tape-inner::before,
.tape-inner::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 8px;
  background: repeating-linear-gradient(
    -45deg,
    #000 0,
    #000 6px,
    #FFD700 6px,
    #FFD700 12px
  );
}

.tape-inner::before { top: 0; }
.tape-inner::after  { bottom: 0; }

/* ═══ FEATURES SECTION ═══ */
.features {
  padding: 80px 24px;
  max-width: 1200px;
  margin: 0 auto;
}

.features-title {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--gold);
  text-align: center;
  margin-bottom: 48px;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.feature-card {
  text-align: center;
  padding: 32px 24px;
}

.feature-icon {
  font-size: 2.5rem;
  margin-bottom: 16px;
  display: block;
}

.feature-card h3 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--gold);
  margin-bottom: 8px;
}

.feature-card p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
}

/* ═══ GAMES CATALOG ═══ */
.page-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 24px;
}

.page-title {
  font-family: var(--font-display);
  font-size: 2.2rem;
  color: var(--gold);
  margin-bottom: 8px;
}

.page-subtitle {
  color: var(--text-secondary);
  margin-bottom: 32px;
  font-size: 1rem;
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

.game-card {
  cursor: pointer;
}

.game-card-cover {
  height: 200px;
  background: linear-gradient(135deg, var(--bg-surface), var(--bg-card));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  position: relative;
  overflow: hidden;
}

.game-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.game-card-cover .placeholder-icon {
  opacity: 0.3;
  font-size: 5rem;
}

.game-card-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--gold);
  color: var(--bg-darkest);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
}

.game-card-body { padding: 20px; }

.game-card-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.game-card-tagline {
  font-family: var(--font-typewriter);
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 12px;
}

.game-card-meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.game-meta-item {
  font-size: 0.8rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.game-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.game-price {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--gold-bright);
}

/* ═══ GAME DETAIL ═══ */
.game-detail {
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 24px;
}

.game-detail-header {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  margin-bottom: 40px;
}

.game-detail-cover {
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-card);
  aspect-ratio: 16/10;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 6rem;
  border: 1px solid var(--border);
}

.game-detail-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.game-detail-info h1 {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--gold);
  margin-bottom: 8px;
}

.game-detail-tagline {
  font-family: var(--font-typewriter);
  color: var(--text-secondary);
  font-size: 1rem;
  margin-bottom: 20px;
}

.game-detail-meta {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
}

.game-detail-meta .meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.game-detail-meta .meta-row span:first-child { font-size: 1.1rem; }

.game-detail-price {
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--gold-bright);
  margin-bottom: 20px;
}

.game-detail-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.game-detail-description {
  font-size: 1rem;
  color: var(--text-secondary);
  line-height: 1.8;
  border-top: 1px solid var(--border);
  padding-top: 32px;
}

.game-detail-description h2 {
  font-family: var(--font-display);
  color: var(--gold);
  font-size: 1.4rem;
  margin-bottom: 16px;
}

/* ═══ AUTH PAGES ═══ */
.auth-container {
  max-width: 440px;
  margin: 60px auto;
  padding: 0 24px;
}

.auth-card {
  padding: 40px 32px;
}

.auth-card h2 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  color: var(--gold);
  text-align: center;
  margin-bottom: 8px;
}

.auth-card .auth-subtitle {
  text-align: center;
  color: var(--text-secondary);
  margin-bottom: 28px;
  font-size: 0.9rem;
}

.auth-footer {
  text-align: center;
  margin-top: 20px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* ═══ GAMEPLAY PAGE ═══ */
.gameplay-container {
  display: grid;
  grid-template-columns: 300px 1fr 320px;
  height: calc(100vh - 64px);
  overflow: hidden;
}

.gameplay-sidebar {
  background: var(--bg-dark);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.gameplay-sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
}

.gameplay-sidebar-header h2 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--gold);
  margin-bottom: 4px;
}

.gameplay-sidebar-header p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.clue-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.clue-item {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 6px;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
}

.clue-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--border);
}

.clue-item.active {
  background: var(--bg-card);
  border-color: var(--gold-dim);
}

.clue-item.unread .read-indicator {
  color: var(--gold);
  font-size: 0.6rem;
}

.clue-item.read {
  opacity: 0.7;
}

.clue-item.read .read-indicator {
  color: var(--gold-dim);
  font-size: 0.75rem;
}

.clue-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}

.clue-viewers {
  display: inline-flex;
  gap: 4px;
  margin-left: auto;
}

.viewer-badge {
  font-size: 0.65rem;
  background: var(--gold-dim);
  color: var(--bg-dark);
  padding: 1px 6px;
  border-radius: 8px;
  font-weight: 600;
  max-width: 60px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.clue-title {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.clue-category {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.gameplay-main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-darkest);
}

.gameplay-main-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-dark);
}

.gameplay-main-header h1 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--gold);
}

.gameplay-document {
  flex: 1;
  overflow-y: auto;
  padding: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.doc-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  max-width: 700px;
  width: 100%;
}

.doc-tab {
  padding: 6px 14px;
  border-radius: var(--radius);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font-body);
}

.doc-tab:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.doc-tab.active {
  background: var(--gold-dim);
  color: var(--bg-dark);
  border-color: var(--gold-dim);
  font-weight: 600;
}

#doc-tab-content {
  width: 100%;
  display: flex;
  justify-content: center;
}

.document-paper {
  max-width: 700px;
  width: 100%;
  background: var(--parchment);
  color: #2a2218;
  padding: 48px 40px;
  border-radius: 4px;
  font-family: var(--font-typewriter);
  font-size: 1rem;
  line-height: 1.8;
  box-shadow: var(--shadow);
  position: relative;
  min-height: 400px;
  word-break: break-word;
  overflow-wrap: break-word;
}

.document-paper.paper-landscape {
  max-width: 960px;
  min-height: 280px;
  aspect-ratio: 1.414 / 1;
}

.document-paper::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    linear-gradient(180deg, rgba(180,160,120,0.1) 0%, transparent 20%, transparent 80%, rgba(180,160,120,0.15) 100%);
  pointer-events: none;
  border-radius: 4px;
}

.document-paper h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: #1a1208;
  margin-bottom: 20px;
  text-align: center;
  border-bottom: 2px solid rgba(42,34,24,0.2);
  padding-bottom: 12px;
}

.document-paper .stamp {
  color: var(--red);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 2px;
  margin-bottom: 16px;
  display: block;
}

.document-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  text-align: center;
  padding: 40px;
}

.document-empty .empty-icon { font-size: 4rem; opacity: 0.3; margin-bottom: 16px; }

/* ═══ CHAT PANEL ═══ */
.chat-panel {
  background: var(--bg-dark);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-header h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--gold);
}

.players-list {
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.player-badge {
  background: var(--bg-card);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.player-badge.online {
  border-color: var(--green);
  color: var(--green-bright);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-message {
  max-width: 90%;
  padding: 8px 14px;
  border-radius: 12px;
  font-size: 0.9rem;
}

.chat-message.mine {
  align-self: flex-end;
  background: rgba(212,165,116,0.15);
  border: 1px solid var(--gold-dim);
  color: var(--text-primary);
}

.chat-message.other {
  align-self: flex-start;
  background: var(--bg-card);
  border: 1px solid var(--border);
}

.chat-message .chat-author {
  font-size: 0.75rem;
  color: var(--gold);
  font-weight: 600;
  margin-bottom: 2px;
}

.chat-message .chat-time {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.chat-message.system-msg {
  align-self: center;
  background: rgba(212,165,116,0.08);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-style: italic;
  border: none;
  max-width: 100%;
  text-align: center;
}

.chat-input-area {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
}

.chat-input-area input {
  flex: 1;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: var(--font-body);
}

.chat-input-area input:focus {
  outline: none;
  border-color: var(--gold);
}

.chat-input-area button {
  padding: 10px 16px;
  background: var(--gold);
  color: var(--bg-darkest);
  border: none;
  border-radius: 20px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.2s;
}

.chat-input-area button:hover { background: var(--gold-bright); }

/* ═══ INVITE MODAL ═══ */
.invite-code-display {
  text-align: center;
  padding: 20px;
}

.invite-code {
  font-family: var(--font-typewriter);
  font-size: 2rem;
  color: var(--gold-bright);
  letter-spacing: 6px;
  background: var(--bg-dark);
  padding: 16px 32px;
  border-radius: var(--radius);
  border: 2px dashed var(--gold-dim);
  display: inline-block;
  margin: 16px 0;
  cursor: pointer;
}

.invite-code:hover { border-color: var(--gold); }

/* ═══ SOLVE SECTION ═══ */
.solve-section {
  padding: 16px;
  padding-bottom: 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-dark);
  flex-shrink: 0;
}

.solve-section h3 {
  font-family: var(--font-display);
  color: var(--gold);
  margin-bottom: 12px;
  font-size: 1rem;
}

.solve-form {
  display: flex;
  gap: 8px;
  min-width: 0;
}

.solve-form button {
  white-space: nowrap;
  flex-shrink: 0;
}

/* Back button in document viewer - hidden on desktop */
.mobile-back-btn {
  display: none;
}

.solve-form input {
  flex: 1;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-family: var(--font-body);
}

.solve-form input:focus {
  outline: none;
  border-color: var(--gold);
}

.solve-result {
  margin-top: 12px;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 0.9rem;
}

.solve-result.correct {
  background: rgba(42,122,58,0.2);
  border: 1px solid var(--green);
  color: var(--green-bright);
}

.solve-result.incorrect {
  background: rgba(139,32,32,0.2);
  border: 1px solid var(--red);
  color: var(--red-bright);
}

/* ═══ ADMIN PANEL ═══ */
.admin-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 24px;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  padding: 24px;
  text-align: center;
}

.stat-card .stat-value {
  font-family: var(--font-display);
  font-size: 2.2rem;
  color: var(--gold-bright);
  font-weight: 700;
}

.stat-card .stat-label {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-top: 4px;
}

.admin-section {
  margin-bottom: 40px;
}

.admin-section h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--gold);
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
}

.admin-table th, .admin-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.admin-table th {
  background: var(--bg-surface);
  color: var(--gold);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.admin-table td { color: var(--text-secondary); }

.admin-table tr:hover td { background: rgba(212,165,116,0.03); }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-success { background: rgba(42,122,58,0.2); color: var(--green-bright); }
.badge-warning { background: rgba(212,165,116,0.2); color: var(--gold); }
.badge-danger { background: rgba(139,32,32,0.2); color: var(--red-bright); }

/* ═══ MODAL ═══ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-overlay.hidden { display: none; }

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 560px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
}

.modal-content h2 {
  font-family: var(--font-display);
  color: var(--gold);
  margin-bottom: 20px;
  font-size: 1.4rem;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px;
}

.modal-close:hover { color: var(--text-primary); }

/* ═══ TOAST ═══ */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 14px 20px;
  border-radius: var(--radius);
  color: white;
  font-size: 0.9rem;
  animation: toast-in 0.3s ease;
  min-width: 260px;
  box-shadow: var(--shadow);
}

.toast-success { background: var(--green); }
.toast-error { background: var(--red); }
.toast-info { background: var(--bg-card); border: 1px solid var(--border); color: var(--text-primary); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ═══ LOADING ═══ */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px;
  color: var(--text-muted);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 12px;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ═══ MY LIBRARY ═══ */
.library-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}

.library-tab {
  padding: 12px 20px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.2s;
}

.library-tab.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

.library-tab:hover { color: var(--text-primary); }

.session-card {
  padding: 16px 20px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.session-card .session-info h3 {
  font-size: 1rem;
  color: var(--text-primary);
}

.session-card .session-info p {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ═══ MOBILE GAMEPLAY TABS ═══ */
.mobile-tabs {
  display: none;
  background: var(--bg-dark);
  border-top: 1px solid var(--border);
}

.mobile-tabs button {
  flex: 1;
  padding: 12px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.85rem;
  cursor: pointer;
  border-top: 2px solid transparent;
}

.mobile-tabs button.active {
  color: var(--gold);
  border-top-color: var(--gold);
  background: rgba(212,165,116,0.05);
}

/* ═══ RESPONSIVE ═══ */
@media (max-width: 1024px) {
  .game-detail-header {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .hamburger { display: flex; }

  .nav-links {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: rgba(6,6,15,0.98);
    flex-direction: column;
    padding: 16px;
    border-bottom: 1px solid var(--border);
    gap: 4px;
  }

  .nav-links.open { display: flex; }

  .hero { padding: 50px 20px; }

  .games-grid {
    grid-template-columns: 1fr;
  }

  .gameplay-container {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
    height: calc(100vh - 64px - 52px);
    overflow: hidden;
    position: relative;
  }

  .gameplay-sidebar,
  .gameplay-main,
  .chat-panel {
    display: none;
  }

  .gameplay-sidebar.mobile-active,
  .gameplay-main.mobile-active,
  .chat-panel.mobile-active {
    display: flex !important;
    height: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .gameplay-sidebar.mobile-active {
    padding-bottom: 0;
  }

  .mobile-tabs {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--bg-dark);
    border-top: 1px solid var(--border);
    box-shadow: 0 -2px 10px rgba(0,0,0,0.5);
  }

  .mobile-back-btn {
    display: inline-block !important;
    margin-bottom: 8px;
  }

  /* Hide footer during gameplay on mobile */
  .gameplay-container ~ .mobile-tabs ~ footer,
  body:has(.gameplay-container) footer {
    display: none !important;
  }

  .solve-section {
    padding: 12px;
  }

  .solve-form {
    flex-direction: column;
  }

  .solve-form button {
    width: 100%;
  }

  .game-detail-header {
    grid-template-columns: 1fr;
  }

  .admin-table { font-size: 0.8rem; }
  .admin-table th, .admin-table td { padding: 8px 10px; }
  .admin-stats { grid-template-columns: repeat(2, 1fr); }

  .auth-card { padding: 28px 20px; }
}

@media (max-width: 480px) {
  .hero-title { font-size: 2rem; }
  .hero-cta { flex-direction: column; align-items: center; }
  .features-grid { grid-template-columns: 1fr; }
  .admin-stats { grid-template-columns: 1fr; }
}

/* ═══ PAPER STYLES ═══ */
.document-paper { position: relative; overflow: hidden; }

.paper-clean { /* default — no extra styles */ }

.paper-aged {
  background: #e8d8a8;
  background-image:
    radial-gradient(ellipse at 20% 80%, rgba(139,100,50,0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 85% 20%, rgba(139,100,50,0.1) 0%, transparent 40%),
    radial-gradient(ellipse at 50% 50%, rgba(100,80,40,0.05) 0%, transparent 70%);
}
.paper-aged::before {
  background: linear-gradient(180deg, rgba(120,90,40,0.15) 0%, transparent 15%, transparent 85%, rgba(120,90,40,0.2) 100%) !important;
}

.paper-crumpled {
  background-color: var(--parchment);
  background-image:
    linear-gradient(135deg, rgba(0,0,0,0.03) 25%, transparent 25%),
    linear-gradient(225deg, rgba(0,0,0,0.03) 25%, transparent 25%),
    linear-gradient(45deg, rgba(0,0,0,0.02) 25%, transparent 25%),
    linear-gradient(315deg, rgba(0,0,0,0.04) 25%, transparent 25%),
    radial-gradient(ellipse at 30% 60%, rgba(0,0,0,0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 30%, rgba(0,0,0,0.03) 0%, transparent 40%);
  box-shadow: inset 0 0 60px rgba(0,0,0,0.08);
}

.paper-official {
  background: #fff;
  border: 3px double #2a4a7a;
  padding: 56px 48px !important;
  color: #1a1a2a;
  font-family: var(--font-body) !important;
}
.paper-official::before {
  background: linear-gradient(180deg, rgba(42,74,122,0.06) 0%, transparent 10%, transparent 90%, rgba(42,74,122,0.04) 100%) !important;
}
.paper-official h2 { color: #1a2a4a !important; }

.paper-notebook {
  background: #fff;
  background-image:
    repeating-linear-gradient(transparent, transparent 31px, #c8d8e8 31px, #c8d8e8 32px);
  background-position: 0 16px;
  border-left: 4px solid #e84040;
  padding-left: 48px !important;
  font-family: var(--font-body) !important;
  line-height: 32px !important;
  color: #2a2a3a;
}
.paper-notebook::before { display: none !important; }

.paper-evidence-bag {
  background: rgba(220,230,240,0.6);
  border: 2px solid rgba(180,190,200,0.5);
  backdrop-filter: blur(1px);
  padding-top: 72px !important;
  position: relative;
}
.paper-evidence-bag::after {
  content: 'EVIDENCE';
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: #c83030;
  color: white;
  padding: 4px 24px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 3px;
  border-radius: 2px;
}

/* ── Extended Paper Styles ── */

.paper-parchment {
  background: #c9a96a;
  background-image:
    radial-gradient(ellipse at 7% 7%, rgba(80,50,15,0.45) 0%, transparent 35%),
    radial-gradient(ellipse at 93% 5%, rgba(70,40,10,0.4) 0%, transparent 28%),
    radial-gradient(ellipse at 96% 95%, rgba(80,55,15,0.45) 0%, transparent 35%),
    radial-gradient(ellipse at 4% 93%, rgba(70,45,10,0.4) 0%, transparent 28%),
    radial-gradient(ellipse at 50% 50%, rgba(150,110,55,0.08) 0%, transparent 70%);
  color: #2a1a06;
  box-shadow: inset 0 0 100px rgba(60,30,10,0.3), var(--shadow);
}
.paper-parchment::before {
  background: linear-gradient(135deg, rgba(180,130,55,0.2) 0%, transparent 40%, transparent 60%, rgba(180,130,55,0.15) 100%) !important;
}

.paper-typewriter {
  background: #f6f2ea;
  font-family: 'Courier New', Courier, monospace !important;
  color: #1a1a1a;
  background-image:
    repeating-linear-gradient(transparent, transparent 27px, rgba(0,0,0,0.04) 27px, rgba(0,0,0,0.04) 28px);
  background-position: 0 8px;
}
.paper-typewriter::before {
  background: linear-gradient(180deg, rgba(0,0,0,0.02) 0%, transparent 8%, transparent 92%, rgba(0,0,0,0.03) 100%) !important;
}

.paper-newspaper {
  background: #dad6c9;
  font-family: 'Times New Roman', Times, serif !important;
  color: #1a1a1a;
  border: 1px solid rgba(0,0,0,0.12);
  background-image:
    radial-gradient(ellipse at 50% 0%, rgba(0,0,0,0.07) 0%, transparent 55%),
    radial-gradient(ellipse at 50% 100%, rgba(0,0,0,0.05) 0%, transparent 45%);
}
.paper-newspaper::before { background: none !important; }
.paper-newspaper h2 {
  font-family: 'Times New Roman', Times, serif !important;
  border-bottom: 2px double rgba(0,0,0,0.4) !important;
  text-align: center !important;
}

.paper-police-report {
  background: #fffce4;
  border: 1px solid #b8a838;
  padding-top: 64px !important;
  font-family: var(--font-body) !important;
  color: #1a1a1a;
  background-image:
    linear-gradient(180deg, rgba(32,60,160,1) 0px, rgba(32,60,160,1) 52px, transparent 52px),
    repeating-linear-gradient(transparent, transparent 27px, rgba(0,0,0,0.06) 27px, rgba(0,0,0,0.06) 28px);
  background-position: 0 0, 0 64px;
}
.paper-police-report::before { display: none !important; }
.paper-police-report::after {
  content: 'POLICE REPORT';
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  color: white;
  font-family: var(--font-body);
  font-weight: 900;
  font-size: 0.9rem;
  letter-spacing: 4px;
  white-space: nowrap;
  z-index: 2;
}

.paper-graph {
  background: #ffffff;
  background-image:
    linear-gradient(rgba(90,130,190,0.22) 1px, transparent 1px),
    linear-gradient(90deg, rgba(90,130,190,0.22) 1px, transparent 1px),
    linear-gradient(rgba(90,130,190,0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(90,130,190,0.07) 1px, transparent 1px);
  background-size: 80px 80px, 80px 80px, 16px 16px, 16px 16px;
  color: #1a1a2a;
  font-family: var(--font-body) !important;
}
.paper-graph::before { background: none !important; }

.paper-blueprint {
  background: #162038;
  background-image:
    linear-gradient(rgba(100,165,225,0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(100,165,225,0.18) 1px, transparent 1px),
    linear-gradient(rgba(100,165,225,0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(100,165,225,0.06) 1px, transparent 1px);
  background-size: 80px 80px, 80px 80px, 16px 16px, 16px 16px;
  color: #9fcfe8;
  font-family: var(--font-body) !important;
  border: 2px solid rgba(100,165,225,0.25);
}
.paper-blueprint::before {
  background: radial-gradient(ellipse at 50% 50%, rgba(50,90,150,0.25) 0%, transparent 80%) !important;
}
.paper-blueprint h2 { color: #c0e4f8 !important; border-bottom-color: rgba(100,165,225,0.35) !important; }

.paper-telegram {
  background: #f0e898;
  border: 3px solid #c0a818;
  padding-top: 72px !important;
  font-family: 'Courier New', Courier, monospace !important;
  color: #2a1a06;
  background-image:
    linear-gradient(180deg, rgba(180,138,18,0.85) 0px, rgba(180,138,18,0.85) 60px, transparent 60px),
    radial-gradient(ellipse at 10% 90%, rgba(100,80,18,0.14) 0%, transparent 40%),
    radial-gradient(ellipse at 90% 10%, rgba(100,80,18,0.1) 0%, transparent 30%);
}
.paper-telegram::before { display: none !important; }
.paper-telegram::after {
  content: '✦ TELEGRAM ✦';
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  color: #f8f0d0;
  font-family: var(--font-body);
  font-weight: 900;
  font-size: 1rem;
  letter-spacing: 6px;
  white-space: nowrap;
  z-index: 2;
}

.paper-forensic-lab {
  background: #f6fff6;
  border: 1px solid #5a9a5a;
  padding-top: 64px !important;
  font-family: 'Courier New', Courier, monospace !important;
  color: #1a2a1a;
  font-size: 0.9rem !important;
  background-image:
    linear-gradient(180deg, rgba(42,100,42,0.88) 0px, rgba(42,100,42,0.88) 52px, transparent 52px),
    repeating-linear-gradient(transparent, transparent 27px, rgba(0,100,0,0.05) 27px, rgba(0,100,0,0.05) 28px);
  background-position: 0 0, 0 64px;
}
.paper-forensic-lab::before { display: none !important; }
.paper-forensic-lab::after {
  content: 'FORENSIC ANALYSIS REPORT';
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  color: white;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 3px;
  white-space: nowrap;
  z-index: 2;
}

.paper-court-doc {
  background: #faf5ea;
  border: 1px solid #c0a868;
  padding-top: 64px !important;
  font-family: 'Times New Roman', Times, serif !important;
  color: #1a1208;
  background-image:
    linear-gradient(180deg, rgba(138,24,24,0.88) 0px, rgba(138,24,24,0.88) 52px, transparent 52px);
}
.paper-court-doc::before { display: none !important; }
.paper-court-doc::after {
  content: 'COURT OF LAW — OFFICIAL RECORD';
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  color: #f8e8c8;
  font-family: 'Times New Roman', Times, serif;
  font-style: italic;
  font-size: 0.76rem;
  letter-spacing: 2px;
  white-space: nowrap;
  z-index: 2;
}
.paper-court-doc h2 { font-family: 'Times New Roman', Times, serif !important; }

.paper-journal {
  background: #d2b48a;
  background-image:
    radial-gradient(ellipse at 50% 0%, rgba(80,48,18,0.2) 0%, transparent 40%),
    radial-gradient(ellipse at 50% 100%, rgba(60,33,10,0.25) 0%, transparent 40%);
  border-left: 18px solid #6a3818;
  padding-left: 44px !important;
  font-family: var(--font-typewriter) !important;
  color: #2a1806;
  box-shadow: -4px 0 14px rgba(0,0,0,0.3), var(--shadow);
}
.paper-journal::before {
  background: linear-gradient(90deg, rgba(80,38,10,0.14) 0%, transparent 20%, transparent 80%, rgba(80,38,10,0.1) 100%) !important;
}

/* ═══ DECORATIONS ═══ */
.decoration {
  position: absolute;
  pointer-events: none;
  z-index: 5;
}

/* Admin interactive decorations */
.decoration.interactive {
  pointer-events: auto;
  cursor: grab;
}
.decoration.interactive { min-width: 40px; min-height: 30px; }
.decoration.interactive:active { cursor: grabbing; }
.decoration.interactive.selected {
  outline: 2px dashed var(--gold);
  outline-offset: 4px;
  clip-path: none !important;
}

.decoration-handles {
  position: absolute;
  top: -24px;
  left: 50%;
  transform: translateX(-50%);
  display: none;
  gap: 4px;
  z-index: 10;
}

.decoration.selected .decoration-handles { display: flex; }

.decoration-handles button {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  width: 22px;
  height: 22px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.decoration-handles button:hover { background: var(--gold); color: var(--bg-darkest); }

.resize-handle {
  position: absolute;
  bottom: -6px;
  right: -6px;
  width: 12px;
  height: 12px;
  background: var(--gold);
  border: 1px solid var(--bg-darkest);
  border-radius: 2px;
  cursor: nwse-resize;
  display: none;
  z-index: 11;
}
.decoration.selected .resize-handle { display: block; }

/* ── Decoration Types ── */
.deco-coffee-stain {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background:
    radial-gradient(ellipse at 48% 52%, transparent 28%, rgba(110,65,18,0.08) 30%, rgba(110,65,18,0.28) 36%, rgba(110,65,18,0.35) 42%, rgba(110,65,18,0.18) 50%, rgba(110,65,18,0.06) 58%, transparent 65%),
    radial-gradient(ellipse at 55% 46%, transparent 32%, rgba(90,50,10,0.12) 38%, transparent 48%);
  filter: blur(0.5px);
}

.deco-water-damage {
  width: 130px;
  height: 100px;
  background:
    radial-gradient(ellipse at 38% 48%, rgba(140,130,100,0.28) 0%, rgba(140,130,100,0.12) 35%, transparent 62%),
    radial-gradient(ellipse at 62% 55%, rgba(150,140,110,0.18) 0%, transparent 45%),
    radial-gradient(ellipse at 45% 42%, rgba(160,145,100,0.08) 0%, transparent 55%);
  border-radius: 48% 42% 56% 44% / 44% 52% 48% 56%;
  filter: blur(1px);
}

.deco-tape {
  width: 148px;
  height: 30px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.15) 0%, transparent 25%, transparent 75%, rgba(0,0,0,0.06) 100%),
    rgba(220,210,160,0.5);
  border-top: 1px solid rgba(200,190,140,0.3);
  border-bottom: 1px solid rgba(180,170,120,0.35);
  filter: blur(0.3px);
}

.deco-pin {
  width: 26px;
  height: 26px;
  background:
    radial-gradient(circle at 45% 35%, rgba(255,255,255,0.4) 0%, transparent 35%),
    radial-gradient(circle at 50% 45%, #e84040 0%, #c02828 45%, #8a1212 80%, #601010 100%);
  border-radius: 50%;
  box-shadow: 0 3px 6px rgba(0,0,0,0.45), inset 0 -2px 4px rgba(0,0,0,0.35), inset 0 1px 3px rgba(255,200,200,0.35);
}
.deco-pin::after {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 2px;
  height: 12px;
  background: linear-gradient(180deg, #777 0%, #aaa 50%, #999 100%);
  box-shadow: 1px 1px 2px rgba(0,0,0,0.25);
}

.deco-stamp-confidential,
.deco-stamp-topsecret,
.deco-stamp-evidence {
  padding: 7px 20px;
  border: 3px solid;
  font-family: var(--font-body);
  font-weight: 900;
  font-size: 1rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  border-radius: 4px;
  white-space: nowrap;
  background-image: url("data:image/svg+xml,%3Csvg width='100' height='40' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='0.8' numOctaves='4' seed='2'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100' height='40' filter='url(%23n)' opacity='0.06'/%3E%3C/svg%3E");
}

.deco-stamp-confidential {
  color: rgba(190,35,35,0.72);
  border-color: rgba(190,35,35,0.65);
}
.deco-stamp-confidential::after { content: 'CONFIDENTIAL'; }

.deco-stamp-topsecret {
  color: rgba(190,35,35,0.72);
  border-color: rgba(190,35,35,0.65);
}
.deco-stamp-topsecret::after { content: 'TOP SECRET'; }

.deco-stamp-evidence {
  color: rgba(35,55,150,0.72);
  border-color: rgba(35,55,150,0.65);
}
.deco-stamp-evidence::after { content: 'EVIDENCE'; }

.deco-paperclip {
  width: 22px;
  height: 52px;
  border: 2.5px solid;
  border-image: linear-gradient(180deg, #c0c0c0 0%, #999 50%, #b0b0b0 100%) 1;
  border-color: #aaa;
  border-radius: 11px 11px 0 0;
  border-bottom: none;
  position: relative;
  box-shadow: 1px 1px 3px rgba(0,0,0,0.2);
}
.deco-paperclip::after {
  content: '';
  position: absolute;
  top: 14px;
  left: 3px;
  width: 10px;
  height: 32px;
  border: 2.5px solid #aaa;
  border-radius: 0 0 9px 9px;
  border-top: none;
}

.deco-blood {
  width: 65px;
  height: 65px;
  background:
    radial-gradient(ellipse at 42% 42%, rgba(110,6,6,0.65) 0%, rgba(110,6,6,0.35) 25%, transparent 50%),
    radial-gradient(ellipse at 58% 52%, rgba(95,4,4,0.35) 0%, transparent 38%),
    radial-gradient(ellipse at 48% 62%, rgba(80,2,2,0.2) 0%, transparent 35%);
  border-radius: 44% 56% 48% 52% / 50% 46% 54% 50%;
  filter: blur(0.5px);
}

.deco-burn {
  width: 105px;
  height: 85px;
  background:
    radial-gradient(ellipse at 50% 95%, rgba(20,12,5,0.75) 0%, rgba(40,25,10,0.45) 22%, rgba(80,55,20,0.18) 48%, transparent 72%),
    radial-gradient(ellipse at 45% 80%, rgba(60,35,8,0.2) 0%, transparent 55%);
  border-radius: 42% 48% 5% 5%;
  filter: blur(0.8px);
}

.deco-fold {
  width: 200px;
  height: 6px;
  background:
    linear-gradient(180deg, rgba(0,0,0,0.06) 0%, rgba(0,0,0,0.1) 45%, transparent 50%, rgba(255,255,255,0.15) 55%, rgba(255,255,255,0.06) 100%),
    linear-gradient(90deg, transparent 0%, rgba(0,0,0,0.04) 15%, rgba(0,0,0,0.06) 50%, rgba(0,0,0,0.04) 85%, transparent 100%);
}

/* ── Extended Decoration Types ── */

.deco-fingerprint {
  width: 58px;
  height: 72px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 58 72'%3E%3Cg fill='none' stroke='rgba(45,25,10,0.38)' stroke-width='1.2' stroke-linecap='round'%3E%3Cpath d='M29,8 C38,8 46,18 46,32 C46,46 38,56 32,62' /%3E%3Cpath d='M29,12 C36,12 42,20 42,32 C42,44 35,52 30,58' /%3E%3Cpath d='M29,16 C34,16 38,23 38,32 C38,42 33,49 28,54' /%3E%3Cpath d='M28,20 C32,20 35,25 35,32 C35,40 31,46 27,50' /%3E%3Cpath d='M27,24 C30,24 32,27 32,32 C32,38 30,42 27,46' /%3E%3Cpath d='M27,28 C28.5,28 30,30 30,33 C30,36 29,39 27,42' /%3E%3Cpath d='M26,8 C18,9 12,18 12,32 C12,44 17,52 22,58' /%3E%3Cpath d='M26,12 C20,13 16,20 16,32 C16,42 20,50 24,55' /%3E%3Cpath d='M27,16 C22,17 19,23 19,32 C19,40 22,47 25,51' /%3E%3Cpath d='M27,20 C24,21 22,25 22,32 C22,38 24,43 26,47' /%3E%3C/g%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  filter: blur(0.4px);
  opacity: 0.85;
}

.deco-ink-blot {
  width: 78px;
  height: 58px;
  background:
    radial-gradient(ellipse at 40% 48%, rgba(6,6,24,0.82) 0%, rgba(6,6,24,0.55) 22%, transparent 48%),
    radial-gradient(ellipse at 60% 55%, rgba(6,6,24,0.55) 0%, rgba(6,6,24,0.25) 28%, transparent 52%),
    radial-gradient(ellipse at 48% 38%, rgba(6,6,24,0.35) 0%, transparent 42%);
  border-radius: 54% 46% 50% 50% / 46% 54% 44% 56%;
  filter: blur(0.6px);
}

.deco-blood-drip {
  width: 44px;
  height: 92px;
  background:
    radial-gradient(ellipse at 50% 14%, rgba(128,6,6,0.82) 0%, rgba(128,6,6,0.45) 28%, transparent 48%),
    linear-gradient(180deg, rgba(128,6,6,0.62) 0%, rgba(118,4,4,0.52) 45%, rgba(108,4,4,0.28) 72%, rgba(100,2,2,0.08) 90%, transparent 100%);
  border-radius: 48% 52% 35% 35% / 22% 22% 65% 65%;
  filter: blur(0.4px);
}

.deco-rust {
  width: 85px;
  height: 65px;
  background:
    radial-gradient(ellipse at 42% 42%, rgba(148,70,15,0.6) 0%, rgba(148,70,15,0.3) 30%, transparent 55%),
    radial-gradient(ellipse at 58% 56%, rgba(138,60,10,0.3) 0%, transparent 42%),
    radial-gradient(ellipse at 50% 48%, rgba(130,55,8,0.12) 0%, transparent 60%);
  border-radius: 46% 54% 44% 56% / 52% 48% 52% 48%;
  filter: blur(0.6px);
}

.deco-tape-yellow {
  width: 158px;
  height: 34px;
  background:
    repeating-linear-gradient(45deg, rgba(238,198,28,0.72), rgba(238,198,28,0.72) 9px, rgba(18,18,18,0.48) 9px, rgba(18,18,18,0.48) 13px),
    linear-gradient(180deg, rgba(255,255,255,0.1) 0%, transparent 30%, transparent 70%, rgba(0,0,0,0.08) 100%);
}

.deco-staple {
  width: 34px;
  height: 4px;
  background: linear-gradient(180deg, #c0c0c0 0%, #aaa 40%, #888 100%);
  box-shadow: 0 1px 1px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.3);
  border-radius: 1px;
}
.deco-staple::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 11px;
  background: linear-gradient(90deg, #aaa 0%, #888 100%);
  box-shadow: 1px 1px 2px rgba(0,0,0,0.25);
}
.deco-staple::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 3px;
  height: 11px;
  background: linear-gradient(90deg, #888 0%, #aaa 100%);
  box-shadow: -1px 1px 2px rgba(0,0,0,0.25);
}

.deco-stamp-classified {
  padding: 6px 18px;
  border: 3px solid rgba(155,0,0,0.72);
  font-family: var(--font-body);
  font-weight: 900;
  font-size: 1rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  border-radius: 4px;
  white-space: nowrap;
  color: rgba(155,0,0,0.72);
}
.deco-stamp-classified::after { content: 'CLASSIFIED'; }

.deco-stamp-date {
  width: 88px;
  height: 88px;
  border: 3px solid rgba(55,75,155,0.6);
  border-radius: 50%;
  color: rgba(55,75,155,0.6);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.6rem;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.deco-stamp-date::after {
  content: 'RECEIVED\A──────────\A__ / __ / ____';
  white-space: pre;
  text-align: center;
  line-height: 1.5;
}

.deco-wax-seal {
  width: 72px;
  height: 72px;
  background:
    radial-gradient(circle at 42% 35%, rgba(255,180,140,0.22) 0%, transparent 30%),
    radial-gradient(circle at 44% 38%, #cc3c3c 0%, #a82020 35%, #7a0e0e 65%, #5e0808 100%);
  border-radius: 48% 52% 50% 50% / 50% 48% 52% 50%;
  box-shadow: 0 4px 12px rgba(0,0,0,0.45), 0 1px 3px rgba(0,0,0,0.3), inset 0 -3px 6px rgba(0,0,0,0.35), inset 0 2px 4px rgba(255,150,90,0.25);
}
.deco-wax-seal::after {
  content: '✦';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: rgba(255,210,160,0.6);
  font-size: 1.6rem;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.deco-sticky-note {
  width: 115px;
  height: 100px;
  background:
    linear-gradient(to bottom right, rgba(0,0,0,0.08) 0%, transparent 25%),
    repeating-linear-gradient(transparent, transparent 19px, rgba(0,0,0,0.06) 19px, rgba(0,0,0,0.06) 20px),
    linear-gradient(168deg, #ffe864 0%, #ffd600 50%, #f5cc00 100%);
  background-size: auto, auto 20px, auto;
  background-position: 0 0, 0 22px, 0 0;
  box-shadow: 3px 5px 12px rgba(0,0,0,0.25), -1px -1px 3px rgba(0,0,0,0.05), inset 0 -2px 4px rgba(0,0,0,0.06);
  transform-origin: top center;
}

.deco-highlighter {
  width: 188px;
  height: 18px;
  background:
    linear-gradient(180deg, rgba(252,218,0,0.15) 0%, rgba(252,218,0,0.45) 20%, rgba(252,218,0,0.45) 80%, rgba(252,218,0,0.15) 100%);
  border-radius: 3px;
  filter: blur(0.5px);
}

.deco-pen-mark {
  width: 168px;
  height: 4px;
  background:
    linear-gradient(90deg, transparent 0%, rgba(18,18,75,0.5) 3%, rgba(18,18,75,0.78) 15%, rgba(18,18,75,0.85) 50%, rgba(18,18,75,0.72) 85%, rgba(18,18,75,0.45) 97%, transparent 100%);
  border-radius: 2px;
  filter: blur(0.3px);
}

.deco-torn-edge {
  width: 210px;
  height: 24px;
  background: var(--parchment, #f0e8d0);
  clip-path: polygon(
    0% 0%, 2% 70%, 5% 15%, 8% 85%, 11% 25%, 14% 80%, 17% 10%,
    20% 72%, 23% 22%, 26% 78%, 29% 8%, 32% 68%, 35% 18%, 38% 82%,
    41% 28%, 44% 74%, 47% 12%, 50% 78%, 53% 22%, 56% 68%, 59% 8%,
    62% 82%, 65% 18%, 68% 72%, 71% 28%, 74% 78%, 77% 12%, 80% 68%,
    83% 22%, 86% 82%, 89% 8%, 92% 72%, 95% 28%, 98% 65%, 100% 45%,
    100% 100%, 0% 100%
  );
  filter: drop-shadow(0 -2px 3px rgba(0,0,0,0.18));
}

/* ── Decoration Palette Category Labels ── */
.deco-cat-label {
  width: 100%;
  font-size: 0.7rem;
  font-family: var(--font-body);
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding: 4px 2px 2px;
  margin-top: 4px;
  border-top: 1px solid var(--border);
}
.deco-cat-label:first-child { margin-top: 0; border-top: none; }

/* ── Decoration Palette (admin) ── */
.deco-palette {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 12px;
}

.deco-palette-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 6px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  font-family: var(--font-body);
  transition: all 0.15s;
}

.deco-palette-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--gold-dim);
}

/* ── Design Preview Area ── */
.deco-preview-area {
  position: relative;
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-y: auto;
  max-height: 600px;
  min-height: 300px;
  background: var(--bg-darkest);
  display: flex;
  justify-content: center;
  padding: 20px;
}

.deco-preview-area .document-paper {
  position: relative;
  max-width: 700px;
  width: 700px;
  min-height: 400px;
  font-size: 1rem;
  padding: 48px 40px;
  overflow: visible;
  transform: scale(0.72);
  transform-origin: top left;
}

.deco-preview-area .document-paper.paper-landscape {
  max-width: 960px;
  width: 960px;
  min-height: 280px;
  transform: scale(0.54);
}

.deco-content-preview {
  font-size: 0.8rem;
  line-height: 1.6;
}

/* ═══ ATTACHMENTS ═══ */
.attachments-section {
  margin-top: 20px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.attachments-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.attachments-header h4 {
  font-family: var(--font-display);
  color: var(--gold);
  font-size: 1rem;
}

.attachments-header .att-btns { display: flex; gap: 6px; }

.attachment-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 8px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  transition: border-color 0.2s;
}

.attachment-card:hover { border-color: var(--border-light); }

.attachment-card .att-thumb {
  width: 80px;
  height: 60px;
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 1.5rem;
}

.attachment-card .att-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.attachment-card .att-info { flex: 1; min-width: 0; }
.attachment-card .att-info .att-type {
  font-size: 0.7rem;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}
.attachment-card .att-info .att-name {
  font-size: 0.9rem;
  color: var(--text-primary);
  font-weight: 500;
}
.attachment-card .att-info .att-caption {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.attachment-card .att-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.attachment-card .att-actions button {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.75rem;
}

.attachment-card .att-actions button:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

/* Player-side attachment gallery */
.clue-attachments {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 2px solid rgba(42,34,24,0.15);
}

.clue-attachments h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  color: #3a2a18;
  margin-bottom: 12px;
}

.clue-att-gallery {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.clue-att-item {
  width: 120px;
  cursor: pointer;
  border: 2px solid rgba(42,34,24,0.15);
  border-radius: 4px;
  overflow: hidden;
  transition: border-color 0.2s;
  background: #fff;
}

.clue-att-item:hover { border-color: rgba(42,34,24,0.4); }
.clue-att-item.active { border-color: var(--red); }

.clue-att-item img {
  width: 100%;
  height: 80px;
  object-fit: cover;
  display: block;
}

.clue-att-item .att-label {
  padding: 4px 6px;
  font-size: 0.7rem;
  color: #3a2a18;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.clue-att-note {
  padding: 8px 12px;
  background: rgba(42,34,24,0.05);
  border: 1px solid rgba(42,34,24,0.1);
  border-radius: 4px;
  font-size: 0.85rem;
  color: #3a2a18;
  cursor: pointer;
  max-width: 200px;
}

.clue-att-note:hover { background: rgba(42,34,24,0.1); }

/* ═══ ANNOTATION TOOL ═══ */
.annotate-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 3000;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
}

.annotate-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  background: var(--bg-card);
  padding: 8px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.annotate-toolbar button {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  font-family: var(--font-body);
}

.annotate-toolbar button:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.annotate-toolbar button.active { background: var(--gold); color: var(--bg-darkest); border-color: var(--gold); }

.annotate-canvas-wrap {
  position: relative;
  max-width: 90vw;
  max-height: calc(100vh - 120px);
  display: inline-block;
}

.annotate-canvas-wrap img {
  max-width: 100%;
  max-height: calc(100vh - 120px);
  display: block;
  border-radius: 4px;
}

.annotate-canvas-wrap svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: auto;
}

/* SVG annotations (player view too) */
.annotation-wrap {
  position: relative;
  display: inline-block;
}

.annotation-wrap svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* ═══ LANGUAGE SWITCHER ═══ */
.lang-switcher {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
}

.lang-flag {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  font-family: var(--font-body);
  letter-spacing: 1px;
  cursor: pointer;
  padding: 6px 10px;
  transition: all 0.2s;
  line-height: 1;
  color: var(--text-secondary);
}

.lang-flag:hover { border-color: var(--gold-dim); color: var(--text-primary); background: var(--bg-card-hover); }
.lang-flag.active { border-color: var(--gold); background: rgba(212,165,116,0.15); color: var(--gold); }

/* ═══ CASE BUILDER ═══ */
.case-builder {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
  min-height: calc(100vh - 64px);
}

.case-builder-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.case-builder-header h1 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  color: var(--gold);
}

.case-builder-header .header-actions {
  display: flex;
  gap: 8px;
}

.case-builder-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  overflow: hidden;
}

.case-builder-tab {
  padding: 12px 20px;
  cursor: pointer;
  border: none;
  background: none;
  color: var(--text-secondary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.2s;
  white-space: nowrap;
}

.case-builder-tab:hover { color: var(--text-primary); }
.case-builder-tab.active { color: var(--gold); border-bottom-color: var(--gold); }

.cb-section { display: none; }
.cb-section.active { display: block; }

/* ── Metadata Tab ── */
.cb-metadata { max-width: 800px; }
.cb-metadata .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.cover-upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s;
  position: relative;
  overflow: hidden;
  min-height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  color: var(--text-muted);
}

.cover-upload-zone:hover { border-color: var(--gold); color: var(--text-secondary); }
.cover-upload-zone img {
  max-width: 100%;
  max-height: 200px;
  border-radius: 4px;
}

/* ── Character Manager ── */
.character-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 12px;
  position: relative;
}

.character-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.character-card-header h3 {
  font-family: var(--font-display);
  color: var(--gold);
  font-size: 1rem;
}

.character-card .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ── Evidence Builder ── */
.evidence-builder {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
  min-height: 500px;
}

.evidence-list {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.evidence-list-header {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.evidence-list-header h3 {
  font-family: var(--font-display);
  color: var(--gold);
  font-size: 1rem;
}

.evidence-list-items {
  flex: 1;
  overflow-y: auto;
}

.evidence-list-item {
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.2s;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.evidence-list-item:hover { background: var(--bg-card-hover); }
.evidence-list-item.active {
  background: var(--bg-surface);
  border-left: 3px solid var(--gold);
  color: var(--text-primary);
}

.evidence-list-item .item-title { flex: 1; }
.evidence-list-item .item-type {
  font-size: 0.7rem;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.reorder-btns {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.reorder-btns button {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 4px;
  font-size: 0.7rem;
  line-height: 1;
}

.reorder-btns button:hover { color: var(--gold); }

.evidence-editor {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 24px;
  overflow-y: auto;
}

.evidence-editor-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.evidence-editor .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ── Rich Text Editor ── */
.rt-toolbar {
  display: flex;
  gap: 4px;
  padding: 8px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  flex-wrap: wrap;
}

.rt-toolbar button {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  font-family: var(--font-body);
  transition: all 0.15s;
}

.rt-toolbar button:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.rt-toolbar .sep {
  width: 1px;
  background: var(--border);
  margin: 0 4px;
}

.rt-editor {
  min-height: 220px;
  padding: 20px;
  background: var(--parchment);
  color: #2a2218;
  font-family: var(--font-typewriter);
  font-size: 0.95rem;
  line-height: 1.8;
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
  outline: none;
  overflow-y: auto;
  max-height: 400px;
}

.rt-editor:focus { border-color: var(--gold); }
.rt-editor h2 { font-family: var(--font-display); font-size: 1.3rem; margin: 12px 0 8px; }
.rt-editor h3 { font-family: var(--font-display); font-size: 1.1rem; margin: 10px 0 6px; }
.rt-editor img { max-width: 100%; border-radius: 4px; margin: 8px 0; }

/* ── Image Upload ── */
.image-upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.2s;
}

.image-upload-zone:hover,
.image-upload-zone.dragover {
  border-color: var(--gold);
  color: var(--text-secondary);
}

.image-thumbnails {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.image-thumb {
  position: relative;
  width: 100px;
  height: 100px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  cursor: pointer;
}

.image-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-thumb .thumb-actions {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s;
}

.image-thumb:hover .thumb-actions { opacity: 1; }

.image-thumb .thumb-actions button {
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.75rem;
}

.image-thumb .thumb-actions button:hover { background: rgba(255,255,255,0.35); }

/* ── Player-side: images in documents ── */
.document-paper img {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  margin: 12px 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.document-paper .image-caption {
  text-align: center;
  font-style: italic;
  color: #5a4a32;
  margin-top: 4px;
  font-size: 0.9rem;
}

/* ── Preview Tab ── */
.cb-preview-container {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
  min-height: 400px;
}

.cb-preview-clues {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  overflow-y: auto;
}

.cb-preview-device-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.preview-device-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}
.preview-device-btn.active {
  background: var(--gold-dim);
  color: var(--gold);
  border-color: var(--gold);
}

.cb-preview-viewer {
  display: flex;
  justify-content: center;
  padding: 24px;
  background: var(--bg-darkest);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow-y: auto;
  transition: max-width 0.3s;
}

.cb-preview-viewer.preview-mobile {
  max-width: 390px;
  margin: 0 auto;
  border: 3px solid #444;
  border-radius: 24px;
  padding: 16px 12px;
}

.cb-preview-viewer.preview-mobile .document-paper {
  font-size: 0.85rem;
  padding: 24px 16px;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .evidence-builder { grid-template-columns: 1fr; }
  .cb-metadata .form-row { grid-template-columns: 1fr; }
  .character-card .form-row { grid-template-columns: 1fr; }
  .evidence-editor .form-row { grid-template-columns: 1fr; }
  .cb-preview-container { grid-template-columns: 1fr; }
  .case-builder-tabs { gap: 0; }
  .case-builder-tab { padding: 10px 12px; font-size: 0.8rem; }
}

/* ══════════════════════════════════════════════════════
   Clue Complexity — Locked clues, hints, badges
   ══════════════════════════════════════════════════════ */

/* Locked clue in gameplay sidebar */
.clue-item.locked {
  opacity: 0.5;
  cursor: not-allowed;
  border-left: 3px solid var(--text-muted);
}
.clue-item.locked:hover {
  background: transparent;
  border-color: var(--text-muted);
}
.clue-item.locked .read-indicator {
  color: var(--text-muted);
  font-size: 0.85rem;
}
.clue-lock-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-left: auto;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Hint button in document header status line */
.clue-hint-btn {
  background: none;
  border: 1px solid var(--gold-dim);
  color: var(--gold);
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
  vertical-align: middle;
}
.clue-hint-btn:hover {
  background: var(--gold-dim);
  color: var(--bg-darkest);
}

/* Revealed hint text */
.clue-hint-text {
  font-size: 0.82rem;
  color: var(--gold);
  font-style: italic;
}

/* Case builder — clue list badges */
.item-badges {
  display: flex;
  gap: 3px;
  align-items: center;
}
.item-badge {
  font-size: 0.8rem;
  line-height: 1;
}

/* Case builder — prerequisite checkbox list */
.complexity-section {
  border-top: 1px solid var(--border);
  margin-top: 24px;
  padding-top: 20px;
}
.prereq-checkbox-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 160px;
  overflow-y: auto;
  padding: 8px;
  background: var(--bg-darkest);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.prereq-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--text-secondary);
  transition: color 0.15s;
}
.prereq-checkbox-label:hover { color: var(--text-primary); }
.prereq-checkbox-label input[type="checkbox"] {
  accent-color: var(--gold);
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* Language selector in export/template modals */
.lang-checkbox-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.lang-checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--text-secondary);
  background: var(--bg-darkest);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 5px 10px;
  transition: all 0.15s;
}
.lang-checkbox-label:hover { color: var(--text-primary); border-color: var(--gold-dim); }
.lang-checkbox-label input[type="checkbox"] {
  accent-color: var(--gold);
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════
   NEW FEATURE STYLES: Custom Orders, Auth, Admin
   ═══════════════════════════════════════════════════ */

/* Badge variants (additional) */
.badge-info { background: rgba(56,139,253,0.15); color: #58a6ff; }
.badge-primary { background: rgba(212,165,116,0.15); color: var(--gold-bright); }
.badge-secondary { background: rgba(160,160,180,0.15); color: #a0a0b4; }
.badge-danger { background: rgba(139,32,32,0.2); color: var(--red-bright); }

/* FREE badge on game cards */
.game-card-badge.badge-free {
  background: var(--green-bright);
  color: #fff;
  font-weight: 700;
}

/* Analytics grid */
.analytics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.analytics-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}
.analytics-card h3 {
  color: var(--gold);
  font-family: var(--font-display);
  font-size: 1.1rem;
  margin-bottom: 16px;
}
.analytics-card canvas {
  width: 100% !important;
  max-height: 320px;
}
@media (max-width: 768px) {
  .analytics-grid { grid-template-columns: 1fr; }
}

/* Filter labels */
.filter-label {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
}

/* Games search & filter bar */
.games-search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.games-search-input {
  flex: 1;
  padding: 10px 14px !important;
  font-size: 0.95rem;
}
.games-filter-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 20px;
}
.games-filter-dropdowns {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.games-filter-dropdowns .form-group {
  flex: 1;
  min-width: 140px;
}
.games-filter-dropdowns select {
  width: 100%;
}

/* Admin table improvements */
.admin-table th, .admin-table td {
  font-size: 0.85rem;
}

/* Info banner */
.info-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(212, 165, 116, 0.1);
  border: 1px solid var(--gold-dim);
  border-left: 4px solid var(--gold);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 24px;
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.5;
}
.info-banner .banner-icon { font-size: 1.4rem; flex-shrink: 0; }
.info-banner strong { color: var(--gold); }

/* Custom order page */
.order-price-display {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--gold);
}

.custom-order-sharing {
  display: flex;
  align-items: flex-start;
  gap: 0;
  cursor: pointer;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.2s;
}
.custom-order-sharing:hover { border-color: var(--gold-dim); }
.custom-order-sharing input[type="checkbox"] { accent-color: var(--gold); cursor: pointer; }

/* Admin tab improvements */
.admin-tab-content { display: none; }
.admin-tab-content.active { display: block; }
