:root {
    --green: #069a4b;
    --green-dark: #047a3b;
    --green-soft: #e7f6ee;
    --gray: #8c8c8f;
    --ink: #1f2522;
    --muted: #66706b;
    --line: #dfe5e2;
    --bg: #f4f7f5;
    --white: #fff;
    --red: #c62828;
    --gold: #f2b705;
    --radius: 14px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: var(--ink);
    background: var(--bg);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--green-dark); }

.wrap { max-width: 520px; margin: 0 auto; padding: 20px 16px 40px; }
.wrap-wide { max-width: 1100px; margin: 0 auto; padding: 24px 16px 48px; }

/* Header thương hiệu */
.brand { text-align: center; padding: 8px 0 18px; }
.brand img { height: 64px; width: auto; }
.brand h1 { margin: 10px 0 2px; font-size: 1.35rem; font-weight: 800; color: var(--green-dark); letter-spacing: .3px; }
.brand p { margin: 0; color: var(--muted); font-size: .92rem; }

.card {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: 0 6px 24px rgba(4, 60, 30, .06);
}
.card + .card { margin-top: 16px; }

.badge {
    display: inline-block; font-size: .78rem; font-weight: 700;
    padding: 3px 10px; border-radius: 999px;
    background: var(--green-soft); color: var(--green-dark);
}
.badge.off { background: #eef0ef; color: var(--muted); }
.badge.live { background: var(--green); color: #fff; }

/* Form */
label { display: block; font-weight: 600; margin: 14px 0 6px; font-size: .95rem; }
input[type=text], input[type=tel], input[type=password], textarea, select {
    width: 100%; font: inherit; font-size: 16px; /* chặn iOS tự zoom */
    padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.error { color: var(--red); font-size: .88rem; margin-top: 4px; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    font: inherit; font-weight: 700; cursor: pointer; text-decoration: none;
    border: 0; border-radius: 10px; padding: 12px 18px;
    background: var(--green); color: #fff;
}
.btn:hover { background: var(--green-dark); }
.btn.block { width: 100%; padding: 15px; font-size: 1.05rem; margin-top: 18px; }
.btn.ghost { background: #fff; color: var(--green-dark); border: 1.5px solid var(--green); }
.btn.ghost:hover { background: var(--green-soft); }
.btn.danger { background: #fff; color: var(--red); border: 1.5px solid #f0c4c4; }
.btn.sm { padding: 7px 12px; font-size: .88rem; }
.btn[disabled] { opacity: .6; cursor: wait; }

/* Câu hỏi */
.q-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.timer { font-variant-numeric: tabular-nums; font-weight: 800; color: var(--green-dark); font-size: 1.1rem; }
.question { font-size: 1.15rem; font-weight: 700; margin: 4px 0 16px; }

.options { display: grid; gap: 10px; }
.option input { position: absolute; opacity: 0; }
.option span {
    display: flex; gap: 12px; align-items: flex-start;
    padding: 14px; border: 2px solid var(--line); border-radius: 12px;
    cursor: pointer; background: #fff; transition: border-color .15s, background .15s;
}
.option b {
    flex: 0 0 30px; height: 30px; border-radius: 50%;
    display: grid; place-items: center; background: var(--green-soft); color: var(--green-dark);
}
.option input:checked + span { border-color: var(--green); background: var(--green-soft); }
.option input:checked + span b { background: var(--green); color: #fff; }

.center { text-align: center; }
.big-icon { font-size: 3rem; line-height: 1; margin-bottom: 8px; }
.muted { color: var(--muted); }
.hello { background: var(--green-soft); border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; font-size: .93rem; }

.footer { text-align: center; color: var(--muted); font-size: .8rem; margin-top: 24px; }

/* Admin */
.topbar { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.topbar h1 { margin: 0; font-size: 1.3rem; }
.rounds { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.stat { display: flex; gap: 18px; margin: 12px 0; }
.stat div { font-size: .85rem; color: var(--muted); }
.stat strong { display: block; font-size: 1.4rem; color: var(--ink); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.flash { background: var(--green-soft); border-left: 4px solid var(--green); padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; }
.qr-thumb { width: 110px; height: 110px; border: 1px solid var(--line); border-radius: 8px; }
.winner-mini { background: #fff8e1; border-radius: 10px; padding: 8px 12px; font-size: .9rem; margin-top: 10px; }

.section-title { margin: 32px 0 12px; font-size: 1.15rem; }
.table-scroll { overflow-x: auto; }
table.rank { font-size: .88rem; }
table.rank th, table.rank td { padding: 7px 8px; white-space: nowrap; }
table.rank tr.top1 td { background: #fff8e1; }
table.rank td.ok { color: var(--green-dark); font-weight: 700; }
table.rank td.bad { color: var(--red); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
th { font-size: .82rem; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }

/* Màn hình LED */
.screen { min-height: 100vh; background: radial-gradient(circle at 20% 0%, #0c7a42, #033d20 70%); color: #fff; padding: 3vh 4vw; }
.screen .brand h1 { color: #fff; font-size: 3vw; }
.screen .brand p { color: #cfe9da; font-size: 1.4vw; }
.screen .brand img { height: 9vh; background: #fff; border-radius: 12px; padding: 6px 10px; }
.screen-grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: 3vw; align-items: start; margin-top: 2vh; }
.screen-panel { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.18); border-radius: 20px; padding: 2.5vw; }
.screen-panel h2 { margin: 0 0 1.5vh; font-size: 1.8vw; color: #cfe9da; }
.screen-q { font-size: 2vw; font-weight: 700; }
.screen-qr { background: #fff; border-radius: 16px; padding: 1vw; width: 100%; max-width: 32vw; display: block; margin: 0 auto; }
.screen-count { font-size: 1.6vw; text-align: center; margin-top: 1.5vh; }
.screen table td, .screen table th { color: #fff; border-color: rgba(255,255,255,.15); font-size: 1.3vw; padding: 1vh 1vw; }
.screen table tr.ok td:first-child { color: var(--gold); font-weight: 800; }
.winner-box { text-align: center; background: linear-gradient(135deg, #f2b705, #f7d154); color: #3b2a00; border-radius: 20px; padding: 3vh 2vw; }
.winner-box .label { font-size: 1.6vw; font-weight: 700; letter-spacing: 2px; }
.winner-box .name { font-size: 4vw; font-weight: 900; margin: 1vh 0; }
.winner-box .meta { font-size: 1.8vw; }

@media (max-width: 800px) {
    .screen-grid { grid-template-columns: 1fr; }
}
