/* DeadAIM — Nostalgic 2003 Doorway Meets 2026 Craft */
:root {
  --bg-deep: #0b111e;
  --bg-surface: #111a2e;
  --bg-card: #16223b;
  --bg-window: #e9ecf4;
  --bg-window-body: #ffffff;
  --bg-window-chrome: linear-gradient(180deg, #1d4ed8 0%, #1e3a8a 100%);
  --bg-tab-bar: #d8dfee;
  --bg-tab-active: #ffffff;
  --text-light: #f1f5f9;
  --text-muted: #94a3b8;
  --text-win: #0f172a;
  --text-win-muted: #475569;
  --amber: #f59e0b;
  --amber-bright: #fbbf24;
  --aim-blue: #2563eb;
  --aim-navy: #172554;
  --online-green: #16a34a;
  --away-amber: #d97706;
  --offline-gray: #64748b;
  --border-win: #94a3b8;
  --border-subtle: rgba(148, 163, 184, 0.22);
  --radius-win: 8px;
  --shadow-win: 0 18px 45px rgba(2, 6, 23, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.12);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: radial-gradient(circle at 20% 0%, #172554 0%, #0b111e 55%, #070b14 100%);
  color: var(--text-light);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.5;
  min-height: 100vh;
}

/* Mandatory Modern Web Guidance Dialog Scroll Containment */
dialog:modal {
  overscroll-behavior: contain;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  background: #111a2e;
  color: var(--text-light);
  padding: 1.5rem;
  max-width: 520px;
  width: calc(100% - 2rem);
  box-shadow: var(--shadow-win);
}

dialog::backdrop {
  overflow: hidden;
  overscroll-behavior: contain;
  background: rgba(5, 10, 20, 0.72);
  backdrop-filter: blur(3px);
}

/* Top Site Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(11, 17, 30, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-subtle);
}

.site-header-inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-light);
}

.brand-logo {
  height: 36px;
  width: auto;
  border-radius: 4px;
}

.brand-title {
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.brand-badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  background: rgba(245, 158, 11, 0.18);
  color: var(--amber-bright);
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.nav-btn {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
  padding: 0.45rem 0.85rem;
  border-radius: 6px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}

.nav-btn:hover {
  color: var(--text-light);
  background: rgba(255, 255, 255, 0.06);
}

.nav-btn[aria-current="page"], .nav-btn.active {
  color: var(--amber-bright);
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.35);
}

.cta-btn {
  background: linear-gradient(180deg, #f59e0b 0%, #d97706 100%);
  color: #090d16;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.3);
}

.cta-btn:hover {
  filter: brightness(1.08);
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-light);
  border: 1px solid var(--border-subtle);
  padding: 0.45rem 0.85rem;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
}

.secondary-btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

/* Main Layout Container */
.main-container {
  max-width: 1320px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* Hero Section */
.hero-banner {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 2rem;
  align-items: center;
  padding: 1.75rem 2rem;
  background: linear-gradient(135deg, rgba(30, 58, 138, 0.38) 0%, rgba(17, 26, 46, 0.85) 100%);
  border: 1px solid rgba(59, 130, 246, 0.28);
  border-radius: 12px;
  margin-bottom: 1.75rem;
}

@media (max-width: 960px) {
  .hero-banner {
    grid-template-columns: 1fr;
  }
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--amber-bright);
  margin-bottom: 0.65rem;
}

.hero-headline {
  font-size: clamp(1.85rem, 3.2vw, 2.65rem);
  font-weight: 800;
  line-height: 1.15;
  margin: 0 0 0.85rem 0;
  letter-spacing: -0.025em;
}

.hero-sub {
  color: #cbd5e1;
  font-size: 1.02rem;
  margin: 0 0 1.25rem 0;
  max-width: 64ch;
}

.law-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.law-pill {
  font-size: 0.76rem;
  font-weight: 600;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(148, 163, 184, 0.25);
  color: #e2e8f0;
}

/* ============================================================================
   DEADAIM WORKSPACE: BUDDY LIST (LEFT) + TABBED IM & LOG MANAGER (RIGHT)
   ============================================================================ */
.deadaim-workspace {
  display: grid;
  grid-template-columns: 310px 1fr;
  gap: 1.25rem;
  align-items: start;
  margin-bottom: 2.5rem;
}

@media (max-width: 960px) {
  .deadaim-workspace {
    grid-template-columns: 1fr;
  }
}

/* Classic 2003 DeadAIM Window Frame */
.da-window {
  background: var(--bg-window);
  color: var(--text-win);
  border-radius: var(--radius-win);
  box-shadow: var(--shadow-win);
  border: 2px solid #1e3a8a;
  overflow: hidden;
  transition: opacity 0.25s ease;
}

@media (prefers-reduced-transparency: reduce) {
  .da-window {
    opacity: 1 !important;
  }
}

.da-titlebar {
  background: var(--bg-window-chrome);
  color: #ffffff;
  padding: 0.45rem 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  user-select: none;
  border-bottom: 1px solid #0f172a;
}

.da-titlebar-left {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.da-door-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fbbf24;
  box-shadow: 0 0 6px #fbbf24;
}

.da-win-controls {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.da-win-btn {
  width: 20px;
  height: 18px;
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.da-win-btn:hover {
  background: rgba(255, 255, 255, 0.28);
}

/* Buddy List Toolbar & Identity Bar */
.bl-identity-bar {
  background: #dbe3f3;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid #b6c4de;
  font-size: 0.82rem;
}

.bl-sn-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.bl-sn-select {
  font-weight: 700;
  font-size: 0.86rem;
  padding: 0.22rem 0.45rem;
  border-radius: 4px;
  border: 1px solid #7c93bf;
  background: #ffffff;
  color: #0f172a;
  flex: 1;
}

.bl-state-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  text-transform: uppercase;
}

.bl-state-badge.online {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #86efac;
}

.bl-state-badge.away {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}

.bl-state-badge.invisible {
  background: #e2e8f0;
  color: #334155;
  border: 1px solid #94a3b8;
}

.bl-away-banner {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 5px;
  padding: 0.4rem 0.55rem;
  font-size: 0.76rem;
  color: #78350f;
  margin-top: 0.35rem;
}

/* Buddy Tree Container */
.bl-tree {
  background: var(--bg-window-body);
  min-height: 330px;
  max-height: 440px;
  overflow-y: auto;
  padding: 0.45rem 0.35rem;
}

.bl-group-header {
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #1e3a8a;
  padding: 0.3rem 0.45rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  border-radius: 4px;
}

.bl-group-header:hover {
  background: #f1f5f9;
}

.bl-buddy-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.38rem 0.55rem;
  border-radius: 5px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.1s ease;
}

.bl-buddy-row:hover {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.bl-buddy-row.active {
  background: #dbeafe;
  border-color: #60a5fa;
}

.bl-buddy-icon {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  background: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
  position: relative;
}

.bl-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  position: absolute;
  bottom: -2px;
  right: -2px;
  border: 1.5px solid #fff;
}

.bl-status-dot.online { background: var(--online-green); }
.bl-status-dot.away { background: var(--away-amber); }
.bl-status-dot.offline { background: var(--offline-gray); }

.bl-buddy-info {
  flex: 1;
  min-width: 0;
}

.bl-buddy-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.bl-alias-tag {
  font-size: 0.68rem;
  font-weight: 600;
  color: #475569;
  background: #e2e8f0;
  padding: 0.05rem 0.35rem;
  border-radius: 3px;
}

.bl-buddy-away-preview {
  font-size: 0.73rem;
  color: #92400e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 0.1rem;
}

.bl-buddy-nowplaying {
  font-size: 0.7rem;
  color: #1d4ed8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Buddy List Bottom Controls */
.bl-footer {
  background: #dbe3f3;
  border-top: 1px solid #b6c4de;
  padding: 0.5rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.35rem;
}

.da-tool-btn {
  background: linear-gradient(180deg, #ffffff 0%, #e2e8f0 100%);
  border: 1px solid #94a3b8;
  border-radius: 4px;
  color: #0f172a;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 0.35rem 0.4rem;
  cursor: pointer;
  text-align: center;
}

.da-tool-btn:hover {
  background: #ffffff;
  border-color: #2563eb;
}

.da-tool-btn.active {
  background: #fef3c7;
  border-color: #d97706;
  color: #78350f;
}

/* ============================================================================
   TABBED IM WINDOW & LOG MANAGER (RIGHT PANEL — Modern Web Guidance Tabs)
   ============================================================================ */
.da-tabstrip {
  display: flex;
  align-items: center;
  overflow-x: auto;
  background: var(--bg-tab-bar);
  border-bottom: 1px solid #94a3b8;
  padding: 0.35rem 0.5rem 0 0.5rem;
  gap: 0.25rem;
  scroll-snap-type: inline proximity;
}

.da-tab {
  position: relative;
  flex: none;
  scroll-snap-align: start;
  background: #c7d2e8;
  color: #1e293b;
  border: 1px solid #94a3b8;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  padding: 0.42rem 0.85rem;
  font-size: 0.81rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.da-tab:hover {
  background: #dce4f5;
}

/* Mandatory Modern Web Guidance Tab Selection Indicator: shape (underline border) + color */
.da-tab[aria-selected="true"] {
  background: var(--bg-tab-active);
  color: #1e3a8a;
}

.da-tab[aria-selected="true"]::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  border-block-end: 3px solid #2563eb;
}

.da-tab-unread {
  background: #dc2626;
  color: #fff;
  font-size: 0.66rem;
  padding: 0.05rem 0.35rem;
  border-radius: 999px;
}

.da-tab-close {
  font-size: 0.75rem;
  opacity: 0.65;
  margin-left: 0.2rem;
}

.da-tab-close:hover {
  opacity: 1;
  color: #dc2626;
}

/* Conversation Toolbar */
.im-conv-header {
  background: #f1f5f9;
  border-bottom: 1px solid #cbd5e1;
  padding: 0.5rem 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.8rem;
}

/* Conversation Transcript Area */
.im-transcript {
  background: #ffffff;
  height: 310px;
  overflow-y: auto;
  padding: 0.85rem 1rem;
  font-size: 0.9rem;
  border-bottom: 1px solid #cbd5e1;
}

.im-line {
  margin-bottom: 0.55rem;
  line-height: 1.42;
  word-break: break-word;
}

.im-time {
  color: #64748b;
  font-size: 0.74rem;
  margin-right: 0.35rem;
}

.im-sender-self {
  color: #dc2626;
  font-weight: 700;
}

.im-sender-buddy {
  color: #1d4ed8;
  font-weight: 700;
}

.im-delivery-tag {
  display: inline-block;
  font-size: 0.68rem;
  color: #475569;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 3px;
  padding: 0.02rem 0.3rem;
  margin-left: 0.4rem;
  vertical-align: middle;
}

.im-system-notice {
  background: #f8fafc;
  border-left: 3px solid #2563eb;
  padding: 0.35rem 0.65rem;
  font-size: 0.78rem;
  color: #334155;
  margin: 0.5rem 0;
}

/* Formatting & Expression Bar */
.im-style-bar {
  background: #e2e8f0;
  padding: 0.35rem 0.75rem;
  border-bottom: 1px solid #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.76rem;
}

/* Input Composer */
.im-composer {
  display: flex;
  gap: 0.5rem;
  padding: 0.65rem 0.75rem;
  background: #edf2f7;
}

.im-input {
  flex: 1;
  padding: 0.55rem 0.75rem;
  border: 1px solid #94a3b8;
  border-radius: 4px;
  font-size: 0.9rem;
  background: #ffffff;
  color: #0f172a;
}

.im-send-btn {
  background: linear-gradient(180deg, #2563eb 0%, #1d4ed8 100%);
  color: #ffffff;
  border: 1px solid #1e3a8a;
  border-radius: 4px;
  padding: 0.5rem 1.1rem;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
}

/* Nudge Shake Animation */
@keyframes da-nudge-shake {
  0%, 100% { transform: translate(0, 0); }
  15% { transform: translate(-7px, 4px); }
  30% { transform: translate(7px, -4px); }
  45% { transform: translate(-6px, -3px); }
  60% { transform: translate(6px, 4px); }
  75% { transform: translate(-4px, 2px); }
}

.nudge-shake {
  animation: da-nudge-shake 0.45s ease-in-out;
}

/* Content Sections (Downloads, Preservation, Trust/Status) */
.section-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 1.75rem;
  margin-bottom: 1.75rem;
}

.section-title {
  font-size: 1.45rem;
  font-weight: 800;
  margin: 0 0 0.5rem 0;
  color: var(--text-light);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.25rem;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.dl-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.sha-box {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.7rem;
  background: rgba(0, 0, 0, 0.35);
  padding: 0.35rem 0.5rem;
  border-radius: 4px;
  color: #94a3b8;
  word-break: break-all;
  margin: 0.5rem 0;
}

/* Floating Feedback Button (GoldenEye Prompt 3) */
.feedback-fab {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 50;
  background: linear-gradient(180deg, #1e3a8a 0%, #0f172a 100%);
  color: #f8fafc;
  border: 1px solid rgba(245, 158, 11, 0.55);
  border-radius: 999px;
  padding: 0.55rem 1.05rem;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.feedback-fab:hover {
  border-color: var(--amber-bright);
  transform: translateY(-1px);
}

/* Form Helpers inside Dialogs */
.form-field {
  margin-bottom: 0.9rem;
}

.form-field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 0.3rem;
  color: #cbd5e1;
}

.form-field input, .form-field textarea, .form-field select {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border-radius: 6px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: #0b111e;
  color: #f8fafc;
  font-size: 0.9rem;
}
