/* ============================================================
   HABBO ARCHIVE — Design System
   Colours, typography, and components based on classic Habbo
   Hotel aesthetics: dark navy/black, orange accents, Verdana.
   ============================================================ */

@font-face {
  font-family: 'Goldfish';
  src: url('/app/assets/volter-goldfish.woff2') format('woff2'),
       url('/app/assets/volter-goldfish.woff')  format('woff');
  font-weight: normal;
  font-style:  normal;
  font-display: swap;
}

@font-face {
  font-family: 'Goldfish';
  src: url('/app/assets/volter-bold-goldfish.woff2') format('woff2'),
       url('/app/assets/volter-bold-goldfish.woff')  format('woff');
  font-weight: bold;
  font-style:  normal;
  font-display: swap;
}

/* ── Variables ─────────────────────────────────────────────── */
:root {
  /* Backgrounds */
  --bg:          #06060f;
  --bg-panel:    #0d1117;
  --bg-window:   #111827;
  --bg-surface:  #1a2035;
  --bg-raised:   #1e2d45;

  /* Brand colours */
  --orange:       #FF9900;
  --orange-dark:  #cc7a00;
  --orange-dim:   rgba(255, 153, 0, 0.12);
  --orange-glow:  rgba(255, 153, 0, 0.25);
  --blue:         #4a8fcc;
  --blue-dark:    #1e3a5f;
  --blue-bright:  #66b2ff;
  --gold:         #ffd700;

  /* Text */
  --text:         #e8eaf0;
  --text-dim:     #8899aa;
  --text-faint:   #4a5568;

  /* Borders */
  --border:       #2d4a7a;
  --border-dim:   #1a2744;
  --border-orange:#FF9900;

  /* Window chrome */
  --titlebar-bg:  #FF9900;
  --titlebar-text:#000000;
  --close-bg:     #cc2200;
  --close-hover:  #ff3300;

  /* Misc */
  --radius:       0px;   /* flat / pixel style — no border-radius */
  --shadow:       4px 4px 0 rgba(0,0,0,0.6);
  --glow-orange:  0 0 16px var(--orange-glow), 0 0 40px rgba(255,153,0,0.1);
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: Verdana, Geneva, Tahoma, sans-serif;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  background-color: var(--bg);
  /* Subtle dot-grid background — mimics habborator's paper.gif texture */
  background-image: radial-gradient(circle, #1a1a2e 1px, transparent 1px);
  background-size: 28px 28px;
}

a { color: var(--orange); text-decoration: none; }
a:hover { color: var(--gold); text-decoration: underline; }

/* ── Typography ────────────────────────────────────────────── */
.font-pixel {
  font-family: 'Goldfish', monospace;
  line-height: 1.6;
}

h1, h2, h3 { font-family: Verdana, sans-serif; font-weight: bold; }

/* ── Habbo Window Component ────────────────────────────────── */
.hb-window {
  background: var(--bg-window);
  border: 2px solid var(--border);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.hb-window--orange {
  border-color: var(--orange);
  box-shadow: var(--shadow), var(--glow-orange);
}

.hb-window__titlebar {
  background: var(--titlebar-bg);
  color: var(--titlebar-text);
  font-size: 10px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 4px 6px 4px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
  flex-shrink: 0;
}

.hb-window__title-text {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hb-window__controls {
  display: flex;
  gap: 3px;
  flex-shrink: 0;
  margin-left: 8px;
}

.hb-window__btn {
  width: 14px;
  height: 14px;
  border: 1px solid rgba(0,0,0,0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
  font-weight: bold;
  line-height: 1;
  transition: filter 0.1s;
}

.hb-window__btn:hover { filter: brightness(1.3); }
.hb-window__btn--close { background: var(--close-bg); color: #fff; }
.hb-window__btn--min   { background: #aa8800; color: #000; }

.hb-window__body {
  padding: 12px;
  flex: 1;
  overflow: auto;
  display: flex;
  flex-direction: column;
}

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-family: Verdana, sans-serif;
  font-size: 11px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.1s, border-color 0.1s, color 0.1s;
  text-decoration: none;
}

.btn--orange {
  background: var(--orange);
  border-color: var(--orange-dark);
  color: #000;
  line-height: 1;
}
.btn--orange:hover {
  background: #ffb020;
  color: #000;
  text-decoration: none;
}

.btn--ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-dim);
}
.btn--ghost:hover {
  border-color: var(--orange);
  color: var(--orange);
  text-decoration: none;
}

.btn--icon {
  padding: 5px 8px;
  font-size: 14px;
  min-width: 32px;
  justify-content: center;
}

/* ── Badge / Pill ──────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 7px;
  font-size: 10px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: 1px solid;
}

.badge--orange { background: var(--orange-dim); border-color: var(--orange); color: var(--orange); }
.badge--blue   { background: rgba(74,143,204,0.1); border-color: var(--blue); color: var(--blue-bright); }
.badge--dim    { background: transparent; border-color: var(--border); color: var(--text-dim); }

/* ── Divider ───────────────────────────────────────────────── */
.divider {
  border: none;
  border-top: 1px solid var(--border-dim);
  margin: 12px 0;
}

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-panel); }
::-webkit-scrollbar-thumb { background: var(--border); }
::-webkit-scrollbar-thumb:hover { background: var(--orange-dark); }


/* ============================================================
   LOBBY PAGE
   ============================================================ */

.lobby {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Lobby Header ──────────────────────────────────────────── */
.lobby-header {
  background: var(--bg-panel);
  border-bottom: 2px solid var(--orange);
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: 72px;
  flex-shrink: 0;
  box-shadow: 0 4px 24px rgba(0,0,0,0.5), 0 2px 0 var(--orange);
}

.lobby-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: inherit;
  flex: 1;
}

.lobby-logo:hover {
  color: inherit;
  text-decoration: none;
}

.lobby-logo__icon {
  image-rendering: pixelated;
}

.lobby-logo__text {
  font-family: 'Goldfish', monospace;
  font-weight: bold;
  font-size: 14px;
  color: var(--orange);
  text-shadow: 0 0 20px var(--orange-glow), 2px 2px 0 rgba(0,0,0,0.8);
  white-space: nowrap;
}

.lobby-logo__sub {
  font-size: 9px;
  color: var(--text-dim);
  margin-top: 4px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.header-nav {
  display: flex;
  align-self: stretch;
}

.header-nav-btn {
  display: flex;
  align-items: center;
  align-self: stretch;
  padding: 0 28px;
  background: transparent;
  color: var(--text-dim);
  font-family: Verdana, sans-serif;
  font-size: 12px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.1s, color 0.1s;
}

.header-nav-btn:hover {
  background: var(--orange);
  color: #000;
  text-decoration: none;
}

.header-nav-btn.active {
  background: var(--orange);
  color: #000;
}

.lobby-header__right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  justify-content: flex-end;
}

.lobby-site-count {
  font-size: 11px;
  color: var(--text-dim);
  text-align: right;
  line-height: 1.4;
}

.lobby-site-count strong {
  display: block;
  font-size: 22px;
  color: var(--orange);
  font-family: 'Goldfish', monospace;
}

/* ── Lobby Hero ────────────────────────────────────────────── */
.lobby-hero {
  padding: 40px 32px 32px;
  border-bottom: 1px solid var(--border-dim);
}

.lobby-hero h1 {
  font-family: 'Goldfish', monospace;
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 3px;
  margin-bottom: 12px;
}

.lobby-hero p {
  color: var(--text-dim);
  max-width: 600px;
  font-size: 13px;
  line-height: 1.7;
}

/* ── Lobby Toolbar ─────────────────────────────────────────── */
.lobby-toolbar {
  padding: 16px 32px;
  display: flex;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid var(--border-dim);
  background: var(--bg-panel);
}

.lobby-toolbar__label {
  font-size: 10px;
  font-weight: bold;
  text-transform: uppercase;
  color: var(--text-faint);
  letter-spacing: 1px;
  white-space: nowrap;
}

.search-input {
  flex: 1;
  max-width: 320px;
  background: var(--bg);
  border: 2px solid var(--border);
  color: var(--text);
  padding: 6px 10px;
  font-family: Verdana, sans-serif;
  font-size: 12px;
  outline: none;
  transition: border-color 0.15s;
}

.search-input::placeholder { color: var(--text-faint); }
.search-input:focus { border-color: var(--orange); }

/* ── Site Grid ─────────────────────────────────────────────── */
.site-grid {
  flex: 1;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 40px;
  image-rendering: pixelated;
  background-image: repeating-linear-gradient(rgba(45,74,122,0.12) 1px, transparent 1px), repeating-linear-gradient(90deg, rgba(45,74,122,0.12) 1px, transparent 1px), linear-gradient(rgba(6,6,15,0.92), rgba(6,6,15,0.99)), url('/app/assets/bg.png');
  background-size: 40px 40px, 40px 40px, cover, cover;
  background-repeat: repeat, repeat, no-repeat, no-repeat;
  background-position: 0 0, 0 0, center, center top;
}

/* -- Category sections ---------------------------------------------------- */
.lobby-category__heading {
  font-size: 11px;
  font-weight: bold;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--orange);
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  margin: 0 0 16px 0;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
}

