/* ── RESET & BASE ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

:root {
  --amber:       #ff9f0a;
  --amber-mid:   #cc7a00;
  --amber-dim:   #7a4a00;
  --amber-faint: #2a1a00;
  --text-amber:  #d48a20;
  --text-dim:    #8a6a30;
  --text-muted:  #8a6a30;
  --bg:          #0a0700;
  --bg-card:     #0e0900;
  --border:      #3a2800;
  --border-dim:  #2a1a00;
  --green:       #5a9a50;
  --red:         #cc4400;
}

/* ── JASNY MOTYW ──────────────────────────────────────────────── */
:root[data-theme="light"] {
  --amber:       #b5650a;
  --amber-mid:   #8f5200;
  --amber-dim:   #c9a35c;
  --amber-faint: #f2e4c2;
  --text-amber:  #4a3200;
  --text-dim:    #6b5a3a;
  --text-muted:  #6b5a3a;
  --bg:          #f7f1e3;
  --bg-card:     #fffdf8;
  --border:      #d9c9a0;
  --border-dim:  #e8ddc0;
  --green:       #2f7a3a;
  --red:         #b23a12;
}

/* W jasnym motywie wyłączamy efekty CRT/winietę – na jasnym tle tylko przyciemniają */
:root[data-theme="light"] body::before,
:root[data-theme="light"] body::after {
  display: none;
}
:root[data-theme="light"] .brand-name,
:root[data-theme="light"] .hero-title,
:root[data-theme="light"] .detail-title {
  text-shadow: none;
}
:root[data-theme="light"] #site-header,
:root[data-theme="light"] .status-bar {
  background: var(--bg-card);
}

body {
  background: var(--bg);
  color: var(--text-amber);
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  line-height: 1.6;
  min-height: 100vh;
}

/* CRT scanlines */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent, transparent 2px,
    rgba(0,0,0,0.06) 2px, rgba(0,0,0,0.06) 4px
  );
  pointer-events: none;
  z-index: 9999;
}

/* Vignette */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,0.65) 100%);
  pointer-events: none;
  z-index: 9998;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

/* ── COLORS ── */
.amber       { color: var(--amber); }
.amber-dim   { color: var(--amber-dim); }
.amber-text  { color: var(--text-amber); }
.muted       { color: var(--text-dim); }
.green       { color: var(--green); }

/* ── LAYOUT HELPERS ── */
.container    { max-width: 1240px; margin: 0 auto; padding: 0 20px; }
@media (min-width: 1024px) { .container { padding: 0 40px; } }
.py-section   { padding-top: 56px; padding-bottom: 56px; }
.hidden       { display: none !important; }
.sr-only      { position: absolute; width: 1px; height: 1px; clip: rect(0,0,0,0); overflow: hidden; }

/* ── HEADER ── */
#site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border);
  background: #070500;
  font-family: 'JetBrains Mono', monospace;
}

.status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 16px;
  background: var(--amber-faint);
  border-bottom: 1px solid var(--amber-dim);
  color: var(--text-dim);
  font-size: 11.5px;
  letter-spacing: 0.03em;
  gap: 12px;
}
.status-bar > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

.status-bar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.nav-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
@media (min-width: 1024px) { .nav-inner { padding: 10px 40px; } }

.brand-link { display: flex; align-items: center; gap: 12px; }
.brand-img  { width: 32px; height: 32px; object-fit: cover; border: 1px solid var(--amber-dim); }
.brand-name { font-weight: 700; font-size: 15px; color: var(--amber); text-shadow: 0 0 20px rgba(255,159,10,0.35); }

.main-nav { display: none; align-items: center; gap: 24px; font-size: 12px; color: var(--text-dim); letter-spacing: 0.04em; }
@media (min-width: 768px) { .main-nav { display: flex; } }
.main-nav a:hover { color: var(--amber); }

