:root {
  --bg-primary: #071830;
  --bg-secondary: #0d2545;
  --bg-card: #0f2d52;
  --gold: #c8a020;
  --gold-light: #e0ba4a;
  --red-warn: #c41e3a;
  --text-primary: #f0f4f8;
  --text-secondary: #9ab0c8;
  --border: rgba(200, 160, 32, 0.2);
  --font-sans: 'Microsoft YaHei', 'PingFang SC', 'Noto Sans SC', sans-serif;
  --font-serif: 'Noto Serif SC', 'SimSun', serif;
  --nav-h: 64px;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  min-height: 100vh;
}

a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-light); }

/* ── Nav ────────────────────────────────── */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  height: var(--nav-h);
  background: rgba(7,24,48,0.96);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
  display: flex; align-items: center;
  padding: 0 40px;
}

.nav-logo {
  display: flex; align-items: center; gap: 12px;
  font-size: 1.3rem; font-weight: 700;
  color: var(--text-primary); letter-spacing: 0.05em;
}

.nav-logo .logo-icon {
  width: 36px; height: 36px;
  border: 2px solid var(--gold);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; color: var(--gold);
}

.nav-links {
  margin-left: auto;
  display: flex; gap: 32px; list-style: none;
}

.nav-links a {
  color: var(--text-secondary);
  font-size: 0.9rem; letter-spacing: 0.05em;
  transition: color .2s;
}
.nav-links a:hover, .nav-links a.active { color: var(--gold); }

.nav-btn {
  margin-left: 32px;
  padding: 8px 20px;
  border: 1px solid var(--gold);
  color: var(--gold);
  font-size: 0.85rem; letter-spacing: 0.05em;
  transition: background .2s, color .2s;
}
.nav-btn:hover { background: var(--gold); color: var(--bg-primary); }

/* ── Hero ───────────────────────────────── */
.hero {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  text-align: center;
  padding: calc(var(--nav-h) + 40px) 40px 80px;
  background:
    linear-gradient(to bottom, rgba(7,24,48,0.6) 0%, rgba(7,24,48,0.95) 100%),
    url('../images/hero.jpg') center/cover no-repeat;
  position: relative; overflow: hidden;
}

.hero::after {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 30%, rgba(200,160,32,0.08) 0%, transparent 70%);
  pointer-events: none;
}

.hero-kicker {
  font-size: 0.8rem; letter-spacing: 0.3em;
  color: var(--gold); text-transform: uppercase;
  margin-bottom: 20px;
}

.hero h1 {
  font-family: var(--font-serif);
  font-size: clamp(2.2rem, 5vw, 4rem);
  line-height: 1.2; font-weight: 700;
  margin-bottom: 24px;
}

.hero p {
  font-size: 1.05rem; color: var(--text-secondary);
  max-width: 560px; margin: 0 auto 40px;
}

/* ── Section ────────────────────────────── */
.section { padding: 80px 40px; }
.section-inner { max-width: 1100px; margin: 0 auto; }
.section-header { text-align: center; margin-bottom: 56px; }
.section-kicker {
  font-size: 0.75rem; letter-spacing: 0.3em;
  color: var(--gold); text-transform: uppercase; margin-bottom: 12px;
}
.section-header h2 {
  font-family: var(--font-serif);
  font-size: clamp(1.6rem, 3vw, 2.4rem); font-weight: 700;
  margin-bottom: 16px;
}
.section-header p { color: var(--text-secondary); max-width: 560px; margin: 0 auto; }

/* ── Cards ──────────────────────────────── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 28px 24px;
  transition: border-color .25s, transform .25s;
}
.card:hover { border-color: rgba(200,160,32,0.5); transform: translateY(-3px); }

/* ── Buttons ────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 32px;
  font-family: var(--font-sans);
  font-size: 0.9rem; letter-spacing: 0.1em;
  cursor: pointer; border: none; transition: all .2s;
}
.btn-gold { background: var(--gold); color: var(--bg-primary); }
.btn-gold:hover { background: var(--gold-light); color: var(--bg-primary); }
.btn-outline {
  background: transparent;
  border: 1px solid var(--gold); color: var(--gold);
}
.btn-outline:hover { background: var(--gold); color: var(--bg-primary); }

/* ── Forms ──────────────────────────────── */
.form-group { margin-bottom: 20px; }
.form-label {
  display: block; margin-bottom: 8px;
  font-size: 0.85rem; letter-spacing: 0.05em; color: var(--text-secondary);
}
.form-input {
  width: 100%; padding: 12px 16px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text-primary);
  font-family: var(--font-sans); font-size: 0.95rem;
  outline: none; transition: border-color .2s;
}
.form-input:focus { border-color: var(--gold); }
.form-input::placeholder { color: rgba(255,255,255,0.25); }