.lobby-category__heading:hover {
  color: var(--text);
}

.lobby-category__heading .collapse-arrow {
  margin-left: auto;
  font-size: 9px;
  color: var(--text-faint);
  transition: transform 0.15s;
}

.lobby-category__heading.collapsed .collapse-arrow {
  transform: rotate(-90deg);
}

.lobby-category__grid.collapsed {
  display: none;
}

.lobby-category__count {
  font-weight: normal;
  color: var(--text-faint);
  margin-left: 6px;
}

.lobby-category__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 24px;
}

/* ── Site Card ─────────────────────────────────────────────── */
.site-card {
  background: var(--bg-window);
  border: 2px solid var(--border);
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
  text-decoration: none;
  color: inherit;
}

.site-card:hover {
  border-color: var(--orange);
  box-shadow: var(--shadow), var(--glow-orange);
  transform: translateY(-2px);
  text-decoration: none;
}

.site-card__header {
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.site-card__header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.site-card__dot {
  width: 10px;
  height: 10px;
  border: 1px solid rgba(0,0,0,0.3);
}

.site-card__header-name {
  font-size: 10px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.site-card__body {
  padding: 16px;
  flex: 1;
  border-top: 1px solid var(--border-dim);
}

.site-card__name {
  font-family: 'Goldfish', monospace;
  font-weight: bold;
  font-size: 18px;
  color: var(--text);
  margin-bottom: 8px;
  line-height: 1.5;
  text-transform: uppercase;
}

.site-card__tagline {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.6;
  margin-bottom: 14px;
}

.site-card__stats {
  display: flex;
  gap: 16px;
  margin-bottom: 14px;
}

.site-card__stat {
  text-align: center;
}

.site-card__stat-value {
  font-family: 'Goldfish', monospace;
  font-size: 14px;
  color: var(--orange);
  display: block;
}

.site-card__stat-label {
  font-size: 9px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: block;
  margin-top: 2px;
}

.site-card__meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.site-card__footer {
  padding: 10px 16px;
  border-top: 1px solid var(--border-dim);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-panel);
}

.site-card__url {
  font-size: 10px;
  color: var(--text-faint);
  font-family: 'Courier New', monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  margin-right: 10px;
}

/* ── No Results ────────────────────────────────────────────── */
.lobby-empty {
  padding: 64px 32px;
  text-align: center;
  color: var(--text-faint);
}

.lobby-empty__icon { font-size: 48px; margin-bottom: 16px; }
.lobby-empty__text { font-size: 13px; }

.lobby-footer {
  margin-top: auto;
  padding: 16px 24px;
  border-top: 1px solid var(--border-dim);
  background: var(--bg-panel);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.footer-avatar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.footer-avatar img {
  image-rendering: pixelated;
}

.footer-author {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
  justify-content: center;
}

.footer-btn {
  padding: 4px 10px;
  font-family: Verdana, sans-serif;
  font-size: 10px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--bg-surface);
  border: 2px solid var(--border);
  color: var(--text-dim);
  text-decoration: none;
  white-space: nowrap;
  transition: border-color 0.1s, color 0.1s;
}

.footer-btn:hover {
  border-color: var(--orange);
  color: var(--orange);
  text-decoration: none;
}

.footer-author a { color: var(--text-faint); font-size: 10px; text-decoration: none; }
.footer-author a:hover { color: var(--orange); }


/* ============================================================
   VIEWER PAGE
   ============================================================ */

.viewer {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Browser Chrome (fixed top bar) ───────────────────────── */
.browser-chrome {
  background: var(--bg-panel);
  border-bottom: 2px solid var(--orange);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 20px rgba(0,0,0,0.6);
  z-index: 100;
}

/* Title bar */
.chrome-titlebar {
  background: var(--orange);
  padding: 3px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #000;
  user-select: none;
}

.chrome-titlebar__left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chrome-titlebar__site-name { font-weight: bold; }
.chrome-titlebar__divider { opacity: 0.4; }
.chrome-titlebar__page-title { font-weight: normal; opacity: 0.8; max-width: 400px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.chrome-titlebar__right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chrome-titlebar__badge {
  background: rgba(0,0,0,0.2);
  padding: 1px 6px;
  font-size: 9px;
  border: 1px solid rgba(0,0,0,0.2);
}

/* Nav bar */
.chrome-navbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
}

.chrome-nav-btn {
  width: 28px;
  height: 28px;
  background: var(--bg-surface);
  border: 2px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  transition: border-color 0.1s, color 0.1s, background 0.1s;
  flex-shrink: 0;
}

.chrome-nav-btn:hover:not(:disabled) {
  border-color: var(--orange);
  color: var(--orange);
  background: var(--orange-dim);
}

.chrome-nav-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.chrome-nav-btn--home:hover:not(:disabled) {
  border-color: var(--blue);
  color: var(--blue-bright);
  background: rgba(74,143,204,0.1);
}

.chrome-address-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.chrome-address-icon {
  position: absolute;
  left: 8px;
  font-size: 11px;
  color: var(--text-faint);
  pointer-events: none;
}

.chrome-address {
  width: 100%;
  background: var(--bg);
  border: 2px solid var(--border);
  color: var(--text-dim);
  font-family: 'Courier New', monospace;
  font-size: 12px;
  padding: 5px 10px 5px 26px;
  outline: none;
  transition: border-color 0.15s, color 0.15s;
  cursor: default;
}

.chrome-address:focus { border-color: var(--orange); color: var(--text); }

.chrome-info-btn {
  width: 28px;
  height: 28px;
  background: var(--bg-surface);
  border: 2px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: border-color 0.1s, color 0.1s;
}

.chrome-info-btn:hover,
.chrome-info-btn.active {
  border-color: var(--blue);
  color: var(--blue-bright);
}

/* Sections bar */
.chrome-sections {
  background: var(--bg);
  border-top: 1px solid var(--border-dim);
  padding: 0 10px;
  display: flex;
  align-items: center;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: thin;
  flex-shrink: 0;
}

.chrome-sections::-webkit-scrollbar { height: 3px; }

.chrome-section-btn {
  padding: 5px 10px;
  font-size: 10px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-faint);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.1s, border-color 0.1s;
  display: flex;
  align-items: center;
  gap: 5px;
}

.chrome-section-btn:hover {
  color: var(--text);
  border-bottom-color: var(--border);
}

.chrome-section-btn.active {
  color: var(--orange);
  border-bottom-color: var(--orange);
}

.chrome-section-icon { font-size: 12px; }

/* ── Viewer Layout ──────────────────────────────────────────── */
.viewer-body {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}

/* ── Info Sidebar ──────────────────────────────────────────── */
.viewer-sidebar {
  width: 240px;
  background: var(--bg-panel);
  border-right: 1px solid var(--border-dim);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
  transition: width 0.2s, opacity 0.2s;
}

.viewer-sidebar.collapsed {
  width: 0;
  opacity: 0;
  border-right: none;
}

.sidebar-section {
  padding: 14px;
  border-bottom: 1px solid var(--border-dim);
}

.sidebar-section__title {
  font-size: 9px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-faint);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sidebar-section__title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-dim);
}

