/* ========== Gypsy Barracks ========== */

:root {
  --bg: #08060f;
  --surface: #13101f;
  --surface-2: #1b1630;
  --surface-3: #251e40;
  --border: rgba(167, 139, 250, 0.16);
  --border-strong: rgba(167, 139, 250, 0.38);
  --text: #eeeaf9;
  --muted: #9d95b9;
  --accent: #8b5cf6;
  --accent-hi: #a78bfa;
  --accent-glow: rgba(139, 92, 246, 0.45);
  --gold: #f2c94c;
  --danger: #f87171;
  --radius: 14px;
  --header-h: 68px;
  --font-display: "Cinzel", Georgia, "Times New Roman", serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background:
    radial-gradient(1100px 600px at 10% -10%, rgba(124, 58, 237, 0.30), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(67, 56, 202, 0.20), transparent 60%),
    radial-gradient(800px 500px at 50% 110%, rgba(124, 58, 237, 0.16), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

/* Star field */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.55;
  background-image:
    radial-gradient(1px 1px at 12% 18%, #fff, transparent),
    radial-gradient(1px 1px at 68% 8%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 82% 42%, #d8ccff, transparent),
    radial-gradient(1px 1px at 33% 64%, #fff, transparent),
    radial-gradient(1px 1px at 52% 88%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 92% 78%, #fff, transparent),
    radial-gradient(1px 1px at 6% 82%, #d8ccff, transparent),
    radial-gradient(1px 1px at 44% 30%, #fff, transparent);
  background-size: 520px 520px;
}

body.no-scroll { overflow: hidden; }

main { flex: 1; }

img { max-width: 100%; }

a { color: var(--accent-hi); text-decoration: none; }

h1, h2, h3 { line-height: 1.15; margin: 0; }

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

:focus-visible {
  outline: 2px solid var(--accent-hi);
  outline-offset: 3px;
}

/* ========== Buttons & fields ========== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn-primary {
  background: linear-gradient(135deg, #9b6dff, #6d3df0);
  color: #fff;
  box-shadow: 0 8px 24px -8px var(--accent-glow);
}

.btn-primary:hover:not(:disabled) { box-shadow: 0 10px 30px -6px var(--accent-glow); }

.btn-ghost {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border-strong);
  color: var(--text);
}

.btn-ghost:hover { background: rgba(167, 139, 250, 0.12); }

.btn-danger {
  background: linear-gradient(135deg, #f87171, #dc2626);
  color: #fff;
  box-shadow: 0 8px 24px -8px rgba(248, 113, 113, 0.5);
}

.btn-block { width: 100%; }
.btn-sm { padding: 7px 14px; font-size: 0.85rem; }

.field {
  width: 100%;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
}

.field:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.25); }
.field::placeholder { color: #6f6890; }

/* ========== Header & nav ========== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(8, 6, 15, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.nav {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
}

.brand-mark {
  display: block;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  object-fit: cover;
  box-shadow: 0 0 20px -4px var(--accent-glow);
}

.brand-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-links {
  display: flex;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  display: block;
  padding: 8px 16px;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 500;
  font-size: 0.95rem;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.nav-links a:hover { color: var(--text); background: rgba(167, 139, 250, 0.1); }

.nav-links a[aria-current="page"] {
  color: #fff;
  background: rgba(139, 92, 246, 0.22);
  box-shadow: inset 0 0 0 1px var(--border-strong);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 42px;
  height: 42px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  height: 2px;
  border-radius: 2px;
  background: var(--text);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 720px) {
  .nav-toggle { display: flex; }

  .nav-links {
    display: none;
    position: absolute;
    top: calc(var(--header-h) - 4px);
    left: 16px;
    right: 16px;
    flex-direction: column;
    padding: 8px;
    border-radius: var(--radius);
    background: var(--surface-2);
    border: 1px solid var(--border);
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.7);
  }

  .nav-links.open { display: flex; }
  .nav-links a { padding: 12px 16px; border-radius: 10px; }
}

/* ========== Shared text ========== */

.eyebrow {
  margin: 0 0 10px;
  color: var(--gold);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.lead {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1.1rem;
}

.page-head {
  padding: 56px 0 36px;
  max-width: 680px;
}

.page-head h1,
.hero-text h1 {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: linear-gradient(180deg, #ffffff 30%, #c4b5fd);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.page-head h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); }

/* ========== Home ========== */

.hero { padding-top: 32px; }

.hero-frame {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  box-shadow: 0 40px 100px -40px var(--accent-glow), 0 0 0 1px rgba(0, 0, 0, 0.5);
}

.hero-frame img {
  display: block;
  width: 100%;
  height: auto;
}

.hero-frame::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 25%;
  background: linear-gradient(transparent, rgba(8, 6, 15, 0.7));
  pointer-events: none;
}

.hero-text {
  max-width: 720px;
  margin: 44px auto 0;
  text-align: center;
}

.hero-text h1 { font-size: clamp(2.4rem, 7vw, 4.4rem); }

.avatar-stack {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  margin: 28px 0 0;
  padding-left: 10px;
}

.avatar-stack img {
  width: 44px;
  height: 44px;
  margin-left: -10px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--bg);
  background: var(--surface-2);
  transition: transform 0.2s ease;
}

.avatar-stack img:hover { transform: translateY(-4px); position: relative; z-index: 1; }

.hero-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  padding-top: 72px;
  padding-bottom: 80px;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 26px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  color: var(--text);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  transform: translateY(-4px);
  border-color: var(--border-strong);
  box-shadow: 0 24px 50px -24px var(--accent-glow);
}

.card-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin-bottom: 10px;
  border-radius: 12px;
  color: var(--accent-hi);
  background: rgba(139, 92, 246, 0.14);
  border: 1px solid var(--border);
}

.card-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.card-text { color: var(--muted); }

.card-link {
  margin-top: 12px;
  color: var(--accent-hi);
  font-weight: 600;
  font-size: 0.9rem;
}

/* ========== Members ========== */

.member-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
  padding-bottom: 80px;
}

.member-card {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.member-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-strong);
  box-shadow: 0 24px 50px -24px var(--accent-glow);
}

.member-photo {
  display: block;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: var(--surface-2);
}

.member-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 25%;
  transition: transform 0.4s ease;
}

.member-card:hover .member-photo img { transform: scale(1.05); }

.member-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 16px 16px;
  border-top: 1px solid var(--border);
}

.member-name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 0.04em;
}

.member-role {
  color: var(--gold);
  font-size: 0.85rem;
  font-weight: 500;
}

@media (max-width: 480px) {
  .member-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .member-info { padding: 10px 12px 12px; }
  .member-name { font-size: 1rem; }
}

/* ========== Gallery ========== */

.gallery-grid {
  columns: 3 280px;
  column-gap: 18px;
  padding-bottom: 80px;
}

.gallery-item {
  display: block;
  width: 100%;
  margin: 0 0 18px;
  padding: 0;
  break-inside: avoid;
  overflow: hidden;
  cursor: zoom-in;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.gallery-item img {
  display: block;
  width: 100%;
  height: auto;
  transition: transform 0.4s ease;
}

.gallery-item:hover {
  border-color: var(--border-strong);
  box-shadow: 0 24px 50px -24px var(--accent-glow);
}

.gallery-item:hover img { transform: scale(1.03); }

/* ========== Leaderboards ========== */

.lb-auth {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.upload-card {
  max-width: 880px;
  margin: 0 auto 32px;
  padding: 22px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
}

.upload-card h2 {
  margin-bottom: 14px;
  font-family: var(--font-display);
  font-size: 1.2rem;
  letter-spacing: 0.04em;
}

.upload-fields {
  display: grid;
  grid-template-columns: 1fr 170px 1.3fr auto;
  align-items: end;
  gap: 14px;
}

.upload-fields .field-label { margin-top: 0; }

.upload-file {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 46px;
  padding: 0 16px;
  overflow: hidden;
  border-radius: 10px;
  border: 1px dashed var(--border-strong);
  background: var(--bg);
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.upload-file:hover,
.upload-file:focus-within { border-color: var(--accent); color: var(--text); }

.upload-file input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.upload-file span { overflow: hidden; text-overflow: ellipsis; }

.upload-card .form-message { margin-top: 14px; }

input[type="date"].field { color-scheme: dark; }

@media (max-width: 640px) {
  .upload-fields { grid-template-columns: 1fr; }
}

/* One leaderboard per row, so the scores are readable without opening it */
.lb-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
  max-width: 880px;
  margin: 0 auto;
  padding-bottom: 80px;
}

.lb-card {
  position: relative;
  margin: 0;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.lb-card:hover {
  border-color: var(--border-strong);
  box-shadow: 0 24px 50px -24px var(--accent-glow);
}

.lb-open {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: var(--surface-2);
  cursor: zoom-in;
}

.lb-open img {
  display: block;
  width: 100%;
  height: auto;
}

.lb-card figcaption {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: 0.04em;
  text-align: center;
}

.lb-edit {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  font-family: var(--font-body);
  font-weight: 400;
  letter-spacing: normal;
}

.lb-edit .field { width: auto; padding: 8px 12px; }
.lb-edit input[type="date"] { flex: 0 0 170px; }
.lb-edit input[type="text"] { flex: 1 1 220px; }

.lb-actions {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 6px;
}

.lb-action {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: rgba(19, 16, 31, 0.85);
  color: var(--text);
  cursor: pointer;
}

.lb-action:hover { color: var(--accent-hi); border-color: var(--accent); }
.lb-action.is-danger:hover { color: var(--danger); border-color: var(--danger); }

.lb-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 60px 20px;
  border-radius: var(--radius);
  border: 1px dashed var(--border);
  color: var(--muted);
  text-align: center;
}

.lb-empty strong {
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.3rem;
  letter-spacing: 0.04em;
}

/* ========== Lightbox ========== */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 72px;
  background: rgba(4, 3, 10, 0.92);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fade-in 0.2s ease;
}

.lb-figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0;
  width: 100%;
  height: 100%;
}

.lb-figure img {
  max-width: 100%;
  max-height: calc(100% - 40px);
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.8);
}

