:root {
  --bg: #0b0714;
  --bg-2: #140d22;
  --panel: #1a1130;
  --panel-2: #221741;
  --text: #ece6f7;
  --muted: #a79cc4;
  --neon: #ff2e92;
  --neon-2: #7c4dff;
  --gold: #ffc24d;
  --ok: #4de0a6;
  --err: #ff6b6b;
  --radius: 14px;
  --font: "Be Vietnam Pro", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: radial-gradient(1200px 600px at 80% -10%, #2a1458 0%, transparent 60%),
              radial-gradient(900px 500px at -10% 30%, #3d0f35 0%, transparent 55%),
              var(--bg);
  color: var(--text);
  font-family: var(--font);
  min-height: 100vh;
}
main { max-width: 1100px; margin: 0 auto; padding: 24px 16px 80px; }
h1, h2, h3 { line-height: 1.2; }
h2 { font-size: 1.7rem; margin: 8px 0 20px; }
.muted { color: var(--muted); font-size: .9rem; }
.hidden { display: none !important; }

/* ===== Logo & age gate ===== */
.logo-neon {
  font-weight: 800; letter-spacing: 2px; font-size: 1.9rem;
  color: #fff; text-shadow: 0 0 8px var(--neon), 0 0 24px var(--neon);
}
.logo-neon span { color: var(--gold); text-shadow: 0 0 10px var(--gold); }
.logo-sm { font-size: 1.05rem; }
.age-gate {
  position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center;
  background: rgba(8, 4, 16, .92); backdrop-filter: blur(6px); padding: 16px;
}
.age-card {
  background: var(--panel); border: 1px solid #3a2a63; border-radius: var(--radius);
  padding: 36px 28px; max-width: 420px; text-align: center; box-shadow: 0 0 60px rgba(255, 46, 146, .25);
}
.age-card p { font-size: 1.05rem; }
.age-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 18px 0 14px; }
.age-card small { color: var(--muted); }

/* ===== Tạo nhân vật ===== */
.gender-row { display: flex; gap: 10px; justify-content: center; margin: 16px 0; }
.gender-card {
  background: var(--bg-2); border: 2px solid #3a2a63; border-radius: 12px; cursor: pointer;
  color: var(--text); font-family: var(--font); font-weight: 600; font-size: .9rem;
  padding: 12px 18px; display: flex; flex-direction: column; align-items: center; gap: 6px;
  transition: border-color .15s, transform .15s;
}
.gender-card:hover { transform: translateY(-2px); }
.gender-card.active { border-color: var(--neon); box-shadow: 0 0 18px rgba(255, 46, 146, .35); }
.avatar-svg { width: 42px; height: 56px; }
#profileName { text-align: center; }

/* ===== Ví coin ===== */
.coin-chip {
  background: #2d2110; border: 1px solid var(--gold); color: var(--gold);
  border-radius: 999px; padding: 8px 14px; font-size: .9rem; font-weight: 700; white-space: nowrap;
}

/* ===== Sơ đồ quán ===== */
.floor-wrap { padding: 10px; overflow-x: auto; }
.floor-wrap svg { width: 100%; min-width: 640px; height: auto; display: block; }
.floor-legend { margin-top: 10px; text-align: center; }

/* ===== Avatar di chuyển + emote + bong bóng chat ===== */
#avatarLayer { pointer-events: none; }
#avatarLayer g.av { transition: transform 1.1s ease; }
.emote-pop { animation: emotePop 2.2s ease forwards; }
@keyframes emotePop {
  0% { opacity: 0; transform: translateY(8px) scale(.6); }
  20% { opacity: 1; transform: translateY(0) scale(1.15); }
  80% { opacity: 1; transform: translateY(-6px) scale(1); }
  100% { opacity: 0; transform: translateY(-16px) scale(.9); }
}
.bubble-pop { animation: bubblePop .25s ease; }
@keyframes bubblePop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; } }
.emote-bar { display: flex; gap: 8px; margin-bottom: 10px; }
.emote-btn {
  font-size: 1.3rem; background: var(--panel); border: 1px solid #3a2a63; border-radius: 12px;
  width: 46px; height: 42px; cursor: pointer; transition: transform .12s, border-color .12s;
}
.emote-btn:hover { transform: translateY(-3px) scale(1.1); border-color: var(--neon); }