.sidebar-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 0;
  font-size: 11px;
}

.sidebar-stat-row__label { color: var(--text-faint); }
.sidebar-stat-row__value { color: var(--text); font-weight: bold; }
.sidebar-stat-row__value--orange { color: var(--orange); }

.sidebar-link {
  display: block;
  padding: 4px 0;
  font-size: 11px;
  color: var(--text-dim);
  text-decoration: none;
  border-bottom: 1px solid var(--border-dim);
}

.sidebar-link:last-child { border-bottom: none; }
.sidebar-link:hover { color: var(--orange); text-decoration: none; }

/* ── Browser iframe ─────────────────────────────────────────── */
.browser-frame-wrap {
  flex: 1;
  position: relative;
  overflow: hidden;
}

#browser-frame {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  background: #fff;
}

/* Loading overlay */
.frame-loading {
  position: absolute;
  inset: 0;
  background: var(--bg-window);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  font-family: 'Goldfish', monospace;
  font-size: 10px;
  color: var(--text-dim);
  transition: opacity 0.3s;
  pointer-events: none;
}

.frame-loading.hidden { opacity: 0; }

.loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Status bar ─────────────────────────────────────────────── */
.viewer-statusbar {
  background: var(--bg-panel);
  border-top: 1px solid var(--border-dim);
  padding: 3px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-faint);
  flex-shrink: 0;
}

