/* ============================================================
   DESIGN TOKENS
============================================================ */
:root {
  --bg-deep:        #050505;
  --bg-card:        #0d0d0d;
  --bg-card-hover:  #111111;
  --red:            #e50000;
  --red-dim:        #7a0000;
  --red-glow:       rgba(229, 0, 0, 0.55);
  --red-glow-soft:  rgba(229, 0, 0, 0.18);
  --white:          #f0f0f0;
  --grey-light:     #a8a8a8;
  --grey-dim:       #555555;
  --border:         1px solid rgba(229, 0, 0, 0.35);
  --font-display:   'Rajdhani', sans-serif;
  --font-mono:      'Share Tech Mono', monospace;
  --font-body:      'Inter', sans-serif;
  --radius:         2px;
  --transition:     all 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ============================================================
   RESET & BASE
============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background-color: var(--bg-deep);
  color: var(--white);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.65;
  background-image: repeating-linear-gradient(
    0deg, transparent, transparent 2px,
    rgba(255,255,255,0.012) 2px, rgba(255,255,255,0.012) 4px
  );
}
a { color: inherit; text-decoration: none; }
img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* ============================================================
   UTILITY
============================================================ */
.mono { font-family: var(--font-mono); }
.label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--red);
}
.section-title {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--white);
}
.section-title span { color: var(--red); }

.section-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2.5rem;
}
.section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, var(--red-dim), transparent);
}
.section-divider .icon-box { display: flex; align-items: center; gap: 0.75rem; }
.section-divider .icon-box i { color: var(--red); font-size: 1.1rem; }

.page-wrapper {
  max-width: 1280px;
  margin: 0 auto;
  padding: 3.5rem 2rem 5rem;
}
.preview-section { margin-bottom: 3.5rem; }
.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

/* BUTTONS */
.btn-red {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.55rem 1.2rem;
  background-color: var(--red); color: #000;
  font-family: var(--font-display); font-weight: 700;
  font-size: 0.9rem; letter-spacing: 0.1em; text-transform: uppercase;
  border: none; cursor: pointer;
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 10px, 100% 100%, 0 100%);
  transition: var(--transition);
}
.btn-red:hover { background-color: #ff1a1a; box-shadow: 0 0 18px var(--red-glow); }

.btn-outline {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.5rem 1.1rem;
  background: transparent; color: var(--red);
  font-family: var(--font-display); font-weight: 700;
  font-size: 0.88rem; letter-spacing: 0.1em; text-transform: uppercase;
  border: 1px solid var(--red); cursor: pointer;
  transition: var(--transition);
}
.btn-outline:hover { background: rgba(229,0,0,0.1); box-shadow: 0 0 14px var(--red-glow-soft); }

/* ============================================================
   HEADER / NAV
============================================================ */
header {
  position: sticky; top: 0; z-index: 100;
  background-color: rgba(5,5,5,0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(229,0,0,0.25);
  padding: 0 2rem;
}
.nav-inner {
  max-width: 1280px; margin: 0 auto;
  height: 64px; display: flex;
  align-items: center; justify-content: space-between;
}
.brand {
  font-family: var(--font-display);
  font-size: 1.45rem; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--white);
}
.brand span { color: var(--red); text-shadow: 0 0 10px var(--red-glow); }
.brand::before {
  content: '//'; font-family: var(--font-mono);
  font-size: 0.85rem; color: var(--red-dim); margin-right: 0.4rem;
}
nav ul { list-style: none; display: flex; align-items: center; gap: 0.25rem; }
nav ul li a {
  font-family: var(--font-display); font-size: 0.92rem; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--grey-light);
  padding: 0.45rem 0.85rem; position: relative; transition: var(--transition);
}
nav ul li a::after {
  content: ''; position: absolute; bottom: -2px; left: 50%;
  width: 0; height: 1px; background: var(--red);
  transition: var(--transition); transform: translateX(-50%);
  box-shadow: 0 0 6px var(--red-glow);
}
nav ul li a:hover { color: var(--white); }
nav ul li a:hover::after { width: 70%; }
nav ul li a.active { color: var(--red); }
nav ul li a.active::after { width: 70%; }

.nav-toggle {
  display: none; flex-direction: column;
  gap: 5px; cursor: pointer; padding: 4px;
}
.nav-toggle span { display: block; width: 24px; height: 2px; background: var(--white); transition: var(--transition); }

/* ============================================================
   HERO SECTION
============================================================ */
.hero-section { padding: 4rem 2rem 3rem; max-width: 1280px; margin: 0 auto; }
.hero-inner {
  position: relative; border: var(--border);
  padding: 3rem 3.5rem; background-color: var(--bg-card);
  clip-path: polygon(0 0, calc(100% - 30px) 0, 100% 30px, 100% 100%, 0 100%);
  overflow: hidden;
}
.hero-inner::before {
  content: ''; position: absolute; left: 0; top: 0;
  width: 3px; height: 100%;
  background: linear-gradient(to bottom, var(--red), transparent);
  box-shadow: 0 0 12px var(--red-glow);
}
.hero-inner::after {
  content: ''; position: absolute; top: 0; right: 0;
  width: 30px; height: 30px; background: var(--red);
  clip-path: polygon(0 0, 100% 0, 100% 100%);
}
.hero-eyebrow { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1.25rem; }
.hero-eyebrow .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--red); box-shadow: 0 0 8px var(--red-glow);
  animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.35} }
