/* ==========================================
   THE PROTOCOL PALETTE & VARIABLES
   ========================================== */
:root {
  --bg-primary: #070709;        /* Deep matte void space */
  --bg-secondary: #101014;      /* Elevated control panel backing */
  --border-matrix: #242430;     /* Ultra-thin structural lines */
  --accent-crimson: #b3122f;    /* Surveillance warning flag */
  --accent-magenta: #ff3355;    /* Seductive highlight flash */
  --accent-cyan: #00b894;       /* Algorithmic operational green-cyan */
  
  /* Font Hierarchies */
  --font-header: 'Orbitron', 'Rajdhani', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --bg-void: var(--bg-primary);
  --bg-sidebar: var(--bg-secondary);
  --bg-chat: #100d0e;
  --bg-elevated: #161214;
  --bg-card: #1a1518;
  --bg-overlay: rgba(6,4,6,0.92);

  --crimson: #8b1a1a;
  --crimson-bright: #c0282a;
  --crimson-mid: #a82020;
  --crimson-glow: rgba(192,40,42,0.25);
  --crimson-dim: rgba(139,26,26,0.15);

  --gold: #b87333;
  --gold-light: #d4924a;
  --gold-pale: #e8c080;
  --gold-dim: #7a4d22;
  --gold-glow: rgba(184,115,51,0.2);

  --chain: #241e22;
  --chain-light: #352d32;

  --text-primary: #e8ddd8;
  --text-secondary: #9a9090;
  --text-muted: #5a5055;
  --text-crimson: #e05050;
  --text-gold: var(--gold);

  --border-subtle: rgba(255,255,255,0.04);
  --border-default: rgba(255,255,255,0.08);
  --border-crimson: rgba(139,26,26,0.5);
  --border-gold: rgba(184,115,51,0.4);

  --radius-none: 0;
  --radius-sm: 6px;
  --radius-md: 14px;
  --radius-pill: 999px;

  --shadow-soft: 0 32px 80px rgba(0,0,0,0.55);
  --shadow-halo: 0 0 26px rgba(184,115,51,0.12);

  --nav-height: 80px;
  --sidebar-w: 220px;
  --right-w: 210px;

  --space-1: 8px;
  --space-2: 12px;
  --space-3: 18px;
  --space-4: 24px;
  --space-5: 32px;
}

/* ==========================================
   RESET & FOUNDATION
   ========================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  min-height: 100%;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  background: radial-gradient(circle, rgba(21,21,29,0.4) 0%, rgba(7,7,9,0.95) 100%), url('../1000008910_2.png') center/cover repeat, var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-mono, 'Barlow Condensed', sans-serif);
  font-size: 14px;
  line-height: 1.6;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--border-matrix);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-magenta);
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: transparent;
  color: inherit;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: var(--gold);
  text-decoration: none;
}
a:hover,
a:focus {
  color: var(--crimson-bright);
}

/* ==========================================
   UI PRIMITIVES
   ========================================== */
.input-field,
input,
textarea {
  width: 100%;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.24s ease, box-shadow 0.24s ease;
}

.input-field:focus,
input:focus,
textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(184,115,51,0.08);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.04);
  color: var(--text-primary);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.btn:hover:not(:disabled),
.btn:focus-visible {
  background: rgba(184,115,51,0.12);
  border-color: var(--gold);
  transform: translateY(-1px);
}

.btn-primary {
  border-color: var(--gold);
  background: linear-gradient(180deg, rgba(184,115,51,0.14), rgba(255,255,255,0.04));
}

.btn-close-overlay {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.03);
  color: var(--text-primary);
  font-size: 24px;
  line-height: 1;
}

.btn-full {
  width: 100%;
}

.section-title,
.panel-label,
.sidebar-section-header,
.footer-copy {
  font-family: var(--font-mono, 'Share Tech Mono', monospace);
}

.overlay-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
}

