/* ============================================================
   APALAVRADO — Full SPA Styles
   ============================================================ */

:root {
  --ink:       #0e0c0a;
  --ink-2:     #171410;
  --paper:     #f5f0e8;
  --paper-dim: #c8b89a;
  --sepia:     #9a8a72;
  --gold:      #c9a84c;
  --gold-dim:  #7a6830;
  --correct:   #4a7c59;
  --present:   #c9a84c;
  --absent:    #2e2b28;
  --red:       #9b2335;
  --ash:       #3a3530;
  --mist:      #6b6459;
  --border:    rgba(201,168,76,.14);
  --border-hi: rgba(201,168,76,.38);

  --font-display: 'Playfair Display', Georgia, serif;
  --font-mono:    'Courier Prime', 'Courier New', monospace;
  --radius: 3px;
  --tr: .18s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-mono);
  min-height: 100vh;
  overflow-x: hidden;
}

#app { min-height: 100vh; }

/* ── Boot loader ──────────────────────────────────────────── */
.boot-loader {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2rem;
}

/* ── Spinner ──────────────────────────────────────────────── */
.spinner {
  width: 28px; height: 28px;
  border: 2px solid var(--ash);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Loading / error states ───────────────────────────────── */
.loading-state, .error-state {
  min-height: 50vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.2rem;
  color: var(--mist);
  font-style: italic;
}
.error-state { color: #e07080; }

/* ── Toast ────────────────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink-2);
  border: 1px solid var(--border-hi);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: .82rem;
  padding: .65rem 1.4rem;
  border-radius: var(--radius);
  z-index: 9999;
  opacity: 0;
  transition: opacity .25s, transform .25s;
  pointer-events: none;
}
#toast.toast-visible { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.toast-success { border-color: var(--correct); }
#toast.toast-error   { border-color: var(--red); color: #e07080; }

/* ── Shared layout ────────────────────────────────────────── */
.site-header {
  background: linear-gradient(180deg, rgba(14,12,10,1) 0%, rgba(14,12,10,0) 100%);
  padding: 2.5rem 3rem 1.5rem;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.logo {
  font-family: var(--font-display);
  font-size: clamp(2rem, 6vw, 3.8rem);
  font-weight: 700;
  letter-spacing: .3em;
  color: var(--paper);
  line-height: 1;
}
.logo::after {
  content: '';
  display: block;
  width: 40px; height: 2px;
  background: var(--gold);
  margin-top: .4rem;
}
.tagline {
  color: var(--mist);
  font-style: italic;
  font-size: .82rem;
  letter-spacing: .12em;
  margin-top: .4rem;
}
.header-nav {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
}
.nav-username {
  font-size: .78rem;
  color: var(--sepia);
  letter-spacing: .08em;
}
.page-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.page-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  flex: 1;
}
.back-btn {
  background: none; border: none;
  color: var(--mist); font-family: var(--font-mono);
  font-size: .78rem; letter-spacing: .1em;
  cursor: pointer;
  transition: color var(--tr);
  padding: 0;
}
.back-btn:hover { color: var(--gold); }

/* ── Sections ─────────────────────────────────────────────── */
.section { padding: 2rem 3rem; }
.section-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--paper);
  margin-bottom: 1.2rem;
  letter-spacing: .05em;
}
.section-sub {
  color: var(--mist);
  font-size: .84rem;
  font-style: italic;
  margin-bottom: 1rem;
}
.community-teaser, .create-teaser {
  border-top: 1px solid var(--border);
}
.site-footer {
  padding: 1.2rem 3rem;
  border-top: 1px solid var(--border);
  color: var(--mist);
  font-size: .75rem;
  letter-spacing: .1em;
}

/* ── Mystery grid ─────────────────────────────────────────── */
.mystery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  gap: 1.2rem;
}
.mystery-grid.compact { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .8rem; }

.mystery-card {
  background: rgba(245,240,232,.04);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  cursor: pointer;
  transition: background var(--tr), border-color var(--tr), transform var(--tr);
  position: relative;
}
.mystery-card:hover, .mystery-card:focus {
  background: rgba(245,240,232,.07);
  border-color: var(--border-hi);
  transform: translateY(-2px);
  outline: none;
}
.mystery-card.compact { padding: 1rem; }
.card-number  { font-size: .68rem; letter-spacing: .18em; color: var(--gold); margin-bottom: .5rem; }
.card-title   { font-family: var(--font-display); font-size: 1.2rem; font-weight: 700; margin-bottom: .5rem; line-height: 1.2; }
.card-description { font-size: .8rem; color: var(--mist); font-style: italic; line-height: 1.65; }
.card-meta    { display: flex; align-items: center; gap: .8rem; margin-top: 1rem; flex-wrap: wrap; }
.card-author  { font-size: .72rem; color: var(--sepia); margin-left: auto; }
.card-words-count { font-size: .72rem; color: var(--mist); }