.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 5vw, 3.8rem); font-weight: 700;
  line-height: 1.1; letter-spacing: 0.04em; text-transform: uppercase; margin-bottom: 1rem;
}
.hero-title .highlight { color: var(--red); text-shadow: 0 0 20px var(--red-glow), 0 0 50px rgba(229,0,0,0.2); }
.hero-desc { max-width: 560px; color: var(--grey-light); font-size: 0.97rem; margin-bottom: 2rem; line-height: 1.75; }
.hero-tags { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.hero-tags .tag {
  font-family: var(--font-mono); font-size: 0.78rem;
  padding: 0.3rem 0.75rem; border: 1px solid var(--red-dim);
  color: var(--red); letter-spacing: 0.1em; text-transform: uppercase;
  background: rgba(229,0,0,0.06); transition: var(--transition);
}
.hero-tags .tag:hover { background: rgba(229,0,0,0.15); border-color: var(--red); box-shadow: 0 0 10px var(--red-glow-soft); }

/* ============================================================
   STORY CARDS
============================================================ */
.stories-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1.25rem; }
.stories-grid.full { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.story-card {
  background: var(--bg-card); border: var(--border);
  border-radius: var(--radius); overflow: hidden;
  cursor: pointer; transition: var(--transition);
  display: flex; flex-direction: column;
}
.story-card:hover {
  transform: translateY(-4px); border-color: var(--red);
  box-shadow: 0 0 20px var(--red-glow-soft), 0 8px 30px rgba(0,0,0,0.6);
  background: var(--bg-card-hover);
}
.story-cover { position: relative; width: 100%; aspect-ratio: 16/9; background: #111; overflow: hidden; }
.story-cover .cover-placeholder {
  width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.5rem; color: var(--grey-dim); font-family: var(--font-mono);
  font-size: 0.72rem; letter-spacing: 0.1em;
  border-bottom: 1px solid rgba(229,0,0,0.12);
  background-image: linear-gradient(rgba(229,0,0,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(229,0,0,0.04) 1px, transparent 1px);
  background-size: 24px 24px; transition: var(--transition);
}
.story-card:hover .cover-placeholder { color: var(--red); }
.story-cover .cover-placeholder i { font-size: 1.6rem; opacity: 0.5; }
.story-cover .genre-badge {
  position: absolute; top: 0.6rem; left: 0.6rem;
  font-family: var(--font-mono); font-size: 0.65rem;
  letter-spacing: 0.15em; text-transform: uppercase;
  padding: 0.25rem 0.6rem; background: rgba(229,0,0,0.85); color: #fff;
}
.story-body { padding: 1rem 1.1rem 1.2rem; flex: 1; display: flex; flex-direction: column; }
.story-meta { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.5rem; }
.story-meta .chapters {
  display: flex; align-items: center; gap: 0.35rem;
  font-family: var(--font-mono); font-size: 0.7rem; color: var(--grey-dim);
}
.story-meta .chapters i { font-size: 0.7rem; color: var(--red-dim); }
.story-title {
  font-family: var(--font-display); font-size: 1.05rem; font-weight: 700;
  letter-spacing: 0.03em; color: var(--white); margin-bottom: 0.45rem;
  line-height: 1.3; transition: var(--transition);
}
.story-card:hover .story-title { color: var(--red); }
.story-excerpt { font-size: 0.8rem; color: var(--grey-light); line-height: 1.6; flex: 1; }
.story-footer {
  margin-top: 0.85rem; padding-top: 0.75rem;
  border-top: 1px solid rgba(255,255,255,0.05);
  display: flex; align-items: center; justify-content: space-between;
}
.story-footer .read-link {
  font-family: var(--font-mono); font-size: 0.72rem;
  letter-spacing: 0.1em; color: var(--red); text-transform: uppercase;
  display: flex; align-items: center; gap: 0.35rem; transition: var(--transition);
}
.story-footer .read-link:hover { gap: 0.65rem; }
.story-footer .status {
  font-family: var(--font-mono); font-size: 0.65rem;
  padding: 0.2rem 0.55rem; border: 1px solid var(--grey-dim);
  color: var(--grey-dim); letter-spacing: 0.1em; text-transform: uppercase;
}
.story-footer .status.ongoing { border-color: rgba(229,0,0,0.4); color: var(--red); }

/* ============================================================
   MODPACK CARDS
============================================================ */
.modpack-list { display: flex; flex-direction: column; gap: 1.25rem; }
.modpack-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 1.25rem; }
.modpack-card {
  background: var(--bg-card); position: relative;
  padding: 1.5rem 1.6rem 1.6rem; border: var(--border);
  cursor: pointer; transition: var(--transition);
  clip-path: polygon(0 0,calc(100% - 18px) 0,100% 18px,100% 100%,18px 100%,0 calc(100% - 18px));
}
.modpack-card:hover {
  border-color: var(--red);
  box-shadow: 0 0 25px var(--red-glow-soft), inset 0 0 40px rgba(229,0,0,0.04);
  transform: translateY(-3px);
}
.modpack-card::before {
  content: ''; position: absolute; top: 0; left: 0;
  width: 50%; height: 2px;
  background: linear-gradient(to right, var(--red), transparent);
  box-shadow: 0 0 10px var(--red-glow);
}
.modpack-card::after {
  content: ''; position: absolute; top: 0; right: 0;
  width: 18px; height: 18px; background: var(--red);
  clip-path: polygon(0 0, 100% 0, 100% 100%); opacity: 0.8;
}
.modpack-header { display: flex; align-items: flex-start; gap: 1rem; margin-bottom: 1rem; }
.modpack-icon {
  width: 52px; height: 52px; min-width: 52px;
  background: rgba(229,0,0,0.1); border: 1px solid var(--red-dim);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; color: var(--red);
  clip-path: polygon(0 0,calc(100% - 8px) 0,100% 8px,100% 100%,8px 100%,0 calc(100% - 8px));
  transition: var(--transition);
}
.modpack-card:hover .modpack-icon { background: rgba(229,0,0,0.2); box-shadow: 0 0 14px var(--red-glow-soft); }
.modpack-info { flex: 1; }
.modpack-name {
  font-family: var(--font-display); font-size: 1.25rem; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--white);
  margin-bottom: 0.3rem; line-height: 1.2; transition: var(--transition);
}
.modpack-card:hover .modpack-name { color: var(--red); }
.modpack-badges { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.4rem; }
.badge { font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.1em; padding: 0.2rem 0.6rem; border: 1px solid; text-transform: uppercase; }
.badge-mc   { border-color: #3a7d44; color: #5aab64; background: rgba(58,125,68,0.1); }
.badge-mods { border-color: #5a4a9e; color: #8a7acf; background: rgba(90,74,158,0.1); }
.badge-new  { border-color: var(--red-dim); color: var(--red); background: rgba(229,0,0,0.08); }
.modpack-desc { font-size: 0.83rem; color: var(--grey-light); line-height: 1.65; margin-bottom: 1.1rem; }
.modpack-footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.75rem; }
.modpack-stats { display: flex; gap: 1.25rem; }
.stat { display: flex; align-items: center; gap: 0.35rem; font-family: var(--font-mono); font-size: 0.73rem; color: var(--grey-dim); }
.stat i { color: var(--red-dim); }

/* ============================================================
   CONTACT PAGE
============================================================ */
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 3rem; align-items: start; }
.contact-socials { display: flex; flex-direction: column; gap: 1rem; margin-top: 1.5rem; }
.social-link {
  display: flex; align-items: center; gap: 1rem;
  padding: 1rem 1.25rem; border: var(--border); background: var(--bg-card);
  transition: var(--transition);
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 0 100%);
}
.social-link:hover {
  border-color: var(--red); background: var(--bg-card-hover);
  transform: translateX(6px); box-shadow: 0 0 16px var(--red-glow-soft);
}
.social-link .s-icon {
  width: 40px; height: 40px; min-width: 40px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.15rem; color: var(--red);
  border: 1px solid var(--red-dim); background: rgba(229,0,0,0.08);
}
.social-link .s-info { flex: 1; }
.social-link .s-name {
  font-family: var(--font-display); font-size: 1rem; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--white); display: block;
}
.social-link .s-handle { font-family: var(--font-mono); font-size: 0.75rem; color: var(--grey-dim); }
.social-link .s-arrow { color: var(--red-dim); transition: var(--transition); }
.social-link:hover .s-arrow { color: var(--red); transform: translateX(4px); }
.contact-form { display: flex; flex-direction: column; gap: 1.1rem; margin-top: 1.5rem; }
.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.form-group label { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.15em; text-transform: uppercase; color: var(--red); }
.form-group input,
.form-group textarea {
  background: var(--bg-card); border: var(--border); color: var(--white);
  font-family: var(--font-body); font-size: 0.9rem;
  padding: 0.75rem 1rem; outline: none;
  transition: var(--transition); border-radius: var(--radius); resize: vertical;
}
.form-group input:focus,
.form-group textarea:focus { border-color: var(--red); box-shadow: 0 0 12px var(--red-glow-soft); }
.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--grey-dim); }
.form-group textarea { min-height: 140px; }
.form-note { font-family: var(--font-mono); font-size: 0.72rem; color: var(--grey-dim); margin-top: -0.25rem; }

/* ============================================================
   FOOTER
============================================================ */
footer { border-top: 1px solid rgba(229,0,0,0.2); padding: 2rem; }
.footer-inner {
  max-width: 1280px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem;
}
.footer-brand { font-family: var(--font-display); font-size: 1.1rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.footer-brand span { color: var(--red); }
.footer-copy { font-family: var(--font-mono); font-size: 0.72rem; color: var(--grey-dim); }
.footer-socials { display: flex; gap: 1rem; }
.footer-socials a {
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(229,0,0,0.3); color: var(--grey-light);
  font-size: 0.9rem; transition: var(--transition);
}
.footer-socials a:hover { border-color: var(--red); color: var(--red); box-shadow: 0 0 12px var(--red-glow-soft); }

/* ============================================================
   RESPONSIVE
============================================================ */
@media (max-width: 900px) { .contact-grid { grid-template-columns: 1fr; } }
@media (max-width: 768px) {
  .nav-toggle { display: flex; }
  nav ul {
    display: none; position: absolute; top: 64px; left: 0;
    width: 100%; flex-direction: column;
    background: rgba(5,5,5,0.97); border-bottom: var(--border); padding: 1rem 0; gap: 0;
  }
  nav ul.open { display: flex; }
  nav ul li a { display: block; padding: 0.85rem 2rem; }
  .hero-inner { padding: 2rem 1.75rem; }
  .hero-title { font-size: 1.9rem; }
  .page-wrapper { padding: 2.5rem 1.25rem 4rem; }
  .hero-section { padding: 2.5rem 1.25rem 2rem; }
  header { padding: 0 1.25rem; }
  .footer-inner { flex-direction: column; text-align: center; }
  .modpack-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .modpack-footer { flex-direction: column; align-items: flex-start; }
  .stories-grid { grid-template-columns: 1fr; }
}


/* ==========================================================================
   OFFLINE GAME STATION STYLES (CYBERPUNK THEME)
   ========================================================================== */
.game-station {
    max-width: 700px;
    margin: 40px auto;
    padding: 0 20px 60px 20px;
    text-align: center;
}

/* Thanh tab chuyển đổi game */
.game-tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    justify-content: flex-start;
}

.tab-btn {
    background: var(--bg-card);
    border: var(--border);
    color: var(--grey-light);
    font-family: var(--font-mono);
    font-size: 14px;
    padding: 10px 18px;
    cursor: pointer;
    transition: var(--transition);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-btn:hover, .tab-btn.active {
    background: var(--red-dim);
    color: var(--white);
    box-shadow: 0 0 12px var(--red-glow-soft);
    border-color: var(--red);
}

/* Khung màn hình chơi game */
.game-viewport {
    background: var(--bg-card);
    border: var(--border);
    border-radius: var(--radius);
    padding: 24px;
    position: relative;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
}

.game-box {
    display: none;
}

.game-box.active {
    display: block;
}

.game-hint {
    font-family: var(--font-body);
    font-size: 13px;
    color: var(--grey-light);
    margin-top: 0;
    margin-bottom: 15px;
}

.score-display {
    font-family: var(--font-mono);
    font-size: 20px;
    color: var(--white);
    margin-top: 15px;
    letter-spacing: 2px;
}

/* --- GAME 1: T-REX RUNNER DESIGN --- */
#dino-container {
    position: relative;
    width: 100%;
    height: 160px;
    background: #050505;
    border-bottom: 2px solid var(--red);
    overflow: hidden;
    cursor: pointer;
}

#dino-player {
    position: absolute;
    left: 50px;
    bottom: 0;
    width: 24px;
    height: 34px;
    background: var(--red);
    box-shadow: 0 0 8px var(--red-glow);
}

#dino-obstacle {
    position: absolute;
    right: -25px;
    bottom: 0;
    width: 16px;
    height: 28px;
    background: var(--white);
    box-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
}

/* --- GAME 2: HOT AIR BALLOON DESIGN --- */
#balloon-container {
    position: relative;
    width: 100%;
    height: 240px;
    background: #050505;
    overflow: hidden;
    border: 1px dashed var(--grey-dim);
}