/* ── Divider ────────────────────────────── */
.divider {
  height: 1px; background: var(--border);
  margin: 60px 0;
}

/* ── Gold tag ───────────────────────────── */
.tag {
  display: inline-block;
  padding: 3px 10px;
  border: 1px solid var(--gold);
  color: var(--gold);
  font-size: 0.75rem; letter-spacing: 0.1em;
}

/* ── Footer ─────────────────────────────── */
footer {
  background: #040e1c;
  border-top: 1px solid var(--border);
  padding: 48px 40px 24px;
}

.footer-inner {
  max-width: 1100px; margin: 0 auto;
}

.footer-cols {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px; margin-bottom: 40px;
}

.footer-brand p { color: var(--text-secondary); font-size: 0.85rem; margin-top: 12px; }

.footer-col h4 {
  font-size: 0.8rem; letter-spacing: 0.15em;
  color: var(--gold); text-transform: uppercase;
  margin-bottom: 16px;
}
.footer-col ul { list-style: none; }
.footer-col ul li { margin-bottom: 8px; }
.footer-col ul li a { color: var(--text-secondary); font-size: 0.85rem; }
.footer-col ul li a:hover { color: var(--text-primary); }

.footer-bottom {
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.78rem; color: var(--text-secondary);
}

/* ── ARG: Hidden warning ─────────────────── */
.hidden-warning {
  color: #0f2d52;
  background: #0f2d52;
  user-select: text;
  -webkit-user-select: text;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 4px 8px;
  display: inline-block;
  cursor: text;
}

.hidden-warning::selection {
  color: var(--red-warn);
  background: #ffe0e5;
}

.hidden-warning *::selection {
  color: var(--red-warn);
  background: #ffe0e5;
}

/* ── Employee Cards ─────────────────────── */
.emp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 28px;
}

.emp-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: border-color .25s, transform .25s;
}
.emp-card:hover { border-color: rgba(200,160,32,0.5); transform: translateY(-4px); }

.emp-photo {
  width: 100%; aspect-ratio: 16/10;
  background: var(--bg-secondary);
  object-fit: cover; object-position: center 25%;
  display: block;
}

.emp-photo-placeholder {
  width: 100%; aspect-ratio: 3/2;
  background: linear-gradient(135deg, var(--bg-secondary) 0%, rgba(200,160,32,0.1) 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: 3rem; color: rgba(200,160,32,0.3);
}

.emp-body { padding: 22px 20px; }
.emp-name { font-size: 1.1rem; font-weight: 700; margin-bottom: 12px; }
.emp-meta { list-style: none; margin-bottom: 14px; }
.emp-meta li {
  display: flex; gap: 8px;
  font-size: 0.82rem; color: var(--text-secondary);
  padding: 3px 0; border-bottom: 1px solid rgba(255,255,255,0.04);
}
.emp-meta li span:first-child { color: var(--gold); min-width: 72px; }

.emp-bio {
  font-size: 0.82rem; color: var(--text-secondary);
  border-top: 1px solid var(--border);
  padding-top: 12px; margin-top: 8px;
}
.emp-bio strong { color: var(--text-primary); }

.emp-status {
  margin-top: 12px; padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 0.8rem; color: var(--text-secondary);
}

/* ── Search ─────────────────────────────── */
.search-box {
  display: flex; gap: 0;
  max-width: 600px; margin: 0 auto 48px;
}
.search-box .form-input { flex: 1; }
.search-box .btn { white-space: nowrap; }

.result-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 24px 28px; max-width: 600px; margin: 0 auto;
}
.result-card h3 { font-size: 1.1rem; margin-bottom: 12px; }
.result-meta { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 8px; }
.result-meta strong { color: var(--gold); }
.result-locked {
  margin-top: 16px; padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 0.8rem; color: rgba(255,255,255,0.35);
}