.btn-author-link {
  background: none; border: none;
  color: var(--sepia); font-family: var(--font-mono);
  font-size: .72rem; cursor: pointer;
  transition: color var(--tr); padding: 0;
}
.btn-author-link:hover { color: var(--gold); }

/* ── Badges ───────────────────────────────────────────────── */
.badge {
  font-size: .68rem; letter-spacing: .12em;
  text-transform: uppercase; padding: .2rem .55rem;
  border-radius: 2px; white-space: nowrap;
}
.badge-easy   { background: rgba(74,124,89,.2);  color: #7ec89a; }
.badge-medium { background: rgba(201,168,76,.2); color: var(--gold); }
.badge-hard   { background: rgba(155,35,53,.2);  color: #e07080; }
.badge-count  {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--red); color: white;
  font-size: .68rem; font-weight: 700;
  width: 18px; height: 18px; border-radius: 50%;
  margin-left: .3rem;
}

.status-badge {
  font-size: .68rem; letter-spacing: .1em; text-transform: uppercase;
  padding: .2rem .5rem; border-radius: 2px;
}
.status-pending  { background: rgba(201,168,76,.15); color: var(--gold); }
.status-approved { background: rgba(74,124,89,.15);  color: #7ec89a; }
.status-rejected { background: rgba(155,35,53,.15);  color: #e07080; }
.status-admin    { background: rgba(201,168,76,.2);  color: var(--gold); }
.status-user     { background: rgba(58,53,48,.4);    color: var(--sepia); }

/* ── Empty state ──────────────────────────────────────────── */
.empty-state {
  color: var(--mist); font-style: italic;
  font-size: .85rem; padding: 2rem;
  text-align: center;
}
.empty-state.small { padding: .6rem; }

/* ── Auth page ────────────────────────────────────────────── */
.auth-page {
  min-height: 100vh; display: flex;
  align-items: center; justify-content: center;
  padding: 2rem;
  background-image: radial-gradient(ellipse at 50% 20%, rgba(201,168,76,.06) 0%, transparent 60%);
}
.auth-box {
  width: 100%; max-width: 380px;
  background: var(--ink-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
}
.auth-box .logo { text-align: center; margin-bottom: 2rem; }
.auth-tabs { display: flex; gap: .4rem; margin-bottom: 1.5rem; }
.auth-footer { margin-top: 1.5rem; }

/* ── Game layout ──────────────────────────────────────────── */
.game-layout {
  display: flex;
  min-height: 100vh;
}
.narrative-panel {
  width: 300px; min-width: 260px;
  background: rgba(245,240,232,.025);
  border-right: 1px solid var(--border);
  padding: 1.8rem 1.5rem;
  display: flex; flex-direction: column;
  gap: .8rem; overflow-y: auto;
}
.mystery-title {
  font-family: var(--font-display);
  font-size: 1.3rem; font-weight: 700;
  border-bottom: 1px solid var(--border);
  padding-bottom: .7rem; line-height: 1.2;
}
.narrative-scroll { flex: 1; overflow-y: auto; }
.narrative-fragment { margin-bottom: 1.2rem; animation: fadeUp .5s ease forwards; opacity: 0; }
@keyframes fadeUp { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:none; } }
.fragment-number { font-size: .65rem; letter-spacing: .2em; color: var(--gold); text-transform: uppercase; margin-bottom: .3rem; }
.fragment-text   { font-family: var(--font-display); font-size: .84rem; line-height: 1.8; color: var(--paper-dim); font-style: italic; }

.progress-indicator { display: flex; gap: 4px; flex-wrap: wrap; margin-top: .5rem; }
.progress-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ash); transition: background .3s; }
.progress-dot.done    { background: var(--gold); }
.progress-dot.current { background: var(--correct); }

.game-panel {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; padding: 1.8rem 1.2rem;
  gap: 1rem; overflow-y: auto;
}
.word-counter { font-size: .72rem; letter-spacing: .2em; color: var(--mist); text-transform: uppercase; }
.hint-row     { font-size: .74rem; color: var(--gold); font-style: italic; letter-spacing: .08em; min-height: 1.2em; }

/* ── Board ────────────────────────────────────────────────── */
.board      { display: flex; flex-direction: column; gap: 5px; }
.board-row  { display: flex; gap: 5px; }
.tile {
  width: 52px; height: 52px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 1.35rem; font-weight: 700;
  border: 2px solid var(--ash); border-radius: var(--radius);
  color: var(--paper); background: transparent;
  transition: border-color .1s;
  user-select: none;
}
.tile.filled { border-color: var(--sepia); }
.tile.revealed { animation: flip .45s ease forwards; }
.tile[data-state="correct"] { background: var(--correct); border-color: var(--correct); }
.tile[data-state="present"] { background: var(--present); border-color: var(--present); color: var(--ink); }
.tile[data-state="absent"]  { background: var(--absent);  border-color: var(--absent); }
@keyframes flip {
  0%   { transform: rotateX(0); }
  50%  { transform: rotateX(90deg); }
  100% { transform: rotateX(0); }
}
.tile.shake { animation: shake .4s ease; }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

/* ── Keyboard ─────────────────────────────────────────────── */
.keyboard { display: flex; flex-direction: column; gap: 5px; align-items: center; width: 100%; max-width: 490px; }
.kb-row   { display: flex; gap: 5px; }
.key {
  height: 50px; min-width: 33px; padding: 0 5px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: .8rem; font-weight: 700;
  letter-spacing: .05em;
  background: var(--ash); color: var(--paper);
  border: none; border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--tr), color var(--tr), transform .1s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.key:active { transform: scale(.93); }
.key.wide   { min-width: 56px; font-size: .72rem; }
.key:disabled { opacity: .5; cursor: wait; }
.key[data-state="correct"] { background: var(--correct); }
.key[data-state="present"] { background: var(--present); color: var(--ink); }
.key[data-state="absent"]  { background: #1a1714; color: var(--mist); }

.message-box {
  background: var(--paper); color: var(--ink);
  font-family: var(--font-mono); font-size: .82rem;
  padding: .55rem 1.2rem; border-radius: var(--radius);
  animation: fadeUp .3s ease;
}
.message-box.hidden { display: none; }

/* ── Victory ──────────────────────────────────────────────── */
.victory-inner {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center; padding: 3rem 2rem;
  gap: 1.2rem;
}
.victory-icon { font-size: 2.5rem; color: var(--gold); animation: pulse 2s infinite; }
@keyframes pulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.12)} }
.victory-inner h2 { font-family: var(--font-display); font-size: 1.8rem; }
.victory-epilogue  { font-family: var(--font-display); font-size: .9rem; color: var(--paper-dim); font-style: italic; line-height: 1.8; max-width: 480px; }
.victory-stats { display: flex; gap: 2rem; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 1rem; }
.stat-item     { text-align: center; }
.stat-value    { font-size: 1.7rem; color: var(--gold); font-weight: 700; }
.stat-label    { font-size: .68rem; color: var(--mist); letter-spacing: .14em; text-transform: uppercase; }
.victory-actions { display: flex; gap: .8rem; flex-wrap: wrap; justify-content: center; }