.lb-figure figcaption {
  display: flex;
  gap: 14px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.9rem;
}

.lb-caption { color: var(--text); font-weight: 600; }

.lb-btn {
  position: absolute;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: rgba(27, 22, 48, 0.85);
  color: var(--text);
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.lb-btn:hover { background: var(--accent); }
.lb-close { top: 16px; right: 16px; }
.lb-prev { left: 14px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 14px; top: 50%; transform: translateY(-50%); }

@media (max-width: 640px) {
  .lightbox { padding: 72px 12px 24px; }
  .lb-prev, .lb-next { top: auto; bottom: 18px; transform: none; }
  .lb-figure img { max-height: calc(100% - 90px); }
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ========== Chat ========== */

.chat-body .site-footer { display: none; }

.chat-page { padding-top: 24px; padding-bottom: 24px; }

.chat {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--header-h) - 48px);
  height: calc(100dvh - var(--header-h) - 48px);
  min-height: 460px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: rgba(19, 16, 31, 0.9);
  box-shadow: 0 40px 100px -50px var(--accent-glow);
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}

.chat-channel {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 1.1rem;
  font-weight: 700;
}

.hash { color: var(--muted); font-size: 1.4rem; font-weight: 400; }

.chat-me { display: flex; align-items: center; gap: 10px; min-width: 0; }
.chat-me-label { color: var(--muted); font-size: 0.85rem; }

