body { padding-bottom: 30px; }
.top {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 16px;
  background: rgba(5, 12, 35, .8); backdrop-filter: blur(8px); border-bottom: 1px solid rgba(80, 120, 200, .3);
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; color: var(--gold); font-size: .95em; min-width: 0; }
.brand #brand { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-ic { flex: none; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: #1b1000; background: linear-gradient(160deg, #ffd76a, #e07d00); box-shadow: 0 2px 10px rgba(246, 163, 27, .35); }
.me { display: flex; align-items: center; gap: 8px; font-size: .78em; color: var(--muted); text-align: right; line-height: 1.25; }
.me-name { color: var(--text); font-weight: 700; font-size: 1.1em; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-av { order: 2; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; background: linear-gradient(160deg, #3c8cff, #1a3f8f); border: 1px solid #78b5ff; font-size: 1.1em; }
main { max-width: 480px; margin: 0 auto; padding: 14px 16px; }

/* Menu đăng nhập MC / quản trị */
.staff-menu { position: relative; flex: none; }
.staff-menu[hidden] { display: none; }
.staff-menu summary {
  list-style: none; cursor: pointer; user-select: none; display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 999px; font-size: .88em; font-weight: 700;
  border: 1px solid var(--line); background: rgba(19, 39, 87, .7); color: var(--text);
}
.staff-menu summary::-webkit-details-marker { display: none; }
.staff-menu summary:hover { border-color: var(--accent-2); }
.staff-menu[open] summary { border-color: var(--gold); color: var(--gold); }
.staff-menu .caret { font-size: .8em; transition: transform .15s; }
.staff-menu[open] .caret { transform: rotate(180deg); }
.staff-menu nav {
  position: absolute; right: 0; top: calc(100% + 8px); width: min(290px, calc(100vw - 32px)); padding: 6px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel)); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .55); display: grid; gap: 4px; animation: toastIn .15s ease-out;
}
.staff-menu nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--text); text-decoration: none; }
.staff-menu nav a:hover, .staff-menu nav a:focus-visible { background: rgba(60, 140, 255, .14); outline: none; }
.staff-menu nav .ic { flex: none; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-size: 1.15em; background: rgba(7, 18, 48, .8); border: 1px solid rgba(80, 120, 200, .35); }
.staff-menu nav b { display: block; }
.staff-menu nav small { display: block; color: var(--muted); font-size: .8em; line-height: 1.3; }

/* Trang vào phòng */
.hero { text-align: center; padding: 26px 0 18px; }
.emblem {
  width: 92px; height: 92px; margin: 0 auto 14px; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, #2a5bd0, #0a1a4a 70%);
  border: 3px solid var(--gold); box-shadow: 0 0 0 6px rgba(255, 215, 106, .12), 0 0 34px rgba(60, 140, 255, .45);
  animation: glow 3s ease-in-out infinite;
}
.emblem span { font-size: 2.8em; font-weight: 900; color: var(--gold); text-shadow: 0 2px 12px rgba(255, 215, 106, .5); }
@keyframes glow { 50% { box-shadow: 0 0 0 10px rgba(255, 215, 106, .06), 0 0 46px rgba(60, 140, 255, .6); } }
.hero h1 { color: var(--gold); font-size: 1.65em; margin: 0 0 6px; letter-spacing: .01em; }
.hero p { color: var(--muted); margin: 0; }