/* ── Profile ──────────────────────────────────────────────── */
.profile-page { padding-bottom: 3rem; }
.profile-hero {
  display: flex; align-items: flex-start; gap: 1.5rem;
  padding: 2rem; border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.profile-avatar {
  width: 60px; height: 60px;
  background: rgba(201,168,76,.15);
  border: 1px solid var(--border-hi);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 1.6rem;
  font-weight: 700; color: var(--gold);
  flex-shrink: 0;
}
.profile-info { flex: 1; }
.profile-username { font-family: var(--font-display); font-size: 1.4rem; }
.profile-bio      { color: var(--mist); font-style: italic; font-size: .85rem; margin-top: .4rem; }
.profile-joined   { color: var(--mist); font-size: .72rem; margin-top: .4rem; letter-spacing: .08em; }
.profile-stats    { display: flex; gap: 1.5rem; }
.profile-section  { padding: 1.5rem 2rem; border-top: 1px solid var(--border); }

.progress-list { display: flex; flex-direction: column; gap: .5rem; }
.progress-item {
  display: flex; align-items: center; gap: .8rem;
  padding: .7rem 1rem;
  background: rgba(245,240,232,.03);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.progress-item.done { border-color: rgba(74,124,89,.3); }
.pi-title  { flex: 1; font-size: .85rem; }
.pi-status { font-size: .72rem; color: var(--mist); margin-left: auto; }

/* ── Community page ───────────────────────────────────────── */
.community-page { padding-bottom: 3rem; }
.community-page .mystery-grid { padding: 1.5rem 2rem; }

/* ── Create/Edit form ─────────────────────────────────────── */
.create-page { padding-bottom: 3rem; }
.create-form { max-width: 680px; padding: 2rem; margin: 0 auto; }
.form-notice {
  background: rgba(201,168,76,.08);
  border: 1px solid rgba(201,168,76,.2);
  border-radius: var(--radius); padding: .9rem 1.2rem;
  font-size: .8rem; line-height: 1.6; margin-bottom: 1.5rem; color: var(--sepia);
}
.form-row { display: flex; gap: 1rem; }
.form-row .form-group { flex: 1; }

/* ── Admin page ───────────────────────────────────────────── */
.admin-page { padding-bottom: 3rem; }
.admin-tabs {
  display: flex; gap: .4rem;
  padding: .8rem 2rem;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.tab-content { display: none; padding: 1.5rem 2rem; }
.tab-content.active { display: block; }
.admin-mystery-card {
  background: rgba(245,240,232,.04);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  margin-bottom: .7rem;
}
.amc-info { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; margin-bottom: .4rem; }
.amc-desc { font-size: .78rem; color: var(--mist); font-style: italic; margin-bottom: .6rem; }
.amc-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.admin-list { display: flex; flex-direction: column; gap: .6rem; }
.admin-item {
  display: flex; align-items: center; gap: .8rem;
  background: rgba(245,240,232,.03);
  border: 1px solid var(--border);
  border-radius: var(--radius); padding: .7rem 1rem;
}
.admin-item-info { display: flex; align-items: center; gap: .6rem; flex: 1; }
.admin-item-actions { display: flex; gap: .4rem; }

/* Ad slots admin */
.ads-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.ad-slot-card {
  background: rgba(245,240,232,.03);
  border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem;
  display: flex; flex-direction: column; gap: .7rem;
}
.ad-slot-header { display: flex; align-items: center; justify-content: space-between; }
.ad-slot-header strong { font-size: .82rem; color: var(--paper); }
.ad-code {
  width: 100%; background: rgba(245,240,232,.04);
  border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--paper); font-family: var(--font-mono); font-size: .75rem;
  padding: .6rem .8rem; resize: vertical; outline: none;
}
.ad-code:focus { border-color: var(--border-hi); }

/* Toggle switch */
.toggle { display: flex; align-items: center; cursor: pointer; }
.toggle input { display: none; }
.toggle-track {
  width: 36px; height: 20px;
  background: var(--ash); border-radius: 20px;
  position: relative; transition: background var(--tr);
}
.toggle-track::after {
  content: '';
  position: absolute; top: 3px; left: 3px;
  width: 14px; height: 14px;
  background: var(--sepia); border-radius: 50%;
  transition: transform var(--tr), background var(--tr);
}
.toggle input:checked + .toggle-track { background: rgba(74,124,89,.5); }
.toggle input:checked + .toggle-track::after { transform: translateX(16px); background: var(--correct); }

/* Ad placeholder slot (user-facing) */
.ad-slot { min-height: 0; }
.ad-slot:not(:empty) { margin: .5rem 0; }
.ad-slot-inline { max-width: 100%; }

/* ── Shared form elements ─────────────────────────────────── */
.form-group { margin-bottom: 1.1rem; }
.form-group label {
  display: block; font-size: .7rem;
  letter-spacing: .14em; text-transform: uppercase;
  color: var(--mist); margin-bottom: .35rem;
}
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  background: rgba(245,240,232,.05);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--paper); font-family: var(--font-mono);
  font-size: .86rem; padding: .58rem .8rem;
  outline: none; resize: vertical;
  transition: border-color var(--tr);
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus { border-color: var(--border-hi); }
.form-group select option { background: var(--ink-2); }

.words-section  { margin-bottom: 1.5rem; }
.words-header   { display: flex; align-items: center; justify-content: space-between; margin-bottom: .35rem; }
.words-header label { font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--mist); }
.words-hint     { font-size: .74rem; color: var(--mist); font-style: italic; margin-bottom: .7rem; }
.word-item {
  background: rgba(245,240,232,.04);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: .6rem .9rem; display: flex; align-items: center; gap: .7rem;
  margin-bottom: .4rem;
}
.word-item-order { font-size: .68rem; color: var(--gold); min-width: 18px; }
.word-item-word  { font-size: .88rem; letter-spacing: .14em; color: var(--paper); flex: 1; }
.word-item-hint  { font-size: .74rem; color: var(--mist); font-style: italic; flex: 2; }