#balloon-player {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 28px;
    line-height: 1;
    width: 32px;
    height: 32px;
}

#balloon-obstacle {
    position: absolute;
    top: -40px;
    left: 50%;
    font-size: 24px;
    line-height: 1;
}

/* Màn hình Game Over dùng chung */
.game-over-screen {
    display: none;
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(5, 5, 5, 0.9);
    z-index: 10;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.game-over-screen h3 {
    color: var(--red);
    font-family: var(--font-display);
    font-size: 28px;
    margin: 0 0 6px 0;
    text-shadow: 0 0 10px var(--red-glow);
}

.game-over-screen span {
    font-family: var(--font-mono);
    color: var(--grey-light);
    font-size: 13px;
    text-decoration: underline;
}

/* Animation cho Khủng long nhảy */
.jump-anim {
    animation: dinoJumpLoop 0.45s cubic-bezier(0.215, 0.610, 0.355, 1);
}

@keyframes dinoJumpLoop {
    0% { bottom: 0; }
    50% { bottom: 85px; }
    100% { bottom: 0; }
}

/* ==========================================================================
   STORY READER PAGES (iron-outlaws-chuong-*.html, và mọi trang đọc truyện sau này)
   Trước đây khối CSS này bị lặp lại y hệt trong từng trang (<style> riêng ở mỗi
   chương) — gộp về đây một lần để tránh 2 bản dễ bị lệch nhau khi sửa sau này.
   ========================================================================== */

/* Thanh tiến trình đọc ở đầu trang */
#read-progress {
  position: fixed;
  top: 64px; /* ngay dưới header */
  left: 0;
  width: 0%;
  height: 3px;
  background: var(--red);
  box-shadow: 0 0 10px var(--red-glow);
  z-index: 99;
  transition: width 0.1s linear;
}

/* Wrapper trang đọc */
.reader-wrapper {
  max-width: 780px;
  margin: 0 auto;
  padding: 3rem 2rem 6rem;
}

/* Breadcrumb điều hướng */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  color: var(--grey-dim);
  text-transform: uppercase;
  margin-bottom: 2.5rem;
}
.breadcrumb a { color: var(--grey-dim); transition: var(--transition); }
.breadcrumb a:hover { color: var(--red); }
.breadcrumb i { font-size: 0.6rem; color: var(--red-dim); }
.breadcrumb .current { color: var(--grey-light); }

/* Header truyện */
.story-header {
  border-left: 3px solid var(--red);
  box-shadow: -8px 0 20px rgba(229,0,0,0.12);
  padding: 0.5rem 0 0.5rem 1.75rem;
  margin-bottom: 3rem;
}
.story-series {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.story-series::before {
  content: '';
  display: inline-block;
  width: 20px; height: 1px;
  background: var(--red);
}
.story-main-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.1;
  color: var(--white);
  margin-bottom: 0.5rem;
}
.story-chapter-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--grey-light);
  letter-spacing: 0.06em;
}

/* Meta info */
.story-meta-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.25rem;
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  border: var(--border);
  margin-bottom: 3rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--grey-dim);
  letter-spacing: 0.1em;
}
.story-meta-bar .meta-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.story-meta-bar .meta-item i { color: var(--red-dim); }
.genre-tag {
  padding: 0.2rem 0.65rem;
  border: 1px solid var(--red-dim);
  color: var(--red);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* Quote nổi bật đầu truyện */
.story-quote {
  position: relative;
  margin: 0 0 3rem 0;
  padding: 1.75rem 2rem 1.75rem 2.5rem;
  background: rgba(229,0,0,0.04);
  border-left: 2px solid var(--red);
}
.story-quote::before {
  content: '\201C';
  position: absolute;
  top: -0.5rem; left: 1rem;
  font-family: Georgia, serif;
  font-size: 5rem;
  color: var(--red-dim);
  line-height: 1;
  opacity: 0.4;
}
.story-quote p {
  font-style: italic;
  color: var(--grey-light);
  line-height: 1.8;
  font-size: 1rem;
  position: relative;
}
.story-quote cite {
  display: block;
  margin-top: 1rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  color: var(--grey-dim);
  font-style: normal;
  text-transform: uppercase;
}

/* Nội dung chính */
.story-content {
  color: #d4d4d4;
  font-size: 1.05rem;
  line-height: 1.95;
  letter-spacing: 0.01em;
}

/* Tiêu đề phần (I. II. III. IV.) */
.story-content .section-heading {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--white);
  margin: 3.5rem 0 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(229,0,0,0.2);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.story-content .section-heading::before {
  content: '';
  display: inline-block;
  width: 4px; height: 1.2em;
  background: var(--red);
  box-shadow: 0 0 8px var(--red-glow);
}

/* Đoạn văn */
.story-content p {
  margin-bottom: 1.4rem;
  text-align: justify;
  hyphens: auto;
}
.story-content p:first-of-type::first-letter {
  font-family: var(--font-display);
  font-size: 3.5rem;
  font-weight: 700;
  color: var(--red);
  float: left;
  line-height: 0.8;
  margin: 0.1em 0.1em 0 0;
  text-shadow: 0 0 20px var(--red-glow);
}

/* Chữ nghiêng / nhấn mạnh */
.story-content em { color: var(--white); font-style: italic; }
.story-content strong { color: var(--red); font-weight: 600; }

/* Dấu ngăn cách phần */
.section-break {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 3rem 0;
  color: var(--grey-dim);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.2em;
}
.section-break::before,
.section-break::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(229,0,0,0.25), transparent);
}

/* Ghi chú cuối chương */
.chapter-note {
  margin-top: 3rem;
  padding: 1.25rem 1.5rem;
  background: var(--bg-card);
  border: var(--border);
  border-left: 2px solid var(--red-dim);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--grey-dim);
  line-height: 1.7;
  letter-spacing: 0.05em;
}
.chapter-note .note-label {
  color: var(--red);
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  display: block;
}

/* Trạng thái kết chương */
.chapter-end {
  text-align: center;
  margin: 4rem 0 2rem;
}
.chapter-end .end-marker {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--grey-dim);
}
.chapter-end .end-marker span { color: var(--red); }

/* Điều hướng cuối trang */
.chapter-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding-top: 2rem;
  border-top: 1px solid rgba(229,0,0,0.15);
  flex-wrap: wrap;
}
.chapter-nav a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--grey-light);
  padding: 0.6rem 1rem;
  border: var(--border);
  transition: var(--transition);
}
.chapter-nav a:hover {
  color: var(--white);
  border-color: var(--red);
  box-shadow: 0 0 12px var(--red-glow-soft);
}
.chapter-nav a.disabled {
  opacity: 0.3;
  pointer-events: none;
}
.chapter-nav .back-to-list {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--grey-dim);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: var(--transition);
}
.chapter-nav .back-to-list:hover { color: var(--red); }

/* Responsive */
@media (max-width: 600px) {
  .reader-wrapper { padding: 2rem 1.25rem 5rem; }
  .story-content { font-size: 0.97rem; }
  .chapter-nav { flex-direction: column; align-items: stretch; }
  .chapter-nav a { justify-content: center; }
}


/* ==========================================================================
   TIỆN ÍCH CHUNG
   ========================================================================== */
/* Thuộc tính hidden luôn thắng các rule display: flex/grid ở trên */
[hidden] { display: none !important; }

/* Trạng thái đang tải / trống / lỗi */
.reader-state {
  font-family: var(--font-mono); font-size: 0.85rem; letter-spacing: 0.05em;
  color: var(--grey-light); text-align: center; padding: 2.5rem 0;
}
.reader-state i { color: var(--red); margin-right: 0.4rem; }
.post-grid .reader-state { grid-column: 1 / -1; }

.btn-outline.small { padding: 0.3rem 0.75rem; font-size: 0.75rem; }
.btn-red:disabled, .btn-outline:disabled { opacity: 0.5; cursor: wait; }

/* Lỗi cũ: .story-header là thẻ <header> nên dính rule `header` (sticky + nền + viền
   dưới) — khi cuộn, khối tiêu đề truyện bị dính đè lên thanh menu. */
.story-header {
  position: static; top: auto; z-index: auto;
  background: none; backdrop-filter: none; border-bottom: none;
}

/* ==========================================================================
   NỀN SINH ĐỘNG (giữ nguyên ngôn ngữ thiết kế: đen / đỏ / lưới kỹ thuật)
   Lớp 1 — body::before: các quầng sáng đỏ trôi chậm ở góc màn hình
   Lớp 2 — body::after : lưới HUD mờ, mờ dần ra rìa
   Lớp 3 — #bg-fx (bg-fx.js): vài đốm lửa đỏ bay lên chậm
   Cả 3 nằm sau nội dung (z-index -1), không bắt chuột; tắt chuyển động nếu
   hệ điều hành bật "giảm chuyển động".
   ========================================================================== */