.nav-actions { display: flex; align-items: center; gap: 12px; font-size: 12px; }
.nav-link { color: var(--text-dim); display: inline-flex; align-items: center; gap: 6px; transition: color 180ms; }
.nav-link:hover { color: var(--amber); }
.nav-link-name { color: var(--text-amber); max-width: 112px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-link-name:hover { color: var(--amber); }
.btn-register {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; font-size: 12px; font-weight: 600;
  background: var(--amber-faint); border: 1px solid var(--amber-dim); color: var(--amber);
  cursor: pointer; transition: opacity 180ms;
}
.btn-register:hover { opacity: 0.85; }
.btn-signout {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; font-size: 11.5px;
  background: transparent; border: 1px solid var(--border); color: var(--text-dim);
  cursor: pointer; transition: all 180ms;
}
.btn-signout:hover { border-color: var(--amber-dim); color: var(--text-amber); }

.btn-theme-toggle {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px; font-size: 10.5px;
  background: transparent; border: 1px solid var(--amber-dim); color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace; cursor: pointer; transition: all 180ms;
  flex-shrink: 0; white-space: nowrap;
}
.btn-theme-toggle:hover { border-color: var(--amber); color: var(--text-amber); }
@media (max-width: 640px) {
  .btn-theme-toggle { padding: 2px 6px; font-size: 10px; }
}

/* ── HERO ── */
.hero {
  max-width: 1240px;
  margin: 0 auto;
  padding: 56px 20px;
}
@media (min-width: 1024px) { .hero { padding: 80px 40px; } }

.hero-title {
  max-width: 720px;
  font-size: clamp(32px, 6vw, 56px);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.03em;
  color: var(--amber);
  text-shadow: 0 0 40px rgba(255,159,10,0.3);
  margin-top: 16px;
}

.hero-sub {
  margin-top: 32px;
  max-width: 380px;
  padding-left: 16px;
  border-left: 2px solid var(--amber-dim);
}
.hero-sub p { font-size: 13px; line-height: 1.8; color: var(--text-dim); }
.hero-sub .motion-link { display: inline-flex; align-items: center; gap: 8px; margin-top: 16px; font-size: 12px; font-weight: 600; color: var(--amber-mid); }

/* ── SECTIONS ── */
.section-dark  { border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--bg-card); }
.section-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em; color: var(--amber); }
.section-sub   { margin-top: 2px; font-size: 12px; color: var(--text-dim); }
.section-title { margin-top: 12px; font-size: 22px; font-weight: 700; letter-spacing: -0.01em; color: var(--amber); }
.section-desc  { margin-top: 16px; max-width: 480px; font-size: 13px; line-height: 1.8; color: var(--text-dim); }
.section-head  { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 32px; }
.hex-icon      { font-size: 18px; color: var(--amber); flex-shrink: 0; margin-top: 2px; }

/* ── HOW IT WORKS ── */
.how-grid { display: grid; gap: 40px; }
@media (min-width: 1024px) { .how-grid { grid-template-columns: 0.8fr 1.2fr; } }
.steps-grid { display: grid; gap: 12px; }
@media (min-width: 640px) { .steps-grid { grid-template-columns: repeat(3, 1fr); } }
.step-card { padding: 20px; border: 1px solid var(--border); background: var(--bg); }
.step-num  { font-size: 12px; font-weight: 700; color: var(--amber); background: var(--amber-faint); display: inline-block; padding: 2px 10px; border: 1px solid var(--amber-dim); }
.step-title { margin-top: 24px; font-size: 13px; font-weight: 600; color: var(--text-amber); }
.step-desc  { margin-top: 8px; font-size: 12px; line-height: 1.7; color: var(--text-dim); }

/* ── COMMUNITY ── */
.publish-section { display: grid; gap: 32px; padding-top: 64px; padding-bottom: 64px; }
@media (min-width: 1024px) { .publish-section { grid-template-columns: 0.7fr 1fr; } }

.community-section { display: grid; gap: 32px; }
@media (min-width: 1024px) { .community-section { grid-template-columns: 1fr 1fr; } }
.community-rules { padding: 24px 32px; border: 1px solid var(--amber-dim); background: rgba(255,159,10,0.03); }
.rules-list { margin-top: 24px; display: grid; gap: 12px; list-style: none; font-size: 12px; line-height: 1.7; color: var(--text-dim); }
.rules-list li { padding-left: 12px; border-left: 2px solid var(--amber-dim); }
.stats-grid { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; }
.stat-card  { padding: 24px; border: 1px solid var(--border); }
.stat-full  { grid-column: 1 / -1; }
.stat-num   { font-size: 26px; font-weight: 700; color: var(--amber); }
.stat-title { font-size: 13px; font-weight: 600; color: var(--text-amber); }
.stat-desc  { margin-top: 8px; font-size: 12px; color: var(--text-dim); }