.form-actions {
  display: flex; justify-content: flex-end; gap: .7rem;
  padding-top: 1rem; border-top: 1px solid var(--border); flex-wrap: wrap;
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn-primary {
  background: var(--gold); color: var(--ink);
  border: none; font-family: var(--font-mono);
  font-size: .8rem; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; padding: .65rem 1.3rem;
  border-radius: var(--radius); cursor: pointer;
  transition: background var(--tr), transform .1s;
}
.btn-primary:hover  { background: #e8c060; }
.btn-primary:active { transform: scale(.97); }
.btn-primary.sm     { padding: .4rem .9rem; font-size: .74rem; }
.btn-primary.full   { width: 100%; }

.btn-ghost {
  background: none; border: 1px solid rgba(201,168,76,.25);
  color: var(--sepia); font-family: var(--font-mono);
  font-size: .8rem; letter-spacing: .09em;
  padding: .6rem 1.1rem; border-radius: var(--radius);
  cursor: pointer; transition: border-color var(--tr), color var(--tr);
}
.btn-ghost:hover { border-color: var(--gold); color: var(--gold); }
.btn-ghost.sm    { padding: .35rem .8rem; font-size: .74rem; }
.btn-ghost.full  { width: 100%; text-align: center; }

.btn-sm {
  background: rgba(201,168,76,.1);
  border: 1px solid rgba(201,168,76,.2);
  color: var(--gold); font-family: var(--font-mono);
  font-size: .72rem; padding: .28rem .65rem;
  border-radius: var(--radius); cursor: pointer;
  transition: background var(--tr);
}
.btn-sm:hover { background: rgba(201,168,76,.22); }

.btn-icon {
  background: none; border: 1px solid rgba(201,168,76,.18);
  color: var(--sepia); font-size: .76rem;
  padding: .28rem .6rem; border-radius: var(--radius);
  cursor: pointer; transition: background var(--tr), color var(--tr);
  white-space: nowrap;
}
.btn-icon:hover       { background: rgba(201,168,76,.12); color: var(--gold); }
.btn-icon.danger:hover{ background: rgba(155,35,53,.2); color: #e07080; border-color: rgba(155,35,53,.3); }

/* ── Modal ────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(14,12,10,.88);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 1rem;
  backdrop-filter: blur(3px);
}
.modal-overlay.hidden { display: none; }
.modal-box {
  background: var(--ink-2);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius); width: 100%;
  max-width: 480px; max-height: 90vh; overflow-y: auto;
  animation: fadeUp .22s ease;
}
.modal-box.small { max-width: 400px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.2rem 1.5rem; border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-family: var(--font-display); font-size: 1.1rem; }
.modal-close { background: none; border: none; color: var(--mist); font-size: .9rem; cursor: pointer; }
.modal-close:hover { color: var(--paper); }
.modal-body { padding: 1.4rem 1.5rem; }

/* ── Tab buttons ──────────────────────────────────────────── */
.tab-btn {
  background: none; border: none; color: var(--mist);
  font-family: var(--font-mono); font-size: .78rem;
  letter-spacing: .1em; cursor: pointer;
  padding: .38rem .75rem; border-radius: var(--radius);
  transition: background var(--tr), color var(--tr);
  display: flex; align-items: center; gap: .2rem;
}
.tab-btn.active { background: rgba(201,168,76,.14); color: var(--gold); }

/* ── Scrollbar ────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--ash); border-radius: 3px; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 760px) {
  .game-layout     { flex-direction: column; }
  .narrative-panel {
    width: 100%; min-width: unset; border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 36vh; padding: 1rem;
  }
  .section         { padding: 1.5rem; }
  .site-header     { padding: 1.5rem; }
  .mystery-grid    { padding: 0; }
  .profile-hero    { flex-direction: column; gap: 1rem; }
  .profile-stats   { flex-direction: row; gap: 1.2rem; }
  .tile            { width: 44px; height: 44px; font-size: 1.1rem; }
  .key             { height: 44px; min-width: 26px; font-size: .74rem; }
  .key.wide        { min-width: 46px; }
  .create-form     { padding: 1.2rem; }
  .tab-content     { padding: 1rem; }
  .admin-tabs      { padding: .6rem 1rem; }
}
@media (max-width: 400px) {
  .tile  { width: 38px; height: 38px; font-size: .95rem; }
  .key   { height: 40px; min-width: 22px; font-size: .68rem; }
  .key.wide { min-width: 40px; }
}
/* ── Weekly mystery card ─────────────────────────────────────── */
.mystery-card.weekly {
  border-color: rgba(201,168,76,.5);
  background: rgba(201,168,76,.06);
  box-shadow: 0 0 0 1px rgba(201,168,76,.2), 0 4px 24px rgba(201,168,76,.08);
}
.mystery-card.weekly:hover {
  border-color: var(--gold);
  background: rgba(201,168,76,.1);
}
.weekly-badge {
  font-size: .68rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: .6rem;
  display: flex;
  align-items: center;
  gap: .3rem;
}

/* ── Weekly badge in admin ───────────────────────────────────── */
.weekly-highlight {
  border-color: rgba(201,168,76,.4) !important;
  background: rgba(201,168,76,.05);
}
.weekly-badge-sm {
  font-size: .65rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--gold);
  background: rgba(201,168,76,.12);
  padding: .18rem .5rem;
  border-radius: 2px;
}

/* ── Weekly picker in admin ──────────────────────────────────── */
.weekly-picker {
  background: rgba(201,168,76,.06);
  border: 1px solid rgba(201,168,76,.2);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  margin-bottom: 1.5rem;
}
.weekly-picker-label {
  display: block;
  font-size: .72rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: .6rem;
}
.weekly-picker-row {
  display: flex;
  gap: .6rem;
  align-items: center;
}
.weekly-picker-row select {
  flex: 1;
  background: rgba(245,240,232,.05);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: .86rem;
  padding: .5rem .8rem;
  outline: none;
}
.weekly-picker-row select:focus { border-color: var(--border-hi); }
.weekly-picker-row select option { background: var(--ink-2); }

/* ── Settings card ───────────────────────────────────────────── */
.settings-card {
  background: rgba(245,240,232,.03);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem;
  margin-bottom: 1.2rem;
  max-width: 560px;
}
.settings-card-title {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--paper);
  margin-bottom: .6rem;
}
.settings-card code {
  background: rgba(245,240,232,.08);
  padding: .1rem .35rem;
  border-radius: 2px;
  font-size: .82rem;
  color: var(--gold);
}

/* ── Security question ───────────────────────────────────────── */
.security-question {
  background: rgba(201,168,76,.05);
  border: 1px solid rgba(201,168,76,.15);
  border-radius: var(--radius);
  padding: .9rem 1rem;
}
.security-prompt {
  font-size: .88rem;
  color: var(--paper);
  margin-bottom: .5rem;
  font-style: italic;
}
.security-hint {
  font-size: .72rem;
  color: var(--mist);
  margin-top: .35rem;
  font-style: italic;
}

/* Shake animation for wrong security answer */
@keyframes shake-field {
  0%,100% { transform: translateX(0); }
  20%     { transform: translateX(-6px); }
  40%     { transform: translateX(6px); }
  60%     { transform: translateX(-4px); }
  80%     { transform: translateX(4px); }
}
.shake-field { animation: shake-field .4s ease; border-color: var(--red) !important; }

/* ── Share preview ───────────────────────────────────────────── */
.share-preview {
  font-family: var(--font-mono);
  font-size: .82rem;
  line-height: 1.6;
  color: var(--paper-dim);
  background: rgba(245,240,232,.05);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  white-space: pre;
  text-align: left;
  max-width: 380px;
  margin-top: .6rem;
  user-select: all; /* easy to select all for copy */
}
.share-preview.hidden { display: none; }

/* ── Blocked user banner ─────────────────────────────────────── */
.blocked-banner {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  color: #e07080;
  text-align: center;
  padding: 2rem;
}
.blocked-banner h2 { font-family: var(--font-display); font-size: 1.5rem; }
.blocked-banner p  { color: var(--mist); font-size: .88rem; max-width: 320px; }
