/* Màn MC và điện thoại: nền sáng, chữ sẫm, nhấn đỏ cờ - đọc được ngoài trời nắng */
:root {
  --nen: #fff6e6;
  --the: #ffffff;
  --the-2: #fbe6cc;
  --vien: #e3c39f;
  --chu: #1e0506;
  --chu-mo: #6f4740;
  --do: #c8141b;
  --do-dam: #8e0b12;
  --nhan: #b10f16;      /* chữ nhấn */
  --vang: #ffce1f;
  --vang-dam: #d99a00;
  --vang-nhat: #fff1c4;
  --xanh-la: #0e7a3a;
  --than: #3a2a2b;      /* nút Sai, trạng thái sai */
  --doi-1: #0a66cc; --doi-2: #dd6203; --doi-3: #8a1a8f; --doi-4: #006838;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); color: var(--chu); background: var(--nen); -webkit-font-smoothing: antialiased; }
button { font: inherit; cursor: pointer; border: 1px solid var(--vien); border-radius: 10px; padding: 10px 14px; background: var(--the-2); color: var(--chu); font-weight: 600; transition: transform .05s, filter .15s; }
.ic { width: 1.2em; height: 1.2em; vertical-align: -.24em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
button .ic:first-child { margin-right: .4em; }
button .ic.sau { margin: 0 .25em; }
button:hover { filter: brightness(.96); }
button:active { transform: scale(.97); }
button:disabled { opacity: .45; cursor: not-allowed; filter: none; }
button:focus-visible { outline: 3px solid var(--do); outline-offset: 2px; }
button.chinh { background: var(--vang); color: var(--chu); border-color: var(--vang-dam); }
button.dung { background: var(--xanh-la); color: #fff; border-color: transparent; }
button.sai { background: var(--do); color: #fff; border-color: transparent; }
button.nhat { background: transparent; border: 1px solid var(--vien); }
input, select, textarea { font: inherit; color: var(--chu); background: #fff; border: 1.5px solid var(--vien); border-radius: 8px; padding: 8px 10px; }
.mo { color: var(--chu-mo); }
input:focus { outline: none; border-color: var(--do); box-shadow: 0 0 0 3px rgba(200, 20, 27, .18); }
input::placeholder { color: #a58a7a; }
::selection { background: var(--vang); color: var(--chu); }
button { -webkit-tap-highlight-color: transparent; }
* { scrollbar-width: thin; scrollbar-color: #c98f6a transparent; }
@supports not (scrollbar-width: thin) { ::-webkit-scrollbar { width: 10px; height: 10px; } ::-webkit-scrollbar-thumb { background: #c98f6a; border-radius: 99px; border: 2px solid var(--nen); } }
/* Hộp hỏi riêng */
.hop-hoi { position: fixed; inset: 0; z-index: 900; display: grid; place-items: center; padding: 20px; background: rgba(60, 4, 8, .62); animation: hh-mo .18s ease both; }
.hop-hoi.dong { opacity: 0; transition: opacity .16s; pointer-events: none; }
.hh-the { width: min(460px, 100%); background: #fffdf7; border-radius: 22px; padding: 30px 30px 26px; text-align: center; box-shadow: 0 0 0 5px var(--vang), 0 24px 70px rgba(40, 0, 3, .5); animation: hh-len .28s cubic-bezier(.2, 1.2, .4, 1) both; }
.hh-icon { width: 70px; height: 70px; margin: 0 auto 14px; border-radius: 50%; display: grid; place-items: center; font-size: 32px; background: var(--vang); color: var(--do-dam); box-shadow: 0 0 0 4px #fff, 0 0 0 7px var(--vang-dam); }
.hh-the.nguy .hh-icon { background: var(--do); color: #fff; box-shadow: 0 0 0 4px #fff, 0 0 0 7px var(--do-dam); }
.hh-icon .ic { width: 36px; height: 36px; }
.hh-the h2 { margin: 0; font-size: 24px; line-height: 1.25; color: var(--do-dam); overflow-wrap: anywhere; }
.hh-the p { margin: 10px 0 0; font-size: 17px; line-height: 1.45; color: var(--chu); text-wrap: balance; }
.hh-nhap { width: 100%; margin-top: 18px; padding: 14px 16px; font-size: 22px; font-weight: 700; text-align: center; border-radius: 12px; border-width: 2px; }
.hh-loi { min-height: 22px; margin-top: 6px; color: var(--do); font-weight: 600; font-size: 15px; }
.hh-nut { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 22px; }
.hh-nhap ~ .hh-nut { margin-top: 4px; }
.hh-nut button { font-size: 18px; padding: 14px; border-radius: 12px; }
@keyframes hh-mo { from { opacity: 0; } }
@keyframes hh-len { from { opacity: 0; transform: translateY(24px) scale(.95); } }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 40px); opacity: 0; background: #1e0506; color: #fff; padding: 12px 18px; border-radius: 12px; transition: .25s; z-index: 999; max-width: 90vw; text-align: center; pointer-events: none; }
#toast.hien { opacity: 1; transform: translate(-50%, 0); }
body.mat-ket-noi::before { content: "Đang kết nối lại với máy chủ…"; position: fixed; top: 0; left: 0; right: 0; background: #1e0506; color: #fff; text-align: center; padding: 6px; z-index: 1000; font-weight: 600; }
.thanh-gio { height: 14px; width: 100%; background: #f0dcc2; border-radius: 99px; overflow: hidden; }
.thanh-gio > div { height: 100%; background: linear-gradient(90deg, var(--do), #f58a07); width: 0; transition: width .1s linear; }

/* ================= ĐIỆN THOẠI CỦA ĐỘI ================= */
body.thi-sinh { min-height: 100vh; min-height: 100dvh; background: linear-gradient(180deg, #fff6e6, #ffe6bd); }
.ts-wrap { max-width: 560px; margin: 0 auto; padding: 14px 16px 30px; display: flex; flex-direction: column; gap: 14px; min-height: 100dvh; }
.ts-top { display: flex; align-items: center; gap: 12px; background: linear-gradient(100deg, var(--do), var(--do-dam)); color: #fff; border-radius: 16px; padding: 12px 14px 12px 16px; border-left: 10px solid var(--mau, var(--vang)); }
.ts-top .ten { flex: 1; font-weight: 700; font-size: 18px; line-height: 1.2; }
.ts-top .ten small { display: block; color: #ffe3c2; font-weight: 500; font-size: 13px; }
.ts-top .diem { font-size: 32px; font-weight: 800; color: var(--vang); font-variant-numeric: tabular-nums; }
.ts-cau { background: #fff; border: 2px solid var(--vien); border-radius: 16px; padding: 16px; font-size: 20px; line-height: 1.4; font-weight: 600; }
.ts-cau img { max-width: 100%; border-radius: 10px; margin-top: 10px; display: block; }
.ts-cau .nhan { font-size: 13px; color: var(--nhan); font-weight: 800; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 6px; }
.ts-gio { display: flex; align-items: center; gap: 12px; }
.ts-gio .so { font-size: 34px; font-weight: 800; min-width: 52px; text-align: center; font-variant-numeric: tabular-nums; }
.ts-gio .so.sap-het { color: var(--do); }
.ts-gio .thanh-gio { flex: 1; }
.nut-chuong { width: 100%; aspect-ratio: 1.6; border-radius: 28px; border: 0; font-size: 40px; font-weight: 900; background: radial-gradient(circle at 50% 35%, #f5413b, #b10f16); color: #fff; box-shadow: 0 10px 0 #6e060c, 0 16px 30px rgba(80, 0, 5, .35); letter-spacing: 2px; touch-action: manipulation; -webkit-user-select: none; user-select: none; }
.nut-chuong:active { transform: translateY(6px); box-shadow: 0 4px 0 #6e060c; }
.nut-chuong:disabled { background: #d8c7b6; box-shadow: 0 10px 0 #b9a590; opacity: 1; color: #6f5a4c; }
.nut-chuong.da-bam, .nut-chuong.da-bam:disabled { background: radial-gradient(circle at 50% 35%, #ffe27a, #f2b800); color: var(--chu); box-shadow: 0 10px 0 #a87a00; }
/* Chuông từ khoá (VCNV): đặt trên câu hỏi, cách xa ô nhập đáp án và bàn phím */
#dau-doi, #tb { order: -2; }
.nut-chuong.tu-khoa { order: -1; aspect-ratio: auto; min-height: 104px; font-size: 25px; letter-spacing: .5px; border-radius: 24px; margin-bottom: 14px; }
.ts-tl { display: flex; flex-direction: column; gap: 10px; }
.ts-tl input { font-size: 22px; padding: 14px; border-radius: 12px; }
.ts-tl button { font-size: 20px; padding: 14px; }
.ts-tl .da-gui { font-size: 15px; color: var(--chu-mo); }
.ts-tb { text-align: center; font-size: 18px; font-weight: 700; padding: 12px; border-radius: 12px; background: var(--the-2); }
.ts-tb.vang { background: var(--vang); color: var(--chu); }
.ts-tb.do { background: var(--do); color: #fff; }
.ts-tb.xanh { background: var(--xanh-la); color: #fff; }
.chon-vi-tri { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.chon-vi-tri button { padding: 22px 10px; font-size: 20px; background: #fff; border: 2px solid var(--vien); }
.chon-vi-tri button.chon { background: var(--do); color: #fff; border-color: var(--do); }
.ts-bang { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: auto; }
.ts-bang div { background: #fff; border-radius: 10px; padding: 6px; text-align: center; font-size: 12px; border-top: 5px solid var(--mau, var(--vien)); overflow: hidden; text-overflow: ellipsis; }
.ts-bang div b { display: block; font-size: 18px; color: var(--nhan); }
.ts-bang div.toi { outline: 2px solid var(--do); }
#vd-area { display: flex; flex-direction: column; gap: 10px; }
.goi-chon { display: grid; gap: 8px; }
.goi-chon.ba { grid-template-columns: repeat(3, 1fr); }
.goi-chon.bon { grid-template-columns: repeat(4, 1fr); }
.goi-chon button { padding: 14px 4px; background: #fff; border: 2px solid var(--vien); }
.goi-chon button b { display: block; font-size: 20px; }
.goi-chon.bon button b { font-size: 17px; }
.goi-chon button small { display: block; font-size: 12px; color: var(--chu-mo); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.goi-chon button.chon { background: var(--do); border-color: var(--do); color: #fff; }
.goi-chon button.chon small { color: #ffe3c2; }