.me-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 200px;
  padding: 4px 12px 4px 4px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
}

.me-chip #me-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 480px) {
  .chat-me-label { display: none; }
  .chat-page { padding-left: 8px; padding-right: 8px; padding-top: 8px; padding-bottom: 8px; }
  .chat { height: calc(100dvh - var(--header-h) - 16px); }
}

.avatar {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--surface-3);
  color: #fff;
  font-weight: 700;
}

.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 26px; height: 26px; font-size: 0.75rem; }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 0;
  overscroll-behavior: contain;
}

.chat-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 100%;
  color: var(--muted);
  text-align: center;
  padding: 20px;
}

.chat-empty strong {
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.4rem;
  letter-spacing: 0.04em;
}

.msg {
  position: relative;
  display: flex;
  gap: 14px;
  padding: 6px 20px;
  margin-top: 10px;
}

.msg-grouped { margin-top: 0; padding-top: 0; padding-bottom: 2px; padding-left: 74px; }
.msg:has(+ .msg-grouped) { padding-bottom: 0; }

.msg:hover { background: rgba(167, 139, 250, 0.05); }

.msg-body { min-width: 0; flex: 1; }

.msg-meta { display: flex; align-items: baseline; gap: 10px; }
.msg-author { font-weight: 700; color: #fff; }
.msg-meta time { color: var(--muted); font-size: 0.75rem; }

.msg-text {
  margin: 2px 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: #dcd6ee;
}

.msg-gif {
  display: block;
  max-width: min(320px, 100%);
  max-height: 280px;
  margin-top: 6px;
  border-radius: 10px;
  background: var(--surface-2);
}

.msg-delete {
  position: absolute;
  top: 4px;
  right: 16px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s ease, color 0.15s ease;
}

.msg:hover .msg-delete,
.msg-delete:focus-visible { opacity: 1; }
.msg-delete:hover { color: var(--danger); }

@media (hover: none) {
  .msg-delete { opacity: 0.6; }
}

/* Composer */

.composer {
  position: relative;
  padding: 0 16px 10px;
}

.composer-box {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 8px 8px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  transition: border-color 0.2s ease;
}

.composer-box:focus-within { border-color: var(--border-strong); }

.composer-locked {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
  padding: 8px 8px 8px 16px;
  border-radius: 14px;
  border: 1px dashed var(--border-strong);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.9rem;
}

.composer textarea {
  flex: 1;
  min-height: 38px;
  max-height: 160px;
  padding: 8px 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  line-height: 1.45;
  resize: none;
  outline: none;
}

.composer textarea::placeholder { color: #6f6890; }

.gif-toggle {
  height: 38px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.gif-toggle:hover,
.gif-toggle[aria-expanded="true"] { background: rgba(139, 92, 246, 0.25); }

.send-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, #9b6dff, #6d3df0);
  color: #fff;
  cursor: pointer;
}

.composer-hint {
  margin: 6px 4px 0;
  color: #6f6890;
  font-size: 0.75rem;
}

@media (max-width: 480px) {
  .composer-hint { display: none; }
}

.chat-notice {
  margin: 0 0 8px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(248, 113, 113, 0.4);
  background: rgba(248, 113, 113, 0.1);
  color: #fecaca;
  font-size: 0.9rem;
}

/* GIF panel */

.gif-panel {
  position: absolute;
  right: 16px;
  bottom: calc(100% + 8px);
  z-index: 10;
  display: flex;
  flex-direction: column;
  width: min(340px, calc(100% - 32px));
  height: min(640px, calc(100vh - var(--header-h) - 210px));
  height: min(640px, calc(100dvh - var(--header-h) - 210px));
  min-height: 260px;
  border-radius: 14px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.8);
  overflow: hidden;
  animation: fade-in 0.15s ease;
}

.gif-tabs {
  display: flex;
  gap: 4px;
  padding: 8px;
  border-bottom: 1px solid var(--border);
}

.gif-tab-btn {
  flex: 1;
  padding: 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.gif-tab-btn:hover { color: var(--text); }
.gif-tab-btn.active { color: #fff; background: rgba(139, 92, 246, 0.25); }

.gif-pane {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  padding: 12px;
}

.gif-pane[data-pane="search"],
.gif-pane[data-pane="favorites"] { flex: 1; }

.gif-results {
  flex: 1;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-height: 120px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.gif-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gif-result {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-3);
  cursor: pointer;
}

.gif-result img { display: block; width: 100%; height: auto; transition: opacity 0.15s ease; }
.gif-result:hover img { opacity: 0.8; }

.gif-message {
  margin: 0;
  padding: 16px 4px;
  color: var(--muted);
  font-size: 0.9rem;
}

.gif-attrib {
  margin: 0;
  color: #6f6890;
  font-size: 0.7rem;
  text-align: right;
}

.gif-link-preview {
  color: var(--muted);
  font-size: 0.85rem;
}

.gif-link-preview:empty { display: none; }

.gif-link-preview img {
  display: block;
  max-width: 100%;
  max-height: 220px;
  margin: 0 auto;
  border-radius: 8px;
}

/* Name modal */

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(4, 3, 10, 0.8);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fade-in 0.2s ease;
}

.modal-card {
  width: min(460px, 100%);
  padding: 28px;
  border-radius: 18px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  box-shadow: 0 40px 100px -30px var(--accent-glow);
}

.modal-card h2 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  letter-spacing: 0.04em;
}

.modal-card > p { margin: 6px 0 18px; color: var(--muted); }

.field-label {
  display: block;
  margin: 12px 0 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

.form-message {
  margin: 14px 0 0;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: rgba(139, 92, 246, 0.1);
  font-size: 0.9rem;
}

.form-message.is-error {
  border-color: rgba(248, 113, 113, 0.4);
  background: rgba(248, 113, 113, 0.1);
  color: #fecaca;
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.btn-link {
  margin-right: auto;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent-hi);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

.btn-link:hover { text-decoration: underline; }

.modal-card > .modal-switch {
  margin: 18px 0 0;
  text-align: center;
  font-size: 0.9rem;
}

select.field option { background: var(--surface); color: var(--text); }

.badge {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--gold);
  color: #1a1300;
  font-size: 0.75rem;
  font-weight: 700;
}

.modal-card-small { width: min(400px, 100%); }

/* Admin page */

.modal-card-wide {
  width: min(560px, 100%);
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
}

.admin-heading {
  margin: 20px 0 10px;
  color: var(--gold);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.admin-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

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

.admin-row-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}

.admin-row-info span {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.85rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-row-actions { display: flex; flex-shrink: 0; gap: 6px; }

.admin-empty { color: var(--muted); font-size: 0.9rem; }

@media (max-width: 480px) {
  .admin-row { flex-wrap: wrap; }
  .admin-row-actions { width: 100%; justify-content: flex-end; }
}

/* ========== Footer ========== */

.site-footer {
  padding: 28px 0;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