/* ── FOOTER ── */
footer { border-top: 1px solid var(--border); }
.footer-inner {
  max-width: 1240px; margin: 0 auto; padding: 24px 20px;
  display: flex; flex-direction: column; gap: 8px;
  font-size: 11px; color: var(--text-dim);
}
@media (min-width: 640px) { .footer-inner { flex-direction: row; justify-content: space-between; align-items: center; } }
@media (min-width: 1024px) { .footer-inner { padding: 24px 40px; } }
.footer-links { display: flex; flex-wrap: wrap; align-items: center; gap: 20px; }
.footer-links .amber-dim { color: var(--amber-dim); }
.footer-links a:hover { color: var(--text-dim); }

/* ── LISTINGS PANEL ── */
.listings-wrapper { display: flex; flex-direction: column; gap: 24px; }

.listings-header { border-bottom: 1px solid var(--border); padding-bottom: 20px; }
.listings-top { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.listings-count { font-size: 11.5px; color: var(--amber-dim); }
.listings-count span { color: var(--amber); }

.filters-box { border: 1px solid var(--border); background: var(--bg-card); padding: 16px; }
.filters-title { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; color: var(--text-amber); margin-bottom: 14px; }
.filters-title svg { color: var(--amber); }
.filters-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.filter-search { grid-column: 1 / -1; position: relative; }
.filter-search input { padding-left: 32px; }
.filter-search-icon { position: absolute; left: 10px; top: 12px; width: 14px; height: 14px; color: var(--amber-dim); pointer-events: none; }

.field, select.field {
  height: 40px;
  width: 100%;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  padding: 0 10px;
  outline: none;
  cursor: pointer;
  transition: border-color 180ms;
}
.field:focus { border-color: var(--amber-dim); color: var(--text-amber); }
option { background: var(--bg); }

.btn-reset {
  height: 40px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--border); background: transparent;
  color: var(--text-dim); font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px; cursor: pointer; padding: 0 12px; transition: all 180ms;
}
.btn-reset:hover { border-color: var(--amber-dim); color: var(--text-amber); }

.error-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  border: 1px solid #8a3a1a; padding: 12px 16px;
  font-size: 12px; color: var(--red);
}
.btn-retry { background: none; border: none; color: var(--amber-mid); cursor: pointer; font-family: inherit; font-size: 12px; text-decoration: underline; }

/* ── LISTING CARDS ── */
.listings-list { display: grid; gap: 10px; }
.listing-card {
  padding: 20px;
  border: 1px solid var(--border); background: var(--bg-card);
  transition: transform 220ms ease, border-color 220ms ease, box-shadow 220ms ease;
}
.listing-card:hover {
  transform: translateY(-3px);
  border-color: var(--amber-dim);
  box-shadow: 0 8px 28px rgba(255,159,10,0.08);
}
.listing-card-inner { display: flex; flex-direction: column; gap: 16px; }
@media (min-width: 640px) { .listing-card-inner { flex-direction: row; align-items: flex-start; justify-content: space-between; } }
.listing-game { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.18em; color: var(--amber); }
.listing-game::before { content: '→ '; color: var(--amber-dim); }
.listing-title { margin-top: 8px; font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.listing-title a { color: var(--text-amber); transition: color 180ms; }
.listing-title a:hover { color: var(--amber); }
.listing-desc { margin-top: 8px; max-width: 640px; font-size: 12px; line-height: 1.7; color: var(--text-dim); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.listing-tags { display: flex; flex-shrink: 0; flex-wrap: wrap; align-items: center; gap: 6px; }
.tag { padding: 2px 10px; border: 1px solid var(--border); background: var(--amber-faint); font-size: 10.5px; color: var(--amber-dim); }
.listing-footer { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--border-dim); display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 11px; color: var(--text-dim); }
.listing-author { display: flex; align-items: center; gap: 8px; }
.avatar { display: inline-grid; place-items: center; width: 24px; height: 24px; font-size: 9px; font-weight: 700; border: 1px solid var(--amber-dim); background: var(--amber-faint); color: var(--amber); flex-shrink: 0; }
.listing-author a { color: var(--text-amber); transition: color 180ms; }
.listing-author a:hover { color: var(--amber); }
.listing-link { font-size: 11px; font-weight: 500; color: var(--amber-mid); transition: color 180ms; }
.listing-link:hover { color: var(--amber); }

/* ── EMPTY STATE ── */
.empty-state { border: 1px dashed var(--border); padding: 48px 24px; text-align: center; }
.empty-title { font-weight: 600; font-size: 13px; color: var(--text-amber); }
.empty-desc  { margin-top: 8px; font-size: 12px; color: var(--text-dim); }

/* ── PAGINATION ── */
.pagination { display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--border); padding-top: 16px; font-size: 12px; }
.btn-page {
  display: inline-flex; align-items: center; gap: 4px;
  border: 1px solid var(--border); background: transparent;
  color: var(--text-dim); font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px; cursor: pointer; padding: 8px 12px; transition: all 180ms;
}
.btn-page:hover:not(:disabled) { border-color: var(--amber-dim); color: var(--text-amber); }
.btn-page:disabled { opacity: 0.4; cursor: not-allowed; }
.page-info { color: var(--amber-dim); }
.page-info span { color: var(--amber); }