.spinner {
  width: 42px;
  height: 42px;
  border: 4px solid rgba(255,255,255,0.08);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 1.1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==========================================
   AUTH SCREEN
   ========================================== */
#auth-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  background: radial-gradient(circle at top, rgba(255,255,255,0.04), transparent 24%), rgba(0,0,0,0.92);
  z-index: 1000;
}

#auth-panel {
  width: min(480px, 100%);
  background: rgba(10,8,11,0.96);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

#auth-header {
  padding: var(--space-5) var(--space-4) var(--space-3);
  border-bottom: 1px solid rgba(255,255,255,0.05);
  text-align: center;
}

#auth-header h1 {
  font-family: var(--font-deco, 'Cinzel Decorative', serif);
  letter-spacing: 0.28em;
  font-size: 28px;
  color: var(--gold);
  margin-bottom: 12px;
}

#auth-header p {
  color: var(--text-secondary);
  font-size: 13px;
}

#auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: rgba(255,255,255,0.03);
}

.auth-tab {
  padding: 16px 0;
  border: none;
  background: rgba(255,255,255,0.03);
  color: var(--text-primary);
  font-weight: 700;
  letter-spacing: 0.08em;
}

.auth-tab.active,
.auth-tab:hover {
  background: rgba(184,115,51,0.16);
  color: var(--gold);
}

#auth-body {
  padding: var(--space-4);
  display: grid;
  gap: var(--space-3);
}

.auth-form > div {
  display: grid;
  gap: 8px;
}

.input-label {
  display: block;
  color: var(--text-secondary);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.auth-error {
  color: var(--crimson-bright);
  min-height: 18px;
  font-size: 12px;
  margin-bottom: 8px;
}

.hidden {
  display: none !important;
}

/* ==========================================
   TOP NAV
   ========================================== */
#jp-app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

#top-nav {
  position: sticky;
  top: 0;
  z-index: 800;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--nav-height);
  gap: var(--space-4);
  padding: 0 var(--space-4);
  background: rgba(8,6,8,0.92);
  border-bottom: 1px solid var(--border-subtle);
  box-shadow: 0 12px 26px rgba(0,0,0,0.4);
}

.nav-group {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.nav-left {
  flex: 1;
}

.nav-center {
  flex: 1;
  justify-content: center;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

#nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-logo {
  display: inline-flex;
  width: 42px;
  height: 42px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.03);
  color: var(--gold);
  font-size: 18px;
}

.nav-title {
  font-family: var(--font-deco, 'Cinzel Decorative', serif);
  letter-spacing: 0.16em;
  font-size: 16px;
  text-transform: uppercase;
}

.nav-tagline {
  color: var(--text-secondary);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

.nav-currency {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  background: rgba(255,255,255,0.03);
}

.currency-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--radius-pill);
  background: rgba(255,255,255,0.04);
  font-size: 12px;
}

.currency-symbol {
  display: inline-flex;
  width: 20px;
  height: 20px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
}

.nav-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 50%;
  background: rgba(255,255,255,0.03);
  color: var(--text-primary);
  font-size: 18px;
  line-height: 1;
}

.nav-icon-btn:hover,
.nav-icon-btn:focus-visible {
  border-color: var(--gold);
  background: rgba(184,115,51,0.12);
}

/* ==========================================
   MAIN LAYOUT
   ========================================== */
#main-area {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--right-w);
  gap: var(--space-4);
  flex: 1;
  min-height: calc(100vh - var(--nav-height) - 96px);
  padding: var(--space-4);
}

#chatroom {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.04));
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}

#chatroom-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid rgba(255,255,255,0.05);
  background: rgba(255,255,255,0.02);
}

#chatroom-name {
  font-family: var(--font-deco, 'Cinzel Decorative', serif);
  font-size: 20px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-primary);
}

#message-list {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-height: 0;
}