/* ===== Sổ lưu bút ===== */
.wish-panel { margin-top: 16px; }
.wish-list { max-height: 220px; overflow-y: auto; margin-bottom: 8px; }
.wish-item { padding: 8px 0; border-bottom: 1px solid #2c1f4e; font-size: .92rem; }
.wish-item .wi-name { color: var(--gold); font-weight: 700; }
.wish-item .wi-time { color: var(--muted); font-size: .78rem; }

/* ===== Sảnh: ai đang online ===== */
.lobby-online { margin-top: 20px; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; font-size: .9rem; }
.lobby-count { color: var(--gold); font-weight: 700; }
.lobby-chip { background: var(--panel-2); border: 1px solid #4a3a78; border-radius: 999px; padding: 4px 12px; }

/* ===== Mời một ly ===== */
.row-btns { display: flex; gap: 6px; }
.gift-picker {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%); z-index: 110;
  background: var(--panel-2); border: 1px solid var(--neon); border-radius: 14px;
  padding: 14px; display: flex; flex-direction: column; gap: 8px; max-width: 92vw;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .6);
}
.gp-title { font-weight: 700; font-size: .92rem; }

/* ===== Khu xã hội (Vào quán) ===== */
.quan-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .quan-grid { grid-template-columns: 1fr; } }
.social-tabs { display: flex; gap: 6px; margin-bottom: 8px; }
.social-tab {
  flex: 1; background: var(--bg-2); border: 1px solid #3a2a63; color: var(--muted);
  border-radius: 10px; padding: 8px 6px; font-family: var(--font); font-weight: 600; font-size: .82rem; cursor: pointer;
}
.social-tab.active { color: #fff; border-color: var(--neon); background: var(--panel-2); }
.conn-state { font-size: .8rem; margin-bottom: 8px; }
.social-log { height: 260px; background: var(--bg-2); border-radius: 10px; padding: 10px; margin-bottom: 4px; }
.social-log .msg { font-size: .85rem; padding: 7px 11px; }
.person-row {
  display: flex; align-items: center; gap: 8px; padding: 9px 6px;
  border-bottom: 1px solid #2c1f4e; font-size: .9rem; border-radius: 8px;
}
.person-row.active { background: var(--panel-2); }
.person-row .pr-name { font-weight: 600; flex: 1; }
.pr-tag { font-size: .72rem; color: var(--ok); border: 1px solid var(--ok); border-radius: 999px; padding: 2px 8px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #555; flex-shrink: 0; }
.dot.on { background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.google-wrap { display: flex; justify-content: center; margin: 14px 0 4px; min-height: 44px; }
#dmBox { margin-top: 10px; }
#dmChat { height: 180px; }

/* ===== Radio của quán ===== */
.radio-box { background: var(--bg-2); border: 1px solid #3a2a63; border-radius: 12px; padding: 14px; margin-bottom: 16px; }
.radio-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.radio-controls { display: flex; align-items: center; gap: 10px; margin: 10px 0; }
.radio-controls input[type="range"] { flex: 1; width: auto; margin: 0; accent-color: var(--neon); }
.radio-track { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 4px; border-bottom: 1px solid #2c1f4e; font-size: .88rem; }
.radio-track.onair .rt-name { color: var(--gold); font-weight: 700; }
.rt-live { color: var(--err); font-size: .78rem; font-weight: 700; animation: liveBlink 1.4s infinite; }
@keyframes liveBlink { 50% { opacity: .45; } }

/* ===== YouTube player ===== */
.yt-wrap { position: relative; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: #000; margin: 10px 0 12px; }
.yt-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ===== Buttons ===== */
.btn {
  font-family: var(--font); font-weight: 600; font-size: .95rem;
  border-radius: 999px; padding: 10px 20px; cursor: pointer; border: 1px solid transparent;
  transition: transform .12s, box-shadow .12s;
}
.btn:active { transform: scale(.97); }
.btn-primary {
  background: linear-gradient(135deg, var(--neon), var(--neon-2)); color: #fff;
  box-shadow: 0 4px 18px rgba(255, 46, 146, .4);
}
.btn-primary:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn-ghost { background: transparent; color: var(--text); border-color: #4a3a78; }
.btn-ghost:hover { border-color: var(--neon); }
.btn-sm { padding: 6px 12px; font-size: .85rem; }

/* ===== Topbar ===== */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 12px 16px; background: rgba(11, 7, 20, .85); backdrop-filter: blur(10px);
  border-bottom: 1px solid #2c1f4e;
}
#mainNav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.nav-btn {
  background: none; border: none; color: var(--muted); font-family: var(--font);
  font-weight: 600; font-size: .9rem; padding: 8px 12px; border-radius: 8px; cursor: pointer;
}
.nav-btn:hover { color: var(--text); }
.nav-btn.active { color: #fff; background: var(--panel-2); box-shadow: inset 0 -2px 0 var(--neon); }
.cart-btn {
  background: var(--panel-2); border: 1px solid #4a3a78; color: var(--text);
  border-radius: 999px; padding: 8px 14px; font-size: .95rem; cursor: pointer;
}
#cartCount { font-weight: 700; color: var(--gold); }

@media (max-width: 760px) {
  .topbar { padding: 10px 12px; }
  #mainNav {
    order: 3; flex-basis: 100%; flex-wrap: nowrap;
    overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;
  }
  #mainNav::-webkit-scrollbar { display: none; }
  .nav-btn { white-space: nowrap; }
}

.happy-banner {
  text-align: center; padding: 8px 12px; font-weight: 600; font-size: .9rem;
  background: linear-gradient(90deg, #4a1040, #6b1a2e); color: var(--gold);
}

/* ===== Views ===== */
.view { display: none; }
.view.active { display: block; animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; } }

/* ===== Hero ===== */
.hero { padding: 48px 0 32px; text-align: center; }
.hero-title { font-size: clamp(1.9rem, 5vw, 3.2rem); margin: 0 0 14px; }
.hero-title em { font-family: "Playfair Display", serif; color: var(--gold); }
.hero-sub { color: var(--muted); max-width: 560px; margin: 0 auto 24px; font-size: 1.05rem; }
.hero-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.open-status { margin-top: 18px; font-size: .9rem; color: var(--ok); }
.open-status.closed { color: var(--err); }
.cards-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-top: 24px; }
.card { background: var(--panel); border: 1px solid #2f2254; border-radius: var(--radius); padding: 20px; }
.card h3 { margin: 0 0 8px; }
.card p { color: var(--muted); margin: 0; font-size: .92rem; line-height: 1.5; }

/* ===== Menu ===== */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.filter-btn {
  background: var(--panel); border: 1px solid #3a2a63; color: var(--muted);
  border-radius: 999px; padding: 7px 14px; font-family: var(--font); font-size: .85rem; cursor: pointer;
}
.filter-btn.active { background: linear-gradient(135deg, var(--neon), var(--neon-2)); color: #fff; border-color: transparent; }
.menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.menu-item { background: var(--panel); border: 1px solid #2f2254; border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.menu-item h4 { margin: 0; font-size: 1.02rem; }
.menu-item .desc { color: var(--muted); font-size: .85rem; flex: 1; }
.price-row { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.price { font-weight: 700; color: var(--gold); }
.price .old { color: var(--muted); font-weight: 400; text-decoration: line-through; font-size: .8rem; margin-right: 6px; }
.badge { font-size: .7rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: #3d2a12; color: var(--gold); width: fit-content; }

/* ===== Panels & forms ===== */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 760px) { .split { grid-template-columns: 1fr; } }
.panel { background: var(--panel); border: 1px solid #2f2254; border-radius: var(--radius); padding: 20px; }
.panel h3 { margin-top: 0; }
form label { display: block; margin-bottom: 12px; font-size: .9rem; color: var(--muted); }
input, select {
  width: 100%; margin-top: 5px; padding: 10px 12px; border-radius: 10px;
  background: var(--bg-2); border: 1px solid #3a2a63; color: var(--text); font-family: var(--font); font-size: .95rem;
}
input:focus, select:focus { outline: none; border-color: var(--neon); }
.form-error { color: var(--err); font-size: .9rem; }
.inline-form { display: flex; gap: 8px; margin-top: 12px; }
.inline-form input { margin-top: 0; flex: 1; }

/* ===== Booking list ===== */
.booking-list .bk-item { border: 1px solid #3a2a63; border-radius: 10px; padding: 12px; margin-bottom: 10px; font-size: .9rem; }
.bk-item .bk-code { color: var(--gold); font-weight: 700; }
.bk-item .bk-meta { color: var(--muted); margin: 4px 0 8px; }

/* ===== Music ===== */
.now-playing { display: flex; align-items: center; gap: 14px; background: var(--bg-2); border-radius: 10px; padding: 14px; margin-bottom: 18px; }
.np-title { font-weight: 700; }
.eq { display: flex; gap: 3px; align-items: flex-end; height: 26px; }
.eq span { width: 5px; background: var(--neon); border-radius: 2px; animation: eq 1s infinite ease-in-out; }
.eq span:nth-child(2) { animation-delay: .2s; background: var(--neon-2); }
.eq span:nth-child(3) { animation-delay: .4s; }
.eq span:nth-child(4) { animation-delay: .6s; background: var(--gold); }
@keyframes eq { 0%, 100% { height: 8px; } 50% { height: 26px; } }
.song-queue { list-style: none; padding: 0; margin: 0 0 8px; }
.song-queue li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid #2c1f4e; font-size: .92rem; }
.song-queue .vote-count { color: var(--gold); font-weight: 700; min-width: 34px; text-align: right; }
.song-queue .song-name { flex: 1; }
.dj-table { width: 100%; border-collapse: collapse; }
.dj-table td { padding: 10px 6px; border-bottom: 1px solid #2c1f4e; font-size: .92rem; }
.dj-table td:first-child { color: var(--muted); white-space: nowrap; }
.dj-table .dj-name { font-weight: 700; }

/* ===== Events ===== */
.event-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.event-card { background: var(--panel); border: 1px solid #2f2254; border-radius: var(--radius); padding: 18px; }
.event-card h4 { margin: 0 0 6px; }
.event-when { color: var(--gold); font-size: .85rem; font-weight: 600; }
.event-card p { color: var(--muted); font-size: .88rem; }
.event-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.seats { font-size: .85rem; color: var(--ok); }
.seats.low { color: var(--err); }

/* ===== Chat ===== */
.chat-panel { max-width: 640px; }
.chat-log { height: 340px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 4px; }
.msg { max-width: 82%; padding: 10px 14px; border-radius: 14px; font-size: .92rem; line-height: 1.45; }
.msg.bot { background: var(--panel-2); border-bottom-left-radius: 4px; align-self: flex-start; }
.msg.user { background: linear-gradient(135deg, var(--neon), var(--neon-2)); color: #fff; border-bottom-right-radius: 4px; align-self: flex-end; }
.msg .btn { margin-top: 8px; }

/* ===== Member ===== */
.member-card-wrap { display: flex; align-items: center; justify-content: center; }
.member-card {
  width: 100%; max-width: 340px; aspect-ratio: 1.6; border-radius: 16px; padding: 22px;
  background: linear-gradient(135deg, #2a1458, #4a1040);
  border: 1px solid #5a3a9a; box-shadow: 0 10px 40px rgba(124, 77, 255, .3);
  display: flex; flex-direction: column; justify-content: space-between;
}
.member-card.gold { background: linear-gradient(135deg, #3d2a12, #6b4a1a); border-color: var(--gold); }
.member-card.diamond { background: linear-gradient(135deg, #0f3a4a, #2a6b7a); border-color: #7ae0ff; }
.mc-rank { font-weight: 800; letter-spacing: 3px; font-size: 1.3rem; color: var(--gold); }
.mc-points { font-size: 2rem; font-weight: 800; }
.mc-note { color: var(--muted); font-size: .85rem; }
.perks { padding-left: 18px; color: var(--muted); font-size: .92rem; line-height: 1.7; }
.order-item { border-bottom: 1px solid #2c1f4e; padding: 8px 0; font-size: .88rem; }
.order-item .muted { font-size: .8rem; }

/* ===== Cart drawer ===== */
.cart-drawer {
  position: fixed; top: 0; right: -360px; width: 340px; max-width: 92vw; height: 100vh; z-index: 90;
  background: var(--bg-2); border-left: 1px solid #3a2a63; padding: 18px;
  display: flex; flex-direction: column; transition: right .25s ease;
}
.cart-drawer.open { right: 0; }
.cart-head { display: flex; justify-content: space-between; align-items: center; }
.cart-head h3 { margin: 0; }
.cart-items { flex: 1; overflow-y: auto; margin: 12px 0; }
.cart-item { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid #2c1f4e; font-size: .9rem; }
.cart-item .ci-name { flex: 1; }
.qty-btn { background: var(--panel-2); border: 1px solid #4a3a78; color: var(--text); width: 26px; height: 26px; border-radius: 6px; cursor: pointer; }
.cart-total { font-size: 1.1rem; margin: 10px 0; }
.cart-total strong { color: var(--gold); }
.order-status { margin-top: 10px; padding: 10px; border-radius: 10px; background: var(--panel); font-size: .9rem; text-align: center; }
.order-status.done { color: var(--ok); }
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 80; }

/* ===== Toast & footer ===== */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 110;
  background: var(--panel-2); border: 1px solid var(--neon); color: var(--text);
  padding: 10px 18px; border-radius: 999px; font-size: .9rem; box-shadow: 0 6px 24px rgba(0,0,0,.5);
}
.footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 24px 16px; border-top: 1px solid #2c1f4e; }

/* ===================== Nạp coin / Ủng hộ ===================== */
.coin-chip-btn { cursor: pointer; }
.coin-chip-btn:hover { filter: brightness(1.2); }
.coin-plus { font-weight: 800; color: var(--gold); }
.pay-modal {
  position: fixed; inset: 0; z-index: 120; display: flex; align-items: center; justify-content: center;
  background: rgba(10, 6, 26, .78); backdrop-filter: blur(4px); padding: 16px;
}
.pay-card {
  background: var(--panel-2); border: 1px solid var(--neon); border-radius: 16px;
  padding: 20px; max-width: 420px; width: 100%; max-height: 90vh; overflow: auto;
  box-shadow: 0 12px 48px rgba(0,0,0,.6); text-align: center;
}
.pay-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.pay-head h3 { margin: 0; }
.pack-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.pack-btn {
  display: flex; flex-direction: column; gap: 4px; padding: 14px 10px; border-radius: 12px;
  background: #241b45; border: 1px solid var(--gold); color: var(--text); cursor: pointer; font-size: 1rem;
}
.pack-btn:hover { background: #2d2110; }
.pack-btn strong { color: var(--gold); }
.pack-btn span { color: var(--muted); font-size: .85rem; }
.qr-img { width: 240px; max-width: 100%; border-radius: 12px; margin: 8px auto; display: block; background: #fff; }
.pay-code { color: var(--gold); font-size: 1.1rem; letter-spacing: 1px; }
.footer-links a { color: var(--muted); text-decoration: none; }
.footer-links a:hover { color: var(--gold); }