.join { padding: 22px 20px; border-radius: 18px; }
.join label { font-weight: 600; color: #cfe0ff; }
.join input { min-height: 50px; border-radius: 12px; font-size: 1.05em; background: #061029; }
.join .pin-input { font-size: 2em; letter-spacing: .35em; text-align: center; font-weight: 800; padding-left: .35em; min-height: 64px; font-variant-numeric: tabular-nums; }
.join .pin-input::placeholder { color: #2a4277; }
.join .hint { font-size: .8em; color: var(--muted); margin-top: 6px; text-align: center; }
.join button[type="submit"] { margin-top: 6px; border-radius: 14px; font-size: 1.15em; box-shadow: 0 6px 20px rgba(246, 163, 27, .3); }

.steps { list-style: none; padding: 0; margin: 20px 0 0; display: grid; gap: 10px; }
.steps li { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 12px; background: rgba(14, 29, 66, .55); border: 1px solid rgba(80, 120, 200, .25); font-size: .92em; color: #cfe0ff; }
.staff-note { text-align: center; font-size: .85em; color: var(--muted); margin-top: 18px; }
.staff-note a { font-weight: 700; text-decoration: none; }
.steps b { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: rgba(246, 163, 27, .15); border: 1px solid rgba(246, 163, 27, .55); color: var(--orange-2); }

/* Sảnh chờ */
.wait { text-align: center; padding: 30px 20px 22px; margin-top: 18px; border-radius: 18px; }
.avatar { width: 84px; height: 84px; margin: 0 auto 12px; border-radius: 50%; display: grid; place-items: center; font-size: 2.3em; font-weight: 900; color: #fff; background: linear-gradient(160deg, #3c8cff, #1a3f8f); border: 3px solid #78b5ff; box-shadow: 0 0 26px rgba(60, 140, 255, .45); }
.wait-hi { color: var(--muted); }
.wait-name { font-size: 1.6em; font-weight: 800; color: var(--gold); margin: 2px 0 12px; word-break: break-word; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip { padding: 5px 12px; border-radius: 999px; background: #18306a; border: 1px solid var(--line); font-size: .85em; font-weight: 600; }
.chip.ok { background: #17451d; border-color: #3fae3a; color: #d9ffd2; }
.wait-status { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 22px 0 8px; font-size: 1.1em; font-weight: 700; }
.pulse { width: 12px; height: 12px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0 rgba(76, 201, 58, .6); animation: pulse 1.6s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 12px rgba(76, 201, 58, 0); } 100% { box-shadow: 0 0 0 0 rgba(76, 201, 58, 0); } }
.wait p { margin: 6px 0 0; }
@media (prefers-reduced-motion: reduce) { .emblem, .pulse { animation: none; } }

.status-big { text-align: center; padding: 36px 10px; font-size: 1.15em; }
.status-big .emoji { font-size: 3em; display: block; margin-bottom: 10px; }

.q-card { background: linear-gradient(180deg, #0c1c44, #000 70%); border: 2px solid #3c8cff; border-radius: 16px; padding: 16px; font-size: 1.12em; font-weight: 600; text-align: center; margin-bottom: 14px; }
.q-meta { display: flex; justify-content: space-between; gap: 8px; font-size: .85em; color: var(--muted); margin-bottom: 8px; flex-wrap: wrap; }
.q-meta b { color: var(--gold); }

.opts { display: grid; gap: 10px; }
.opt-btn {
  display: flex; align-items: center; gap: 10px; text-align: left; justify-content: flex-start;
  background: linear-gradient(180deg, #0c1c44, #050d26); border: 2px solid #3c8cff; border-radius: 14px;
  padding: 12px 14px; min-height: 58px; font-size: 1.05em; width: 100%; color: #fff; font-weight: 600;
}
.opt-btn .l { color: var(--orange); font-weight: 900; min-width: 1.6em; }
.opt-btn.sel, .opt-btn.locked { background: linear-gradient(180deg, #ffd27a, #f6a31b 50%, #d07b00); color: #120a00; border-color: #ffd27a; }
.opt-btn.sel .l, .opt-btn.locked .l, .opt-btn.ok .l, .opt-btn.bad .l { color: #fff; }
.opt-btn.ok { background: linear-gradient(180deg, #b7f59a, #4cc93a 50%, #237f19); color: #061a02; border-color: #b7f59a; }
.opt-btn.bad { background: linear-gradient(180deg, #ff9f99, #e5413a 50%, #9e1c16); border-color: #ff9f99; }
.opt-btn.gone { visibility: hidden; }
.opt-btn:disabled { opacity: 1; cursor: default; }

.actions { display: grid; gap: 10px; margin-top: 14px; }
.ll-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 14px; }
.ll-grid button { font-size: .88em; min-height: 48px; }
.ll-grid button.used { text-decoration: line-through; }

.timer-line { display: flex; justify-content: center; margin: 6px 0 10px; }
.timer-line .ring { font-size: .75em; }

.order-seq { display: flex; gap: 8px; justify-content: center; margin: 12px 0; min-height: 50px; }
.order-seq .slot { width: 50px; height: 50px; border: 2px dashed var(--line); border-radius: 10px; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 1.3em; color: var(--orange); }
.order-seq .slot.filled { border-style: solid; border-color: var(--orange); }

.result-card { text-align: center; padding: 22px 10px; }
.result-card .money { font-size: 2em; font-weight: 900; color: var(--gold); }
.mini-ladder { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin-bottom: 12px; font-size: .7em; }
.mini-ladder span { text-align: center; padding: 4px 0; border-radius: 6px; background: #0e1d42; color: #ffcf8a; }
.mini-ladder span.safe { color: #fff; font-weight: 800; }
.mini-ladder span.cur { background: var(--orange); color: #1a0f00; font-weight: 800; }
.mini-ladder span.done { background: #1d4a22; color: #c9f5bf; }