.no-result {
  text-align: center; padding: 60px 20px;
  color: var(--text-secondary); font-size: 0.9rem;
}
.no-result .code { font-family: monospace; color: rgba(255,255,255,0.2); font-size: 2rem; }

/* ── Login ──────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: calc(var(--nav-h) + 40px) 40px 80px;
  background:
    linear-gradient(135deg, rgba(7,24,48,0.97) 0%, rgba(13,37,69,0.97) 100%),
    repeating-linear-gradient(45deg, transparent, transparent 40px, rgba(200,160,32,0.03) 40px, rgba(200,160,32,0.03) 80px);
}

.login-panel {
  width: 100%; max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 40px 36px;
}

.login-panel h2 {
  font-family: var(--font-serif);
  font-size: 1.4rem; margin-bottom: 6px;
}
.login-panel .subtitle {
  font-size: 0.8rem; color: var(--text-secondary);
  margin-bottom: 32px; padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.hint-block {
  background: rgba(200,160,32,0.07);
  border-left: 3px solid var(--gold);
  padding: 12px 16px;
  font-size: 0.82rem; color: var(--text-secondary);
  margin-top: 20px;
  display: none;
}
.hint-block.show { display: block; }
.hint-link { color: var(--gold); cursor: pointer; font-size: 0.8rem; }

.error-msg {
  background: rgba(196,30,58,0.1);
  border-left: 3px solid var(--red-warn);
  padding: 10px 14px;
  font-size: 0.82rem; color: #e05070;
  margin-bottom: 20px; display: none;
}
.error-msg.show { display: block; }

/* ── Internal page ──────────────────────── */
.internal-wrap {
  min-height: 100vh;
  padding: calc(var(--nav-h) + 40px) 40px 80px;
}

.internal-header {
  max-width: 860px; margin: 0 auto 40px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: flex-start;
}

.internal-badge {
  display: flex; align-items: center; gap: 10px;
}

.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--red-warn);
  box-shadow: 0 0 6px var(--red-warn);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.internal-body { max-width: 860px; margin: 0 auto; }

.profile-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 32px; margin-bottom: 32px;
}

.profile-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 24px;
}

.profile-section.danger {
  border-color: rgba(196,30,58,0.4);
  background: rgba(196,30,58,0.05);
}