/* ── PUBLISH AREA ── */
.publish-locked {
  padding: 24px;
  border: 1px solid var(--border); background: var(--bg-card);
}
.publish-locked p { font-size: 12px; color: var(--text-dim); }
.publish-locked a {
  margin-top: 20px;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 16px; font-size: 12px; font-weight: 600;
  background: var(--amber-faint); border: 1px solid var(--amber-dim); color: var(--amber);
  transition: opacity 180ms;
}
.publish-locked a:hover { opacity: 0.85; }

.listing-form {
  display: grid; gap: 10px; grid-template-columns: repeat(2, 1fr);
  border: 1px solid var(--border); background: var(--bg-card); padding: 20px;
}
.listing-form .field        { color: var(--text-amber); font-size: 12px; }
.listing-form input.full    { grid-column: 1 / -1; }
.listing-form textarea.field { grid-column: 1 / -1; height: auto; min-height: 96px; padding: 12px; resize: vertical; }
.textarea { height: auto; min-height: 96px; padding: 12px; resize: vertical; }

/* ── MODAL ── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.75);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.modal-box {
  width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto;
  background: var(--bg-card); border: 1px solid var(--border);
  padding: 28px;
}
.modal-title { margin-top: 20px; font-size: 18px; font-weight: 700; color: var(--amber); }

.terminal-bar { display: flex; align-items: center; gap: 7px; padding-bottom: 16px; border-bottom: 1px solid var(--border-dim); margin-bottom: 4px; }
.dot   { width: 10px; height: 10px; border-radius: 50%; opacity: 0.7; display: inline-block; flex-shrink: 0; }
.red   { background: #ff5f57; }
.yellow{ background: #febc2e; }
.green { background: #28c840; }
.terminal-label { margin-left: 8px; font-size: 11px; color: var(--text-dim); letter-spacing: 0.04em; }

.form-error   { font-size: 11.5px; color: var(--red); grid-column: 1 / -1; }
.form-success { font-size: 11.5px; color: var(--green); grid-column: 1 / -1; }
.form-buttons { grid-column: 1 / -1; display: flex; gap: 10px; }

.btn-primary {
  flex: 1; height: 44px;
  background: var(--amber-faint); border: 1px solid var(--amber-dim); color: var(--amber);
  font-family: 'JetBrains Mono', monospace; font-size: 12px; font-weight: 700;
  cursor: pointer; letter-spacing: 0.04em; transition: all 180ms;
}
.btn-primary:hover:not(:disabled) { border-color: var(--amber); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; color: var(--amber-dim); }
.btn-secondary {
  padding: 0 16px; height: 44px;
  background: transparent; border: 1px solid var(--border); color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace; font-size: 12px; cursor: pointer; transition: all 180ms;
}
.btn-secondary:hover { border-color: var(--amber-dim); color: var(--text-amber); }

/* ── DETAIL PAGE ── */
.detail-container { max-width: 720px; margin: 0 auto; padding: 48px 20px; }
.detail-back { font-size: 12px; color: var(--text-dim); transition: color 180ms; }
.detail-back:hover { color: var(--amber); }
.detail-card { margin-top: 24px; border: 1px solid var(--border); background: var(--bg-card); padding: 28px 32px; }
.detail-game { font-size: 10.5px; font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase; color: var(--amber-dim); }
.detail-game::before { content: '→ '; color: var(--amber); }
.detail-title { margin-top: 12px; font-size: clamp(20px, 3vw, 26px); font-weight: 700; color: var(--amber); text-shadow: 0 0 24px rgba(255,159,10,0.25); line-height: 1.2; }
.detail-meta { margin-top: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 11px; color: var(--text-dim); }
.detail-meta .tag { padding: 2px 10px; }
.detail-date { color: var(--text-dim); }
.detail-body { margin-top: 24px; white-space: pre-line; line-height: 1.9; font-size: 13px; color: var(--text-amber); }
.detail-author { margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--border-dim); font-size: 12px; color: var(--text-dim); }
.detail-author a { color: var(--text-amber); transition: color 180ms; }
.detail-author a:hover { color: var(--amber); }

