:root {
  --navy: #1B2A4E; --blue: #2F6FB5; --red: #D8343A; --orange: #F26A21; --gold: #F2B233;
  --cream: #FFF8EC; --ink: #1D2433; --muted: #5B6577; --line: #E3E7EF; --bg: #F4F6FA; --ok: #2E8B57; --card: #fff;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
  --font: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); color: var(--ink); background: var(--navy); -webkit-tap-highlight-color: transparent; overflow: hidden; }
a { color: var(--blue); }
button { font: inherit; cursor: pointer; }
#app { position: fixed; inset: 0; }

/* ---------- Màn chào ---------- */
.welcome { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; overflow: auto;
  background: radial-gradient(1200px 600px at 50% 110%, #D8343A33, transparent), linear-gradient(160deg, #1B2A4E, #243a6b 60%, #2F6FB5); }
.welcome-card { background: var(--cream); border-radius: 24px; padding: 32px 24px; max-width: 420px; width: 100%; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.welcome-card h1 { font-size: 26px; line-height: 1.2; margin: 6px 0 12px; color: var(--navy); }
.eyebrow { margin: 14px 0 0; color: var(--red); font-weight: 800; text-transform: uppercase; letter-spacing: .12em; font-size: 12px; }
.lead { color: var(--muted); margin: 0 0 22px; line-height: 1.5; }
.fine { color: var(--muted); font-size: 12px; margin-top: 18px; }
.crest { width: 64px; height: 72px; margin: 0 auto; display: grid; place-items: center; color: #fff; font-weight: 800; letter-spacing: .04em;
  background: var(--red); clip-path: polygon(50% 0, 100% 14%, 100% 58%, 50% 100%, 0 58%, 0 14%); }
.crest.sm { width: 30px; height: 34px; font-size: 9px; margin: 0; flex: none; }

/* ---------- Nút & ô nhập ---------- */
.btn { display: block; width: 100%; border: 0; border-radius: 14px; padding: 12px 16px; font-weight: 700; font-size: 15px; text-align: center; text-decoration: none; margin-top: 10px; }
.btn.primary { background: var(--red); color: #fff; }
.btn.primary:active { transform: translateY(1px); }
.btn.primary:disabled { opacity: .6; }
.btn.ghost { background: #EEF1F6; color: var(--navy); }
.btn.danger { background: #FDECEC; color: var(--red); }
.btn.big { padding: 16px; font-size: 17px; }
.btn.sm { display: inline-block; width: auto; padding: 7px 12px; font-size: 13px; margin-top: 6px; }
.icon-btn { width: 36px; height: 36px; border-radius: 50%; border: 0; background: #EEF1F6; color: var(--navy); font-size: 18px; font-weight: 700; display: grid; place-items: center; }
.input { width: 100%; border: 1.5px solid var(--line); border-radius: 12px; padding: 11px 12px; font: inherit; font-size: 15px; background: #fff; color: var(--ink); margin-top: 6px; }
.input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px #2F6FB522; }
.input.sm { width: 80px; margin: 0; padding: 7px 10px; }
textarea.input { resize: vertical; }
.lbl { display: block; font-size: 13px; font-weight: 700; color: var(--muted); margin-top: 12px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row-btns { display: flex; gap: 10px; }
.row-btns .btn { flex: 1; }
.row-inline { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.row-inline .btn { margin: 0; }
.stack { display: grid; gap: 0; }
.err { color: var(--red); font-size: 13px; min-height: 1em; margin: 6px 0 0; }
.ok { color: var(--ok); font-weight: 700; }
.big { font-size: 18px; }
.muted { color: var(--muted); font-size: 13px; }
.note { background: #FFF6DB; border-radius: 12px; padding: 10px 12px; font-size: 13px; }
h3 { margin: 18px 0 8px; font-size: 15px; color: var(--navy); }

/* ---------- Sheet ---------- */
.backdrop { position: fixed; inset: 0; background: rgba(15,22,40,.45); display: flex; align-items: flex-end; justify-content: center; z-index: 50; opacity: 0; transition: opacity .2s; }
.backdrop.open { opacity: 1; }
.sheet { background: var(--bg); width: 100%; max-width: 520px; max-height: 88vh; border-radius: 22px 22px 0 0; display: flex; flex-direction: column; transform: translateY(30px); transition: transform .2s; padding-bottom: var(--sab); }
.sheet.wide { max-width: 640px; }
.backdrop.open .sheet { transform: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 6px; }
.sheet-head h2 { margin: 0; font-size: 18px; color: var(--navy); }
.sheet-body { overflow: auto; padding: 4px 16px 20px; overscroll-behavior: contain; }
@media (min-width: 700px) { .backdrop { align-items: center; } .sheet { border-radius: 22px; } }

/* ---------- Tạo nhân vật ---------- */
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice { border: 2px solid var(--line); background: #fff; border-radius: 16px; padding: 18px 10px; font-weight: 700; color: var(--navy); display: grid; gap: 6px; justify-items: center; }
.choice.on { border-color: var(--red); }
.choice-ico { font-size: 30px; }
.editor { display: grid; grid-template-columns: 130px 1fr; gap: 12px; align-items: start; }
.avatar-preview { background: linear-gradient(#E6F0FA, #F7F3EA); border-radius: 18px; display: grid; place-items: center; padding: 6px; position: sticky; top: 0; }
.opt-row { margin-bottom: 4px; }
.opt-row .lbl { margin-top: 6px; }
.opts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.opt { border: 2px solid var(--line); background: #fff; border-radius: 10px; padding: 5px 9px; font-size: 12.5px; font-weight: 600; min-width: 30px; min-height: 30px; color: var(--ink); }
.opt.on { border-color: var(--red); box-shadow: 0 0 0 2px #D8343A33; }
@media (max-width: 400px) { .editor { grid-template-columns: 1fr; } .avatar-preview { position: static; } }
.code-box { font-family: ui-monospace, Menlo, monospace; font-size: 24px; font-weight: 700; letter-spacing: .08em; text-align: center; background: #fff; border: 2px dashed var(--navy); border-radius: 14px; padding: 16px; margin: 10px 0; user-select: all; }
.code-box.sm { font-size: 17px; padding: 10px; }

/* ---------- Màn sân trường ---------- */
#world { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; background: #8FBF73; }
.hud { position: absolute; top: 0; left: 0; right: 0; padding: calc(10px + var(--sat)) 12px 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; pointer-events: none;
  background: linear-gradient(rgba(27,42,78,.85), rgba(27,42,78,0)); color: #fff; }
.hud > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 8px; min-width: 0; }
.brand b { display: block; font-size: 14px; white-space: nowrap; }
.brand small { display: block; font-size: 11px; opacity: .8; white-space: nowrap; }
.hud-right { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.chip { background: rgba(255,255,255,.95); color: var(--navy); border-radius: 999px; padding: 5px 10px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.chip.warn { background: var(--gold); }
.minimap { position: absolute; right: 12px; top: calc(64px + var(--sat)); width: 120px; height: 103px; border-radius: 12px; border: 3px solid #fff; box-shadow: 0 4px 14px rgba(0,0,0,.25); cursor: pointer; background: #A9D18E; }
.zoom { position: absolute; right: 12px; top: calc(178px + var(--sat)); display: grid; gap: 6px; }
.zoom .icon-btn { background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.2); }
.dock { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(12px + var(--sab)); display: flex; gap: 4px; background: rgba(255,255,255,.97); border-radius: 20px; padding: 6px; box-shadow: 0 8px 24px rgba(0,0,0,.25); max-width: calc(100% - 24px); }
.dock button { border: 0; background: transparent; border-radius: 14px; padding: 6px 12px; font-size: 11px; font-weight: 700; color: var(--navy); display: grid; justify-items: center; gap: 2px; min-width: 64px; }
.dock button span { font-size: 20px; }
.dock button:active { background: #EEF1F6; }
@media (max-width: 420px) { .brand small { display: none; } .dock button { min-width: 0; padding: 6px 9px; } }

/* ---------- Nội dung bảng ---------- */
.place-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.place-list.small { grid-template-columns: repeat(3, 1fr); }
.place { border: 0; background: #fff; border-radius: 14px; padding: 12px 10px; text-align: left; font-weight: 600; font-size: 13.5px; display: flex; align-items: center; gap: 8px; color: var(--ink); box-shadow: 0 1px 0 var(--line); }
.place span { font-size: 20px; }
.place-list.small .place { font-size: 12.5px; padding: 10px 8px; }
.quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.pill { border: 0; background: #fff; border-radius: 999px; padding: 7px 12px; font-size: 13px; font-weight: 600; color: var(--navy); box-shadow: 0 1px 0 var(--line); }
.me-card { display: flex; gap: 12px; align-items: center; background: #fff; border-radius: 16px; padding: 10px; }
.me-card canvas { background: linear-gradient(#E6F0FA, #F7F3EA); border-radius: 12px; }
.tabs { display: flex; gap: 6px; overflow-x: auto; margin: 4px 0 12px; }
.tab { border: 0; background: #E6EAF1; color: var(--navy); border-radius: 999px; padding: 8px 14px; font-weight: 700; font-size: 13px; white-space: nowrap; }
.tab.on { background: var(--navy); color: #fff; }
.gb-form { background: #fff; border-radius: 16px; padding: 10px; margin-bottom: 12px; }
.gb-form .input { margin: 0; }
.gb-form .btn { margin-top: 6px; }
.gb-list { display: grid; gap: 8px; }
.gb-item { background: #fff; border-radius: 14px; padding: 10px 12px; }
.gb-item header { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; }
.gb-item time { margin-left: auto; color: var(--muted); font-size: 11px; }
.gb-item p { margin: 6px 0 0; white-space: pre-wrap; line-height: 1.45; word-break: break-word; }
.tag { background: #EEF1F6; color: var(--navy); border-radius: 6px; padding: 1px 6px; font-size: 11px; font-weight: 700; }
.rank { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.rank li { display: flex; align-items: center; gap: 10px; background: #fff; border-radius: 12px; padding: 8px 12px; }
.medal { width: 26px; text-align: center; font-weight: 800; color: var(--muted); }
.rn { flex: 1; font-weight: 700; }
.rn small { display: block; color: var(--muted); font-weight: 500; font-size: 11px; }
.roster { margin: 0; padding-left: 22px; line-height: 1.8; }
.menu { display: grid; gap: 6px; margin-top: 10px; }
.menu-item { display: flex; align-items: center; gap: 10px; border: 0; background: #fff; border-radius: 12px; padding: 10px 12px; text-align: left; color: var(--ink); font-weight: 600; }
.menu-item .emoji { font-size: 22px; }
.menu-item span:nth-child(2) { flex: 1; }
.menu-item b { color: var(--red); }
.menu-item s { color: var(--muted); font-weight: 400; font-size: 12px; margin-left: 6px; }
.feed { display: grid; gap: 4px; }
.feed-item { font-size: 13px; background: #fff; border-radius: 10px; padding: 7px 10px; }
.game { width: 100%; height: 360px; border-radius: 16px; display: block; touch-action: none; }
.events { display: grid; gap: 8px; margin-top: 10px; }
.event { display: flex; gap: 12px; background: #fff; border-radius: 14px; padding: 12px; }
.event .date { flex: none; width: 56px; height: 60px; border-radius: 12px; background: var(--red); color: #fff; display: grid; place-content: center; text-align: center; }
.event .date b { font-size: 22px; line-height: 1; }
.event .date small { font-size: 10px; }
.ev-body { flex: 1; min-width: 0; display: grid; gap: 3px; }
.ev-body p { margin: 2px 0; font-size: 13.5px; }
.card { background: #fff; border-radius: 16px; padding: 12px; }
.card h3 { margin-top: 0; }
details summary { cursor: pointer; color: var(--muted); font-weight: 600; padding: 8px 0; }
.quiz { background: #fff; border-radius: 16px; padding: 14px; }
.quiz .q { font-weight: 700; font-size: 16px; }
.answers { display: grid; gap: 8px; }
.answer { border: 2px solid var(--line); background: #fff; border-radius: 12px; padding: 10px 12px; text-align: left; font-weight: 600; color: var(--ink); }
.answer.right { border-color: var(--ok); background: #E7F5EC; }
.answer.wrong { border-color: var(--red); background: #FDECEC; }
.speech { background: #fff; border-radius: 16px; padding: 14px; font-size: 15px; line-height: 1.5; position: relative; }
.hero-sign { background: var(--navy); color: var(--gold); font-weight: 800; text-align: center; border-radius: 12px; padding: 14px; letter-spacing: .03em; }
.bullets { padding-left: 4px; list-style: none; line-height: 1.7; }
.timeline { display: grid; gap: 10px; border-left: 3px solid var(--red); padding-left: 14px; }
.timeline p { margin: 2px 0 0; font-size: 14px; }

#toast { position: fixed; left: 50%; bottom: calc(130px + var(--sab)); transform: translate(-50%, 20px); background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 14px; font-size: 14px; font-weight: 600; opacity: 0; transition: .2s; z-index: 80; max-width: calc(100% - 32px); text-align: center; pointer-events: none; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.bad { background: var(--red); }

/* Trang tĩnh */
body.page { overflow: auto; background: var(--bg); }
.page-wrap { max-width: 720px; margin: 0 auto; padding: 16px 16px 48px; line-height: 1.6; }
.page-nav { display: flex; gap: 14px; flex-wrap: wrap; font-size: 14px; padding: 8px 0 16px; }
.page-wrap h1 { color: var(--navy); line-height: 1.25; }
.page-wrap h2 { color: var(--navy); margin-top: 28px; }

/* ---------- Bố cục giống trang mẫu: thanh trên, thanh chat dưới ---------- */
.hud { background: var(--navy); padding: calc(8px + var(--sat)) 12px 8px; }
.brand > div { min-width: 0; }
.brand b { font-size: 16px; }
.brand small { font-size: 12px; opacity: .85; }
.brand .clock { font-weight: 800; font-size: 14px; opacity: 1; }
.hud-right { align-items: center; flex-wrap: nowrap; }
.online-pill { display: inline-flex; align-items: center; gap: 5px; background: #E7F5EC; color: var(--ok); font-weight: 800; font-size: 13px; padding: 5px 10px; border-radius: 999px; }
.online-pill i { width: 8px; height: 8px; border-radius: 50%; background: #2ECC71; box-shadow: 0 0 0 3px #2ECC7133; }
.hud-btn { border: 0; background: #fff; color: var(--navy); font-weight: 800; border-radius: 999px; padding: 8px 14px; font-size: 14px; }
.hud-avatar { border: 2px solid #fff; background: linear-gradient(#E6F0FA, #F7F3EA); border-radius: 50%; width: 38px; height: 38px; padding: 0; overflow: hidden; display: grid; place-items: center; }
.fabs { position: absolute; right: 12px; bottom: calc(118px + var(--sab)); display: grid; gap: 8px; }
.fab { width: 44px; height: 44px; border-radius: 50%; border: 0; background: #fff; color: var(--navy); font-size: 22px; font-weight: 700; box-shadow: 0 3px 12px rgba(0,0,0,.2); }
.chatbar { position: absolute; left: 0; right: 0; bottom: 0; background: #fff; padding: 8px 0 calc(8px + var(--sab)); box-shadow: 0 -4px 18px rgba(0,0,0,.12); }
.quick-row { display: flex; gap: 6px; overflow-x: auto; padding: 0 12px 8px; scrollbar-width: none; }
.quick-row::-webkit-scrollbar { display: none; }
.quick-row .pill { flex: none; border: 1.5px solid var(--line); box-shadow: none; background: #fff; }
.quick-row .pill.emoji { padding: 6px 9px; font-size: 16px; }
.chat-row { display: flex; gap: 8px; align-items: center; padding: 0 12px; }
.map-btn { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 0; background: #EEF1F6; font-size: 22px; }
.chat-input { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; font-size: 15px; color: var(--ink); padding: 10px 4px; }
.chat-input:focus { outline: none; }
.chat-send { flex: none; width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--red); color: #fff; font-size: 16px; }
.overview { width: 100%; display: block; border-radius: 16px; cursor: pointer; margin-top: 8px; }
.welcome-in { text-align: left; }
.trio { display: flex; justify-content: center; gap: 10px; }
.welcome-title { font-size: 24px; line-height: 1.25; color: var(--navy); margin: 6px 0 8px; }
.role-list { display: grid; gap: 8px; }
.role { display: flex; align-items: center; gap: 14px; border: 1.5px solid var(--line); background: #fff; border-radius: 16px; padding: 12px 14px; text-align: left; color: var(--ink); }
.role:active, .role:hover { border-color: var(--red); }
.role-ico { font-size: 28px; width: 36px; text-align: center; }
.role b { display: block; font-size: 16px; }
.role small { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.btn.link { background: transparent; color: var(--navy); text-decoration: underline; padding: 8px; margin-top: 4px; }
.btn.link.muted { color: var(--muted); font-weight: 600; }
@media (max-width: 420px) { .brand small { display: block; } .hud-btn { padding: 7px 11px; font-size: 13px; } .chip { padding: 4px 8px; } }

/* Nhạc nền */
.music-btn { width: 38px; height: 38px; border-radius: 12px; border: 0; background: rgba(255,255,255,.14); color: #fff; font-size: 18px; }
.music-btn.on { background: var(--gold); color: var(--navy); box-shadow: 0 0 0 3px #F2B23355; }
.music-box { position: fixed; left: max(12px, env(safe-area-inset-left, 0px)); bottom: calc(124px + var(--sab)); width: 220px; background: #fff; border-radius: 14px; padding: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.25); z-index: 30; display: grid; gap: 6px; font-size: 12px; }
.music-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; color: var(--navy); }
.music-head b { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.music-box iframe { width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 8px; background: #000; }
.music-box a { color: var(--muted); }
.icon-btn.sm { width: 28px; height: 28px; font-size: 13px; }
@media (max-width: 420px) { .music-btn { width: 34px; height: 34px; font-size: 16px; } .music-box { width: 180px; } }
.brand b, .brand small { overflow: hidden; text-overflow: ellipsis; }
.hud-right { flex: none; }
@media (max-width: 480px) {
  .hud { gap: 6px; padding-inline: 10px; }
  .chip.warn { font-size: 0; padding: 4px 7px; }
  .chip.warn::before { content: '⚠'; font-size: 13px; }
  .hud-right { gap: 4px; }
}

.fab.balloon { font-size: 22px; width: 52px; height: 52px; justify-self: end; }
.fab.balloon:active { transform: scale(.92); }

/* ---------- Logo trường ---------- */
.logo { width: 40px; height: 40px; border-radius: 50%; background: #fff; flex: none; object-fit: cover; box-shadow: 0 0 0 2px rgba(255,255,255,.6); }
.welcome-logo { display: block; width: 84px; height: 84px; border-radius: 50%; margin: 0 auto 6px; box-shadow: 0 4px 14px rgba(0,0,0,.15); }

/* ---------- Chọn người ném bóng ---------- */
.pick-list { display: grid; gap: 8px; margin-bottom: 4px; }
.pick { display: flex; align-items: center; gap: 12px; border: 1.5px solid var(--line); background: #fff; border-radius: 14px; padding: 6px 12px 6px 6px; text-align: left; color: var(--ink); }
.pick canvas { background: linear-gradient(#E6F0FA, #F7F3EA); border-radius: 10px; flex: none; }
.pick:disabled { opacity: .55; }
.pick:not(:disabled):hover, .pick:not(:disabled):active { border-color: var(--red); }
.pick-info { flex: 1; min-width: 0; }
.pick-info b { display: block; }
.pick-info small { display: block; color: var(--muted); font-size: 12px; }
.pick-go { font-size: 22px; }

/* ---------- Ảnh kỷ yếu ---------- */
.shot-stage { display: grid; place-items: center; min-height: 120px; margin-bottom: 8px; }
.countdown { font-size: 88px; font-weight: 800; color: var(--navy); line-height: 1; padding: 30px 0; animation: pop .9s ease-out infinite; }
.countdown.flash { animation: flash .5s ease-out; }
@keyframes pop { from { transform: scale(1.4); opacity: .4; } to { transform: scale(1); opacity: 1; } }
@keyframes flash { from { background: #fff; box-shadow: 0 0 0 999px rgba(255,255,255,.9); } to { background: transparent; box-shadow: none; } }
@media (prefers-reduced-motion: reduce) { .countdown, .countdown.flash { animation: none; } }
.shot { width: 100%; height: auto; border-radius: 10px; box-shadow: 0 4px 16px rgba(0,0,0,.18); display: block; }
.album { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.album-item { border: 0; background: #fff; border-radius: 12px; padding: 6px; display: grid; gap: 4px; text-align: left; color: var(--muted); box-shadow: 0 1px 0 var(--line); }
.album-item img { width: 100%; height: auto; border-radius: 8px; display: block; }
.album-item small { font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Sổ lưu bút ---------- */
.book-page { min-height: 340px; border-radius: 6px 14px 14px 6px; padding: 22px 22px 22px 34px; position: relative;
  background: repeating-linear-gradient(#FFFDF6 0 27px, #D7E3F2 27px 28px); box-shadow: inset 10px 0 0 #E9DFC8, 0 6px 18px rgba(0,0,0,.15);
  font-family: Pangolin, "Be Vietnam Pro", cursive; color: #25407A; }
.book-page::before { content: ''; position: absolute; left: 26px; top: 0; bottom: 0; width: 1.5px; background: #F1A3A3; }
.book-page.cover { background: linear-gradient(150deg, #1B2A4E, #2F6FB5); color: #fff; display: grid; place-content: center; text-align: center; gap: 6px; box-shadow: inset 12px 0 0 #142040, 0 6px 18px rgba(0,0,0,.2); }
.book-page.cover::before { display: none; }
.book-logo { width: 92px; height: 92px; border-radius: 50%; margin: 0 auto 6px; background: #fff; }
.book-title { font-size: 34px; }
.book-owner { font-size: 26px; color: var(--gold); }
.book-sub, .book-count { font-family: var(--font); font-size: 13px; opacity: .85; }
.book-to { font-size: 22px; line-height: 28px; margin-bottom: 0; }
.book-body { font-size: 20px; line-height: 28px; margin: 0; white-space: pre-wrap; word-break: break-word; }
.book-sign { text-align: right; font-size: 19px; line-height: 28px; margin-top: 28px; }
.book-date { text-align: right; font-size: 15px; line-height: 28px; color: #6B7FA6; }
.book-input { width: 100%; border: 0; background: transparent; font: 20px/28px Pangolin, "Be Vietnam Pro", cursive; color: #25407A; resize: vertical; padding: 0; }
.book-input:focus { outline: 2px dashed #9DB4D6; outline-offset: 4px; }
.book-nav { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 12px; font-weight: 700; color: var(--navy); }
.book-nav .icon-btn { font-size: 22px; }
.book-nav .icon-btn:disabled { opacity: .35; }

/* lưu bút trong lớp, góc kỷ niệm: chữ viết tay trên giấy kẻ */
.gb-item p { font-family: Pangolin, "Be Vietnam Pro", cursive; font-size: 17px; line-height: 1.55; color: #25407A; }

.fabs { gap: 10px; }

/* ===================== Đợt 6: giao diện giống trang mẫu ===================== */
.hud-icon { position: relative; width: 38px; height: 38px; border-radius: 12px; border: 0; background: rgba(255,255,255,.14); color: #fff; font-size: 18px; display: grid; place-items: center; }
.badge { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--red); color: #fff; font: 800 11px/18px var(--font); font-style: normal; box-shadow: 0 0 0 2px var(--navy); }
.chip.wallet { border: 0; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.online-pill { border: 0; cursor: pointer; font-family: var(--font); }

/* khung chat nổi */
.chat-feed { position: absolute; left: max(12px, env(safe-area-inset-left, 0px)); bottom: calc(124px + var(--sab)); width: min(70vw, 380px); z-index: 5;
  background: rgba(255,255,255,.93); border-radius: 16px; box-shadow: 0 4px 16px rgba(0,0,0,.16); overflow: hidden; }
.chat-head { width: 100%; display: flex; align-items: center; gap: 6px; border: 0; background: var(--navy); color: #fff; font-size: 12.5px; font-weight: 700; padding: 6px 10px; text-align: left; }
.chat-toggle { margin-left: auto; font-size: 12px; }
.chat-badge { font-style: normal; background: var(--red); color: #fff; border-radius: 999px; padding: 0 6px; font-size: 11px; }
.chat-list { max-height: 150px; overflow-y: auto; padding: 6px 8px; display: grid; gap: 4px; overscroll-behavior: contain; }
.chat-feed.min .chat-list { display: none; }
.chat-feed.min { width: auto; }
.chat-list:empty::before { content: 'Chưa có tin nhắn. Gửi lời chào nhé!'; color: var(--muted); font-size: 12.5px; }
.feed-row { color: var(--ink); border-radius: 10px; padding: 4px 8px; font-size: 13px; line-height: 1.35; word-break: break-word; }
.feed-row b { color: var(--navy); }
.feed-row small { color: var(--muted); font-size: 11.5px; font-weight: 600; }
.feed-row.own { background: #E8F0FB; }
.music-box ~ .chat-feed, body:has(.music-box) .chat-feed { bottom: calc(260px + var(--sab)); }

/* banner chuông trống */
.banner { position: absolute; left: 50%; transform: translateX(-50%); top: calc(64px + var(--sat)); width: min(560px, calc(100% - 24px)); background: var(--navy); color: #fff; border-radius: 16px; padding: 10px 10px 10px 14px; display: flex; align-items: center; gap: 8px; z-index: 20; box-shadow: 0 8px 24px rgba(0,0,0,.25); font-size: 14px; font-weight: 600; }
.banner span { flex: 1; }
.banner .btn { margin: 0; white-space: nowrap; }
.banner .icon-btn { background: rgba(255,255,255,.15); color: #fff; flex: none; }

.fab.shield.on { background: #DBEAFE; box-shadow: 0 0 0 3px #60A5FA; }

/* nhiệm vụ & thành tựu */
.quest-list { display: grid; gap: 8px; }
.quest { display: flex; align-items: center; gap: 12px; background: #fff; border-radius: 14px; padding: 10px 12px; box-shadow: 0 1px 0 var(--line); }
.quest.claimed { opacity: .6; }
.q-ico { font-size: 24px; width: 32px; text-align: center; flex: none; }
.q-body { flex: 1; min-width: 0; display: grid; gap: 2px; }
.q-body small { color: var(--muted); font-size: 12px; }
.q-body .q-reward { color: #B8862B; font-weight: 700; }
.q-done { color: var(--ok); font-weight: 700; font-size: 12px; white-space: nowrap; }
.q-todo { color: var(--muted); font-size: 12px; white-space: nowrap; }
.quest .btn { margin: 0; }
.bar { height: 6px; background: #EEF1F6; border-radius: 3px; overflow: hidden; margin: 2px 0; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--orange)); border-radius: 3px; }
.tier { background: #fff; border-radius: 14px; padding: 4px 12px; margin-bottom: 8px; }
.tier summary { padding: 10px 0; color: var(--navy); }
.tier .quest { box-shadow: none; background: var(--bg); }
.tier .quest-list { padding-bottom: 10px; }

/* ví */
.wallet-big { font-size: 40px; font-weight: 800; color: var(--navy); text-align: center; padding: 10px 0 0; font-variant-numeric: tabular-nums; }
.ledger { display: grid; gap: 4px; }
.ledger-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; background: #fff; border-radius: 10px; padding: 8px 12px; font-size: 13.5px; }
.ledger-row b { text-align: right; font-variant-numeric: tabular-nums; }
.ledger-row small { color: var(--muted); font-size: 11px; grid-column: 1 / -1; }

/* vé xe */
.transport { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-bottom: 12px; }
.ticket { background: #fff; border-radius: 16px; overflow: hidden; box-shadow: 0 4px 16px rgba(0,0,0,.1); margin: 8px 0; border: 2px dashed #D6DCE6; }
.ticket-head { background: var(--navy); color: var(--gold); font-weight: 800; letter-spacing: .08em; padding: 8px 14px; font-size: 13px; }
.ticket-body { display: flex; gap: 12px; align-items: center; padding: 12px 14px; }
.ticket-ico { font-size: 34px; }
.ticket-body b { display: block; font-size: 17px; }
.ticket-body small { color: var(--muted); }
.ticket-foot { padding: 8px 14px; background: #FFF7E6; color: #B8862B; font-weight: 700; font-size: 13px; }

/* tỏ tình */
.love-card { background: linear-gradient(135deg, #FFE4EC, #FFF1F2); border-radius: 16px; padding: 16px; margin-bottom: 8px; }
.love-line { font: 24px/1.4 Pangolin, var(--font); color: #BE185D; margin: 6px 0 0; }
.love-opt { text-align: left; }

/* âm thanh */
.range-row { display: grid; grid-template-columns: 1fr; gap: 6px; margin-top: 10px; }
.range-row span { font-size: 13px; color: var(--muted); font-weight: 600; }
.range-row b { font-size: 13px; color: var(--navy); }
.range { width: 100%; accent-color: var(--red); }
.card + .card { margin-top: 10px; }

/* trò chơi */
.game-head { font-weight: 800; color: var(--navy); margin: 0 0 8px; }
.game-stage { display: grid; gap: 10px; }
.game-card { background: #fff; border-radius: 16px; padding: 18px; text-align: center; display: grid; gap: 8px; justify-items: center; }
.game-card .btn { width: auto; min-width: 160px; }
.game-lv { font-size: 22px; font-weight: 800; color: var(--navy); }
.game-lv.ok { color: var(--ok); }
.game-lv.bad { color: var(--red); }
.game-score { font-size: 54px; font-weight: 800; color: var(--red); line-height: 1; }
.game-canvas { display: block; margin: 0 auto; border-radius: 14px; touch-action: none; box-shadow: 0 4px 14px rgba(0,0,0,.12); }
.chem-goal { font-weight: 700; color: var(--navy); background: #fff; border-radius: 12px; padding: 10px 12px; margin: 0; }
.beaker { width: 110px; height: 120px; margin: 4px auto; border: 4px solid #9DB4D6; border-top: 0; border-radius: 0 0 26px 26px; position: relative; overflow: hidden; background: rgba(255,255,255,.7); }
.beaker .liquid { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: #D6E4F0; transition: height .8s ease, background .8s ease; }
.beaker.filled .liquid { height: 70%; }
.beaker.bubbles::after { content: '∘ ° ∘ ° ∘'; position: absolute; left: 0; right: 0; top: 20%; text-align: center; color: #fff; font-size: 18px; animation: rise 1s infinite; }
@keyframes rise { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(-10px); opacity: 1; } }
.bottles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.bottle { border: 2px solid var(--line); background: #fff; border-radius: 12px; padding: 8px 6px; display: grid; gap: 2px; justify-items: center; font-weight: 700; font-size: 13px; color: var(--ink); }
.bottle.on { border-color: var(--blue); background: #E8F0FB; }
.flask { font-size: 22px; }
.mines { display: grid; gap: 3px; max-width: 360px; margin: 0 auto; width: 100%; }
.mine { aspect-ratio: 1; border: 0; border-radius: 6px; background: #9DB4D6; box-shadow: inset 0 -3px 0 rgba(0,0,0,.15); font-weight: 800; font-size: 15px; color: var(--navy); padding: 0; }
.mine.open { background: #EEF1F6; box-shadow: none; }
.mine[data-k="1"] { color: #2563EB; } .mine[data-k="2"] { color: #16A34A; } .mine[data-k="3"] { color: #DC2626; } .mine[data-k="4"] { color: #7C3AED; }
.btn.on { background: #FDECEC; color: var(--red); }
.quick .pill.on { background: var(--navy); color: #fff; }

/* tri ân & 20/11 */
.flower-box { background: linear-gradient(135deg, #FFF1F2, #FFF8EC); border-radius: 16px; padding: 14px; display: grid; gap: 8px; }
.flower-count { font-size: 15px; color: #BE185D; }
.flower-count b { font-size: 26px; }
.card.td { background: linear-gradient(135deg, #FFF1F2, #FFF8EC); }

/* đẹp hơn: sheet, nút, thanh dưới */
.sheet { box-shadow: 0 -10px 40px rgba(15,22,40,.25); }
.sheet-head { padding: 16px 16px 8px; }
.sheet-head h2 { font-size: 19px; }
.backdrop { backdrop-filter: blur(2px); }
.btn.primary { box-shadow: 0 3px 0 #A8242A; }
.btn.primary:active { box-shadow: 0 1px 0 #A8242A; transform: translateY(2px); }
.place { transition: transform .1s; }
.place:active { transform: scale(.97); }
.fab { transition: transform .1s; }
.fab:active { transform: scale(.92); }
@media (max-width: 480px) { .hud-icon { width: 34px; height: 34px; } .chat-feed { width: calc(100% - 96px); } .chat-feed.min { width: auto; } .chat-list { max-height: 112px; } }
.chip.wallet .short { display: none; }
@media (max-width: 480px) {
  .hud .chip.warn { display: none; }
  .chip.wallet .long { display: none; }
  .chip.wallet .short { display: inline; }
  .music-btn, .hud-icon { width: 32px; height: 32px; font-size: 15px; border-radius: 10px; }
  .hud-avatar { width: 34px; height: 34px; }
  .online-pill { padding: 4px 8px; }
  .logo { width: 34px; height: 34px; }
  .brand b { font-size: 14px; }
  .brand small { font-size: 11px; }
}

/* ---------- Lớp học: bảng lớp, sổ đầu bài, nội quy ---------- */
.board-menu { display: grid; gap: 8px; }
.board-item { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 14px; padding: 10px 12px; }
.board-item:active { background: var(--bg); }
.board-item b { display: block; font-size: 15px; color: var(--navy); }
.board-item small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.bi-icon { flex: none; width: 40px; height: 40px; display: grid; place-items: center; font-size: 20px; border-radius: 12px; background: #2F5D50; }
.ok-box, .warn-box { margin-top: 12px; padding: 10px 12px; border-radius: 12px; font-size: 14px; line-height: 1.45; }
.ok-box { background: #E8F5EC; color: #1F6B41; }
.warn-box { background: #FFF4DC; color: #8A5A00; }
.board-text { margin: 4px 0 10px; padding: 14px 14px 14px 34px; background: #FFFDF6; border: 1px solid #E9DFC6; border-radius: 12px; line-height: 1.6; font-weight: 600; }
.board-text li { margin: 2px 0; }
.board-text.red { color: #A3262B; }
.small { font-size: 13px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.logbook h4 { margin: 14px 0 6px; font-size: 14px; color: var(--navy); }
.logbook table.log { width: 100%; border-collapse: collapse; font-size: 13px; background: #fff; border-radius: 10px; overflow: hidden; }
.logbook table.log td { padding: 7px 8px; border-bottom: 1px solid var(--line); }
.logbook table.log td:first-child { width: 28px; color: var(--muted); text-align: right; }
.logbook table.log td:last-child { width: 52px; color: var(--muted); text-align: right; }
.logbook small { color: var(--muted); }
.logbook tr.me td, .logbook li.me, .logbook p.me { background: #EAF2FC; }
.notes { margin: 0; padding-left: 18px; font-size: 13.5px; line-height: 1.5; }
.writeups { margin-top: 12px; padding: 10px 12px; background: #FDECEC; border-radius: 12px; font-size: 13.5px; }
.writeups p { margin: 6px 0 0; }
.logbook textarea.input { margin-top: 4px; }
.logbook select.input.sm { width: auto; max-width: 70%; font-weight: 700; }

/* ---------- Tạo nhân vật / chọn ngoại hình (giống trang mẫu) ---------- */
.ob-step { display: grid; gap: 0; }
.ob-lbl { display: block; font-size: 14px; font-weight: 700; color: var(--ink); margin: 16px 0 8px; }
.ob-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ob-chip { border: 1.5px solid var(--line); background: #fff; color: var(--ink); border-radius: 999px; padding: 8px 14px; font-size: 14px; font-weight: 600; min-height: 38px; }
.ob-chip.on { background: var(--blue); border-color: var(--blue); color: #fff; }
.ob-sw { width: 34px; height: 34px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 1.5px var(--line); padding: 0; }
.ob-sw.on { box-shadow: 0 0 0 3px var(--blue); }
.ob-btns { display: grid; gap: 4px; margin-top: 18px; }
.ob-btns .btn { margin-top: 0; }
.btn.big { padding: 15px 16px; font-size: 16px; border-radius: 16px; }
.btn.primary:disabled { background: #EBA9AC; cursor: default; }
.ob-btns .btn.link { text-decoration: none; }
.ob-center { display: grid; place-items: center; text-align: center; }
.ob-step .warn-box { margin: 12px 0 0; }
.look-stage { display: flex; align-items: center; justify-content: space-around; gap: 12px; background: #fff; border: 1.5px solid var(--line); border-radius: 20px; padding: 8px 12px; }
.look-stage canvas { flex: none; }
.look-stage .dice { width: auto; margin: 0; padding: 10px 16px; border-radius: 14px; }
.look { padding-bottom: 4px; }

/* ---------- Trình phát nhạc nền ---------- */
.now-playing { margin: 4px 0 8px; font-size: 14px; color: var(--ink); }
.mp-row { display: flex; justify-content: center; align-items: center; gap: 14px; margin: 6px 0 10px; }
.mp-btn { width: 44px; height: 44px; border-radius: 50%; border: 1.5px solid var(--line); background: #fff; font-size: 18px; }
.mp-btn.main { width: 56px; height: 56px; background: var(--red); border-color: var(--red); color: #fff; font-size: 22px; }

/* ---------- Quản trị: bảng tên thầy cô ---------- */
.admin-table { display: grid; gap: 6px; margin: 8px 0 4px; }
.admin-row { display: grid; grid-template-columns: minmax(110px, 1fr) 92px 2fr; gap: 6px; align-items: center; }
.admin-row .input { margin: 0; padding: 8px 10px; font-size: 14px; }
.admin-row .input.sm { width: 100%; }
.admin-slot { font-size: 13px; font-weight: 700; color: var(--navy); }
@media (max-width: 420px) { .admin-row { grid-template-columns: 1fr 92px; } .admin-row .input:not(.sm) { grid-column: 1 / -1; } }
.admin-head { margin: 10px 0 2px; font-size: 12px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.admin-row .admin-sub { grid-column: 3; }
@media (max-width: 420px) { .admin-row .admin-sub { grid-column: 1 / -1; } }

/* ---------- Quản trị: tin nhắn, thành viên ---------- */
.admin-msgs { display: grid; gap: 8px; margin: 8px 0; }
.admin-msg { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; font-size: 14px; }
.admin-msg.banned { background: #FDF3F3; }
.admin-msg-text { margin: 4px 0; word-break: break-word; }
.admin-msg .row-btns .btn { flex: none; }
.ban-form { margin-top: 8px; padding: 10px; border-radius: 10px; background: #FFF6E5; display: grid; gap: 6px; }
.ban-form .input { margin: 0; }
.check { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.feed-x { display: none; float: right; border: 0; background: transparent; color: var(--muted); font-weight: 800; padding: 0 4px; margin-left: 4px; }
.chat-feed.admin .feed-x { display: inline-block; }

/* ---------- Bảng tin: lá thư của khóa ---------- */
.letter { margin: 10px 0; padding: 16px 16px 12px; background: #FFFDF6; border: 1px solid #EADFC4; border-left: 4px solid #F2B233; border-radius: 14px; box-shadow: 0 2px 10px rgba(0,0,0,.06); }
.letter-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.letter-head img { width: 40px; height: 40px; border-radius: 50%; }
.letter-head b { display: block; color: var(--navy); font-size: 13px; }
.letter-head small { color: var(--red); font-weight: 700; }
.letter h4 { margin: 12px 0 4px; color: var(--red); font-size: 15px; }
.letter .thanks h4 { color: #8E3B8E; }
.letter p { margin: 0 0 8px; font-family: Pangolin, "Be Vietnam Pro", cursive; font-size: 17px; line-height: 1.6; color: #25407A; white-space: pre-line; }
.letter-foot { margin-top: 6px; text-align: right; font-size: 12px; color: var(--muted); }
.btn.link.admin-del { color: var(--red); font-size: 12.5px; padding: 2px 0; margin-top: 4px; text-align: left; width: auto; }