.profile-section h4 {
  font-size: 0.75rem; letter-spacing: 0.2em;
  color: var(--gold); text-transform: uppercase;
  margin-bottom: 18px; padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.profile-section.danger h4 { color: #e05070; border-color: rgba(196,30,58,0.3); }

.data-row {
  display: flex; justify-content: space-between;
  padding: 6px 0; font-size: 0.85rem;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.data-row:last-child { border-bottom: none; }
.data-row .label { color: var(--text-secondary); }
.data-row .value { color: var(--text-primary); font-family: monospace; }
.data-row .value.warn { color: #e05070; font-weight: 700; }
.data-row .value.ok { color: #4caf7d; }

.notes-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 24px; margin-bottom: 28px;
}
.notes-block h4 {
  font-size: 0.75rem; letter-spacing: 0.2em;
  color: var(--gold); text-transform: uppercase;
  margin-bottom: 16px;
}
.notes-block p { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 8px; }
.notes-block p strong { color: #e05070; }

.files-section { margin-top: 32px; }
.files-section h4 {
  font-size: 0.75rem; letter-spacing: 0.2em;
  color: var(--gold); text-transform: uppercase;
  margin-bottom: 16px;
}

.file-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  margin-bottom: 8px; cursor: pointer;
  transition: border-color .2s;
}
.file-item:hover { border-color: rgba(200,160,32,0.4); }
.file-icon { color: var(--gold); font-size: 1.1rem; }
.file-name { font-size: 0.9rem; }
.file-meta { margin-left: auto; font-size: 0.75rem; color: var(--text-secondary); }

/* ── Modal ──────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(4,14,28,0.92);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; opacity: 0; pointer-events: none;
  transition: opacity .25s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  width: 100%; max-width: 640px;
  max-height: 80vh; overflow-y: auto;
  padding: 32px;
  transform: translateY(20px);
  transition: transform .25s;
}
.modal-overlay.open .modal { transform: none; }

.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 24px; padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 1rem; }
.modal-close {
  cursor: pointer; color: var(--text-secondary);
  font-size: 1.3rem; line-height: 1;
  background: none; border: none; color: var(--text-secondary);
  transition: color .2s;
}
.modal-close:hover { color: var(--text-primary); }

.modal-body { font-size: 0.85rem; color: var(--text-secondary); line-height: 1.8; }
.modal-body p { margin-bottom: 12px; }
.modal-body .log-entry {
  background: rgba(0,0,0,0.3);
  border-left: 3px solid var(--gold);
  padding: 10px 14px; margin-bottom: 10px;
  font-family: monospace; font-size: 0.8rem;
}
.modal-body .log-entry.fail { border-color: var(--red-warn); }
.modal-body strong { color: var(--text-primary); }

/* ── News strip ─────────────────────────── */
.news-strip {
  background: rgba(200,160,32,0.08);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 10px 40px; overflow: hidden;
  white-space: nowrap;
}
.news-strip-inner {
  display: inline-block; animation: ticker 30s linear infinite;
  font-size: 0.78rem; color: var(--gold); letter-spacing: 0.05em;
}
@keyframes ticker {
  from { transform: translateX(100vw); }
  to   { transform: translateX(-100%); }
}

/* ── Partner logos ──────────────────────── */
.partners { display: flex; flex-wrap: wrap; gap: 20px; justify-content: center; align-items: center; }
.partner-logo {
  padding: 12px 24px;
  border: 1px solid var(--border);
  font-size: 0.85rem; letter-spacing: 0.1em;
  color: var(--text-secondary);
  transition: border-color .2s, color .2s;
}
.partner-logo:hover { border-color: rgba(200,160,32,0.4); color: var(--text-primary); }

/* ── Careers ─────────────────────────────── */
.job-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 24px 28px; margin-bottom: 16px;
  display: flex; justify-content: space-between; align-items: flex-start;
  transition: border-color .25s;
  cursor: pointer;
}
.job-card:hover { border-color: rgba(200,160,32,0.5); }
.job-title { font-size: 1rem; font-weight: 600; margin-bottom: 6px; }
.job-tags { display: flex; gap: 8px; flex-wrap: wrap; }
.job-tag {
  padding: 2px 10px; font-size: 0.72rem;
  border: 1px solid rgba(200,160,32,0.3); color: var(--gold);
}
.job-salary { font-size: 1.1rem; font-weight: 700; color: var(--gold); white-space: nowrap; }

/* ── Forum ──────────────────────────────── */
.thread {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 20px 24px; margin-bottom: 10px;
  display: flex; align-items: center; gap: 20px;
  cursor: pointer; transition: border-color .2s;
}
.thread:hover { border-color: rgba(200,160,32,0.4); }
.thread.pinned { border-left: 3px solid var(--gold); }
.thread-icon { font-size: 1.2rem; color: var(--text-secondary); }
.thread-title { font-size: 0.9rem; font-weight: 600; margin-bottom: 4px; }
.thread-meta { font-size: 0.75rem; color: var(--text-secondary); }
.thread-views { margin-left: auto; font-size: 0.75rem; color: var(--text-secondary); text-align: right; }

/* ── Start page ─────────────────────────── */
.start-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 40px;
  background: #040e1c;
}

.legal-box {
  max-width: 680px; width: 100%;
  border: 1px solid rgba(200,160,32,0.25);
  padding: 48px 44px;
}

.legal-box .kicker {
  font-size: 0.7rem; letter-spacing: 0.3em;
  color: var(--gold); margin-bottom: 8px;
  text-transform: uppercase;
}

.legal-box h1 {
  font-family: var(--font-serif);
  font-size: 1.6rem; margin-bottom: 24px;
}

.legal-text {
  font-size: 0.82rem; color: var(--text-secondary);
  line-height: 1.9; margin-bottom: 20px;
  max-height: 220px; overflow-y: auto;
  padding-right: 8px;
}
.legal-text::-webkit-scrollbar { width: 4px; }
.legal-text::-webkit-scrollbar-thumb { background: var(--border); }

.legal-check {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 24px; cursor: pointer;
  font-size: 0.84rem; color: var(--text-secondary);
}
.legal-check input { accent-color: var(--gold); width: 16px; height: 16px; cursor: pointer; }
.legal-check:hover { color: var(--text-primary); }

/* ── Utilities ───────────────────────────── */
.text-center { text-align: center; }
.text-gold { color: var(--gold); }
.text-sm { font-size: 0.82rem; }
.text-muted { color: var(--text-secondary); }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; } .mt-40 { margin-top: 40px; }
.mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; }
.full-width { width: 100%; }