#voyeur-banner {
  padding: var(--space-3) var(--space-4);
  color: var(--text-secondary);
  font-size: 12px;
  background: rgba(255,255,255,0.03);
  border-top: 1px solid rgba(255,255,255,0.04);
}

body.is-voyeur #chat-upload-btn {
  display: none;
}

#chat-input-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: var(--space-3) var(--space-4) var(--space-4);
  border-top: 1px solid rgba(255,255,255,0.05);
  background: rgba(255,255,255,0.02);
}

#chat-input-bar textarea {
  min-height: 56px;
  resize: none;
}

#chat-send-btn {
  width: 52px;
  min-width: 52px;
  border-radius: var(--radius-sm);
}

#right-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  box-shadow: var(--shadow-soft);
}

.panel-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-bottom: var(--space-2);
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.panel-title {
  font-family: var(--font-deco, 'Cinzel Decorative', serif);
  font-size: 14px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.panel-tag {
  color: var(--text-secondary);
  font-size: 11px;
  letter-spacing: 0.12em;
}

.panel-group {
  display: grid;
  gap: 10px;
}

.panel-label {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.panel-list,
.panel-metric {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px;
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.02);
  font-size: 13px;
}

.panel-metric strong {
  color: var(--gold);
}

#app-footer {
  padding: var(--space-3) var(--space-4) var(--space-4);
  color: var(--text-secondary);
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  border-top: 1px solid rgba(255,255,255,0.05);
}

.footer-links {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--text-secondary);
}

.footer-links a:hover {
  color: var(--gold);
}

.footer-copy {
  font-family: var(--font-mono, 'Share Tech Mono', monospace);
  letter-spacing: 0.12em;
}

/* ==========================================
   OVERLAY LAYER
   ========================================== */
#overlay-container {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  background: rgba(6,4,6,0.7);
  backdrop-filter: blur(14px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.24s ease, visibility 0.24s ease;
  z-index: 1200;
}

#overlay-container.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.overlay-panel {
  position: relative;
  width: min(100%, 680px);
  max-height: min(95vh, 760px);
  background: var(--bg-secondary);
  border: 1px solid rgba(36,36,48,0.6);
  backdrop-filter: blur(12px);
  border-radius: 22px;
  box-shadow: 0 40px 120px rgba(0,0,0,0.8), 0 0 0 1px rgba(255,255,255,0.03);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.overlay-panel::before {
  content: '';
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: 44px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
}

.overlay-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: calc(var(--space-4) + 8px) var(--space-4) var(--space-3);
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.overlay-title {
  font-family: var(--font-deco, 'Cinzel Decorative', serif);
  color: var(--text-primary);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 13px;
}

.overlay-content {
  overflow: auto;
  padding: var(--space-4);
  min-height: 220px;
  max-height: calc(95vh - 110px);
}

.overlay-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.overlay-section-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

/* ==========================================
   PANEL ELEMENTS
   ========================================== */
.sidebar-section-header {
  padding: 14px 20px 10px;
  font-family: var(--font-mono, 'Share Tech Mono', monospace);
  font-size: 9px;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.sidebar-block {
  padding: 0 0 16px;
}

.sidebar-empty,
.panel-list {
  padding: 14px 18px;
  color: var(--text-secondary);
  font-size: 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: var(--radius-sm);
}

/* ==========================================
   ROLE BADGES
   ========================================== */
.role-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  border-radius: var(--radius-pill);
}

.role-badge.voyeur { background: rgba(255,255,255,0.04); color: var(--text-muted); }
.role-badge.sub { background: rgba(106,110,192,0.12); color: #7f84e0; }
.role-badge.dom { background: rgba(204,0,0,0.12); color: var(--crimson-bright); }
.role-badge.admin { background: rgba(184,115,51,0.16); color: var(--bg-void); }

/* ==========================================
   RESPONSIVE
   ========================================== */
@media (max-width: 1100px) {
  #main-area {
    grid-template-columns: 1fr;
  }

  #right-panel,
  .desktop-only {
    display: none;
  }

  #sidebar {
    position: fixed;
    inset: var(--nav-height) auto auto 0;
    width: var(--sidebar-w);
    max-width: 100%;
    transform: translateX(-100%);
    transition: transform 240ms ease;
    z-index: 950;
    box-shadow: 32px 0 90px rgba(0,0,0,0.55);
  }

  .sidebar-open #sidebar {
    transform: translateX(0);
  }

  #sidebar-backdrop {
    display: block;
  }
}

