:root {
  --green: #a9c5a4;
  --green-hover: #bdd8b8;
  --muted: #8b9986;
  --line: #2e3a30;
  --gold: #d4b272;
  --bg-dark: #121914;
  --bg-card: rgba(26, 36, 29, 0.78);
  --text-dark: #e1e8de;
  --text-body: #a8b5a3;
  --ink-accent: #3d5241;
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-dark);
  font-family: 'Noto Serif', serif;
  font-weight: 400;
  line-height: 1.7;
  position: relative;
  min-height: 100vh;
}

/* Nền tranh Thủy Mặc Đêm Tối (Dark Ink Wash): Núi đêm mờ sương, bóng tùng & trăng mờ */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -2;
  background-color: var(--bg-dark);
  /* Tranh thủy mặc đêm: Dãy núi mực thẫm, vầng trăng khuyết và mây sương u huyền */
  background-image: 
    radial-gradient(circle at 80% 12%, rgba(212, 178, 114, 0.08) 0%, transparent 45%),
    radial-gradient(circle at 15% 75%, rgba(61, 82, 65, 0.15) 0%, transparent 55%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 600' preserveAspectRatio='none'%3E%3Cpath fill='%230b100d' fill-opacity='0.85' d='M0,320L48,300C96,280,192,240,288,245C384,250,480,300,576,285C672,270,768,190,864,180C960,170,1056,230,1152,240C1248,250,1344,210,1392,190L1440,170L1440,600L1392,600C1344,600,1248,600,1152,600C1056,600,960,600,864,600C768,600,672,600,576,600C480,600,384,600,288,600C192,600,96,600,48,600L0,600Z'%3E%3C/path%3E%3Cpath fill='%23070a08' fill-opacity='0.95' d='M0,420L60,390C120,360,240,300,360,310C480,320,600,400,720,390C840,380,960,280,1080,270C1200,260,1320,340,1380,380L1440,420L1440,600L1380,600C1320,600,1200,600,1080,600C960,600,840,600,720,600C600,600,480,600,360,600C240,600,120,600,60,600L0,600Z'%3E%3C/path%3E%3C/svg%3E");
  background-position: bottom center;
  background-repeat: no-repeat;
  background-size: 100% 480px;
}

/* Hạt bụi mực cổ phong trong đêm */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Cpath fill='%23fff' opacity='.02' filter='url(%23n)' d='M0 0h200v200H0z'/%3E%3C/svg%3E");
}

/* Header */
.header {
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 80px;
  padding: 0 6%;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--green);
}

.brand-mark {
  border: 1px solid var(--green);
  width: 38px;
  height: 42px;
  display: grid;
  place-items: center;
  font-family: 'Ma Shan Zheng', 'Noto Serif', serif;
  font-size: 26px;
  color: var(--green);
}

.brand strong {
  font-family: 'Noto Serif', serif;
  letter-spacing: 2px;
}

.brand small {
  display: block;
  font-size: 8px;
  letter-spacing: 3px;
  color: var(--muted);
  margin-top: 2px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 24px;
}

.session {
  color: var(--muted);
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.session i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  display: inline-block;
}

.text-button {
  background: none;
  border: none;
  color: #6d7862;
  font-size: 11.5px;
  cursor: pointer;
  padding: 4px 8px;
  transition: color 0.2s;
  font-family: 'Noto Serif', serif;
}

.text-button:hover {
  color: var(--green);
}

.nav-btn {
  background: #18231c;
  border: 1px solid #384d3c;
  color: #d8e5d5;
  padding: 6px 12px;
  font-size: 11px;
  cursor: pointer;
  border-radius: 2px;
  font-family: inherit;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.nav-btn:hover {
  border-color: var(--green);
  background: #233428;
  color: #fff;
}

.nav-btn b {
  color: var(--gold);
}

/* Main Container */
.game {
  max-width: 1100px;
  margin: 0 auto 60px;
  padding: 0 24px;
}

.section-heading {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  margin-bottom: 35px;
}

.eyebrow {
  letter-spacing: 2.5px;
  color: var(--gold);
  font-size: 10px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 12px;
}

.eyebrow span {
  width: 30px;
  height: 1px;
  background: #bfa879;
}

.world {
  color: var(--muted);
  font-size: 11px;
  font-style: italic;
}

/* 2-Column Grid Layout */
.game-grid {
  display: grid;
  grid-template-columns: 290px 1fr;
  gap: 45px;
  align-items: start;
}

/* Profile Sidebar */
.profile {
  background: var(--bg-card);
  border: 1px solid var(--line);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px);
  padding: 28px 22px;
  position: sticky;
  top: 20px;
  border-radius: 2px;
}

.profile-top {
  text-align: center;
}

.profile-icon {
  font-size: 32px;
  color: var(--green);
  margin-bottom: 10px;
  display: block;
}