.page-top { padding-top: calc(var(--nav-h) + 60px); padding-bottom: 80px; }

.breadcrumb {
  font-size: 0.78rem; color: var(--text-secondary);
  margin-bottom: 32px;
}
.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--gold); }
.breadcrumb span { margin: 0 8px; }

/* ── Horror overlay ────────────────────────── */
.horror-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: #000;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.15s;
  overflow: hidden;
}
.horror-overlay.active {
  opacity: 1; pointer-events: all;
}

.horror-bg {
  position: absolute; inset: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(255,0,0,0.03) 0px,
    rgba(255,0,0,0.03) 2px,
    transparent 2px,
    transparent 6px
  );
  animation: scanline 0.1s linear infinite;
  pointer-events: none;
}

@keyframes scanline {
  0% { transform: translateY(0); }
  100% { transform: translateY(8px); }
}

.horror-static {
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.08'/%3E%3C/svg%3E");
  pointer-events: none;
  animation: staticShift 0.1s steps(3) infinite;
  opacity: 0;
  transition: opacity 0.5s;
}
.horror-overlay.active .horror-static { opacity: 1; }

@keyframes staticShift {
  0% { transform: translate(0,0); }
  33% { transform: translate(-2px,1px); }
  66% { transform: translate(1px,-2px); }
  100% { transform: translate(-1px,-1px); }
}

/* Glitch text */
.glitch-text {
  font-family: var(--font-serif);
  font-size: clamp(3rem, 8vw, 6rem);
  color: #cc0000;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-shadow:
    3px 0 #00ffff,
    -3px 0 #ff00ff,
    0 0 40px rgba(255,0,0,0.8);
  animation: glitchText 0.3s infinite;
  position: relative; z-index: 2;
}