@media (max-width: 768px) {
  #top-nav {
    padding: 0 14px;
  }

  .nav-tagline {
    display: none;
  }

  #main-area {
    padding: var(--space-3);
  }

  #chat-input-bar {
    flex-direction: column;
    align-items: stretch;
  }

  #chat-input-bar textarea {
    min-height: 96px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ==========================================
   SYNTHETIC REQUIEM EXTENSIONS
   ========================================== */

/* Dual-View Protocol Architecture */
.content-executor {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--border-matrix);
  border-radius: var(--radius-md);
  box-shadow: 0 0 20px rgba(0,0,0,0.5);
  background: var(--bg-secondary);
  backdrop-filter: blur(12px);
}
.protocol-view {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.hidden-view {
  display: none !important;
}
.view-header {
  padding: 12px 18px;
  font-family: var(--font-header, 'Orbitron', sans-serif);
  font-size: 18px;
  color: var(--accent-crimson);
  border-bottom: 1px solid var(--border-matrix);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  background: rgba(255,255,255,0.02);
}
.chat-scroller, .forum-scroller {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
}

/* Terminal Input Engines */
.chat-input-bar, .forum-input-bar {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: rgba(10,10,14,0.85);
  border-top: 1px solid var(--border-matrix);
}
.forum-input-bar {
  flex-direction: column;
  align-items: stretch;
}
.forum-input-header {
  font-family: var(--font-header, 'Orbitron', sans-serif);
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.input-split {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.terminal-input, .terminal-textarea {
  flex: 1;
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--border-matrix);
  color: var(--accent-magenta);
  font-family: var(--font-mono, monospace);
  padding: 12px 16px;
  border-radius: 4px;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
  outline: none;
}
.terminal-input:focus, .terminal-textarea:focus {
  border-color: var(--accent-crimson);
  box-shadow: 0 0 12px rgba(179, 18, 47, 0.4);
}
.send-btn {
  background: rgba(179, 18, 47, 0.1);
  color: var(--accent-crimson);
  border: 1px solid var(--accent-crimson);
  padding: 12px 24px;
  font-family: var(--font-header, 'Orbitron', sans-serif);
  font-weight: 700;
  text-transform: uppercase;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.send-btn:hover {
  background: var(--accent-crimson);
  color: #fff;
  box-shadow: 0 0 15px rgba(179, 18, 47, 0.6);
}
.forum-post-btn {
  align-self: flex-end;
  margin-top: 8px;
}

/* Global Interaction Pulse */
.msg-user.domina, .msg-user.sub, .user-clickable {
  cursor: pointer;
  font-family: var(--font-mono);
  font-weight: bold;
  transition: text-shadow 0.2s ease, color 0.2s ease;
}
.msg-user.domina {
  color: var(--accent-crimson) !important;
}
.msg-user.domina:hover {
  text-shadow: 0 0 10px var(--accent-crimson);
}
.msg-user.sub {
  color: var(--accent-cyan) !important;
}
.msg-user.sub:hover {
  text-shadow: 0 0 10px var(--accent-cyan);
}
.user-clickable:hover {
  text-shadow: 0 0 10px var(--accent-magenta);
}

/* Sidebar Glassmorphism */
#sidebar {
  background: var(--bg-secondary);
  border-right: 1px solid rgba(36,36,48,0.6);
  backdrop-filter: blur(12px);
}