.detail-actions { margin-top: 24px; display: flex; flex-wrap: wrap; gap: 10px; }
.btn-action {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 16px; font-size: 12px; font-weight: 600;
  background: var(--amber-faint); border: 1px solid var(--amber-dim); color: var(--amber);
  cursor: pointer; font-family: 'JetBrains Mono', monospace; transition: all 180ms;
}
.btn-action:hover { border-color: var(--amber); }
.btn-action-secondary {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 16px; font-size: 12px;
  background: transparent; border: 1px solid var(--border); color: var(--text-dim);
  cursor: pointer; font-family: 'JetBrains Mono', monospace; transition: all 180ms;
}
.btn-action-secondary:hover { border-color: var(--amber-dim); color: var(--text-amber); }
.btn-danger {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 16px; font-size: 12px;
  background: transparent; border: 1px solid #8a3a1a; color: var(--red);
  cursor: pointer; font-family: 'JetBrains Mono', monospace; transition: all 180ms;
}
.btn-danger:hover { border-color: var(--red); }

/* ── AUTH PAGES ── */
.auth-page { min-height: 100vh; display: grid; place-items: center; background: var(--bg); padding: 40px 20px; }
.auth-box { width: 100%; max-width: 440px; border: 1px solid var(--border); background: var(--bg-card); padding: 32px; }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 32px; }
.auth-brand img { width: 32px; height: 32px; object-fit: cover; border: 1px solid var(--amber-dim); }
.auth-label-field {
  display: flex; flex-direction: column; gap: 8px; grid-column: 1 / -1;
}
.auth-label-field label { font-size: 11.5px; color: var(--text-dim); letter-spacing: 0.08em; text-transform: uppercase; }
.auth-label-field label span.amber-dim::after { content: ' '; }
.auth-hint { font-size: 11px; color: var(--text-dim); margin-top: 4px; }
.auth-form { display: flex; flex-direction: column; gap: 20px; margin-top: 28px; }
.auth-form .field { height: 44px; font-size: 13px; padding: 0 12px; }
.auth-footer { margin-top: 24px; text-align: center; font-size: 12px; color: var(--text-dim); }
.auth-footer a { color: var(--amber-mid); font-weight: 600; transition: color 180ms; }
.auth-footer a:hover { color: var(--amber); }

/* ── PROFILE PAGE ── */
.profile-header { border: 1px solid var(--border); background: var(--bg-card); padding: 28px 32px; margin-bottom: 24px; }
.profile-name { font-size: 22px; font-weight: 700; color: var(--amber); margin-top: 12px; }
.profile-since { font-size: 11px; color: var(--text-dim); margin-top: 4px; }

/* ── MESSAGES PAGE ── */
.messages-layout { display: grid; gap: 0; min-height: calc(100vh - 80px); }
@media (min-width: 768px) { .messages-layout { grid-template-columns: 280px 1fr; } }
.conversations-panel { border-right: 1px solid var(--border); background: var(--bg-card); }
.conversation-item { padding: 14px 16px; border-bottom: 1px solid var(--border-dim); cursor: pointer; transition: background 180ms; }
.conversation-item:hover, .conversation-item.active { background: var(--amber-faint); }
.conv-name { font-size: 13px; font-weight: 600; color: var(--text-amber); }
.conv-time { font-size: 10px; color: var(--text-dim); margin-top: 2px; }
.chat-area { display: flex; flex-direction: column; height: 100%; }
.messages-list { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.message-row { max-width: 70%; }
.message-row.own { align-self: flex-end; }
.message-bubble { padding: 10px 14px; font-size: 12px; line-height: 1.6; }
.message-bubble.own { background: var(--amber-faint); border: 1px solid var(--amber-dim); color: var(--text-amber); }
.message-bubble.other { background: var(--bg-card); border: 1px solid var(--border); color: var(--text-dim); }
.message-time { font-size: 10px; color: var(--text-dim); margin-top: 4px; }
.chat-input-area { border-top: 1px solid var(--border); padding: 16px; display: flex; gap: 10px; }
.chat-input-area input { flex: 1; }

/* ── ANIMATIONS ── */
@keyframes zg-fade-up  { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes zg-fade-in  { from { opacity: 0; } to { opacity: 1; } }
@keyframes amber-pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(255,159,10,0); } 50% { box-shadow: 0 0 0 6px rgba(255,159,10,0.12); } }
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0; } }