@keyframes glitchText {
  0%   { transform: translate(0); }
  15%  { transform: translate(-6px, 4px); }
  30%  { transform: translate(6px, -4px); }
  45%  { transform: translate(-4px, -6px); }
  60%  { transform: translate(4px, 6px); color: #ff0040; }
  75%  { transform: translate(-2px, 2px); color: #ff0000; }
  90%  { transform: translate(2px, -2px); }
  100% { transform: translate(0); }
}

.glitch-subtitle {
  color: #ff4444;
  font-size: 1rem;
  letter-spacing: 0.3em;
  margin-top: 20px;
  opacity: 0;
  animation: fadeInOut 1.5s infinite;
  position: relative; z-index: 2;
}

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

/* Error flashes */
.error-flash {
  position: absolute;
  color: #ff0000;
  font-family: 'Courier New', monospace;
  font-size: 0.82rem;
  font-weight: 700;
  text-shadow: 0 0 8px rgba(255,0,0,0.6);
  white-space: nowrap;
  pointer-events: none;
  z-index: 3;
  animation: flashError 0.8s ease-out forwards;
}

@keyframes flashError {
  0%   { opacity: 0; transform: translateY(10px) scale(0.9); }
  15%  { opacity: 1; transform: translateY(0) scale(1); }
  85%  { opacity: 0.8; transform: translateY(-5px) scale(1); }
  100% { opacity: 0; transform: translateY(-20px) scale(0.8); }
}

/* Screen shake for body */
body.shaking {
  animation: bodyShake 0.15s infinite;
}

@keyframes bodyShake {
  0%   { transform: translate(0,0); }
  10%  { transform: translate(-8px, 4px); }
  20%  { transform: translate(8px, -4px); }
  30%  { transform: translate(-4px, 8px); }
  40%  { transform: translate(4px, -8px); }
  50%  { transform: translate(-6px, 3px); }
  60%  { transform: translate(6px, -3px); }
  70%  { transform: translate(-3px, 6px); }
  80%  { transform: translate(3px, -6px); }
  90%  { transform: translate(-5px, 2px); }
  100% { transform: translate(0,0); }
}

/* Red flash overlay */
.red-flash {
  position: fixed; inset: 0; z-index: 9998;
  background: rgba(180,0,0,0.7);
  pointer-events: none;
  animation: redFlash 0.15s steps(1) infinite;
}

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

/* Warning banner */
.warning-banner {
  position: fixed; top: var(--nav-h); left: 0; right: 0; z-index: 999;
  background: rgba(180,10,10,0.93);
  color: #fff;
  text-align: center;
  padding: 16px 20px;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  animation: warningPulse 1.5s ease-in-out infinite;
  display: flex; align-items: center; justify-content: center; gap: 12px;
}

@keyframes warningPulse {
  0%, 100% { background: rgba(180,10,10,0.93); }
  50% { background: rgba(140,5,5,0.85); }
}

.warning-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: #fff;
  animation: warningDot 0.8s ease-in-out infinite;
}
@keyframes warningDot {
  0%, 100% { opacity: 1; box-shadow: 0 0 6px #fff; }
  50% { opacity: 0.3; box-shadow: 0 0 2px #fff; }
}

/* Game Over overlay */
.gameover-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: #000;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.6s;
}
.gameover-overlay.active {
  opacity: 1; pointer-events: all;
}
.gameover-title {
  font-family: var(--font-serif);
  font-size: clamp(2.5rem, 6vw, 5rem);
  color: #cc0000;
  font-weight: 900;
  letter-spacing: 0.15em;
  text-shadow: 0 0 60px rgba(255,0,0,0.9), 0 0 120px rgba(255,0,0,0.5);
  animation: gameoverGlow 2s ease-in-out infinite;
  margin-bottom: 20px;
}
@keyframes gameoverGlow {
  0%, 100% { text-shadow: 0 0 60px rgba(255,0,0,0.9), 0 0 120px rgba(255,0,0,0.5); }
  50% { text-shadow: 0 0 100px rgba(255,0,0,1), 0 0 200px rgba(255,0,0,0.8); }
}
.gameover-sub {
  color: #888;
  font-size: 0.9rem;
  letter-spacing: 0.3em;
  margin-top: 16px;
  animation: fadeInOut 3s infinite;
}

/* ── Chat widget ─────────────────────────── */
.chat-widget {
  position: fixed; bottom: 20px; right: 20px; z-index: 5000;
  font-family: var(--font-sans);
}
.chat-bubble {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: #0f2d35;
  border: 2px solid rgba(200,160,32,.4);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 1.3rem;
  transition: all .25s;
  position: relative;
}
.chat-bubble:hover {
  border-color: var(--gold);
  box-shadow: 0 0 20px rgba(200,160,32,.2);
}
.chat-bubble .unread-dot {
  position: absolute; top: 2px; right: 2px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #e05070;
  border: 2px solid #0d2545;
  animation: warningDot 0.8s ease-in-out infinite;
}
.chat-panel {
  display: none;
  position: absolute; bottom: 64px; right: 0;
  width: 360px; max-height: 480px;
  background: #0a1622;
  border: 1px solid rgba(200,160,32,.25);
  box-shadow: 0 8px 40px rgba(0,0,0,.6);
  flex-direction: column;
  overflow: hidden;
}
.chat-panel.open { display: flex; }
.chat-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
  background: rgba(0,0,0,.3);
}
.chat-header-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(200,160,32,.15);
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem; color: var(--gold);
  flex-shrink: 0;
}
.chat-header-info .chat-name {
  font-size: .82rem; font-weight: 600; color: var(--text-primary);
}
.chat-header-info .chat-status {
  font-size: .7rem; color: var(--text-secondary);
}
.chat-header-info .chat-status.online { color: #4caf7d; }
.chat-close {
  margin-left: auto;
  background: none; border: none; color: var(--text-secondary);
  cursor: pointer; font-size: 1rem; padding: 4px;
}
.chat-close:hover { color: var(--text-primary); }
.chat-messages {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
  max-height: 310px;
}
.chat-messages::-webkit-scrollbar { width: 3px; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--border); }
.chat-msg {
  max-width: 85%; padding: 10px 14px;
  font-size: .8rem; line-height: 1.6;
  animation: msgIn .3s ease-out;
}
.chat-msg.them {
  align-self: flex-start;
  background: rgba(255,255,255,.05);
  border-radius: 4px 12px 12px 12px;
  color: #cdd6df;
}
.chat-msg.red {
  color: #e05070 !important;
  font-weight: 700;
}
.chat-msg .msg-sender {
  font-size: .68rem; color: var(--gold); margin-bottom: 4px;
  font-weight: 600;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.chat-typing {
  align-self: flex-start;
  padding: 10px 14px;
  display: none;
}
.chat-typing.show { display: block; }
.chat-typing span {
  display: inline-block; width: 6px; height: 6px;
  border-radius: 50%; background: var(--text-secondary);
  margin-right: 4px;
  animation: typingBounce 1.2s infinite;
}
.chat-typing span:nth-child(2) { animation-delay: .15s; }
.chat-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: .3; }
  30% { transform: translateY(-6px); opacity: 1; }
}
.chat-choices {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: none; gap: 10px;
}
.chat-choices.show { display: flex; }
.chat-choice-btn {
  flex: 1; padding: 10px;
  font-size: .78rem; letter-spacing: .05em;
  cursor: pointer; text-align: center;
  border: 1px solid rgba(255,255,255,.15);
  background: transparent; color: var(--text-secondary);
  transition: all .2s;
  font-family: var(--font-sans);
}
.chat-choice-btn:hover {
  border-color: var(--gold); color: var(--gold);
}
.chat-choice-btn.danger:hover {
  border-color: #e05070; color: #e05070;
  background: rgba(200,30,58,.08);
}
/* Game over inside chat */
.chat-gameover {
  display: none; text-align: center; padding: 20px 16px;
}
.chat-gameover.show { display: block; }
.chat-gameover h3 {
  color: #e05070; font-size: 1rem; margin-bottom: 8px;
  font-family: monospace;
}
.chat-gameover p {
  color: var(--text-secondary); font-size: .78rem;
}