.statusbar-left { display: flex; align-items: center; gap: 12px; }
.statusbar-right { display: flex; align-items: center; gap: 12px; }

.status-dot {
  width: 7px;
  height: 7px;
  background: #4caf50;
  border-radius: 50%;
  display: inline-block;
  margin-right: 4px;
}

/* ── Viewer back link ───────────────────────────────────────── */
.back-to-lobby {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  color: var(--text-faint);
  text-decoration: none;
  padding: 2px 8px;
  border: 1px solid transparent;
  transition: color 0.1s, border-color 0.1s;
}

.back-to-lobby:hover {
  color: var(--orange);
  border-color: var(--orange);
  text-decoration: none;
}

/* ── Popup overlay ──────────────────────────────────────────── */
.popup-overlay {
  position: absolute;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 48px;
}

.popup-overlay.hidden {
  display: none;
}

.popup-window {
  background: var(--panel);
  border: 2px solid var(--border);
  box-shadow: 0 8px 32px rgba(0,0,0,0.8), 0 0 0 1px rgba(255,153,0,0.15);
  display: flex;
  flex-direction: column;
  width: 620px;
  max-width: calc(100vw - 40px);
  height: 440px;
  max-height: calc(100vh - 120px);
  resize: both;
  overflow: hidden;
  position: relative;
}