.profile-top p {
  letter-spacing: 2.5px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 600;
}

.profile h2 {
  font-family: 'Noto Serif', serif;
  font-size: 28px;
  font-weight: 500;
  color: #eff5ee;
  margin: 10px 0 12px;
  letter-spacing: 1px;
}

.realm-tag {
  color: var(--green);
  border: 1px solid var(--ink-accent);
  background: rgba(46, 64, 49, 0.5);
  padding: 4px 12px;
  font-size: 10px;
  display: inline-block;
  letter-spacing: 0.5px;
}

.gifted {
  color: var(--gold);
  font-size: 10px;
  display: block;
  margin-top: 8px;
}

dl {
  border-top: 1px solid var(--line);
  margin: 22px 0 18px;
  padding-top: 12px;
}

dl div {
  display: flex;
  justify-content: space-between;
  margin: 11px 0;
  font-size: 11px;
}

dt {
  color: var(--muted);
}

dd {
  font-weight: 500;
  color: #e1e8de;
}

.text-gold {
  color: var(--gold);
}

/* Stats Progress Bars */
.stats {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.stats > div {
  margin-top: 14px;
}

.stats > div > div:first-child {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
}

.stats b {
  font-weight: 500;
  color: #c5d6c1;
}

.stats small {
  color: var(--muted);
  font-size: 9px;
}

.bar {
  background: #1c261e;
  height: 4px;
  margin-top: 7px;
  border-radius: 2px;
  overflow: hidden;
}

.bar span {
  background: #476c4c;
  height: 100%;
  display: block;
  transition: width 0.3s ease;
}

.bar-hp span {
  background: #b85b48;
}

.bar-spirit span {
  background: #538fa8;
}

/* Age Counter */
.age {
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 22px;
  padding-top: 16px;
}

.age span {
  color: var(--muted);
  font-size: 10px;
}

.age strong {
  font-family: 'Noto Serif', serif;
  font-size: 28px;
  font-weight: 500;
  color: var(--green);
}

.age small {
  font-size: 11px;
  color: var(--muted);
}

/* Actions in profile */
.profile-actions {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.primary {
  background: #2d4533;
  color: #f0f5ee;
  border: 1px solid #43634b;
  padding: 14px 18px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.primary:hover {
  background: #395640;
  border-color: var(--green);
  transform: translateY(-1px);
}

.primary span {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.primary small {
  font-size: 9px;
  color: #9cb398;
  margin-top: 2px;
}

.btn-seclusion-toggle {
  background: #18221b;
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 10px;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.btn-seclusion-toggle:hover {
  border-color: var(--green);
  color: var(--green);
  background: #1f2b23;
}

.btn-auto-active {
  background: #345c46 !important;
  color: #f5f2e9 !important;
  border-color: var(--green) !important;
}

/* Chronicle Story Area */
.story-heading {
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 14px;
  margin-bottom: 24px;
}

.story-heading h2 {
  font-family: 'Noto Serif', serif;
  font-size: 21px;
  font-weight: 500;
  color: var(--green);
}

.story-heading span {
  color: #969a89;
  font-size: 11px;
}

/* Timeline Entries */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.entry {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: 18px;
  animation: entryFade 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes entryFade {
  0% { opacity: 0; transform: translateY(8px); }
  100% { opacity: 1; transform: translateY(0); }
}

.time {
  text-align: right;
  padding-top: 1px;
}

.time b {
  font-family: 'Noto Serif', serif;
  font-size: 24px;
  font-weight: 500;
  color: var(--green);
  display: block;
  line-height: 1;
}

.time small {
  font-size: 9px;
  color: #8c9383;
  letter-spacing: 1px;
}

.entry-content {
  border-left: 1px solid var(--line);
  padding: 0 0 30px 24px;
  position: relative;
}

.dot {
  position: absolute;
  top: 7px;
  left: -4px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  border: 2px solid var(--bg-dark);
  box-shadow: 0 0 8px rgba(169, 197, 164, 0.4);
}

.entry h3 {
  font-family: 'Noto Serif', serif;
  font-size: 16px;
  font-weight: 600;
  color: #dbe4d8;
  margin-bottom: 8px;
  letter-spacing: 0.3px;
}

.entry p {
  font-size: 14px;
  color: var(--text-body);
  line-height: 1.95;
  font-family: 'Noto Serif', serif;
}

/* Dòng biến cố đặc thù */
.entry.disaster h3 { color: #e28f7d; }
.entry.disaster .dot { background: #d97460; box-shadow: 0 0 8px rgba(217, 116, 96, 0.5); }
.entry.breakthrough h3 { 
  color: #b7e3b0; 
  font-size: 17px; 
  font-weight: 700;
  border-left: 2px solid var(--green);
  padding-left: 8px;
  background: rgba(169, 197, 164, 0.08);
}
.entry.breakthrough .dot { background: #96dd8c; box-shadow: 0 0 10px rgba(150, 221, 140, 0.6); }

/* Choice Card */
.choice-card {
  background: rgba(23, 33, 26, 0.9);
  border: 1px solid #3c4f3f;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  padding: 28px;
  margin: 10px 0 30px;
  animation: cardArrive 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes cardArrive {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.choice-card h2 {
  font-family: 'Noto Serif', serif;
  font-size: 24px;
  font-weight: 500;
  color: #dbe8d8;
  margin: 12px 0 10px;
}

.choice-card p {
  font-size: 13.5px;
  color: #a4b39e;
  line-height: 1.9;
}

.options {
  display: grid;
  gap: 12px;
  margin-top: 22px;
}

.options button {
  background: #19241d;
  border: 1px solid #324335;
  color: #d1ded0;
  padding: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 16px;
  text-align: left;
  transition: all 0.2s;
  font-family: inherit;
}

.options button:hover {
  background: #233428;
  border-color: var(--green);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.4);
}

.option-num {
  font-family: 'Noto Serif', serif;
  font-size: 16px;
  color: var(--gold);
  min-width: 20px;
}

.option-text b {
  font-size: 13px;
  font-weight: 500;
  display: block;
  color: #e5ece3;
}

.option-text small {
  font-size: 11px;
  color: #8c9c89;
  margin-top: 4px;
  display: block;
}

/* ========================================================
   THIÊN PHÚ BẢN MỆNH & GACHA MODAL STYLES (ĐẦU THAI)
   ======================================================== */

.talents-box {
  border-top: 1px solid var(--line);
  margin-top: 14px;
  padding-top: 12px;
  text-align: left;
}

.box-label {
  font-size: 8.5px;
  letter-spacing: 1.5px;
  color: var(--muted);
  display: block;
  margin-bottom: 8px;
}

.talent-chips {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.talent-chip {
  padding: 4px 8px;
  font-size: 10px;
  border-radius: 2px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid transparent;
}

/* Phẩm giai Thiên Phú: Trắng -> Lam -> Tím -> Vàng Kim */
.rarity-common {
  background: rgba(140, 150, 138, 0.12);
  color: #c7d1c5;
  border-color: #3b473d;
}

.rarity-rare {
  background: rgba(83, 143, 168, 0.15);
  color: #7dd3fc;
  border-color: #2b576b;
}

.rarity-epic {
  background: rgba(168, 85, 247, 0.15);
  color: #d8b4fe;
  border-color: #582e7e;
}

.rarity-legendary {
  background: rgba(212, 178, 114, 0.15);
  color: #fde047;
  border-color: #78602f;
  box-shadow: 0 0 10px rgba(212, 178, 114, 0.15);
}

/* Modal Overlay Toàn Màn Hình */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 12, 9, 0.88);
  backdrop-filter: blur(10px);
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
  animation: fadeInModal 0.25s ease-out;
}

@keyframes fadeInModal {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Khung Hộp Thoại Phường Thị & Túi Đồ */
.shop-dialog {
  background: #141d17;
  border: 1px solid #3c5240;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.95), 0 0 40px rgba(169, 197, 164, 0.08);
  width: 100%;
  max-width: 640px;
  max-height: 88vh;
  overflow-y: auto;
  border-radius: 3px;
  padding: 24px;
  display: flex;
  flex-direction: column;
}

.shop-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
  margin-bottom: 10px;
}

.shop-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.shop-seal {
  font-family: 'Ma Shan Zheng', serif;
  font-size: 32px;
  color: var(--gold);
  border: 2px solid var(--gold);
  padding: 2px 10px;
  line-height: 1.1;
  transform: rotate(-4deg);
}

.shop-title-wrap h2 {
  font-family: 'Noto Serif', serif;
  font-size: 20px;
  color: #e5ece3;
}

.shop-wallet {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 11px;
}

.modal-close-btn {
  background: #1a271e;
  border: 1px solid var(--line);
  color: var(--muted);
  width: 28px;
  height: 28px;
  border-radius: 2px;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 13px;
  transition: all 0.2s;
}

.modal-close-btn:hover {
  background: #283a2d;
  color: #fff;
  border-color: var(--green);
}

.shop-intro {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 14px;
}

/* Lưới vật phẩm Phường Thị */
.shop-items-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.shop-item-card {
  background: #19241d;
  border: 1px solid #2d3e30;
  padding: 12px;
  border-radius: 2px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  text-align: left;
}

.shop-item-card:hover {
  border-color: var(--green);
}

.item-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.item-name {
  font-family: 'Noto Serif', serif;
  font-size: 13.5px;
  font-weight: 600;
  color: #e8f0e6;
}

.item-type-badge {
  font-size: 9px;
  color: var(--muted);
  border: 1px solid #334335;
  padding: 1px 5px;
  border-radius: 2px;
}

.item-desc {
  font-size: 11px;
  color: var(--text-body);
  line-height: 1.6;
}

.item-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 6px;
}

.item-price {
  font-size: 11px;
  color: var(--gold);
  font-weight: 600;
}

.btn-buy-item {
  background: #25392a;
  border: 1px solid #446149;
  color: #d1ded0;
  padding: 4px 10px;
  font-size: 11px;
  cursor: pointer;
  border-radius: 2px;
  transition: all 0.15s;
}

.btn-buy-item:hover:not(:disabled) {
  background: #345c46;
  color: #fff;
}

.btn-buy-item:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Phần Trang Bị Pháp Bảo */
.equipped-section {
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

.equipped-slots {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 8px;
}

.equip-slot {
  background: #18231c;
  border: 1px dashed #3a4d3c;
  padding: 10px;
  border-radius: 2px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.slot-type {
  font-size: 9px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.equip-slot strong {
  font-family: 'Noto Serif', serif;
  font-size: 13px;
  color: var(--green);
}

.equip-slot small {
  font-size: 10px;
  color: var(--gold);
}

/* Danh sách vật phẩm trong Túi Đồ */
.bag-items-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
  min-height: 120px;
}

.bag-item-row {
  background: #18231c;
  border: 1px solid #2d3e30;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 2px;
}

.bag-item-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-align: left;
}

.bag-item-name {
  font-size: 13px;
  font-weight: 600;
  color: #e5ece3;
}

.bag-item-desc {
  font-size: 11px;
  color: var(--muted);
}

.bag-item-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-use-item {
  background: #25392a;
  border: 1px solid #446149;
  color: #d1ded0;
  padding: 5px 12px;
  font-size: 11px;
  cursor: pointer;
  border-radius: 2px;
}

.btn-use-item:hover {
  background: #345c46;
  color: #fff;
}

.empty-bag-hint {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 30px 0;
  font-style: italic;
}

/* ========================================================
   TỪ ĐƯỜNG LUÂN HỒI & CÂY NÂNG CẤP VĨNH VIỄN (ANCESTRAL)
   ======================================================== */
.ancestral-upgrades-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

@media (max-width: 600px) {
  .ancestral-upgrades-grid {
    grid-template-columns: 1fr;
  }
}

.upgrade-card {
  background: #18231c;
  border: 1px solid #2d3e30;
  padding: 12px;
  border-radius: 2px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
  text-align: left;
}

.upgrade-card.maxed {
  border-color: var(--gold);
  background: rgba(212, 178, 114, 0.05);
}

.upgrade-card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.upgrade-card-name {
  font-family: 'Noto Serif', serif;
  font-size: 13.5px;
  font-weight: 600;
  color: #e5ece3;
}

.upgrade-level-badge {
  font-size: 9.5px;
  color: var(--green);
  border: 1px solid #374b3b;
  padding: 1px 6px;
  border-radius: 2px;
}

.upgrade-card-desc {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
}

.upgrade-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 6px;
}

.upgrade-cost {
  font-size: 11px;
  color: #7dd3fc;
  font-weight: 500;
}

.btn-upgrade-action {
  background: #25392a;
  border: 1px solid #446149;
  color: #d1ded0;
  padding: 4px 10px;
  font-size: 11px;
  cursor: pointer;
  border-radius: 2px;
  transition: all 0.15s;
}

.btn-upgrade-action:hover:not(:disabled) {
  background: #345c46;
  color: #fff;
}

.btn-upgrade-action:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Gia Phả Tiền Nhân (Hall of Fame) */
.ancestral-records-box {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.ancestral-records-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 150px;
  overflow-y: auto;
  margin-top: 8px;
}

.past-life-row {
  background: #19221b;
  border: 1px solid #28372b;
  padding: 8px 12px;
  font-size: 11.5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 2px;
}

.past-life-name {
  color: var(--green);
  font-weight: 600;
}

.past-life-meta {
  color: var(--muted);
  font-size: 10.5px;
}

.past-life-karma {
  color: #7dd3fc;
  font-weight: 500;
}

.mobile-sub-btn {
  flex: 0.6 !important;
  background: #19251e !important;
  border-color: #384c3c !important;
  color: #c9d6c6 !important;
}

.gacha-dialog {
  background: #151e18;
  border: 1px solid #3c5240;
  box-shadow: 0 25px 80px rgba(0, 0, 0, 0.9), 0 0 40px rgba(169, 197, 164, 0.08);
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 3px;
  padding: 30px 28px;
  display: flex;
  flex-direction: column;
}

.gacha-header {
  display: flex;
  align-items: center;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
  margin-bottom: 18px;
}

.gacha-seal {
  font-family: 'Ma Shan Zheng', serif;
  font-size: 38px;
  color: var(--gold);
  border: 2px solid var(--gold);
  padding: 4px 12px;
  transform: rotate(-6deg);
  display: inline-block;
  line-height: 1.1;
}

.gacha-titles h2 {
  font-family: 'Noto Serif', serif;
  font-size: 24px;
  font-weight: 500;
  color: #e5ece3;
  margin: 4px 0 6px;
}

.gacha-titles p {
  font-size: 12px;
  color: var(--muted);
}

.gacha-meta-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  font-size: 12px;
  color: #d1ded0;
}

/* Lưới 10 Thẻ Bài Thiên Phú Gacha */
.gacha-talents-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

@media (max-width: 600px) {
  .gacha-talents-grid {
    grid-template-columns: 1fr;
  }
}

.talent-card {
  background: #1a251e;
  border: 1px solid #2e3e31;
  padding: 14px;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  text-align: left;
}

.talent-card:hover {
  transform: translateY(-2px);
  border-color: var(--green);
}

.talent-card.selected {
  outline: 2px solid var(--gold);
  background: #24352a;
  border-color: var(--gold);
}

.talent-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.talent-card-name {
  font-family: 'Noto Serif', serif;
  font-size: 14px;
  font-weight: 600;
}

.talent-badge {
  font-size: 9px;
  padding: 1px 6px;
  border-radius: 2px;
  border: 1px solid currentColor;
}

.talent-card-desc {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.6;
}

.gacha-footer {
  border-top: 1px solid var(--line);
  padding-top: 18px;
  display: flex;
  justify-content: center;
}

.gacha-submit-btn {
  width: 100%;
  max-width: 380px;
}

.gacha-submit-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
}

/* Modal Tọa Hóa Tạ Thế (Death Recap) */
.death-dialog {
  background: #171f19;
  border: 1px solid #45342a;
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.95);
  max-width: 480px;
  width: 100%;
  padding: 35px 25px;
  text-align: center;
  border-radius: 3px;
  animation: deathZoom 0.3s ease-out;
}

@keyframes deathZoom {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.death-seal {
  font-family: 'Ma Shan Zheng', serif;
  font-size: 50px;
  color: #b8624f;
  margin-bottom: 12px;
}

.death-dialog h2 {
  font-family: 'Noto Serif', serif;
  font-size: 24px;
  color: #ebd7d3;
  margin-bottom: 12px;
}

.death-summary {
  font-size: 13px;
  color: #9e9a93;
  line-height: 1.8;
  margin-bottom: 22px;
}

.death-score-board {
  border-top: 1px solid #332720;
  border-bottom: 1px solid #332720;
  padding: 16px 0;
  margin-bottom: 24px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.death-score-board span {
  font-size: 9.5px;
  color: #8c8279;
  display: block;
  margin-bottom: 6px;
}

.death-score-board strong {
  font-family: 'Noto Serif', serif;
  font-size: 16px;
}

.death-rebirth-btn {
  width: 100%;
}


/* Story Area & Compact Timeline Scroll */
.story-area {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: 520px;
  overflow-y: auto;
  padding-right: 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.timeline::-webkit-scrollbar {
  width: 4px;
}
.timeline::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 4px;
}

/* ========================================================
   ĐỘNG PHỦ TIÊN GIA (GARDEN, ALCHEMY & SPIRIT ARRAY STYLES)
   ======================================================== */
.abode-dialog {
  max-width: 680px;
}

.abode-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
  margin-bottom: 16px;
  overflow-x: auto;
}

.abode-tab {
  background: #162118;
  border: 1px solid #2d3f30;
  color: #adbfa9;
  padding: 8px 14px;
  font-size: 11.5px;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  white-space: nowrap;
}

.abode-tab:hover {
  background: #1f3023;
  color: #fff;
  border-color: var(--green);
}

.abode-tab.active {
  background: #25392a;
  border-color: var(--green);
  color: #e5ece3;
  font-weight: 600;
  box-shadow: 0 0 10px rgba(169, 197, 164, 0.15);
}

.pane-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.08);
}

.pane-header-row b {
  font-family: 'Noto Serif', serif;
  font-size: 14px;
  color: #dbe5d8;
  display: block;
}

.pane-header-row small {
  font-size: 10px;
  color: var(--muted);
}

.abode-action-btn {
  background: #2d4533;
  border: 1px solid #43634b;
  color: #fff;
  padding: 6px 12px;
  font-size: 11px;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.abode-action-btn:hover {
  background: #395741;
  border-color: var(--green);
}

/* Garden Plots Grid */
.garden-plots-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.plot-card {
  background: #111a14;
  border: 1px solid #28392c;
  border-radius: 3px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 115px;
  position: relative;
  transition: all 0.2s;
}

.plot-card.empty {
  border-style: dashed;
  background: rgba(17, 26, 20, 0.4);
}

.plot-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  color: var(--muted);
}

.plot-herb-info {
  margin: 6px 0;
}

.plot-herb-name {
  font-size: 13px;
  font-weight: 600;
  color: #e5ece3;
  display: flex;
  align-items: center;
  gap: 6px;
}

.plot-herb-age {
  font-size: 11px;
  color: var(--gold);
  margin-top: 3px;
}

.plot-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.plot-btn {
  flex: 1;
  padding: 4px 6px;
  font-size: 10px;
  background: #1a271d;
  border: 1px solid #374d3b;
  color: #cfdbcc;
  cursor: pointer;
  border-radius: 2px;
  transition: all 0.2s;
  font-family: inherit;
}

.plot-btn:hover {
  background: #25392a;
  border-color: var(--green);
  color: #fff;
}

.plot-btn.harvest-ready {
  background: #2f4e37;
  border-color: var(--green);
  color: #bbf7d0;
  font-weight: 600;
  animation: pulseHarvest 1.5s infinite;
}

@keyframes pulseHarvest {
  0% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.4); }
  70% { box-shadow: 0 0 0 6px rgba(74, 222, 128, 0); }
  100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); }
}