.motion-page  { animation: zg-fade-in 500ms ease-out both; }
.motion-rise  { animation: zg-fade-up 650ms cubic-bezier(.22,1,.36,1) both; }
.motion-stagger > * { animation: zg-fade-up 600ms cubic-bezier(.22,1,.36,1) both; }
.motion-stagger > *:nth-child(2) { animation-delay: 90ms; }
.motion-stagger > *:nth-child(3) { animation-delay: 180ms; }
.motion-link { transition: color 180ms ease, transform 180ms ease; }
.motion-link:hover { transform: translateX(3px); color: var(--amber); }
.motion-brand { animation: amber-pulse 2.8s ease-in-out 900ms 2; }
.cursor-blink { color: var(--amber); animation: blink 1.1s step-end infinite; }

/* ── FOCUS ── */
:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; }

/* ── REDUCED MOTION ── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ── TOAST ── */
#toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 9000;
  padding: 12px 18px; font-size: 12px;
  border: 1px solid var(--amber-dim); background: var(--bg-card); color: var(--text-amber);
  animation: zg-fade-up 300ms ease both;
  pointer-events: none;
}
#toast.error { border-color: #8a3a1a; color: var(--red); }

/* ── ADMIN ── */
.admin-section { border: 1px solid var(--border); background: var(--bg-card); padding: 20px; margin-bottom: 24px; }
.admin-title { font-size: 15px; font-weight: 700; color: var(--amber); margin-bottom: 16px; }
.report-item { padding: 14px; border: 1px solid var(--border); margin-bottom: 8px; }
.report-meta { font-size: 11px; color: var(--text-dim); }
.report-text { font-size: 12px; color: var(--text-amber); margin-top: 4px; }
.report-actions { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }

/* ── MESSAGES / CHAT ── */
.messages-layout {
  display: grid; grid-template-columns: 240px 1fr; height: calc(100vh - 96px); overflow: hidden;
}
.conversations-panel {
  border-right: 1px solid var(--border); overflow-y: auto; background: var(--bg-card);
}
.conversation-item {
  padding: 14px 16px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background 150ms;
}
.conversation-item:hover { background: rgba(255,159,10,.06); }
.conversation-item.active { background: rgba(255,159,10,.12); border-left: 2px solid var(--amber); }
.conv-name { font-size: 12.5px; color: var(--text-amber); }
.chat-area { display: flex; flex-direction: column; overflow: hidden; }
.messages-list { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.message-row { display: flex; flex-direction: column; }
.message-row.own { align-items: flex-end; }
.message-row.other { align-items: flex-start; }
.message-bubble {
  max-width: 72%; padding: 10px 14px; font-size: 12.5px; line-height: 1.5;
  border: 1px solid var(--border);
}
.message-bubble.own  { background: rgba(255,159,10,.12); border-color: var(--amber-dim); color: var(--text-amber); }
.message-bubble.other { background: var(--bg-card); color: var(--text-muted); }
.message-time { font-size: 10px; color: var(--text-dim); margin-top: 3px; }
.chat-input-area {
  display: flex; gap: 8px; padding: 14px 16px;
  border-top: 1px solid var(--border); background: var(--bg-card);
}
.chat-input-area .field { flex: 1; }
/* ══════════════════════════════════════════════════════════════
   MOBILE – max 640px
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 640px) {

  /* ── Nav ── */
  .nav-inner { gap: 8px; padding: 8px 14px; }
  .brand-name { font-size: 13px; }
  .brand-img  { width: 26px; height: 26px; }
  .nav-actions { gap: 6px; flex-wrap: nowrap; overflow: hidden; }
  .nav-link    { font-size: 11px; gap: 4px; }
  .nav-link-name { max-width: 72px; font-size: 11px; }
  .btn-register { padding: 6px 10px; font-size: 11px; }
  .btn-signout  { padding: 5px 8px; font-size: 10.5px; }
  /* Ukryj etykiety, pokaż tylko ikony w małym nav */
  #nav-following { display: none !important; }

  /* ── Hero ── */
  .hero { padding: 32px 16px; }
  .hero-title { font-size: clamp(26px, 8vw, 40px); }
  .hero-sub { max-width: 100%; }

  /* ── Sekcje ── */
  .py-section { padding-top: 36px; padding-bottom: 36px; }
  .section-title { font-size: 18px; }
  .publish-section  { padding-top: 36px; padding-bottom: 36px; gap: 24px; }
  .community-section { gap: 20px; }
  .how-grid { gap: 24px; }
  .steps-grid { grid-template-columns: 1fr; gap: 10px; }

  /* ── Filtry i listings ── */
  .filters-grid { grid-template-columns: 1fr; }
  .filters-box { padding: 12px; }
  .listing-card { padding: 14px; }
  .listing-card-inner { flex-direction: column; gap: 12px; }
  .listing-tags { flex-wrap: wrap; gap: 5px; }
  .listing-footer { flex-direction: column; align-items: flex-start; gap: 8px; }
  .listings-top { flex-direction: column; align-items: flex-start; gap: 4px; }

  /* ── Formularz ogłoszenia – 1 kolumna ── */
  .listing-form { grid-template-columns: 1fr; padding: 14px; gap: 8px; }
  /* override inline style="grid-column:1/-1" z JS */
  .listing-form > * { grid-column: 1 !important; }

  /* ── Pagination ── */
  .pagination { gap: 8px; }
  .btn-page { padding: 8px; font-size: 10.5px; }
  .page-info { font-size: 10.5px; }

  /* ── Detail page ── */
  .detail-container { padding: 24px 14px; }
  .detail-card { padding: 18px 16px; }
  .detail-title { font-size: 18px; }
  .detail-actions { flex-direction: column; }
  .btn-action, .btn-action-secondary, .btn-danger { width: 100%; justify-content: center; }

  /* ── Profile ── */
  .profile-header { padding: 20px 16px; }
  .profile-name   { font-size: 19px; }

  /* ── Auth ── */
  .auth-box { padding: 20px 16px; }
  .auth-form .field { font-size: 14px; height: 46px; }

  /* ── Messages / Chat ── */
  .messages-layout {
    grid-template-columns: 1fr;
    grid-template-rows: 140px 1fr;
    height: calc(100vh - 80px);
  }
  .conversations-panel {
    height: 140px;
    overflow-x: auto;
    overflow-y: hidden;
    display: flex;
    flex-direction: row;
    align-items: stretch;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .conversation-item {
    min-width: 130px;
    max-width: 160px;
    border-bottom: none;
    border-right: 1px solid var(--border);
    padding: 12px;
    flex-shrink: 0;
  }
  .conv-name { font-size: 11.5px; }
  .chat-area { min-height: 0; }
  .messages-list { padding: 12px; gap: 8px; }
  .message-bubble { max-width: 88%; font-size: 12px; }
  .chat-input-area { padding: 10px 12px; gap: 6px; }
  .chat-input-area .field { font-size: 13px; }

  /* ── Modal ── */
  .modal-box { padding: 18px 14px; max-height: 95vh; }
  .modal-overlay { padding: 10px; align-items: flex-end; }

  /* ── Admin ── */
  .admin-section { padding: 14px; }
  .report-actions { gap: 6px; }
  .report-actions button { font-size: 10.5px; padding: 5px 10px; }

  /* ── Toast ── */
  #toast { bottom: 16px; right: 12px; left: 12px; text-align: center; font-size: 11.5px; }

  /* ── Settings ── */
  .container[style*="max-width:560px"] { padding: 28px 14px; }
}

/* ── Bardzo małe ekrany (≤ 375px) ── */
@media (max-width: 375px) {
  .hero-title   { font-size: 24px; }
  .brand-name   { display: none; }
  .nav-actions  { gap: 4px; }
  .nav-link-name { max-width: 60px; }
}

/* ── PROFILE ── */
.profile-header { margin-bottom: 32px; }
.profile-name { font-size: 24px; font-weight: 700; color: var(--amber); margin-top: 8px; }
.profile-since { font-size: 11.5px; color: var(--text-dim); margin-top: 4px; }

/* ── DETAIL PAGE ── */
.detail-container { max-width: 680px; margin: 0 auto; padding: 48px 20px; }
.detail-back { font-size: 12px; color: var(--text-dim); text-decoration: none; display: inline-block; margin-bottom: 24px; }
.detail-back:hover { color: var(--amber); }
.detail-card { border: 1px solid var(--border); background: var(--bg-card); padding: 28px; margin-bottom: 20px; }
.detail-game { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--amber-dim); margin-bottom: 8px; }
.detail-title { font-size: 20px; font-weight: 700; color: var(--amber); margin-bottom: 16px; line-height: 1.3; }
.detail-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.detail-date { font-size: 11px; color: var(--text-dim); display: flex; align-items: center; }
.detail-body { font-size: 13px; color: var(--text-muted); line-height: 1.8; white-space: pre-wrap; word-break: break-word; }
.detail-author { margin-top: 20px; font-size: 12px; color: var(--text-dim); padding-top: 16px; border-top: 1px solid var(--border); }
.detail-author a { color: var(--amber-mid); }
.detail-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.btn-action { font-family: inherit; font-size: 12px; padding: 10px 16px; background: transparent; border: 1px solid var(--amber-dim); color: var(--amber); cursor: pointer; transition: all 150ms; text-decoration: none; display: inline-block; }
.btn-action:hover { background: rgba(255,159,10,.1); border-color: var(--amber); }
.btn-action-secondary { font-family: inherit; font-size: 12px; padding: 10px 16px; background: transparent; border: 1px solid var(--border); color: var(--text-dim); cursor: pointer; transition: all 150ms; text-decoration: none; display: inline-block; }
.btn-action-secondary:hover { color: var(--amber-mid); border-color: var(--amber-dim); }
.btn-danger { font-family: inherit; font-size: 12px; padding: 10px 16px; background: transparent; border: 1px solid #6a2410; color: var(--red); cursor: pointer; transition: all 150ms; }
.btn-danger:hover { background: rgba(255,59,48,.08); border-color: var(--red); }

/* ── POLICY ── */
.policy-page { padding: 48px 20px 80px; max-width: 720px; margin: 0 auto; }
.policy-content h2 { font-size: 13px; font-weight: 700; color: var(--amber); margin: 28px 0 10px; text-transform: uppercase; letter-spacing: .06em; }
.policy-content p { font-size: 12.5px; color: var(--text-muted); line-height: 1.75; margin-bottom: 10px; }
.policy-content ul { margin: 8px 0 14px 20px; }
.policy-content ul li { font-size: 12.5px; color: var(--text-muted); line-height: 1.7; margin-bottom: 4px; }
.policy-content a { color: var(--amber-mid); }
.policy-date { font-size: 11px; color: var(--text-dim); margin-bottom: 24px; }
.policy-back { margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--border); }
.policy-back a { font-size: 12px; color: var(--text-dim); text-decoration: none; }
.policy-back a:hover { color: var(--amber); }