.popup-titlebar {
  background: var(--orange);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px 0 10px;
  height: 26px;
  flex-shrink: 0;
  cursor: move;
  user-select: none;
}

.popup-title {
  font-size: 10px;
  font-weight: bold;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  margin-right: 8px;
}

.popup-controls {
  display: flex;
  gap: 3px;
}

.popup-btn {
  background: rgba(0,0,0,0.2);
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff;
  font-size: 10px;
  cursor: pointer;
  padding: 1px 5px;
  line-height: 1;
  font-family: inherit;
}
.popup-btn:hover { background: rgba(0,0,0,0.4); }
.popup-btn--close:hover { background: #cc3300; border-color: #cc3300; }

#popup-frame {
  flex: 1;
  border: none;
  width: 100%;
  background: #fff;
}

/* ============================================================
   GALLERY PAGE
   ============================================================ */

.gallery-toolbar {
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid var(--border-dim);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg-panel);
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
}

.gallery-main {
  flex: 1;
  overflow-y: auto;
}

.gallery-scroll {
  padding: 28px 32px 48px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.gallery-tabs-wrap {
  padding: 10px 32px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  border-bottom: 1px solid var(--border-dim);
}

.gallery-cat-btn {
  padding: 5px 12px;
  font-family: Verdana, sans-serif;
  font-size: 10px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--bg-surface);
  border: 2px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.1s, border-color 0.1s, color 0.1s;
}

.gallery-cat-btn:hover {
  border-color: var(--orange);
  color: var(--orange);
}

.gallery-cat-btn.active {
  background: var(--orange);
  border-color: var(--orange-dark);
  color: #000;
}

.gallery-cat-heading {
  font-size: 11px;
  font-weight: bold;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--orange);
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  margin-bottom: -16px;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.gallery-cat-heading:hover {
  color: var(--text);
}

.gallery-cat-heading span {
  font-weight: normal;
  color: var(--text-faint);
  margin-left: 0;
}

