/* HồngLive – sân khấu đêm màu mận, ánh đèn hồng. Hoa hồng là nhân vật chính, mọi thứ khác lùi lại. */
:root {
  --night: #1B0E22;
  --plum: #2A1533;
  --plum-2: #3B2147;
  --line: #4D2E5C;
  --rose: #FF4D8D;
  --rose-deep: #D81E63;
  --petal: #FFE3EC;
  --gold: #FFC65C;
  --mint: #62E3B8;
  --ink: #FFF6F9;
  --muted: #C2A9C9;
  --display: "Bricolage Grotesque", "Be Vietnam Pro", system-ui, sans-serif;
  --body: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
  --bar-h: 56px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--night); color: var(--ink);
  font: 400 15px/1.5 var(--body); -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3 { font-family: var(--display); margin: 0; line-height: 1.05; letter-spacing: -0.02em; }
a { color: inherit; }
[hidden] { display: none !important; }

/* ---- thanh trên ---- */
.bar {
  height: var(--bar-h); display: flex; align-items: center; gap: 12px; padding: 0 16px;
  position: sticky; top: 0; z-index: 30; background: color-mix(in srgb, var(--night) 88%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--plum-2);
}
.logo { font: 800 22px/1 var(--display); letter-spacing: -0.03em; text-decoration: none; display: flex; align-items: center; gap: 8px; }
.logo i { width: 12px; height: 12px; border-radius: 50%; background: var(--rose); box-shadow: 0 0 0 4px rgba(255, 77, 141, .25); }
.bar .grow { flex: 1; }
.wallet { display: flex; align-items: center; gap: 6px; font-weight: 600; padding: 6px 12px; border-radius: 999px; background: var(--plum); }
.wallet b { font-variant-numeric: tabular-nums; }
.wallet.bump { animation: bump .5s; }
@keyframes bump { 40% { transform: scale(1.18); background: var(--rose-deep); } }
.who { color: var(--muted); max-width: 22ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px;
  border-radius: 12px; font-weight: 600; background: var(--plum-2); color: var(--ink); text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--line); }