body::before {
  content: ''; position: fixed; inset: -20vmax; z-index: -1; pointer-events: none;
  background:
    radial-gradient(38vmax 38vmax at 84% 10%, rgba(229, 0, 0, 0.14), transparent 70%),
    radial-gradient(44vmax 44vmax at 8% 90%, rgba(229, 0, 0, 0.10), transparent 70%),
    radial-gradient(30vmax 30vmax at 48% 55%, rgba(122, 0, 0, 0.08), transparent 70%);
  animation: bgDrift 26s ease-in-out infinite alternate;
  will-change: transform;
}
@keyframes bgDrift {
  from { transform: translate3d(-2%, -1%, 0) scale(1); }
  to   { transform: translate3d(2%, 2%, 0) scale(1.08); }
}
body::after {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image:
    linear-gradient(rgba(229, 0, 0, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(229, 0, 0, 0.055) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 35%, #000 0%, transparent 78%);
          mask-image: radial-gradient(ellipse 80% 70% at 50% 35%, #000 0%, transparent 78%);
}
#bg-fx { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }
@media (prefers-reduced-motion: reduce) {
  body::before { animation: none; }
}

/* ==========================================================================
   CARD TAG (stories.html) + chip tag trên card truyện
   ========================================================================== */
.tag-card {
  background: var(--bg-card); border: var(--border);
  padding: 1.25rem 1.5rem 1.1rem; margin-bottom: 2.25rem; position: relative;
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 18px 100%, 0 calc(100% - 18px));
}
.tag-card::before {
  content: ''; position: absolute; left: 0; top: 0; width: 3px; height: 100%;
  background: linear-gradient(to bottom, var(--red), transparent);
  box-shadow: 0 0 12px var(--red-glow);
}
.tag-card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  margin-bottom: 1.1rem; padding-bottom: 0.8rem; border-bottom: 1px solid rgba(229, 0, 0, 0.15);
}
.tag-card-tools { display: flex; align-items: center; gap: 0.9rem; font-size: 0.72rem; color: var(--grey-dim); letter-spacing: 0.1em; }
.tag-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.3rem 2.25rem; }
.tag-group-title {
  display: flex; align-items: center; gap: 0.5rem;
  font-family: var(--font-mono); font-size: 0.7rem; font-weight: 400;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--grey-light);
  margin-bottom: 0.6rem;
}
.tag-group-title i { color: var(--red); font-size: 0.8rem; }
.tag-list { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tag-chip {
  display: inline-flex; align-items: center; gap: 0.45rem;
  font-family: var(--font-display); font-weight: 600; font-size: 0.86rem; letter-spacing: 0.04em;
  padding: 0.28rem 0.7rem; background: rgba(229, 0, 0, 0.05);
  border: 1px solid var(--red-dim); color: var(--grey-light);
  cursor: pointer; transition: var(--transition);
}
.tag-chip em { font-style: normal; font-family: var(--font-mono); font-size: 0.64rem; color: var(--red-dim); transition: var(--transition); }
.tag-chip:hover, .tag-chip:focus-visible { color: var(--white); border-color: var(--red); outline: none; box-shadow: 0 0 10px var(--red-glow-soft); }
.tag-chip:hover em { color: var(--red); }
.tag-chip.active { color: #fff; background: rgba(229, 0, 0, 0.2); border-color: var(--red); box-shadow: 0 0 12px var(--red-glow-soft); }
.tag-chip.active em { color: var(--red); }
.tag-chip.empty { opacity: 0.55; }
.tag-chip.empty:hover, .tag-chip.empty.active { opacity: 1; }
.tag-info {
  margin-top: 1.1rem; padding-top: 0.8rem; border-top: 1px dashed rgba(229, 0, 0, 0.2);
  font-size: 0.76rem; line-height: 1.6; color: var(--grey-light); min-height: 3.2em; letter-spacing: 0.03em;
}
.tag-info strong { color: var(--white); font-weight: 400; }
.tag-info .dim { color: var(--grey-dim); }

.story-tags { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.75rem; }
.story-tag {
  font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.06em;
  padding: 0.12rem 0.45rem; border: 1px solid rgba(229, 0, 0, 0.3);
  color: var(--grey-light); background: rgba(229, 0, 0, 0.05); transition: var(--transition);
}
a.story-tag:hover, a.story-tag.active { color: #fff; border-color: var(--red); background: rgba(229, 0, 0, 0.18); }
.story-tag.more { color: var(--grey-dim); border-style: dashed; }
.story-footer .read-link.soon { color: var(--grey-dim); }
a.genre-tag { transition: var(--transition); margin-right: 0.3rem; }
a.genre-tag:hover { color: #fff; border-color: var(--red); background: rgba(229, 0, 0, 0.18); }
.story-meta-bar .meta-item { flex-wrap: wrap; }

/* ==========================================================================
   BLOG + BÀI VIẾT
   ========================================================================== */
.post-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.25rem; }
.post-card {
  background: var(--bg-card); border: var(--border); padding: 1.3rem 1.4rem 1.2rem;
  display: flex; flex-direction: column; gap: 0.5rem; cursor: pointer; transition: var(--transition);
}
.post-card:hover {
  transform: translateY(-3px); border-color: var(--red); background: var(--bg-card-hover);
  box-shadow: 0 0 20px var(--red-glow-soft), 0 8px 30px rgba(0, 0, 0, 0.6);
}
.post-date { font-size: 0.7rem; color: var(--grey-dim); letter-spacing: 0.1em; }
.post-date i { color: var(--red-dim); margin-right: 0.25rem; }
.post-title { font-family: var(--font-display); font-size: 1.2rem; font-weight: 700; letter-spacing: 0.03em; color: var(--white); line-height: 1.3; transition: var(--transition); }
.post-card:hover .post-title { color: var(--red); }
.post-summary { font-size: 0.85rem; color: var(--grey-light); line-height: 1.65; flex: 1; }
.post-card .read-link {
  margin-top: 0.7rem; font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.1em;
  color: var(--red); text-transform: uppercase; display: flex; align-items: center; gap: 0.35rem; transition: var(--transition);
}
.post-card .read-link:hover { gap: 0.65rem; }

.post-main-title { text-transform: none; font-size: clamp(1.6rem, 4vw, 2.4rem); }
.post-tags { margin: -1.5rem 0 2rem; }

/* Nội dung dựng từ MiniMD (bài viết + chương động) */
.story-content .sub-heading {
  font-family: var(--font-display); font-size: 1.1rem; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--white); margin: 2rem 0 0.8rem;
}
.story-content ul { margin: 0 0 1.4rem 1.3rem; }
.story-content li { margin-bottom: 0.4rem; }
.story-content a { color: var(--red); border-bottom: 1px solid var(--red-dim); transition: var(--transition); }
.story-content a:hover { color: #ff4a4a; border-bottom-color: #ff4a4a; }
/* Bài viết thường: không dùng chữ cái đầu to kiểu truyện */
.story-content.post-body p:first-of-type::first-letter {
  font: inherit; color: inherit; float: none; line-height: inherit; margin: 0; text-shadow: none;
}
.story-content.post-body p { text-align: left; hyphens: manual; }

/* ==========================================================================
   ADMIN (admin.html)
   ========================================================================== */
.admin-wrap { max-width: 900px; }
.admin-page nav ul {
  display: flex !important; position: static; width: auto; flex-direction: row;
  background: none; border: none; padding: 0;
}
.admin-page nav ul li a { padding: 0.45rem 0.85rem; }

.panel { background: var(--bg-card); border: var(--border); padding: 1.4rem 1.5rem 1.5rem; margin-bottom: 1.5rem; }
.panel-head {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap;
  margin-bottom: 1.2rem; padding-bottom: 0.8rem; border-bottom: 1px solid rgba(229, 0, 0, 0.15);
}
.conn-state { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.08em; color: var(--grey-dim); }
.conn-state.on { color: #3ddc84; }

.field { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 1rem; min-width: 0; }
.field > span { font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--grey-light); }
.field input, .field select, .field textarea {
  width: 100%; background: #080808; color: var(--white);
  border: 1px solid rgba(229, 0, 0, 0.3); border-radius: var(--radius);
  padding: 0.6rem 0.75rem; font-family: var(--font-body); font-size: 0.92rem; line-height: 1.6;
  transition: var(--transition);
}
.field textarea { resize: vertical; min-height: 7rem; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--red); box-shadow: 0 0 12px var(--red-glow-soft);
}
.field select option { background: #0d0d0d; }
.field-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.field-row .field { flex: 1 1 170px; }
.field-row .field.grow { flex: 2 1 260px; }
.field-row .field.narrow { flex: 0 1 170px; }
.check { display: flex; gap: 0.5rem; align-items: center; font-size: 0.8rem; color: var(--grey-light); margin-bottom: 1rem; cursor: pointer; }
.check input { accent-color: var(--red); }
.btn-row { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 0.5rem; }

.help { margin-top: 1rem; font-size: 0.82rem; color: var(--grey-light); line-height: 1.7; }
.help summary { cursor: pointer; font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.1em; color: var(--red); text-transform: uppercase; }
.help ol, .help ul { margin: 0.6rem 0 0.6rem 1.3rem; }
.help p { margin-top: 0.4rem; }
.help code, .syntax code {
  font-family: var(--font-mono); font-size: 0.78rem; padding: 0.05rem 0.35rem;
  background: rgba(229, 0, 0, 0.08); border: 1px solid rgba(229, 0, 0, 0.2); color: #ff8a8a;
}

.admin-tabs { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 1.3rem; border-bottom: 1px solid rgba(229, 0, 0, 0.2); }
.admin-tab {
  display: inline-flex; align-items: center; gap: 0.5rem; background: transparent;
  border: 1px solid transparent; border-bottom: none; color: var(--grey-light); cursor: pointer;
  font-family: var(--font-display); font-weight: 600; font-size: 0.9rem; letter-spacing: 0.08em;
  text-transform: uppercase; padding: 0.55rem 1rem; transition: var(--transition);
}
.admin-tab:hover { color: var(--white); }
.admin-tab.active { color: var(--white); background: rgba(229, 0, 0, 0.12); border-color: rgba(229, 0, 0, 0.45); }

.meta-line { font-size: 0.72rem; color: var(--grey-dim); min-height: 1.2em; margin: -0.4rem 0 0.8rem; letter-spacing: 0.05em; }
.preview-box { position: relative; margin-top: 1.4rem; border: 1px dashed rgba(229, 0, 0, 0.35); padding: 1.4rem 1.5rem 1rem; background: #080808; }
.preview-tag { position: absolute; top: -0.65rem; left: 1rem; padding: 0 0.5rem; background: var(--bg-card); font-size: 0.65rem; letter-spacing: 0.2em; color: var(--red); }

.tag-picker .tag-group { margin-bottom: 0.9rem; }
.tag-add { align-items: center; margin-top: 0.6rem; margin-bottom: 0; gap: 0.6rem; }
.tag-add input {
  flex: 1 1 220px; background: #080808; color: var(--white); border: 1px solid rgba(229, 0, 0, 0.3);
  padding: 0.5rem 0.7rem; font-family: var(--font-body); font-size: 0.88rem;
}
.tag-add input:focus { outline: none; border-color: var(--red); }

.log { max-height: 260px; overflow: auto; font-size: 0.76rem; line-height: 1.75; letter-spacing: 0.03em; }
.log-line.ok { color: #3ddc84; }
.log-line.err { color: #ff5a5a; }
.log-line.info { color: var(--grey-light); }
.log-line a { color: var(--red); text-decoration: underline; }

@media (max-width: 600px) {
  .tag-card { padding: 1.1rem 1.1rem 1rem; }
  .tag-groups { grid-template-columns: 1fr; }
  .panel { padding: 1.1rem 1.1rem 1.2rem; }
  .post-tags { margin-top: -1rem; }
}

/* ===== Trang truyện (story.html) + menu chọn chương ===== */
.story-hero { display: grid; grid-template-columns: 240px 1fr; gap: 2rem; margin: 1.5rem 0 2.5rem; }
.story-hero-cover { aspect-ratio: 2/3; border: 1px solid var(--border, rgba(255,255,255,.12)); border-radius: 6px; overflow: hidden; background: rgba(255,255,255,.03); }
.story-hero-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.story-hero-cover .cover-placeholder { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem; opacity: .5; }
.story-hero-info { display: flex; flex-direction: column; gap: .9rem; min-width: 0; }
.story-hero-info .story-main-title { margin: 0; }
.story-hero-synopsis { line-height: 1.7; opacity: .9; margin: 0; }
.story-hero-stats { font-size: .8rem; opacity: .7; }
.dim-text { opacity: .6; }
.preview-header { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.chapter-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.chapter-row { display: grid; grid-template-columns: 3.2rem 1fr auto 1rem; align-items: center; gap: 1rem; padding: .8rem 1rem; border: 1px solid rgba(255,255,255,.1); border-radius: 6px; background: rgba(255,255,255,.02); color: inherit; text-decoration: none; transition: border-color .2s, background .2s, transform .2s; }
a.chapter-row:hover { border-color: var(--red); background: rgba(229,0,0,.07); transform: translateX(3px); }
.chapter-num { color: var(--red); font-weight: 700; }
.chapter-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.chapter-meta { font-size: .75rem; opacity: .6; white-space: nowrap; }
.chapter-row.soon { opacity: .4; border-style: dashed; cursor: default; }
.chapter-select { background: rgba(0,0,0,.4); color: inherit; border: 1px solid rgba(255,255,255,.2); border-radius: 4px; padding: .5rem .7rem; font: inherit; font-size: .85rem; max-width: 100%; min-width: 0; cursor: pointer; }
.chapter-select:hover, .chapter-select:focus { border-color: var(--red); outline: none; }
.chapter-select option { background: #111; }
.chapter-nav #nav-mid { display: flex; justify-content: center; min-width: 0; }
@media (max-width: 640px) {
  .story-hero { grid-template-columns: 1fr; }
  .story-hero-cover { max-width: 200px; }
  .chapter-row { grid-template-columns: 2.6rem 1fr 1rem; }
  .chapter-meta { display: none; }
  .chapter-nav { flex-wrap: wrap; gap: .6rem; }
  .chapter-nav #nav-mid, .chapter-nav .chapter-select { order: 3; width: 100%; }
}

/* ===== Hero 2 cột 60/40: tác phẩm chủ lực + terminal ===== */
.hero-split { display: grid; grid-template-columns: 3fr 2fr; gap: 2.5rem; align-items: center; }
.hero-left, .hero-right { min-width: 0; position: relative; z-index: 1; }
.hero-right { display: flex; flex-direction: column; gap: 1rem; }
.spotlight { display: grid; grid-template-columns: 110px 1fr; gap: 1rem; padding: .9rem; border: 1px solid rgba(229,0,0,.35); border-radius: 6px; background: rgba(0,0,0,.35); color: inherit; text-decoration: none; transition: border-color .2s, box-shadow .2s, transform .2s; }
.spotlight:hover { border-color: var(--red); box-shadow: 0 0 18px var(--red-glow-soft); transform: translateY(-2px); }
.spot-cover { position: relative; aspect-ratio: 2/3; border-radius: 4px; overflow: hidden; background: rgba(255,255,255,.04); }
.spot-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.spot-cover .cover-placeholder { height: 100%; display: flex; align-items: center; justify-content: center; opacity: .4; }
.spot-badge { position: absolute; left: 0; bottom: 0; right: 0; background: var(--red); color: #fff; font-size: .6rem; font-weight: 700; letter-spacing: .08em; text-align: center; padding: .2rem 0; font-family: 'Rajdhani', sans-serif; }
.spot-info { display: flex; flex-direction: column; gap: .4rem; justify-content: center; min-width: 0; }
.spot-info h3 { margin: 0; font-size: 1.35rem; text-transform: uppercase; }
.spot-label { font-size: .65rem; letter-spacing: .12em; color: var(--red); }
.spot-info p { margin: 0; font-size: .75rem; opacity: .75; }
.terminal { border: 1px solid rgba(255,255,255,.12); border-radius: 6px; background: rgba(0,0,0,.55); overflow: hidden; }
.term-bar { display: flex; align-items: center; gap: .35rem; padding: .4rem .7rem; border-bottom: 1px solid rgba(255,255,255,.08); background: rgba(255,255,255,.03); }
.term-bar span { width: 8px; height: 8px; border-radius: 50%; background: #444; }
.term-bar span:first-child { background: var(--red); }
.term-bar b { margin-left: auto; font-size: .65rem; font-weight: 400; opacity: .5; }
.term-body { margin: 0; padding: .8rem 1rem; font-size: .78rem; line-height: 1.7; color: #b8c4b8; white-space: pre-wrap; overflow-wrap: anywhere; }
.term-body i { font-style: normal; color: var(--red); }
.cursor { animation: termBlink 1s steps(1) infinite; }
@keyframes termBlink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .cursor { animation: none; } }
@media (max-width: 860px) { .hero-split { grid-template-columns: 1fr; gap: 1.75rem; } }

/* ===== Admin: thanh bên trái + sửa/xóa ===== */
.admin-wrap { max-width: 1120px; }
.admin-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.admin-side { position: sticky; top: 5rem; padding: 1.1rem; margin-bottom: 0; display: flex; flex-direction: column; gap: 1rem; }
.side-user { display: flex; gap: .7rem; align-items: center; padding-bottom: .9rem; border-bottom: 1px solid rgba(229,0,0,.2); }
.side-user > i { font-size: 1.8rem; color: var(--red); }
.side-user b { display: block; font-family: var(--font-display, 'Rajdhani', sans-serif); font-size: 1.05rem; }
.side-user span { font-size: .62rem; letter-spacing: .14em; color: var(--grey-dim); }
.side-nav { display: flex; flex-direction: column; gap: .3rem; }
.side-link { display: flex; align-items: center; gap: .6rem; padding: .6rem .75rem; border: 1px solid transparent; border-left: 2px solid transparent; color: var(--grey-light); text-decoration: none; font-size: .88rem; transition: all .2s; }
.side-link i { width: 1.1rem; text-align: center; color: var(--red); }
.side-link:hover { color: var(--white); background: rgba(229,0,0,.06); }
.side-link.active { color: var(--white); background: rgba(229,0,0,.12); border-left-color: var(--red); }
.admin-main { min-width: 0; }
.login-panel { max-width: 560px; margin-left: auto; margin-right: auto; }
.notice { margin: .8rem 0 0; padding: .6rem .8rem; border: 1px solid rgba(255,90,90,.4); background: rgba(255,90,90,.07); color: #ff9a9a; font-size: .82rem; }
.editing-bar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1.1rem; padding: .6rem .9rem; border: 1px solid rgba(61,220,132,.4); background: rgba(61,220,132,.07); color: #3ddc84; font-size: .85rem; }
.editing-bar[hidden] { display: none; }
.mine-h { font-family: var(--font-display, 'Rajdhani', sans-serif); letter-spacing: .08em; text-transform: uppercase; font-size: .95rem; color: var(--red); margin: 1.4rem 0 .7rem; }
.mine-h:first-child { margin-top: 0; }
.mine-item { border: 1px solid rgba(255,255,255,.1); background: rgba(255,255,255,.02); padding: .75rem .9rem; margin-bottom: .6rem; }
.mine-row { display: flex; justify-content: space-between; align-items: center; gap: .8rem; flex-wrap: wrap; }
.mine-title { min-width: 0; overflow-wrap: anywhere; }
.mine-btns { display: inline-flex; gap: .4rem; flex-wrap: wrap; }
.mine-btns .btn-outline, .mine-btns a.btn-outline { text-decoration: none; }
.btn-outline.danger { border-color: rgba(255,90,90,.5); color: #ff8a8a; }
.btn-outline.danger:hover { background: rgba(255,90,90,.12); }
.mine-sub { list-style: none; margin: .7rem 0 0 .2rem; padding: .6rem 0 0 .9rem; border-top: 1px dashed rgba(255,255,255,.1); display: flex; flex-direction: column; gap: .45rem; }
.mine-sub li { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; font-size: .88rem; }
.mine-sub li .mono { color: var(--red); }
.who-tag { font-size: .65rem; border: 1px solid rgba(229,0,0,.4); padding: .05rem .4rem; margin-left: .4rem; color: var(--grey-light); }
.keyout { margin-top: 1rem; padding: .9rem; background: #080808; border: 1px dashed rgba(229,0,0,.4); font-size: .75rem; white-space: pre-wrap; overflow-wrap: anywhere; user-select: all; }
@media (max-width: 860px) {
  .admin-layout { grid-template-columns: 1fr; }
  .admin-side { position: static; }
  .side-nav { flex-direction: row; flex-wrap: wrap; }
  .side-link { flex: 1 1 45%; }
}
@media (max-width: 480px) {
  .admin-page .nav-inner { padding-left: .9rem; padding-right: .9rem; gap: .5rem; }
  .admin-page .brand { font-size: 1.05rem; }
  .admin-page nav ul li a { padding: .35rem .4rem; font-size: .68rem; letter-spacing: .04em; }
}

/* ===== Ảnh trong chương / bài viết (![mô tả](https://...)) ===== */
.story-figure { margin: 1.8rem 0; text-align: center; }
.story-figure img { max-width: 100%; height: auto; border: 1px solid rgba(255,255,255,.12); border-radius: 4px; display: inline-block; }
.story-figure figcaption { margin-top: .5rem; font-size: .78rem; opacity: .65; font-style: italic; }
.file-btn { cursor: pointer; display: inline-flex; align-items: center; gap: .4rem; }
.file-btn input { display: none; }
textarea.drop { outline: 2px dashed var(--red); outline-offset: -4px; }


/* ==========================================================================
   TRẢI NGHIỆM ĐỌC (reader-tools.js)
   Biến --r-* do reader-tools.js đặt từ lựa chọn của người đọc; nếu chưa chọn
   gì thì dùng đúng giá trị mặc định cũ nên giao diện không đổi.
   ========================================================================== */
.reader-wrapper { max-width: var(--r-width, 780px); }
.reader-wrapper .story-content {
  font-size: calc(1.05rem * var(--r-scale, 1));
  line-height: var(--r-lh, 1.95);
}
@media (max-width: 600px) {
  .reader-wrapper .story-content { font-size: calc(0.97rem * var(--r-scale, 1)); }
}
html[data-rfont="serif"] .story-content { font-family: 'Noto Serif', 'Source Serif 4', Georgia, 'Times New Roman', serif; }
html[data-ralign="left"] .story-content p { text-align: left; hyphens: manual; }

/* Nền "Đen": tắt quầng sáng + lưới + đốm lửa để tiết kiệm pin (OLED) và bớt xao nhãng */
html[data-rtheme="black"] body { background-color: #000; background-image: none; }
html[data-rtheme="black"] body::before,
html[data-rtheme="black"] body::after,
html[data-rtheme="black"] #bg-fx { display: none; }

/* Nền "Giấy": chữ tối trên nền kem, dễ đọc ban ngày */
html[data-rtheme="paper"] body { background-color: #f1e8d4; background-image: none; color: #2b2419; }
html[data-rtheme="paper"] body::before,
html[data-rtheme="paper"] body::after,
html[data-rtheme="paper"] #bg-fx { display: none; }
html[data-rtheme="paper"] .story-content { color: #2f281c; }
html[data-rtheme="paper"] .story-content em { color: #1b160d; }
html[data-rtheme="paper"] .story-content strong { color: #a30000; }
html[data-rtheme="paper"] .story-content .section-heading { color: #1b160d; border-bottom-color: rgba(163,0,0,.3); }
html[data-rtheme="paper"] .story-content .section-break,
html[data-rtheme="paper"] .story-content .story-quote { color: #4a4030; }
html[data-rtheme="paper"] .story-main-title,
html[data-rtheme="paper"] .story-chapter-title { color: #1b160d; text-shadow: none; }
html[data-rtheme="paper"] .story-series,
html[data-rtheme="paper"] .breadcrumb,
html[data-rtheme="paper"] .breadcrumb a,
html[data-rtheme="paper"] .story-meta-bar,
html[data-rtheme="paper"] .story-meta-bar .meta-item,
html[data-rtheme="paper"] .reader-state { color: #5a4e38; }
html[data-rtheme="paper"] .chapter-nav a,
html[data-rtheme="paper"] .chapter-select { color: #1b160d; background-color: rgba(0,0,0,.04); }
html[data-rtheme="paper"] .end-marker { color: #5a4e38; }

/* Thanh menu tự ẩn khi cuộn xuống */
header { transition: transform .28s ease; }
header.rt-hide { transform: translateY(-100%); }

/* Nút nổi: Aa + lên đầu trang */
.rt-fab {
  position: fixed; right: 1rem; z-index: 90; width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  background: rgba(13,13,13,.92); color: var(--white); border: var(--border);
  font-family: var(--font-display); font-weight: 700; font-size: 1.05rem;
  backdrop-filter: blur(6px); transition: var(--transition);
}
.rt-fab:hover, .rt-fab:focus-visible { border-color: var(--red); box-shadow: 0 0 12px var(--red-glow-soft); outline: none; }
.rt-fab small { font-size: .75em; }
.rt-aa { bottom: 1rem; }
.rt-top { bottom: 4rem; flex-direction: column; gap: 0; font-size: .7rem; line-height: 1; }
.rt-top i { font-size: .8rem; color: var(--red); margin-bottom: 2px; }
.rt-top b { font-size: .58rem; font-weight: 400; color: var(--grey-light); }

.rt-panel {
  position: fixed; right: 1rem; bottom: 4rem; z-index: 91; width: min(320px, calc(100vw - 2rem));
  background: rgba(10,10,10,.97); border: var(--border); padding: .9rem 1rem 1rem;
  box-shadow: 0 8px 30px rgba(0,0,0,.6); color: #e8e8e8;
}
.rt-row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .45rem 0; }
.rt-row label { font-family: var(--font-mono); font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--grey-light); }
.rt-step, .rt-seg { display: flex; align-items: center; gap: .35rem; }
.rt-step output { min-width: 3.4rem; text-align: center; font-family: var(--font-mono); font-size: .8rem; }
.rt-step button, .rt-seg button {
  min-width: 36px; height: 32px; padding: 0 .6rem; cursor: pointer; font-family: var(--font-display);
  font-size: .85rem; font-weight: 600; color: #e8e8e8; background: #141414;
  border: 1px solid rgba(255,255,255,.14); border-radius: var(--radius); transition: var(--transition);
}
.rt-step button:hover, .rt-seg button:hover { border-color: var(--red); }
.rt-seg button.on { background: var(--red); border-color: var(--red); color: #fff; }
.rt-reset {
  margin-top: .5rem; width: 100%; height: 32px; cursor: pointer; background: none; color: var(--grey-light);
  border: 1px dashed rgba(255,255,255,.2); font-family: var(--font-mono); font-size: .72rem; letter-spacing: .08em;
}
.rt-reset:hover { color: var(--white); border-color: var(--red); }

.rt-toast {
  position: fixed; left: 50%; bottom: 1.2rem; transform: translateX(-50%); z-index: 95; max-width: calc(100vw - 2rem);
  display: flex; align-items: center; gap: .7rem; padding: .6rem .9rem; background: rgba(10,10,10,.96); color: #e8e8e8;
  border: var(--border); font-family: var(--font-mono); font-size: .75rem; box-shadow: 0 8px 24px rgba(0,0,0,.6);
  animation: rtIn .3s ease; transition: opacity .4s;
}
.rt-toast.out { opacity: 0; }
.rt-toast i { color: var(--red); }
.rt-toast button { cursor: pointer; background: none; border: 1px solid rgba(255,255,255,.25); color: #e8e8e8; padding: .15rem .5rem; font: inherit; }
.rt-toast button:hover { border-color: var(--red); }
@keyframes rtIn { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* story.html: dấu đã đọc + nút đọc tiếp */
.chapter-row.is-read .chapter-name { color: var(--grey-dim); }
.chapter-row .read-tick { color: var(--red); font-size: .7rem; margin-left: .35rem; }
.chapter-row.is-resume { border-color: var(--red); }

@media (prefers-reduced-motion: reduce) {
  header, .rt-fab, .rt-toast { transition: none; animation: none; }
}
@media print { .rt-fab, .rt-panel, .rt-toast { display: none !important; } }


/* ==========================================================================
   CAROUSEL TÁC PHẨM CHỦ LỰC (spotlight.js)
   ========================================================================== */
.spot-carousel { min-width: 0; touch-action: pan-y; }
.spot-viewport { overflow: hidden; border-radius: 6px; }
.spot-track { display: flex; transition: transform .55s cubic-bezier(.22,.8,.3,1); will-change: transform; }
.spot-slide { flex: 0 0 100%; min-width: 0; box-sizing: border-box; }
.spot-slide:hover { transform: none; box-shadow: none; }
.spot-dots { display: flex; justify-content: center; gap: .15rem; margin-top: .45rem; }
.spot-dot { width: 32px; height: 16px; padding: 0; border: 0; background: none; cursor: pointer; display: flex; align-items: center; }
.spot-dot .bar { position: relative; display: block; width: 100%; height: 4px; border-radius: 2px; overflow: hidden; background: rgba(255,255,255,.16); transition: background .2s; }
.spot-dot:hover .bar, .spot-dot:focus-visible .bar { background: rgba(255,255,255,.32); }
.spot-dot:focus-visible { outline: 1px solid var(--red); outline-offset: 1px; }
.spot-dot .fill { position: absolute; inset: 0; background: var(--red); transform: scaleX(0); transform-origin: left; }
.spot-dot.on .fill { animation: spotFill 5s linear forwards; }
.spot-carousel.paused .spot-dot.on .fill { animation-play-state: paused; }
@keyframes spotFill { to { transform: scaleX(1); } }
@media (prefers-reduced-motion: reduce) {
  .spot-track { transition: none; }
  .spot-dot.on .fill { animation: none; transform: scaleX(1); }
}

/* ==========================================================================
   THANH TÌM KIẾM + NÚT GACHA
   ========================================================================== */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.search-bar {
  position: relative; display: flex; align-items: center; flex: 1; min-width: 0;
  background: rgba(0,0,0,.45); border: var(--border); transition: var(--transition);
}
.search-bar:focus-within { border-color: var(--red); box-shadow: 0 0 12px var(--red-glow-soft); }
.search-bar > i { padding: 0 .3rem 0 .85rem; color: var(--grey-light); font-size: .85rem; }
.search-bar input {
  flex: 1; min-width: 0; height: 42px; padding: 0 .75rem; background: none; border: 0; outline: 0;
  color: var(--white); font-family: var(--font-body, inherit); font-size: .95rem;
}
.search-bar input::placeholder { color: var(--grey-light); opacity: .8; }
.search-bar input::-webkit-search-cancel-button { display: none; }
.search-bar .search-clear { height: 42px; width: 38px; background: none; border: 0; color: var(--grey-light); font-size: 1.2rem; cursor: pointer; }
.search-bar .search-clear:hover { color: var(--white); }
.search-bar kbd { margin-right: .7rem; padding: 0 .4rem; font: .7rem var(--font-mono); color: var(--grey-light); border: 1px solid rgba(255,255,255,.2); border-radius: 3px; }
.search-bar input:focus ~ kbd, .search-bar input:not(:placeholder-shown) ~ kbd { display: none; }
.search-wrap { margin-bottom: 1rem; }

.home-tools { display: flex; gap: .75rem; align-items: stretch; margin: 0 0 1.1rem; flex-wrap: wrap; }
.home-tools .search-bar { flex: 1 1 260px; }
.btn-gacha {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem; padding: 0 1.1rem; height: 44px; cursor: pointer;
  font-family: var(--font-display); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; font-size: .85rem;
  color: #ffc247; background: rgba(255,194,71,.07); border: 1px solid rgba(255,194,71,.45); transition: var(--transition);
}
.btn-gacha:hover, .btn-gacha:focus-visible { background: rgba(255,194,71,.16); box-shadow: 0 0 16px rgba(255,194,71,.3); outline: none; }
.btn-gacha:hover i { transform: rotate(180deg); }
.btn-gacha i { transition: transform .4s; }
.btn-gacha:disabled { opacity: .6; cursor: wait; }

/* ==========================================================================
   GACHA (gacha.js)
   ========================================================================== */
.gacha-overlay { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; padding: 1rem; background: rgba(0,0,0,.82); backdrop-filter: blur(4px); animation: gachaFade .2s ease; }
.gacha-overlay[hidden] { display: none; }
.gacha-box { position: relative; width: min(360px, 100%); max-height: calc(100vh - 2rem); overflow-y: auto; padding: 1.1rem 1.1rem 1rem; background: #0b0b0b; border: var(--border); box-shadow: 0 10px 50px rgba(0,0,0,.7); }
.gacha-x { position: absolute; top: .3rem; right: .5rem; width: 34px; height: 34px; background: none; border: 0; color: var(--grey-light); font-size: 1.5rem; cursor: pointer; }
.gacha-x:hover { color: var(--white); }
.gacha-label { font-size: .68rem; letter-spacing: .12em; color: var(--red); margin-bottom: .8rem; padding-right: 1.8rem; }
.gacha-card { --rc: rgba(255,255,255,.18); position: relative; display: flex; flex-direction: column; gap: .5rem; padding: .8rem; min-height: 280px; border: 1px solid var(--rc); background: rgba(255,255,255,.02); transition: border-color .3s, box-shadow .3s; }
.gacha-cover { aspect-ratio: 16 / 10; overflow: hidden; background: rgba(255,255,255,.04); display: flex; align-items: center; justify-content: center; }
.gacha-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gacha-card.spinning .gacha-cover { filter: blur(2px) saturate(.6); }
.gacha-card.spinning .gacha-title { opacity: .6; }
.gacha-title { margin: 0; font-size: 1.25rem; text-transform: uppercase; }
.gacha-rar { font-size: .72rem; letter-spacing: .14em; color: var(--rc); font-weight: 700; }
.gacha-tags { display: flex; flex-wrap: wrap; gap: .3rem; }
.gacha-syn { margin: 0; font-size: .8rem; opacity: .8; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.gacha-meta { font-size: .68rem; opacity: .65; margin-top: auto; }
.gacha-card.revealed { animation: gachaPop .45s cubic-bezier(.2,1.4,.4,1); box-shadow: 0 0 18px color-mix(in srgb, var(--rc) 35%, transparent); }
.gacha-card.rar-N   { --rc: #9a9a9a; }
.gacha-card.rar-R   { --rc: #3fd0c9; }
.gacha-card.rar-SR  { --rc: #b66bff; box-shadow: 0 0 26px rgba(182,107,255,.45); }
.gacha-card.rar-SSR { --rc: #ffc247; box-shadow: 0 0 34px rgba(255,194,71,.6); background: linear-gradient(135deg, rgba(255,194,71,.1), rgba(255,255,255,.02) 40%, rgba(255,194,71,.1)); }
.gacha-card.rar-SSR::after { content: ""; position: absolute; inset: -2px; border: 2px solid #ffc247; pointer-events: none; animation: gachaRing 1.1s ease-out forwards; }
.gacha-actions { display: flex; gap: .6rem; margin-top: .8rem; }
.gacha-actions > * { flex: 1; justify-content: center; text-align: center; }
.gacha-actions .btn-outline:disabled { opacity: .5; cursor: wait; }
.gacha-foot { margin-top: .7rem; font-size: .66rem; color: var(--grey-light); text-align: center; min-height: 1em; }
@keyframes gachaFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes gachaPop { 0% { transform: scale(.92); } 100% { transform: scale(1); } }
@keyframes gachaRing { from { opacity: 1; transform: scale(1); } to { opacity: 0; transform: scale(1.12); } }
@media (prefers-reduced-motion: reduce) {
  .gacha-overlay, .gacha-card.revealed, .gacha-card.rar-SSR::after { animation: none; }
}

/* Vé gacha + kỷ lục minigame */
.ticket-line { margin: 0 0 1rem; font-size: .78rem; color: var(--grey-light); line-height: 1.6; }
.ticket-line i { color: #ffc247; }
.ticket-line b { color: var(--white); }
.ticket-line a { color: #ffc247; margin-left: .3rem; white-space: nowrap; }
.over-note { margin: 0 0 .6rem; min-height: 1em; font-size: 12px; color: #ffc247; text-align: center; padding: 0 .8rem; }
.gacha-empty { display: flex; flex-direction: column; align-items: center; gap: .5rem; text-align: center; padding: 2rem .5rem; }
.gacha-empty i { font-size: 2rem; color: #ffc247; }

/* Modpack chưa có bản tải: nút mờ, không bấm được */
.btn-disabled { opacity: .45; cursor: not-allowed; pointer-events: none; filter: grayscale(.4); }

/* Khung xám khi đang tải danh sách truyện */
.story-card.skeleton { pointer-events: none; }
.story-card.skeleton .story-cover { min-height: 170px; background: rgba(255,255,255,.05); }
.story-card.skeleton .story-body { display: flex; flex-direction: column; gap: .6rem; padding: 1rem; }
.story-card.skeleton .story-body i { display: block; height: 12px; border-radius: 3px; background: rgba(255,255,255,.06); }
.story-card.skeleton .story-body i.short { width: 55%; }
.story-card.skeleton .story-cover, .story-card.skeleton .story-body i { animation: skelPulse 1.3s ease-in-out infinite; }
@keyframes skelPulse { 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) { .story-card.skeleton .story-cover, .story-card.skeleton .story-body i { animation: none; } }

/* ==========================================================================
   FLAPPY + 2048 (js/game-flappy.js, js/game-2048.js)
   ========================================================================== */
.game-tabs { flex-wrap: wrap; }

#flappy-container { position: relative; width: 100%; max-width: 360px; margin: 0 auto; background: #050505; border-bottom: 2px solid var(--red); overflow: hidden; cursor: pointer; touch-action: manipulation; user-select: none; }
#flappy-canvas { display: block; width: 100%; height: auto; aspect-ratio: 320 / 480; }

#g2048-wrap { position: relative; width: 100%; max-width: 360px; margin: 0 auto; padding: 8px; box-sizing: border-box; background: #0b0b0b; border: 1px solid rgba(255,255,255,.1); touch-action: none; user-select: none; }
#g2048-grid { --gap: 8px; --cell: calc((100% - 3 * var(--gap)) / 4); position: relative; width: 100%; aspect-ratio: 1; display: grid; grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(4, 1fr); gap: var(--gap); }
.g2048-cell { background: rgba(255,255,255,.04); border-radius: 3px; }
.g2048-tile {
  position: absolute; width: var(--cell); height: var(--cell); box-sizing: border-box;
  left: calc(var(--c) * (var(--cell) + var(--gap))); top: calc(var(--r) * (var(--cell) + var(--gap)));
  display: flex; align-items: center; justify-content: center; border-radius: 3px;
  font-family: var(--font-mono); font-weight: 700; font-size: 1.7rem; color: #e8e8e8;
  background: #1a1a1a; border: 1px solid rgba(255,255,255,.08);
  transition: left .12s ease, top .12s ease;
}
.g2048-tile.d3 { font-size: 1.4rem; } .g2048-tile.d4 { font-size: 1.1rem; } .g2048-tile.d5 { font-size: .9rem; }
.g2048-tile.v2 { background: #1d1d1d; }
.g2048-tile.v4 { background: #2a1717; }
.g2048-tile.v8 { background: #4a1b1b; color: #fff; }
.g2048-tile.v16 { background: #6e1c1c; color: #fff; }
.g2048-tile.v32 { background: #962020; color: #fff; }
.g2048-tile.v64 { background: #c42a2a; color: #fff; box-shadow: 0 0 10px var(--red-glow-soft); }
.g2048-tile.v128 { background: #b87a24; color: #fff; }
.g2048-tile.v256 { background: #c98c2a; color: #fff; }
.g2048-tile.v512 { background: #d99f31; color: #111; }
.g2048-tile.v1024 { background: #e8b53b; color: #111; box-shadow: 0 0 12px rgba(255,194,71,.4); }
.g2048-tile.v2048 { background: #ffd24a; color: #111; box-shadow: 0 0 18px rgba(255,194,71,.7); }
.g2048-tile.v4096 { background: #fff; color: #111; }
.g2048-tile.new { animation: g48new .18s ease .1s backwards; }
.g2048-tile.pop { animation: g48pop .16s ease; }
@keyframes g48new { from { transform: scale(0); } to { transform: scale(1); } }
@keyframes g48pop { 50% { transform: scale(1.14); } }
@media (max-width: 400px) { .g2048-tile { font-size: 1.35rem; } .g2048-tile.d3 { font-size: 1.1rem; } .g2048-tile.d4 { font-size: .9rem; } }
@media (prefers-reduced-motion: reduce) { .g2048-tile { transition: none; } .g2048-tile.new, .g2048-tile.pop { animation: none; } }

/* ---- Modpack từ admin ---- */
.modpack-icon.has-img { padding: 0; overflow: hidden; }
.modpack-icon.has-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.modpack-name a { color: inherit; text-decoration: none; }
.modpack-name a:hover { color: var(--red, #e50000); }
.dl-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .9rem 1.1rem; margin-bottom: .6rem; border: 1px solid rgba(255,255,255,.08); border-radius: 8px; background: rgba(255,255,255,.03); }
.dl-info { display: flex; align-items: center; gap: .9rem; min-width: 0; }
.dl-info > i { font-size: 1.4rem; opacity: .8; }
.dl-label { font-weight: 600; overflow-wrap: anywhere; }
.dl-meta { font-size: .8rem; opacity: .65; }
@media (max-width: 560px) { .dl-row { flex-direction: column; align-items: stretch; } .dl-row .btn-red { text-align: center; } }
.mp-desc { line-height: 1.8; max-width: 70ch; } .mp-desc img { max-width: 100%; }
.dl-edit { display:flex; gap:.6rem; align-items:center; margin:.4rem 0; flex-wrap:wrap } .dl-edit input { flex:1 1 200px }

/* ---- Nhập hàng loạt ---- */
.dropzone { border: 2px dashed rgba(255,255,255,.18); border-radius: 10px; padding: 1.4rem 1rem; text-align: center; margin: .8rem 0; transition: border-color .2s, background .2s; }
.dropzone.drop { border-color: var(--red, #e50000); background: rgba(229,0,0,.06); }
.dropzone > i { font-size: 1.8rem; opacity: .7; }
.bulk-scroll { overflow-x: auto; margin: .8rem 0; }
.bulk-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.bulk-table th, .bulk-table td { padding: .4rem .5rem; border-bottom: 1px solid rgba(255,255,255,.08); text-align: left; vertical-align: top; }
.bulk-table input[type=text], .bulk-table input[type=number] { width: 100%; min-width: 7rem; }
.bulk-table input.b-n { width: 5rem; min-width: 0; }
.b-st.ok { color: #4ade80; } .b-st.warn { color: #fbbf24; } .b-st.err { color: #f87171; } .b-st.dim { opacity: .6; }

/* ---- Trang tác giả + link vào admin ---- */
.author-hero { display: flex; gap: 1.6rem; align-items: center; margin-bottom: 2rem; flex-wrap: wrap; }
.author-avatar { width: 128px; height: 128px; border-radius: 50%; overflow: hidden; flex: 0 0 auto; display: grid; place-items: center; background: rgba(229,0,0,.15); border: 2px solid rgba(255,255,255,.12); font-size: 3rem; font-weight: 700; }
.author-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.author-info { flex: 1 1 260px; min-width: 0; }
.author-bio { white-space: pre-line; line-height: 1.7; margin: .6rem 0; max-width: 62ch; }
.author-links { display: flex; flex-wrap: wrap; gap: .5rem; margin: .6rem 0; }
.author-link { color: inherit; border-bottom: 1px dotted currentColor; text-decoration: none; }
.author-link:hover { color: var(--red, #e50000); }
.footer-admin { display: inline-flex; align-items: center; gap: .4rem; font-size: .8rem; opacity: .7; margin-top: .6rem; color: inherit; text-decoration: none; }
.footer-admin:hover { opacity: 1; }

/* ---- Bình luận + hồ sơ độc giả ---- */
.comments-box { max-width: 760px; margin: 3rem auto 2rem; padding: 0 .5rem; }
.cm-title { font-family: 'Rajdhani', sans-serif; font-size: 1.4rem; margin-bottom: 1rem; }
.cm-count { font-size: .85rem; opacity: .7; }
.cm-login { padding: 1.1rem; border: 1px dashed rgba(255,255,255,.18); border-radius: 10px; margin-bottom: 1.2rem; }
.cm-login p { margin-bottom: .8rem; opacity: .85; line-height: 1.6; }
.cm-me { display: flex; align-items: center; gap: .6rem; margin-bottom: .6rem; flex-wrap: wrap; }
.cm-me .btn-outline { margin-left: auto; }
.comments-box textarea { width: 100%; resize: vertical; }
.cm-actions { display: flex; align-items: center; justify-content: space-between; margin: .5rem 0 1rem; }
.cm-note { min-height: 1.2em; font-size: .85rem; } .cm-note.err { color: #f87171; }
.cm-avatar { width: 40px; height: 40px; border-radius: 50%; overflow: hidden; flex: 0 0 auto; display: inline-grid; place-items: center; background: rgba(229,0,0,.18); font-weight: 700; }
.cm-avatar.big { width: 96px; height: 96px; font-size: 2.4rem; }
.cm-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cm-item { display: flex; gap: .8rem; padding: .9rem 0; border-top: 1px solid rgba(255,255,255,.07); }
.cm-body { min-width: 0; flex: 1; }
.cm-head { display: flex; gap: .6rem; align-items: baseline; flex-wrap: wrap; }
.cm-name { font-weight: 600; color: inherit; text-decoration: none; } a.cm-name:hover { color: var(--red, #e50000); }
.cm-time { font-size: .72rem; opacity: .6; }
.cm-del { margin-left: auto; background: none; border: 0; color: #f87171; cursor: pointer; font-size: .78rem; }
.cm-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.65; margin-top: .25rem; }
.reader-hero { display: flex; gap: 1.4rem; align-items: center; flex-wrap: wrap; margin-bottom: 1.5rem; }
.rd-comment { padding: .7rem 0; border-top: 1px solid rgba(255,255,255,.07); }
.rd-comment .where { font-size: .78rem; opacity: .65; }