.gallery-cat-heading .collapse-arrow {
  margin-left: auto;
  font-size: 9px;
  color: var(--text-faint);
  transition: transform 0.15s;
}

.gallery-cat-heading.collapsed .collapse-arrow {
  transform: rotate(-90deg);
}

.gallery-cat-thumbs.collapsed {
  display: none;
}

.gallery-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 6px;
}

.gallery-thumb {
  aspect-ratio: 4 / 3;
  background: var(--bg-surface);
  border: 2px solid var(--border);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.1s, box-shadow 0.1s, transform 0.1s;
  outline: none;
}

.gallery-thumb:hover,
.gallery-thumb:focus {
  border-color: var(--orange);
  box-shadow: 0 0 10px var(--orange-glow);
  transform: scale(1.03);
  z-index: 1;
  position: relative;
}

.gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ── Lightbox ──────────────────────────────────────────────── */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.lightbox.hidden { display: none; }

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  cursor: zoom-out;
}

.lightbox-window {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  max-width: calc(100vw - 160px);
  max-height: calc(100vh - 60px);
  min-width: 200px;
}

.lightbox-img-wrap {
  flex: 1;
  overflow: auto;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100px;
}

.lightbox-img-wrap img {
  max-width:  calc(100vw - 200px);
  max-height: calc(100vh - 130px);
  display: block;
}

.lightbox-footer {
  background: var(--bg-panel);
  border-top: 1px solid var(--border-dim);
  padding: 5px 12px;
  flex-shrink: 0;
}

.lb-info {
  font-size: 10px;
  color: var(--text-faint);
  font-family: 'Courier New', monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.lb-nav {
  position: relative;
  z-index: 2;
  background: var(--bg-surface);
  border: 2px solid var(--border);
  color: var(--text-dim);
  font-size: 28px;
  width: 52px;
  height: 52px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: border-color 0.1s, color 0.1s, background 0.1s;
  line-height: 1;
  padding: 0;
}

.lb-nav:hover:not(:disabled) {
  border-color: var(--orange);
  color: var(--orange);
  background: var(--orange-dim);
}

.lb-nav:disabled {
  opacity: 0.2;
  cursor: default;
}

/* ── Assets Section ────────────────────────────────────────── */
.assets-section {
  padding: 28px 32px 0;
}

.assets-section .gallery-cat-heading {
  margin-bottom: 16px;
}

.assets-section__heading {
  font-size: 11px;
  font-weight: bold;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--orange);
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  margin-bottom: 16px;
}

.assets-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.asset-card {
  width: 300px;
}

.asset-card__body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.asset-card__preview {
  font-family: 'Goldfish', monospace;
  font-size: 22px;
  color: var(--orange);
  letter-spacing: 1px;
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--border-dim);
  text-align: center;
}

.asset-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  flex: 1;
}

.asset-size:empty { display: none; }

.asset-card__tag {
  font-size: 9px;
  font-weight: bold;
  letter-spacing: 0.08em;
  padding: 2px 6px;
  background: var(--orange-dim);
  border: 1px solid var(--orange);
  color: var(--orange);
}

.asset-card__desc {
  font-size: 11px;
  color: var(--text-dim);
}

.asset-card__actions {
  display: flex;
  gap: 8px;
}

/* ── Responsive tweaks ──────────────────────────────────────── */
@media (max-width: 768px) {
  .site-grid { padding: 16px; gap: 16px; }
  .lobby-hero { padding: 24px 16px; }
  .lobby-toolbar { padding: 10px 16px; }
  .viewer-sidebar { display: none; }
  .chrome-sections { display: none; }
  .lobby-logo__text { font-size: 10px; }
}

@media (max-width: 600px) {
  .lobby-header {
    flex-wrap: wrap;
    height: auto;
    padding: 12px 16px 0;
    gap: 0;
  }
  .lobby-logo {
    flex: none;
    padding-bottom: 12px;
  }
  .lobby-header__right { display: none; }
  .header-nav {
    order: 3;
    width: 100%;
    border-top: 1px solid var(--border-dim);
    margin: 0 -16px;
    width: calc(100% + 32px);
  }
  .header-nav-btn {
    flex: 1;
    justify-content: center;
    padding: 10px 0;
    font-size: 10px;
  }
  .lobby-logo__sub { display: none; }
}