/* ── Horror stalking: random flashes + text popups ── */
.horror-popup {
  position: fixed; inset: 0; z-index: 10000;
  pointer-events: none;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.08s;
}
.horror-popup.show { opacity: 1; }
.horror-popup .msg {
  font-family: 'SimSun', '宋体', serif;
  font-size: 4rem; font-weight: 900;
  color: #cc0000;
  text-shadow: 0 0 40px rgba(255,0,0,.8), 0 0 80px rgba(200,0,0,.5), 0 0 120px rgba(150,0,0,.4);
  letter-spacing: .15em;
  animation: horrorTextGlitch 0.15s ease-in-out infinite;
  text-align: center;
  user-select: none;
}
@keyframes horrorTextGlitch {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-3px, 2px); }
  40% { transform: translate(3px, -1px); }
  60% { transform: translate(-2px, -2px); }
  80% { transform: translate(2px, 1px); }
}
.screen-red-flash {
  position: fixed; inset: 0; z-index: 9999;
  pointer-events: none;
  background: rgba(180,0,0,.7);
  opacity: 0;
  transition: opacity 0.05s;
}
.screen-red-flash.fire { opacity: 1; transition: opacity 0s; }
body.shock-shake {
  animation: shockShake 0.4s ease-out;
}
@keyframes shockShake {
  0%   { transform: translate(0, 0); }
  10%  { transform: translate(-8px, 5px); }
  20%  { transform: translate(8px, -3px); }
  30%  { transform: translate(-6px, -6px); }
  40%  { transform: translate(6px, 4px); }
  50%  { transform: translate(-3px, -2px); }
  60%  { transform: translate(3px, 1px); }
  70%  { transform: translate(-1px, 1px); }
  100% { transform: translate(0, 0); }
}
