/* ==========================================================================
   SCiPNET TERMINAL CORE - STARK MONOCHROME STYLESHEET
   Zero-dependency, self-contained, pitch-black aesthetic
   ========================================================================== */

:root {
  --bg-black: #000000;
  --bg-deep: #050505;
  --bg-card: #0a0a0a;
  --bg-panel: #121212;
  --border-muted: #262626;
  --border-strong: #525252;
  --border-white: #ffffff;
  --text-white: #ffffff;
  --text-muted: #737373;
  --text-light-muted: #a3a3a3;
  --text-dim: #525252;
  --font-mono: "JetBrains Mono", Consolas, "Courier New", monospace;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

html, body {
  width: 100%;
  height: 100%;
  background-color: var(--bg-black);
  color: var(--text-white);
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

::selection {
  background-color: #ffffff;
  color: #000000;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: #000000;
}
::-webkit-scrollbar-thumb {
  background: #2b2b2b;
}
::-webkit-scrollbar-thumb:hover {
  background: #ffffff;
}

/* Typography Helpers */
.font-mono { font-family: var(--font-mono) !important; }
.font-sans { font-family: var(--font-sans) !important; }

.text-\[9px\] { font-size: 11px; }
.text-\[10px\] { font-size: 12px; }
.text-\[11px\] { font-size: 13px; }
.text-xs { font-size: 13.5px; }
.text-sm { font-size: 15px; }
.text-base { font-size: 16.5px; }
.text-lg { font-size: 19px; }
.text-xl { font-size: 22px; }
.text-2xl { font-size: 26px; }
.text-3xl { font-size: 34px; }
.text-4xl { font-size: 42px; }
.text-5xl { font-size: 50px; }

.font-light { font-weight: 300; }
.font-normal { font-weight: 400; }
.font-bold { font-weight: 700; }
.font-black { font-weight: 900; }

.uppercase { text-transform: uppercase; }
.tracking-tight { letter-spacing: -0.025em; }
.tracking-normal { letter-spacing: 0; }
.tracking-wider { letter-spacing: 0.05em; }
.tracking-widest { letter-spacing: 0.15em; }

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.leading-normal { line-height: 1.5; }
.leading-relaxed { line-height: 1.65; }
.leading-tight { line-height: 1.25; }
.whitespace-pre-wrap { white-space: pre-wrap !important; }

/* Colors */
.text-white { color: #ffffff !important; }
.text-black { color: #000000 !important; }
.text-stark-muted { color: var(--text-muted) !important; }
.text-stark-lightMuted { color: var(--text-light-muted) !important; }
.text-neutral-200 { color: #e5e5e5 !important; }
.text-neutral-300 { color: #d4d4d4 !important; }
.text-neutral-400 { color: #a3a3a3 !important; }
.text-green-400 { color: #4ade80 !important; }
.text-yellow-400 { color: #facc15 !important; }
.text-red-300 { color: #fca5a5 !important; }
.text-red-400 { color: #f87171 !important; }

.bg-black { background-color: #000000 !important; }
.bg-white { background-color: #ffffff !important; }
.bg-transparent { background-color: transparent !important; }
.bg-neutral-900 { background-color: #171717 !important; }
.bg-neutral-950 { background-color: #0a0a0a !important; }
.bg-black\/80 { background-color: rgba(0, 0, 0, 0.8) !important; }
.bg-black\/90 { background-color: rgba(0, 0, 0, 0.9) !important; }

/* Borders */
.border { border: 1px solid var(--border-muted); }
.border-2 { border: 2px solid var(--border-white); }
.border-white { border-color: #ffffff !important; }
.border-white\/30 { border-color: rgba(255, 255, 255, 0.3) !important; }
.border-white\/40 { border-color: rgba(255, 255, 255, 0.4) !important; }
.border-white\/60 { border-color: rgba(255, 255, 255, 0.6) !important; }
.border-stark-border { border-color: var(--border-muted) !important; }
.border-stark-border\/50 { border-color: rgba(38, 38, 38, 0.5) !important; }
.border-stark-border\/60 { border-color: rgba(38, 38, 38, 0.6) !important; }
.border-red-500\/40 { border-color: rgba(239, 68, 68, 0.4) !important; }
.border-transparent { border-color: transparent !important; }

.border-t { border-top: 1px solid var(--border-muted); }
.border-t-2 { border-top: 2px solid var(--border-white); }
.border-b { border-bottom: 1px solid var(--border-muted); }
.border-b-2 { border-bottom: 2px solid var(--border-white); }
.border-l { border-left: 1px solid var(--border-muted); }
.border-r { border-right: 1px solid var(--border-muted); }

/* Layout & Flexbox */
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.flex-col { flex-direction: column; }
.flex-row { flex-direction: row; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1 1 0%; }
.shrink-0 { flex-shrink: 0; }

.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.justify-start { justify-content: flex-start; }

/* Grid */
.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (min-width: 640px) {
  .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sm\:inline { display: inline !important; }
  .sm\:flex-row { flex-direction: row !important; }
}

@media (min-width: 768px) {
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .md\:col-span-2 { grid-column: span 2 / span 2; }
  .md\:flex-row { flex-direction: row !important; }
  .md\:items-center { align-items: center !important; }
  .md\:items-end { align-items: flex-end !important; }
  .md\:inline { display: inline !important; }
  .md\:p-8 { padding: 2rem !important; }
  .md\:p-12 { padding: 3rem !important; }
  .md\:px-8 { padding-left: 2rem !important; padding-right: 2rem !important; }
  .md\:px-12 { padding-left: 3rem !important; padding-right: 3rem !important; }
  .md\:text-sm { font-size: 14px !important; }
  .md\:text-lg { font-size: 18px !important; }
  .md\:text-xl { font-size: 20px !important; }
  .md\:text-2xl { font-size: 24px !important; }
  .md\:text-4xl { font-size: 36px !important; }
}

@media (min-width: 1024px) {
  .lg\:px-20 { padding-left: 5rem !important; padding-right: 5rem !important; }
}

/* Gaps & Spacing */
.gap-1 { gap: 0.25rem; }
.gap-1\.5 { gap: 0.375rem; }
.gap-2 { gap: 0.5rem; }
.gap-2\.5 { gap: 0.625rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-5 { gap: 1.25rem; }
.gap-6 { gap: 1.5rem; }

.space-x-1 > * + * { margin-left: 0.25rem; }
.space-x-1\.5 > * + * { margin-left: 0.375rem; }
.space-x-2 > * + * { margin-left: 0.5rem; }
.space-x-2\.5 > * + * { margin-left: 0.625rem; }
.space-x-3 > * + * { margin-left: 0.75rem; }
.space-x-4 > * + * { margin-left: 1rem; }

.space-y-1 > * + * { margin-top: 0.25rem; }
.space-y-1\.5 > * + * { margin-top: 0.375rem; }
.space-y-2 > * + * { margin-top: 0.5rem; }
.space-y-3 > * + * { margin-top: 0.75rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-5 > * + * { margin-top: 1.25rem; }
.space-y-6 > * + * { margin-top: 1.5rem; }
.space-y-8 > * + * { margin-top: 2rem; }

/* Dimensions */
.w-full { width: 100%; }
.w-screen { width: 100vw; }
.h-full { height: 100%; }
.h-screen { height: 100vh; }
.min-h-screen { min-height: 100vh; }
.min-h-\[65vh\] { min-height: 65vh; }
.max-w-md { max-width: 28rem; }
.max-w-2xl { max-width: 42rem; }
.max-w-3xl { max-width: 48rem; }
.max-w-4xl { max-width: 56rem; }
.max-w-5xl { max-width: 64rem; }
.max-w-6xl { max-width: 72rem; }
.max-w-\[85\%\] { max-width: 85%; }
.max-w-\[90\%\] { max-width: 90%; }
.max-h-32 { max-height: 8rem; }
.max-h-\[90vh\] { max-height: 90vh; }
.w-64 { width: 16rem; }
.w-48 { width: 12rem; }

.w-1\.5 { width: 0.375rem; }
.h-1\.5 { height: 0.375rem; }
.w-2 { width: 0.5rem; }
.h-2 { height: 0.5rem; }
.w-4 { width: 1rem; }
.h-4 { height: 1rem; }
.w-6 { width: 1.5rem; }
.h-6 { height: 1.5rem; }
.w-8 { width: 2rem; }
.h-8 { height: 2rem; }
.w-10 { width: 2.5rem; }
.h-10 { height: 2.5rem; }
.w-12 { width: 3rem; }
.h-12 { height: 3rem; }
.w-14 { width: 3.5rem; }
.h-14 { height: 3.5rem; }
.w-16 { width: 4rem; }
.h-16 { height: 4rem; }

/* Paddings & Margins */
.p-1 { padding: 0.25rem; }
.p-1\.5 { padding: 0.375rem; }
.p-2 { padding: 0.5rem; }
.p-2\.5 { padding: 0.625rem; }
.p-3 { padding: 0.75rem; }
.p-3\.5 { padding: 0.875rem; }
.p-4 { padding: 1rem; }
.p-5 { padding: 1.25rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }

.px-1 { padding-left: 0.25rem; padding-right: 0.25rem; }
.px-1\.5 { padding-left: 0.375rem; padding-right: 0.375rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-2\.5 { padding-left: 0.625rem; padding-right: 0.625rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-3\.5 { padding-left: 0.875rem; padding-right: 0.875rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }

.py-0\.5 { padding-top: 0.125rem; padding-bottom: 0.125rem; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-1\.5 { padding-top: 0.375rem; padding-bottom: 0.375rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-2\.5 { padding-top: 0.625rem; padding-bottom: 0.625rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-6 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }

.pt-1 { padding-top: 0.25rem; }
.pt-2 { padding-top: 0.5rem; }
.pt-3 { padding-top: 0.75rem; }
.pt-4 { padding-top: 1rem; }
.pb-1 { padding-bottom: 0.25rem; }
.pb-2 { padding-bottom: 0.5rem; }
.pb-4 { padding-bottom: 1rem; }
.pb-6 { padding-bottom: 1.5rem; }
.pl-10 { padding-left: 2.5rem; }
.pr-3 { padding-right: 0.75rem; }

.mx-auto { margin-left: auto; margin-right: auto; }
.mt-0\.5 { margin-top: 0.125rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }

/* Positioning */
.fixed { position: fixed; }
.absolute { position: absolute; }
.relative { position: relative; }
.inset-0 { inset: 0; }
.top-0 { top: 0; }
.left-0 { left: 0; }
.right-0 { right: 0; }
.bottom-0 { bottom: 0; }
.left-3 { left: 0.75rem; }
.top-2\.5 { top: 0.625rem; }
.-top-1 { top: -0.25rem; }
.-right-1 { right: -0.25rem; }

.z-10 { z-index: 10; }
.z-20 { z-index: 20; }
.z-30 { z-index: 30; }
.z-50 { z-index: 50; }

.overflow-hidden { overflow: hidden; }
.overflow-y-auto { overflow-y: auto; }
.overflow-x-auto { overflow-x: auto; }

/* Interactive Elements */
button, input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  border-radius: 0;
}

input, textarea, select {
  background-color: #0a0a0a;
  border: 1px solid var(--border-muted);
  color: #ffffff;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: #ffffff;
}

button {
  cursor: pointer;
  background: transparent;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}

.cursor-pointer { cursor: pointer; }
.pointer-events-none { pointer-events: none; }
.user-select-none { user-select: none; }
.resize-none { resize: none; }
.hidden { display: none !important; }
.block { display: block; }
.inline-block { display: inline-block; }
.underline { text-decoration: underline; }

/* Hover States */
.hover\:bg-white:hover { background-color: #ffffff !important; color: #000000 !important; }
.hover\:bg-neutral-200:hover { background-color: #e5e5e5 !important; color: #000000 !important; }
.hover\:bg-neutral-900:hover { background-color: #171717 !important; }
.hover\:border-white:hover { border-color: #ffffff !important; }
.hover\:text-white:hover { color: #ffffff !important; }
.hover\:text-red-400:hover { color: #f87171 !important; }
.hover\:text-black:hover { color: #000000 !important; }

/* Table Styles */
table {
  width: 100%;
  border-collapse: collapse;
}

.divide-y > * + * {
  border-top: 1px solid var(--border-muted);
}
.divide-stark-border\/60 > * + * {
  border-top: 1px solid rgba(38, 38, 38, 0.6);
}

/* Watermark & SCP Aesthetics */
.classified-watermark {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-30deg);
  font-size: 8rem;
  font-weight: 900;
  color: rgba(255, 255, 255, 0.02);
  font-family: var(--font-mono);
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
  z-index: 0;
}

.stark-stamp {
  border: 2px solid #ffffff;
  padding: 2px 8px;
  font-family: var(--font-mono);
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  display: inline-block;
}

.censor-bar {
  display: inline-block;
  background-color: #ffffff;
  color: #000000;
  padding: 0 4px;
  font-family: var(--font-mono);
  font-weight: 700;
  user-select: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.censor-bar.redacted-black {
  background-color: #262626;
  color: #262626;
  border: 1px solid #404040;
}

.censor-bar.redacted-black:hover, .censor-bar.revealed {
  background-color: #000000;
  color: #ffffff;
  border: 1px solid #ffffff;
}

/* Shadow Utility */
.shadow-2xl {
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.85);
}

/* Transition Utility */
.transition {
  transition-property: color, background-color, border-color, opacity, transform;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 150ms;
}

/* 文字流光渐变动画 (SCiPNET 文字流渐变) */
@keyframes scipnetGradientShift {
  0% {
    background-position: 100% 50%;
  }
  100% {
    background-position: -100% 50%;
  }
}

.scipnet-gradient-text {
  background: linear-gradient(
    90deg,
    #404040 0%,
    #8c8c8c 25%,
    #ffffff 50%,
    #8c8c8c 75%,
    #404040 100%
  );
  background-size: 200% auto;
  color: #ffffff;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
  animation: scipnetGradientShift 2s linear infinite;
  letter-spacing: 0.12em;
  font-weight: 700;
}

@keyframes pulseEffect {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.animate-pulse {
  animation: pulseEffect 1.2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* ================= 终端质感全套动效体系 (TERMINAL MOTION & ANIMATIONS) ================= */

/* 1. 终端消息渐入与微平移 */
@keyframes terminalFadeIn {
  0% {
    opacity: 0;
    transform: translateY(8px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.terminal-fade-in {
  animation: terminalFadeIn 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* 2. 本地权威卷宗卡片扫描解密入场 (Card Scan-In) */
@keyframes cardScanIn {
  0% {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
    border-color: #ffffff;
    box-shadow: 0 0 24px rgba(255, 255, 255, 0.22);
  }
  65% {
    border-color: #ffffff;
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.14);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    border-color: rgba(255, 255, 255, 0.6);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.85);
  }
}

.card-scan-in {
  animation: cardScanIn 0.38s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* 3. 本地直出权威标识微光拂过动画 (Badge Direct Repo) */
@keyframes directRepoBadgeGlow {
  0% {
    background-color: rgba(255, 255, 255, 0.22);
    border-left-width: 4px;
    box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.25);
  }
  60% {
    background-color: rgba(255, 255, 255, 0.12);
  }
  100% {
    background-color: rgba(255, 255, 255, 0.04);
    border-left-width: 3px;
    box-shadow: none;
  }
}

.badge-direct-repo {
  animation: directRepoBadgeGlow 0.65s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* 4. 独立卷宗页面平滑展开动效 (Dossier View Reveal) */
@keyframes dossierReveal {
  0% {
    opacity: 0;
    transform: translateY(10px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.dossier-reveal {
  animation: dossierReveal 0.32s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* 5. 脚注与正文互跳发光提示 (Footnote Flash) */
@keyframes footnoteHighlight {
  0% {
    background-color: rgba(255, 255, 255, 0.4);
    border-color: #ffffff;
    box-shadow: 0 0 16px rgba(255, 255, 255, 0.35);
  }
  30% {
    background-color: rgba(255, 255, 255, 0.22);
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.2);
  }
  100% {
    background-color: transparent;
    border-color: var(--border-muted);
    box-shadow: none;
  }
}

.footnote-flash {
  animation: footnoteHighlight 1.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* 6. 快捷指令卡微动效 (Prompt Card Hover Feedback) */
.prompt-card-hover {
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.15s ease, box-shadow 0.2s ease;
}
.prompt-card-hover:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 18px rgba(255, 255, 255, 0.09);
}
.prompt-card-hover:active {
  transform: translateY(0) scale(0.99);
}

/* 7. 终端按键微触感 */
button:active {
  transform: scale(0.98);
}

/* Terminal & Dossier Hyperlinks */
#dossierView a, #chatView a {
  color: #ffffff;
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

#dossierView a:hover, #chatView a:hover {
  background-color: #ffffff;
  color: #000000 !important;
  text-decoration: none;
}

/* Wikidot Rich Typography in Dossier */
#dossierView blockquote, .dossier-rich-content blockquote {
  border-left: 3px solid #ffffff;
  padding: 0.6rem 1rem;
  margin: 0.8rem 0;
  background-color: rgba(255, 255, 255, 0.03);
  font-family: var(--font-sans);
  color: #d4d4d4;
  line-height: 1.65;
}

#dossierView hr, .dossier-rich-content hr {
  border: 0;
  border-top: 1px solid var(--border-strong);
  margin: 1.5rem 0;
}

#dossierView table, .dossier-rich-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  border: 1px solid var(--border-muted);
}

#dossierView th, .dossier-rich-content th,
#dossierView td, .dossier-rich-content td {
  border: 1px solid var(--border-muted);
  padding: 0.5rem 0.75rem;
  text-align: left;
}

#dossierView th, .dossier-rich-content th {
  background-color: #171717;
  color: #ffffff;
  font-weight: 700;
}

/* Wikidot Collapsible Blocks */
.collapsible-block {
  border: 1px solid var(--border-muted);
  background-color: rgba(255, 255, 255, 0.02);
  margin: 1rem 0;
  padding: 0.75rem;
  transition: border-color 0.15s ease;
}
.collapsible-block:hover {
  border-color: rgba(255, 255, 255, 0.5);
}
.collapsible-block-link, .collapsible-block-unfolded-link a {
  color: #ffffff !important;
  text-decoration: underline !important;
  font-weight: bold;
  cursor: pointer;
}
.collapsible-block-content {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-muted);
}

/* Wikidot Footnote References */
sup.footnoteref {
  font-family: var(--font-mono);
  font-size: 0.8em;
  padding: 0 2px;
}
sup.footnoteref a {
  color: #a3a3a3 !important;
  text-decoration: underline !important;
  transition: all 0.15s ease;
}
sup.footnoteref a:hover {
  color: #000000 !important;
  background-color: #ffffff !important;
}

/* Ruby Text (Annotations above kanji/terms) */
ruby {
  ruby-align: center;
}
rt {
  font-size: 0.75em;
  color: #a3a3a3;
}


/* Print Rules for Dossier Archival */
@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
  }
  header, #loginView, #chatView, button {
    display: none !important;
  }
  #dossierView {
    display: block !important;
  }
  #dossierView a {
    color: #000000 !important;
    text-decoration: underline !important;
  }
  .classified-watermark {
    color: rgba(0, 0, 0, 0.05) !important;
  }
}