/* ============================================================
   GUESTBOOK
   ============================================================ */

.gb-sticky {
  display: none;
  position: fixed;
  width: 378px;
  height: 362px;
  background-image: url('/app/assets/actualsticky.png');
  background-repeat: no-repeat;
  background-size: 100% 100%;
  background-position: center;
  z-index: 9999;
  user-select: none;
  cursor: grab;
}
.gb-sticky:active { cursor: grabbing; }

/* Transparent overlay on the X button in the image */
.gb-close {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 24px;
  height: 24px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
}

/* Content area sits inside the red body of the sticky */
.gb-content {
  position: absolute;
  top: 47px;
  left: 14px;
  right: 12px;
  bottom: 37px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: default;
}

.gb-entries {
  flex: 1;
  overflow-y: auto;
  font-family: 'Goldfish', monospace;
  font-size: 9px;
  line-height: 1.6;
  color: #000;
  word-break: break-word;
}

.gb-entries::-webkit-scrollbar       { width: 3px; }
.gb-entries::-webkit-scrollbar-track { background: rgba(0,0,0,0.1); }
.gb-entries::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.3); }

.gb-entry  { margin-bottom: 4px; color: #000; }
.gb-sig    { color: #000; }
.gb-sep    { color: #000; margin: 4px 0; }

.gb-form {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-top: 4px;
  border-top: 1px solid rgba(0,0,0,0.3);
}

.gb-form input,
.gb-form textarea {
  background: rgba(255,255,255,0.3);
  border: 1px solid rgba(0,0,0,0.4);
  color: #000;
  font-family: 'Goldfish', monospace;
  font-size: 9px;
  padding: 2px 4px;
  width: 100%;
  outline: none;
  resize: none;
}

.gb-form input::placeholder,
.gb-form textarea::placeholder { color: rgba(0,0,0,0.45); }

.gb-form textarea { height: 36px; }

.gb-submit {
  align-self: flex-end;
  background: rgba(0,0,0,0.2);
  border: 1px solid rgba(0,0,0,0.4);
  color: #000;
  font-family: 'Goldfish', monospace;
  font-size: 9px;
  padding: 2px 10px;
  cursor: pointer;
}
.gb-submit:hover    { background: rgba(0,0,0,0.35); }
.gb-submit:disabled { opacity: 0.5; cursor: default; }

/* ============================================================
   UTILITY CLASSES (replacing inline styles)
   ============================================================ */

/* Sign Guestbook button in hero */
.btn-hero {
  margin-top: 12px;
  font-size: 10px;
  padding: 6px 16px;
}

/* Toolbar right-aligned count */
.toolbar-count {
  margin-left: auto;
}

/* Gallery tab image count */
.gallery-cat-count {
  opacity: .6;
  font-size: 9px;
}

/* Viewer sidebar scrollable section */
.sidebar-section--scroll {
  flex: 1;
  overflow-y: auto;
}

/* Viewer sidebar URL link */
.sidebar-link--url {
  font-size: 10px;
  font-family: monospace;
  word-break: break-all;
}

/* Viewer status bar text */
.status-text--dim {
  color: var(--text-dim);
}
.status-text--path {
  font-family: monospace;
  font-size: 10px;
  color: var(--text-faint);
}

/* Download All button in gallery header */
.btn--download {
  font-size: 10px;
  padding: 5px 12px;
  line-height: 1;
  text-decoration: none;
}


/* Gallery inner toolbar (no top border) */
.gallery-toolbar-inner {
  border-top: none;
  padding: 10px 32px;
}

/* Lightbox titlebar */
.lb-titlebar {
  background: var(--orange);
}

/* Lightbox open-full-size button */
.lb-open-btn {
  text-decoration: none;
  font-size: 9px;
}

/* FAQ: inline code output */
.code-output {
  color: var(--orange);
  font-family: monospace;
}

/* FAQ: small note under Linux command */
.note-hint {
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-faint);
}

/* Lobby JS generated */
.badge--dim       { font-size: 9px; }
.hb-window__body--flush { padding: 0; }
.site-card__stat-value--year { }
.site-card__actions {
  display: flex;
  gap: 6px;
  align-items: center;
}
