:root { --c: #2f9e44; --c2: #1c7ed6; --ink: #14203d; --mut: #5d6a8a; --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px); }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #2f8a3a; font-family: "Be Vietnam Pro", system-ui, sans-serif; color: var(--ink); overscroll-behavior: none; }
canvas#c { position: fixed; inset: 0; touch-action: none; display: block; }
#menu { position: fixed; inset: 0; z-index: 20; display: none; overflow-y: auto; -webkit-overflow-scrolling: touch; }
#menu.on { display: block; }
#panel { position: fixed; inset: 0; z-index: 30; display: none; overflow-y: auto; }
#panel.on { display: block; }
button { font: inherit; cursor: pointer; color: inherit; }
button:disabled { cursor: default; opacity: .5; }
a { color: var(--c2); }

body .agt-root { --agt-c: #2f9e44; }
body .agt-rt { background: none; -webkit-text-fill-color: currentColor; color: #1f7a34; }
/* ---------- trang chính ---------- */
.home { min-height: 100%; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: calc(var(--sat) + 74px) 16px 28px; max-width: 540px; margin: 0 auto; }
.logo { text-align: center; color: #fff; text-shadow: 0 3px 16px rgba(0,30,10,.5); }
.logo .mark { width: 74px; height: 74px; margin: 0 auto 6px; border-radius: 24px; background: linear-gradient(180deg, #8fd0f7 0 52%, #5cb543 52%); box-shadow: 0 10px 28px rgba(0,40,10,.35); position: relative; overflow: hidden; transform: rotate(-6deg); }
.logo .mark::before { content: ''; position: absolute; left: 44px; top: 12px; width: 4px; height: 30px; background: #fff; border-radius: 2px; }
.logo .mark::after { content: ''; position: absolute; left: 48px; top: 12px; border-left: 16px solid #e63946; border-top: 6px solid transparent; border-bottom: 6px solid transparent; }
.logo .mark i { position: absolute; left: 16px; bottom: 10px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: inset -3px -3px 0 rgba(0,0,0,.12); }
.logo h1 { margin: 0; font-size: clamp(40px, 11vw, 58px); font-weight: 900; letter-spacing: -1px; line-height: 1; }
.logo p { margin: 6px 0 0; font-weight: 800; font-size: 15px; }
.btn { display: block; width: 100%; min-height: 52px; border: 0; border-radius: 18px; background: rgba(255,255,255,.96); font-weight: 800; font-size: 17px; margin: 6px 0; box-shadow: 0 6px 18px rgba(0,30,10,.2); padding: 8px 14px; }
.btn.main { background: linear-gradient(180deg, #4cc062, var(--c)); color: #fff; box-shadow: 0 8px 22px rgba(47,158,68,.45); }
.btn.big { min-height: 70px; font-size: 22px; font-weight: 900; }
.btn.big small { display: block; font-size: 13px; font-weight: 700; opacity: .9; margin-top: 2px; }
.btn.ghost { background: rgba(255,255,255,.6); }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; }
.tile { border: 0; border-radius: 20px; background: rgba(255,255,255,.94); padding: 14px 12px; text-align: left; min-height: 92px; box-shadow: 0 6px 18px rgba(0,30,10,.18); display: flex; flex-direction: column; gap: 4px; }
.tile b { font-size: 16px; }
.tile small { color: var(--mut); font-weight: 700; font-size: 12.5px; line-height: 1.3; }
.link { border: 0; background: rgba(255,255,255,.88); border-radius: 14px; padding: 12px 16px; font-weight: 800; width: 100%; display: block; text-align: center; text-decoration: none; color: var(--ink); margin: 6px 0; }
.link.edu { background: #e7f5ff; color: #1864ab; }
.stat { color: #fff; font-weight: 800; font-size: 13px; text-align: center; margin: 0; text-shadow: 0 2px 8px rgba(0,30,10,.6); }
.foot { color: #fff; font-weight: 700; font-size: 13px; text-align: center; text-shadow: 0 2px 8px rgba(0,30,10,.6); }
.foot a { color: #fff; }

/* ---------- trang con ---------- */
.page { max-width: 680px; margin: 0 auto; padding: calc(var(--sat) + 68px) 16px 40px; min-height: 100%; background: rgba(244,250,244,.97); }
.top { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.top h2 { margin: 0; font-size: 23px; font-weight: 900; line-height: 1.15; }
.back { border: 0; background: #fff; border-radius: 14px; min-height: 44px; padding: 0 14px; font-weight: 800; box-shadow: 0 3px 10px rgba(10,40,20,.1); flex: none; }
.mut { color: var(--mut); font-size: 14px; margin: 6px 0 10px; line-height: 1.45; }
h3 { margin: 18px 0 8px; font-size: 18px; }
.zone { background: #fff; border-radius: 22px; padding: 14px; margin: 12px 0; border-top: 6px solid var(--z); box-shadow: 0 6px 18px rgba(10,40,20,.08); }
.zone h3 { margin: 0; color: var(--z); }
.list { display: flex; flex-direction: column; gap: 8px; }
.row { border: 0; background: #fff; border-radius: 16px; padding: 14px 16px; text-align: left; display: flex; flex-direction: column; gap: 2px; box-shadow: 0 3px 12px rgba(10,40,20,.07); }
.zone .row { background: #f3f8f3; box-shadow: none; }
.row span { color: var(--mut); font-weight: 600; font-size: 13.5px; }
.row .st { font-style: normal; color: #f2a900; letter-spacing: 1px; margin-left: 6px; }
.brief { background: #fff; border-radius: 22px; padding: 16px; border-left: 8px solid var(--z); box-shadow: 0 6px 18px rgba(10,40,20,.08); margin-bottom: 12px; }
.brief small { color: var(--z); font-weight: 800; }
.brief h2 { margin: 2px 0 6px; font-size: 24px; }
.brief h2.q { font-size: 19px; line-height: 1.35; }
.brief p { margin: 4px 0; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 2px solid #dfe9df; background: #fff; border-radius: 14px; min-height: 44px; padding: 0 14px; font-weight: 800; }
.chip.on { border-color: var(--c); background: #e9f8ec; }
.opt { display: flex; gap: 12px; align-items: flex-start; background: #fff; border-radius: 16px; padding: 12px 14px; margin: 10px 0; box-shadow: 0 3px 12px rgba(10,40,20,.07); }
.opt input { width: 24px; height: 24px; accent-color: var(--c); flex: none; margin-top: 2px; }
.opt span { display: flex; flex-direction: column; gap: 2px; }
.opt small { color: var(--mut); font-weight: 600; font-size: 13px; line-height: 1.4; }
.courses { display: flex; flex-direction: column; gap: 10px; }
.course { display: flex; gap: 12px; align-items: stretch; text-align: left; border: 3px solid transparent; background: #fff; border-radius: 20px; padding: 10px; box-shadow: 0 4px 14px rgba(10,40,20,.08); }
.course.on { border-color: var(--z); }
.course .cmini { width: 92px; min-height: 92px; border-radius: 14px; flex: none; }
.course div { display: flex; flex-direction: column; gap: 3px; }
.course b { font-size: 17px; }
.course small { color: var(--z); font-weight: 800; }
.course span { color: var(--mut); font-size: 13px; font-weight: 600; line-height: 1.35; }
.course em { font-style: normal; font-weight: 800; color: #b07d00; font-size: 13px; }
.steps { display: flex; flex-direction: column; gap: 8px; }
.step { display: flex; gap: 12px; align-items: center; text-align: left; border: 0; background: #fff; border-radius: 16px; padding: 12px; box-shadow: 0 3px 12px rgba(10,40,20,.07); }
.step i { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; font-style: normal; font-weight: 900; background: #e9f8ec; color: var(--c); flex: none; }
.step.done i { background: var(--c); color: #fff; }
.step.lock { opacity: .55; }
.step div { display: flex; flex-direction: column; } .step small { color: var(--mut); font-weight: 600; }
canvas.fig { display: block; width: 100%; height: 170px; border-radius: 16px; margin: 8px 0; background: #eef6ee; }
canvas.fig.big { height: 200px; }
ul.rl { margin: 6px 0 10px; padding-left: 20px; }
ul.rl li { padding: 5px 0; font-weight: 600; font-size: 15px; line-height: 1.5; }
.qa.right { background: #d3f9d8; } .qa.wrong { background: #ffe3e3; }
.okk { color: #2b8a3e; font-weight: 700; } .nok { color: #c92a2a; font-weight: 700; }
.cd-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 6px 0; }
table.clubs { border-collapse: collapse; width: 100%; background: #fff; border-radius: 14px; overflow: hidden; font-size: 14px; }
table.clubs th { background: var(--ink); color: #fff; padding: 8px; text-align: left; font-size: 13px; }
table.clubs td { padding: 7px 8px; border-bottom: 1px solid #edf2ed; font-weight: 700; }
table.clubs td small { display: block; white-space: nowrap; color: var(--mut); font-weight: 600; font-size: 11.5px; }
.setrow { display: flex; flex-direction: column; gap: 6px; padding: 10px 0; border-bottom: 1px solid #eef0f8; font-weight: 800; font-size: 14px; }
.sw { width: 40px; height: 40px; border-radius: 12px; border: 3px solid #dfe6f3; }
.sw.on { border-color: var(--c); box-shadow: 0 0 0 2px #fff inset; }

/* ---------- bảng nổi trong lúc chơi ---------- */
.ov { min-height: 100%; display: grid; place-items: center; padding: 16px; background: rgba(8,24,14,.45); backdrop-filter: blur(2px); }
.panel { width: 100%; max-width: 440px; background: #fff; border-radius: 26px; padding: 20px; box-shadow: 0 24px 60px rgba(10,30,20,.35); }
.panel h2 { margin: 0 0 6px; font-size: 24px; font-weight: 900; }
.hole-intro { text-align: left; border-top: 8px solid var(--c); }
.hi-num { font-weight: 900; color: var(--c); font-size: 15px; } .hi-num small { color: var(--mut); }
.hi-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 6px 0; }
.hi-row span { background: #eef7ef; border-radius: 10px; padding: 6px 10px; font-weight: 800; font-size: 14px; }
.hi-c { color: var(--mut); font-weight: 700; font-size: 14px; margin: 6px 0; }
.hi-hz { background: #fff6e0; border-radius: 12px; padding: 8px 10px; font-weight: 700; font-size: 13.5px; margin: 8px 0; }
.hi-ord { font-size: 14px; margin: 8px 0; } .hi-ord small { color: var(--mut); font-weight: 600; }
.hi-acts { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; }
.hole-done { text-align: center; }
.hd-big { font-size: 38px; font-weight: 900; color: var(--ink); margin: 4px 0; }
.hd-big.good { color: #e8590c; }
.hd-s { font-weight: 700; color: var(--mut); margin: 4px 0 10px; }
.hd-row { display: flex; justify-content: space-between; align-items: center; background: #eef7ef; border-radius: 14px; padding: 10px 14px; font-weight: 800; }
.hd-row b { font-size: 22px; }
.hd-pt { display: flex; flex-direction: column; gap: 4px; margin: 10px 0; text-align: left; font-size: 14px; }
.hd-pt small { color: var(--mut); }
.decide { border-top: 8px solid #e8590c; }
.dc-i { font-weight: 700; margin: 6px 0; line-height: 1.45; }
.dc-r { background: #f6f8fb; border-radius: 14px; padding: 4px 12px; margin: 8px 0; }
.dc-r ul.rl li { font-size: 14px; }
.dc-opts { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.dc-o { border: 2px solid #e3e8f0; background: #fff; border-radius: 16px; padding: 12px 14px; text-align: left; display: flex; flex-direction: column; gap: 2px; min-height: 56px; }
.dc-o.main { border-color: var(--c); background: #eefaf0; }
.dc-o small { color: var(--mut); font-weight: 600; font-size: 13px; }
.pause .btn { margin: 6px 0; }
.stars3 { font-size: 40px; letter-spacing: 6px; color: #dfe3ea; text-align: center; } .stars3 .on { color: #fcc419; }
.cardx { margin: 0 -6px; }
h4.cd-h { margin: 10px 0 4px; font-size: 14px; }
table.cd { border-collapse: collapse; font-size: 13px; min-width: 100%; }
table.cd th, table.cd td { border: 1px solid #e6ebf2; padding: 4px 2px; text-align: center; min-width: 24px; white-space: nowrap; }
table.cd tr.cd-st td { font-size: 10.5px; letter-spacing: -0.5px; }
table.cd th:first-child { text-align: left; padding-left: 6px; white-space: nowrap; background: #f6f8fb; }
table.cd tr.cd-hd th { background: var(--ink); color: #fff; }
table.cd tr.cd-par td { background: #eef7ef; font-weight: 800; }
table.cd tr.cd-si td { color: var(--mut); font-size: 11px; }
table.cd tr.cd-op td, table.cd tr.cd-op th { color: #5d6a8a; }
i.sc { font-style: normal; display: inline-grid; place-items: center; width: 22px; height: 22px; font-weight: 800; }
i.sc.bi { border: 1.6px solid #14203d; border-radius: 50%; }
i.sc.ea { border: 1.6px solid #14203d; border-radius: 50%; box-shadow: 0 0 0 2px #fff, 0 0 0 3.6px #14203d; }
i.sc.bo { border: 1.6px solid #14203d; }
i.sc.db { border: 1.6px solid #14203d; box-shadow: 0 0 0 2px #fff, 0 0 0 3.6px #14203d; }
i.sc.mx { background: #ffe3e3; border-radius: 4px; }
.cd-sum { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.cd-sum span { background: #eef7ef; border-radius: 10px; padding: 6px 9px; font-size: 13px; font-weight: 700; }
.club-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.club-row { border: 2px solid #e3e8f0; background: #fff; border-radius: 12px; padding: 8px 10px; text-align: left; display: flex; flex-direction: column; min-height: 50px; }
.club-row.on { border-color: var(--c); background: #eefaf0; }
.club-row span { color: var(--mut); font-size: 12px; font-weight: 700; }
.agt-b canvas.fig { height: 160px; }
.agt-b ul.rl li { font-size: 14px; }

/* ---------- HUD trong lúc chơi ---------- */
.hud-top, .hud-bot, .datacard { display: none; }
body.playing .hud-top, body.playing .hud-bot { display: flex; }
.hud-top { position: fixed; z-index: 12; top: 0; left: 0; right: 0; padding: calc(var(--sat) + 8px) 10px 8px; gap: 10px; align-items: center; pointer-events: none; background: linear-gradient(180deg, rgba(8,24,14,.55), rgba(8,24,14,0)); }
.hud-top > * { pointer-events: auto; }
.hb-t { display: flex; flex-direction: column; color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,.6); line-height: 1.25; min-width: 0; }
.hb-t b { font-size: 15px; } .hb-t span { font-size: 13px; font-weight: 700; opacity: .95; }
.hb-btn { border: 0; background: rgba(255,255,255,.92); border-radius: 14px; min-height: 44px; padding: 0 12px; font-weight: 800; font-size: 14px; box-shadow: 0 3px 10px rgba(0,0,0,.18); white-space: nowrap; flex: none; }
.hud-bot { position: fixed; z-index: 12; left: 0; right: 0; bottom: 0; flex-direction: column; gap: 8px; padding: 10px 10px calc(var(--sab) + 10px); background: linear-gradient(0deg, rgba(8,24,14,.72) 70%, rgba(8,24,14,0)); pointer-events: none; }
.hud-bot > * { pointer-events: auto; }
.hud-bot.ph-fly, .hud-bot.ph-after, .hud-bot.ph-wait, .hud-bot.ph-holed, .hud-bot.ph-intro { background: none; }
.hb-info { color: #fff; font-size: 14px; font-weight: 600; line-height: 1.35; text-shadow: 0 1px 3px rgba(0,0,0,.5); }
.hb-info b { font-size: 16px; font-weight: 900; }
.hb-info small { display: block; font-size: 13px; font-weight: 600; color: #dff7d8; margin-top: 2px; }
.hb-clubs { display: flex; gap: 8px; align-items: stretch; }
.hb-club { flex: 1; border: 0; border-radius: 14px; background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 52px; line-height: 1.2; }
.hb-club b { font-size: 18px; font-weight: 900; } .hb-club small { color: var(--mut); font-weight: 700; font-size: 12.5px; }
.hb-acts { display: flex; gap: 8px; align-items: center; }
.hb-main { flex: 1; border: 0; border-radius: 16px; min-height: 54px; font-weight: 900; font-size: 18px; background: linear-gradient(180deg, #4cc062, var(--c)); color: #fff; box-shadow: 0 6px 16px rgba(47,158,68,.45); }
.hb-etq { display: flex; gap: 8px; flex-wrap: wrap; }
.chip-e { border: 0; border-radius: 14px; min-height: 44px; padding: 0 14px; font-weight: 800; background: #fff3bf; box-shadow: 0 3px 10px rgba(0,0,0,.2); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.05); } }
.hb-shape { display: flex; gap: 6px; margin-left: auto; }
.chip-s { border: 2px solid rgba(255,255,255,.6); background: rgba(255,255,255,.18); color: #fff; border-radius: 12px; min-height: 44px; padding: 0 12px; font-weight: 800; }
.chip-s.on { background: #fff; color: var(--ink); }
.datacard { position: fixed; z-index: 13; top: calc(var(--sat) + 64px); left: 10px; right: 10px; max-width: 460px; margin: 0 auto; background: rgba(255,255,255,.96); border-radius: 18px; padding: 10px 12px; box-shadow: 0 10px 30px rgba(0,0,0,.25); font-size: 14px; }
body.playing .datacard.on { display: block; }
.dt-g { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 6px; }
.dt-g span { background: #f1f6f1; border-radius: 10px; padding: 5px 6px; font-size: 11.5px; font-weight: 700; color: var(--mut); display: flex; flex-direction: column; }
.dt-g b { color: var(--ink); font-size: 14px; }
.dt-x { position: absolute; top: 6px; right: 8px; border: 0; background: #f1f3fb; border-radius: 10px; min-height: 32px; padding: 0 10px; font-weight: 800; font-size: 12px; }
.load { position: fixed; z-index: 40; left: 50%; top: 45%; transform: translate(-50%, -50%); background: rgba(8,24,14,.8); color: #fff; padding: 12px 20px; border-radius: 16px; font-weight: 800; display: none; }
.load.on { display: block; }

@media (max-width: 380px) { .dt-g { grid-template-columns: repeat(2, 1fr); } .hb-btn { padding: 0 9px; font-size: 13px; } }
@media (orientation: landscape) and (max-height: 520px) {
  .home { padding-top: calc(var(--sat) + 56px); }
  .hud-bot { flex-direction: row; flex-wrap: wrap; align-items: flex-end; gap: 6px; padding: 6px 10px calc(var(--sab) + 6px); }
  .hb-info { flex-basis: 100%; font-size: 13px; }
  .hb-info small { display: inline; margin-left: 6px; }
  .hb-clubs { flex: 1.1; } .hb-acts { flex: 1.3; }
  .hb-club { min-height: 46px; } .hb-main { min-height: 46px; }
  .hb-etq { flex-basis: 100%; }
  .panel { max-width: 560px; }
  .grid { grid-template-columns: repeat(3, 1fr); }
}
body.playing .agt-toast { bottom: auto; top: calc(var(--sat) + 132px); transform: translate(-50%, -10px); }
body.playing .agt-toast.on { transform: translate(-50%, 0); }