/* Herb inventory chips */
.herb-inventory-box {
  background: #0d1510;
  border: 1px solid #243527;
  padding: 10px 14px;
  border-radius: 2px;
}

.herb-chips-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

.herb-chip {
  background: #162419;
  border: 1px solid #324736;
  padding: 4px 10px;
  font-size: 11px;
  color: #d1ded0;
  border-radius: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.herb-chip b {
  color: var(--gold);
}

/* Alchemy Recipes */
.recipes-list-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.recipe-card {
  background: #121c15;
  border: 1px solid #2c3f30;
  padding: 14px;
  border-radius: 3px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  transition: all 0.2s;
}

.recipe-card:hover {
  border-color: #4a6750;
  background: #17241b;
}

.recipe-info h3 {
  font-family: 'Noto Serif', serif;
  font-size: 14px;
  color: #e5ece3;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.recipe-info p {
  font-size: 11.5px;
  color: var(--text-body);
  margin-bottom: 6px;
}

.recipe-cost {
  font-size: 10.5px;
  color: var(--muted);
}

.recipe-cost span.have {
  color: #86efac;
}

.recipe-cost span.miss {
  color: #f87171;
}

.recipe-craft-btn {
  background: #25392a;
  border: 1px solid #43634b;
  color: #fff;
  padding: 8px 16px;
  font-size: 11.5px;
  font-family: inherit;
  border-radius: 2px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.recipe-craft-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  border-color: #2b392e;
  background: #141f17;
}

.recipe-craft-btn:not(:disabled):hover {
  background: #344f3b;
  border-color: var(--green);
  box-shadow: 0 0 10px rgba(169, 197, 164, 0.25);
}

/* Spirit Array Card */
.spirit-array-card {
  background: #121c15;
  border: 1px solid #2d4131;
  padding: 24px;
  text-align: center;
  border-radius: 3px;
  max-width: 480px;
  margin: 0 auto;
}

.array-icon {
  font-size: 40px;
  color: #6ee7b7;
  margin-bottom: 8px;
  animation: spinArray 20s linear infinite;
}

@keyframes spinArray {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.spirit-array-card h3 {
  font-family: 'Noto Serif', serif;
  font-size: 18px;
  color: #e5ece3;
  margin-bottom: 6px;
}

.spirit-array-card p {
  font-size: 12px;
  color: var(--text-body);
  margin-bottom: 16px;
  line-height: 1.6;
}

.array-stat-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 12px;
  border-top: 1px solid #233426;
  font-size: 11.5px;
}

.array-upgrade-btn {
  margin-top: 18px;
  width: 100%;
}

/* ========================================================
   TRẢM YÊU THÁP & CÔNG PHÁP (TOWER & MARTIAL ARTS STYLES)
   ======================================================== */
.tower-dialog {
  max-width: 660px;
}

.text-coral {
  color: #f87171;
}

.tower-current-box {
  background: #111a14;
  border: 1px solid #2d4131;
  border-radius: 3px;
  padding: 20px;
  text-align: center;
}

.tower-banner {
  margin-bottom: 20px;
}

.tower-level-badge {
  background: rgba(212, 178, 114, 0.15);
  border: 1px solid var(--gold);
  color: var(--gold);
  padding: 3px 10px;
  font-size: 11px;
  display: inline-block;
  margin-bottom: 8px;
  border-radius: 2px;
}

.tower-banner h3 {
  font-family: 'Noto Serif', serif;
  font-size: 22px;
  color: #f87171;
  margin-bottom: 6px;
}

.tower-banner p {
  font-size: 12px;
  color: var(--text-body);
}

.tower-stats-compare {
  display: flex;
  align-items: center;
  justify-content: space-around;
  background: #0d1510;
  border: 1px solid #223226;
  border-radius: 3px;
  padding: 16px;
  margin-bottom: 18px;
}

.combat-side {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.combat-label {
  font-size: 10px;
  color: var(--muted);
  margin-bottom: 4px;
}

.combat-side strong {
  font-family: 'Noto Serif', serif;
  font-size: 24px;
  font-weight: 600;
}

.combat-side small {
  font-size: 10px;
  color: #8c9c89;
  margin-top: 2px;
}

.combat-vs {
  font-family: 'Ma Shan Zheng', serif;
  font-size: 24px;
  color: var(--gold);
  padding: 0 16px;
}

.tower-reward-hint {
  font-size: 11.5px;
  color: var(--muted);
  margin-bottom: 18px;
  background: rgba(212, 178, 114, 0.08);
  padding: 8px;
  border-radius: 2px;
}

.tower-reward-hint b {
  color: var(--gold);
}

.tower-fight-btn {
  width: 100%;
  padding: 12px;
}

/* Martial Arts Library Grid */
.martial-arts-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.art-card {
  background: #111a14;
  border: 1px solid #2d4131;
  padding: 12px 14px;
  border-radius: 2px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.art-card.equipped {
  border-color: var(--green);
  background: #152419;
}

.art-info h4 {
  font-family: 'Noto Serif', serif;
  font-size: 13.5px;
  color: #e5ece3;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.art-info p {
  font-size: 11px;
  color: var(--text-body);
  line-height: 1.5;
}

.art-actions button {
  background: #1a271d;
  border: 1px solid #374d3b;
  color: #cfdbcc;
  padding: 6px 12px;
  font-size: 11px;
  cursor: pointer;
  border-radius: 2px;
  white-space: nowrap;
  font-family: inherit;
  transition: all 0.2s;
}

.art-actions button:hover {
  background: #25392a;
  border-color: var(--green);
  color: #fff;
}

.art-actions button.equipped {
  background: #2d4533;
  border-color: var(--green);
  color: #86efac;
}

.mobile-action-bar {
  display: none;
}

/* ========================================================
   RESPONSIVE HOÀN HẢO CHO ĐIỆN THOẠI (MOBILE OPTIMIZATIONS)
   ======================================================== */
@media (max-width: 768px) {
  body {
    padding-bottom: 70px; /* Chừa chỗ cho mobile bottom bar */
  }

  /* Header mobile: Giữ brand và nút Tái Sinh, ẩn các nút trùng lặp đã có ở bottom bar */
  .header {
    height: 48px;
    padding: 0 12px;
  }

  .header .session {
    display: none;
  }

  .brand {
    font-size: 11px;
    gap: 8px;
    letter-spacing: 1px;
  }

  .brand-mark {
    width: 28px;
    height: 32px;
    font-size: 20px;
  }

  .brand small {
    display: none; /* Ẩn slogan dài trên mobile */
  }

  .header-right {
    gap: 8px;
  }

  /* Ẩn các nút điều hướng ở header trên mobile vì đã có ở bottom bar */
  .header-right .nav-btn {
    display: none;
  }

  .text-button {
    font-size: 11px;
    padding: 2px 6px;
    border: 1px solid #324335;
    background: rgba(24, 35, 28, 0.6);
    border-radius: 2px;
  }

  .game {
    padding: 0 10px;
    margin-bottom: 16px;
  }

  .section-heading {
    padding: 6px 0;
    margin-bottom: 12px;
  }

  .section-heading .world {
    font-size: 9px;
  }

  .game-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  /* Thu gọn Profile Sidebar trên mobile thành dạng thẻ gọn gàng */
  .profile {
    position: static;
    padding: 12px 10px;
    box-shadow: none;
  }

  .profile-top {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 10px;
    text-align: left;
    margin-bottom: 8px;
  }

  .profile-icon {
    font-size: 20px;
    margin-bottom: 0;
    display: inline-block;
  }

  .profile-top p {
    display: none;
  }

  .profile h2 {
    font-size: 18px;
    margin: 0;
    display: inline-block;
  }

  .realm-tag {
    font-size: 9.5px;
    padding: 2px 8px;
  }

  .profile .gifted {
    margin-top: 0;
    font-size: 8.5px;
    width: 100%;
  }

  /* Thiên phú dạng chip gọn hơn */
  .talents-box {
    margin-top: 8px;
    padding-top: 8px;
  }

  .box-label {
    font-size: 8px;
    margin-bottom: 4px;
  }

  .talent-chips {
    gap: 4px;
  }

  .talent-chip {
    padding: 3px 6px;
    font-size: 9.5px;
  }

  /* Thu gọn bảng chỉ số dl thành grid 2 cột trên điện thoại */
  dl {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 10px;
    margin: 8px 0;
    padding-top: 6px;
  }

  dl div {
    margin: 2px 0;
    font-size: 9.5px;
  }

  /* 3 thanh chỉ số xếp theo chiều dọc rõ ràng, không bị chèn chữ */
  .stats {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 6px;
    padding-top: 6px;
  }

  .stats > div {
    margin-top: 0;
  }

  .stats > div > div:first-child {
    font-size: 9px;
  }

  .bar {
    height: 4px;
    margin-top: 4px;
  }

  .age {
    margin-top: 8px;
    padding-top: 6px;
  }

  .age span {
    font-size: 9px;
  }

  .age strong {
    font-size: 19px;
  }

  .age small {
    font-size: 9.5px;
  }

  /* Ẩn nút to ở sidebar trên mobile, dùng mobile bar cố định dưới cùng */
  .profile-actions {
    display: none;
  }

  /* Khung Biên Niên Sử gọn gàng, vừa vặn ngón tay cái */
  .story-heading {
    padding-bottom: 6px;
    margin-bottom: 10px;
  }

  .story-heading h2 {
    font-size: 16px;
  }

  .timeline {
    max-height: 52vh; /* Cho phép đọc biên niên sử thoáng đãng hơn */
    padding-right: 4px;
  }

  .entry {
    grid-template-columns: 42px 1fr;
    gap: 10px;
  }

  .time b {
    font-size: 16px;
  }

  .time small {
    font-size: 7.5px;
  }

  .entry-content {
    padding: 0 0 14px 12px;
  }

  .entry h3 {
    font-size: 13.5px;
    margin-bottom: 3px;
  }

  .entry p {
    font-size: 12px;
    line-height: 1.65;
  }

  /* Khung lựa chọn ngã rẽ trên mobile */
  .choice-card {
    padding: 14px 12px;
    margin: 6px 0 14px;
  }

  .choice-card h2 {
    font-size: 16px;
    margin: 6px 0;
  }

  .choice-card p {
    font-size: 11.5px;
    line-height: 1.6;
  }

  .options {
    gap: 8px;
    margin-top: 12px;
  }

  .options button {
    padding: 10px 12px;
    gap: 8px;
  }

  /* Thanh điều khiển nổi dưới đáy điện thoại (Mobile Floating Bar) */
  .mobile-action-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: rgba(15, 21, 17, 0.96);
    border-top: 1px solid #2e3a30;
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 0 8px;
    z-index: 50;
    box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.8);
  }

  .mobile-btn {
    height: 42px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 2px;
    font-size: 11px;
    font-family: inherit;
    cursor: pointer;
    border: 1px solid #2d3d30;
    background: #17221a;
    color: #e5ece3;
    padding: 0 4px;
  }

  .mobile-sub-btn {
    flex: 0 0 38px;
    font-size: 15px;
  }

  .mobile-btn.primary {
    flex: 1.5;
    background: #253b2c;
    border-color: #3f6048;
    color: #fff;
  }

  .mobile-btn.btn-seclusion-toggle {
    flex: 1.2;
    background: #1c2b21;
    border-color: #38503e;
    color: var(--green);
  }

  .mobile-btn span {
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.2;
  }

  .mobile-btn small {
    font-size: 8.5px;
    opacity: 0.85;
    line-height: 1.1;
  }

  /* Modal Gacha trên mobile */
  .gacha-dialog {
    padding: 18px 14px;
    max-height: 94vh;
  }

  .gacha-header {
    gap: 12px;
    padding-bottom: 12px;
    margin-bottom: 12px;
  }

  .gacha-seal {
    font-size: 28px;
    padding: 2px 8px;
  }

  .gacha-titles h2 {
    font-size: 18px;
  }

  .gacha-talents-grid {
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 14px;
  }

  .talent-card {
    padding: 10px;
  }

  .talent-card-name {
    font-size: 13px;
  }

  .talent-card-desc {
    font-size: 10.5px;
  }

  /* Động Phủ trên mobile */
  .abode-dialog {
    padding: 16px 12px;
  }

  .garden-plots-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .plot-card {
    min-height: 95px;
    padding: 10px;
  }

  .recipe-card {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .recipe-craft-btn {
    width: 100%;
    text-align: center;
  }

  /* Trảm Yêu Tháp trên mobile */
  .tower-dialog {
    padding: 16px 12px;
  }

  .tower-current-box {
    padding: 14px 10px;
  }

  .tower-banner h3 {
    font-size: 18px;
  }

  .tower-stats-compare {
    padding: 10px;
    gap: 6px;
  }

  .combat-side strong {
    font-size: 19px;
  }

  .combat-vs {
    font-size: 18px;
    padding: 0 8px;
  }

  .art-card {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .art-actions button {
    width: 100%;
    text-align: center;
  }
}