/* ── AUTH PAGE LAYOUT ── */
.auth-page { display: flex; flex-direction: column; min-height: 100vh; }
.auth-main { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px 20px; }
.auth-box { width: 100%; max-width: 400px; border: 1px solid var(--border); background: var(--bg-card); padding: 28px; }
.auth-brand { display: flex; align-items: center; gap: 10px; margin: 20px 0 16px; }
.auth-brand img { width: 28px; height: 28px; object-fit: contain; }
.auth-brand span { font-size: 16px; font-weight: 700; }
.auth-form { display: flex; flex-direction: column; gap: 14px; margin: 20px 0; }
.auth-label-field { display: flex; flex-direction: column; gap: 5px; }
.auth-label-field label { font-size: 11px; color: var(--text-dim); }
.auth-hint { font-size: 10.5px; color: var(--text-dim); margin-top: 2px; }
.auth-footer { font-size: 12px; color: var(--text-dim); margin-top: 16px; text-align: center; }
.auth-footer a { color: var(--amber-mid); }

/* ── PUBLISH LOCKED ── */
.publish-locked {
  border: 1px dashed var(--border); padding: 32px; text-align: center; background: var(--bg-card);
}
.publish-locked p { font-size: 11.5px; color: var(--text-dim); margin-bottom: 16px; }
.publish-locked a { font-size: 13px; color: var(--amber); text-decoration: none; }
.publish-locked a:hover { color: var(--amber-mid); }

/* ── TERMINAL BAR ── */
.terminal-bar {
  display: flex; align-items: center; gap: 6px;
  background: rgba(0,0,0,.3); padding: 8px 14px;
  border-bottom: 1px solid var(--border); margin-bottom: 20px;
}
.dot { width: 10px; height: 10px; border-radius: 50%; }
.dot.red    { background: #ff5f57; }
.dot.yellow { background: #febc2e; }
.dot.green  { background: #28c840; }
.terminal-label { font-size: 11px; color: var(--text-dim); margin-left: 4px; }