.btn.primary { background: var(--rose); color: #2B0716; }
.btn.primary:hover { background: #ff6b9f; }
.btn.gold { background: var(--gold); color: #33230A; }
.btn.ghost { background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.btn.danger { background: #5A1730; color: #FFD3DF; }
.btn.small { min-height: 32px; padding: 0 12px; border-radius: 10px; font-size: 14px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.field { display: grid; gap: 6px; }
.field > span { font-size: 13px; color: var(--muted); }
.input, select.input, textarea.input {
  width: 100%; min-height: 44px; padding: 10px 14px; border-radius: 12px; background: var(--night);
  border: 1px solid var(--line); color: var(--ink);
}
.input::placeholder { color: #8F7498; }
.input:focus { outline: none; border-color: var(--rose); }
.err { color: #FF9DB8; font-size: 14px; min-height: 1.5em; margin: 0; }
.hint { color: var(--muted); font-size: 13px; margin: 0; }

/* ---- sảnh ---- */
.lobby { max-width: 1120px; margin: 0 auto; padding: 28px 16px 64px; }
.lobby-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.lobby h1 { font-size: clamp(34px, 7vw, 64px); font-weight: 800; max-width: 14ch; }
.lobby-head p { margin: 10px 0 0; color: var(--muted); max-width: 46ch; }
.tiles { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.tile {
  position: relative; aspect-ratio: 3 / 4; border-radius: 22px; overflow: hidden; text-decoration: none; display: flex;
  flex-direction: column; justify-content: flex-end; padding: 16px; isolation: isolate;
  background: radial-gradient(120% 90% at 20% 0%, var(--c) 0%, color-mix(in srgb, var(--c) 35%, var(--plum)) 45%, var(--plum) 100%);
}
.tile:first-child { grid-column: span 2; aspect-ratio: auto; min-height: 320px; }
.tile .initial {
  position: absolute; right: 6%; top: 12%; z-index: -1; font: 800 clamp(150px, 26vw, 260px)/.8 var(--display);
  color: rgba(255, 246, 249, .16); letter-spacing: -0.06em;
}
.tile h3 { font-size: 22px; font-weight: 800; text-wrap: balance; }
.tile:first-child h3 { font-size: clamp(26px, 4vw, 40px); max-width: 16ch; }
.tile .by { margin-top: 6px; font-weight: 600; }
.tile .meta { position: absolute; top: 14px; left: 14px; right: 14px; display: flex; gap: 8px; align-items: center; font-size: 13px; font-weight: 600; }
.tile:hover { filter: brightness(1.08); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: rgba(27, 14, 34, .6); backdrop-filter: blur(6px); font-size: 13px; font-weight: 600; }
.pill.live { background: var(--rose-deep); color: #fff; }
.pill.live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #fff; animation: blink 1.4s infinite; }
@keyframes blink { 50% { opacity: .3; } }
.empty { border: 1px dashed var(--line); border-radius: 22px; padding: 40px 24px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--ink); font: 800 24px var(--display); margin-bottom: 6px; }
.lobby h2 { font-size: 24px; margin: 44px 0 14px; }
.idols { display: flex; flex-wrap: wrap; gap: 10px; }
.idol-chip { display: flex; align-items: center; gap: 10px; padding: 8px 14px 8px 8px; border-radius: 999px; background: var(--plum); }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font: 800 15px var(--display); color: #2B0716; background: var(--c, var(--rose)); flex: none; }
.idol-chip small { color: var(--muted); }

/* ---- hộp thoại ---- */
dialog { border: 0; padding: 0; background: var(--plum); color: var(--ink); border-radius: 22px; width: min(420px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(10, 4, 14, .7); backdrop-filter: blur(3px); }
.dlg { padding: 24px; display: grid; gap: 14px; }
.dlg h2 { font-size: 28px; }
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--night); border-radius: 14px; }
.tabs button { flex: 1; min-height: 38px; border-radius: 10px; font-weight: 600; color: var(--muted); }
.tabs button[aria-selected="true"] { background: var(--plum-2); color: var(--ink); }

/* ---- phòng live ---- */
.room { display: grid; grid-template-columns: minmax(0, 1fr) 380px; height: calc(100dvh - var(--bar-h)); }
.stage { position: relative; background: #0E0612; overflow: hidden; display: grid; place-items: center; }
.stage video { width: 100%; height: 100%; object-fit: contain; background: #0E0612; }
.stage video.mirror { transform: scaleX(-1); }
.stage-wait { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px; color: var(--muted); background: radial-gradient(80% 60% at 50% 30%, var(--plum-2), #0E0612); }
.stage-wait strong { display: block; font: 800 clamp(24px, 4vw, 38px) var(--display); color: var(--ink); margin-bottom: 8px; }
.stage-top { position: absolute; top: 12px; left: 12px; right: 12px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; pointer-events: none; }
.stage-top .title { flex-basis: 100%; font-weight: 600; text-shadow: 0 1px 8px #000; max-width: 60ch; }
.stage-tools { position: absolute; left: 12px; right: 12px; bottom: 12px; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.stage-tools .btn { background: rgba(27, 14, 34, .72); backdrop-filter: blur(8px); }
.stage-tools .btn.primary { background: var(--rose); }
.stage-tools .btn.off { background: #5A1730; }
.stage-tools .btn.danger { background: #7A1638; color: #fff; }
.unmute { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); }

/* hoa và tim bay */
.fx { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.fly { position: absolute; bottom: -40px; font-size: var(--s, 28px); animation: fly var(--d, 3s) ease-out forwards; will-change: transform, opacity; }
@keyframes fly {
  0% { transform: translate(0, 0) rotate(0) scale(.6); opacity: 0; }
  12% { opacity: 1; transform: translate(calc(var(--x) * .2), -12vh) rotate(calc(var(--r) * .3)) scale(1); }
  100% { transform: translate(var(--x), -82vh) rotate(var(--r)) scale(1.15); opacity: 0; }
}
.gift-banner {
  position: absolute; left: 12px; top: 96px; max-width: min(360px, calc(100% - 24px)); padding: 10px 16px 10px 10px; border-radius: 16px;
  background: linear-gradient(100deg, var(--rose-deep), rgba(216, 30, 99, .55)); display: flex; gap: 10px; align-items: center;
  animation: banner 4.2s ease forwards; box-shadow: 0 8px 30px rgba(216, 30, 99, .35);
}
.gift-banner .n { font: 800 26px var(--display); color: var(--gold); white-space: nowrap; }
.gift-banner small { display: block; color: var(--petal); overflow-wrap: anywhere; }
@keyframes banner { 0% { transform: translateX(-110%); } 8%, 88% { transform: none; opacity: 1; } 100% { transform: translateX(-20%); opacity: 0; } }

/* cột bên */
.side { display: flex; flex-direction: column; min-height: 0; background: var(--plum); border-left: 1px solid var(--plum-2); position: relative; }
.side .tabs { margin: 10px 12px 0; }
.pane { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.scroll { overflow-y: auto; padding: 12px; display: grid; gap: 14px; align-content: start; }
.topfans { display: flex; gap: 8px; padding: 10px 12px 0; overflow-x: auto; scrollbar-width: none; }
.topfans .pill { background: var(--night); flex: none; }
.topfans .pill b { color: var(--gold); }
.log { flex: 1; min-height: 0; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.msg { overflow-wrap: anywhere; line-height: 1.4; }
.msg .name { font-weight: 600; color: var(--c, var(--petal)); margin-right: 6px; }
.msg .tag { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 6px; margin-right: 6px; background: var(--gold); color: #33230A; vertical-align: 1px; }
.msg .tag.ai { background: var(--mint); color: #0B3528; }
.msg.hidden-msg { color: #8F7498; font-style: italic; font-size: 13px; }
.msg.sys { color: var(--muted); font-size: 13px; }
.msg.gift { background: rgba(216, 30, 99, .22); border-radius: 12px; padding: 8px 10px; }
.msg.gift b { color: var(--gold); }
.msg .x { margin-left: 6px; color: #8F7498; font-size: 12px; text-decoration: underline; }

.sticker {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px 8px 10px; border-radius: 16px 16px 16px 4px; font: 800 17px/1.1 var(--display);
  color: #2B0716; background: var(--t, var(--rose)); transform: rotate(-2deg); box-shadow: 0 3px 0 rgba(0, 0, 0, .28); margin: 4px 0 2px; max-width: 100%;
}
.sticker .e { font-size: 26px; line-height: 1; }
.sticker.rose { --t: #FF8DB4; } .sticker.gold { --t: var(--gold); } .sticker.mint { --t: var(--mint); } .sticker.sky { --t: #8CCBFF; } .sticker.grape { --t: #CDA8FF; }
button.sticker:hover { transform: rotate(0) scale(1.04); }

.composer { display: flex; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--plum-2); align-items: center; }
.composer .input { min-height: 42px; border-radius: 999px; flex: 1; min-width: 0; }
.icon-btn { width: 42px; height: 42px; border-radius: 50%; background: var(--plum-2); display: grid; place-items: center; font-size: 20px; flex: none; }
.icon-btn:hover { background: var(--line); }
.icon-btn.rose { background: var(--rose); }
.icon-btn:active { transform: scale(.92); }

/* tấm trượt: sticker, quà */
.sheet {
  position: absolute; left: 8px; right: 8px; bottom: 70px; z-index: 5; background: var(--night); border: 1px solid var(--line); border-radius: 20px;
  padding: 14px; display: grid; gap: 12px; max-height: 70%; overflow-y: auto; box-shadow: 0 -10px 40px rgba(0, 0, 0, .5);
}
.sheet h3 { font-size: 18px; display: flex; justify-content: space-between; align-items: center; }
.sheet .row { display: flex; gap: 8px; }
.sheet .row .input { flex: 1; min-width: 0; }
.pack { display: flex; flex-wrap: wrap; gap: 10px 8px; }
.amounts { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.amounts button { padding: 10px 0; border-radius: 14px; background: var(--plum); font-weight: 700; display: grid; gap: 2px; }
.amounts button span { font-size: 20px; }
.amounts button[aria-pressed="true"] { background: var(--rose-deep); box-shadow: inset 0 0 0 2px var(--rose); }
.wish-opts { display: grid; gap: 6px; }
.wish-opts button { text-align: left; padding: 8px 12px; border-radius: 12px; background: var(--plum); font-size: 14px; }
.wish-opts button:hover { background: var(--plum-2); }

/* câu hỏi */
.poll { margin: 10px 12px 0; padding: 14px; border-radius: 18px; background: var(--night); border: 1px solid var(--line); display: grid; gap: 10px; }
.poll .q { font: 800 19px/1.2 var(--display); text-wrap: balance; }
.poll .info { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--muted); }
.poll .info b { color: var(--gold); }
.timer { height: 6px; border-radius: 3px; background: var(--plum-2); overflow: hidden; }
.timer i { display: block; height: 100%; width: 100%; background: var(--gold); transform-origin: left; }
.timer.hot i { background: var(--rose); }
.opts { display: grid; gap: 8px; }
.opt {
  position: relative; text-align: left; padding: 10px 12px; border-radius: 12px; background: var(--plum-2); font-weight: 500; overflow: hidden;
  display: flex; justify-content: space-between; gap: 10px; isolation: isolate;
}
button.opt:hover { background: var(--line); }
.opt .fill { position: absolute; inset: 0 auto 0 0; background: rgba(255, 255, 255, .12); z-index: -1; transition: width .5s; }
.opt.mine { box-shadow: inset 0 0 0 2px var(--rose); }
.opt.right { box-shadow: inset 0 0 0 2px var(--mint); }
.opt.right .fill { background: rgba(98, 227, 184, .28); }
.opt .pct { font-variant-numeric: tabular-nums; color: var(--muted); flex: none; }
.poll .verdict { font-weight: 600; }
.poll .verdict.win { color: var(--mint); }
.poll .verdict.lose { color: #FF9DB8; }

/* studio của idol */
.form { display: grid; gap: 12px; }
.optrow { display: flex; gap: 8px; align-items: center; }
.optrow input[type="radio"] { width: 20px; height: 20px; accent-color: var(--mint); flex: none; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.card { background: var(--night); border: 1px solid var(--line); border-radius: 16px; padding: 14px; display: grid; gap: 10px; }
.card h3 { font-size: 17px; }
.card ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.center { max-width: 520px; margin: 0 auto; padding: 40px 16px; display: grid; gap: 18px; }
.center h1 { font-size: clamp(32px, 6vw, 48px); font-weight: 800; }
.check { display: flex; gap: 10px; align-items: flex-start; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--rose); flex: none; }

/* quản trị */
.admin { max-width: 900px; margin: 0 auto; padding: 32px 16px 64px; display: grid; gap: 24px; }
.admin h1 { font-size: 36px; }
.admin form { display: grid; grid-template-columns: repeat(3, 1fr) auto; gap: 10px; align-items: end; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--plum-2); }
.table th { color: var(--muted); font-weight: 500; }
.table-wrap { overflow-x: auto; }

#toasts { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; width: min(420px, calc(100vw - 32px)); pointer-events: none; }
.toast { background: var(--ink); color: #2B0716; padding: 10px 16px; border-radius: 14px; font-weight: 600; text-align: center; animation: toast 3.6s forwards; }
.toast.good { background: var(--mint); }
@keyframes toast { 0% { transform: translateY(12px); opacity: 0; } 8%, 88% { transform: none; opacity: 1; } 100% { opacity: 0; } }

@media (max-width: 860px) {
  .room { grid-template-columns: 1fr; grid-template-rows: minmax(200px, 38dvh) minmax(0, 1fr); }
  .side { border-left: 0; }
  .tile:first-child { grid-column: span 1; min-height: 0; aspect-ratio: 3 / 4; }
  .admin form { grid-template-columns: 1fr; }
  .who { display: none; }
  .gift-banner { top: 64px; }
}
@media (prefers-reduced-motion: reduce) {
  .fly, .pill.live::before { animation: none; display: none; }
  .gift-banner, .toast, .wallet.bump { animation-duration: 4s; }
}
