:root { --c: #e63946; --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: #0f1f45; 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; }
button { font: inherit; cursor: pointer; color: inherit; }
button:disabled { cursor: default; opacity: .45; }

/* trang chính: nền là trận đấu thật chạy phía sau, phủ lớp tối */
.home { min-height: 100%; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: calc(var(--sat) + 70px) 16px calc(var(--sab) + 28px); max-width: 560px; margin: 0 auto; }
#menu.on:has(.home) { background: linear-gradient(180deg, rgba(10,18,45,.25) 0%, rgba(10,18,45,.55) 35%, rgba(10,18,45,.88) 100%); }
#menu.on:has(.page) { background: rgba(10,18,45,.6); }
.logo { text-align: center; color: #fff; text-shadow: 0 4px 18px rgba(0,0,0,.45); }
.logo .mark { width: 72px; height: 72px; margin: 0 auto 6px; border-radius: 22px; display: grid; place-items: center; font-size: 40px; background: linear-gradient(135deg, #ff5a5f, #a4133c); box-shadow: 0 10px 30px rgba(230,57,70,.5); transform: rotate(-6deg); }
.logo h1 { margin: 0; font-size: clamp(40px, 11vw, 58px); font-weight: 900; letter-spacing: -1px; line-height: 1; }
.logo p { margin: 4px 0 0; font-weight: 800; font-size: 16px; opacity: .95; }
.sports { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: 100%; }
.spt { border: 3px solid transparent; border-radius: 18px; background: rgba(255,255,255,.14); color: #fff; padding: 10px 4px; min-height: 74px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; backdrop-filter: blur(6px); }
.spt i { font-style: normal; font-size: 26px; line-height: 1.1; }
.spt b { font-size: 13px; font-weight: 800; text-align: center; line-height: 1.15; }
.spt.on { background: #fff; color: var(--ink); border-color: var(--z); box-shadow: 0 8px 24px rgba(0,0,0,.35); transform: translateY(-2px); }
.clubcard { width: 100%; display: flex; align-items: center; gap: 12px; background: rgba(255,255,255,.95); border-radius: 20px; padding: 10px 12px; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.clubcard > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.clubcard b { font-size: 18px; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clubcard small { color: var(--mut); font-weight: 700; font-size: 12.5px; }
.clubcard small.tp { color: #b26b00; }
.mini { border: 0; background: #eef2fb; border-radius: 12px; padding: 8px 10px; font-weight: 800; font-size: 13px; min-height: 44px; }
.kit { display: grid; place-items: center; flex: none; font-style: normal; font-weight: 900; font-size: 13px; color: var(--n); border-radius: 12px 12px 16px 16px; background: linear-gradient(180deg, var(--a) 0 70%, var(--b) 70% 100%); box-shadow: inset 0 -3px 0 rgba(0,0,0,.15), 0 2px 6px rgba(0,0,0,.2); border: 2px solid rgba(255,255,255,.8); }
.btn { display: block; width: 100%; min-height: 52px; border: 0; border-radius: 18px; background: #fff; font-weight: 800; font-size: 17px; margin: 8px 0; box-shadow: 0 6px 18px rgba(10,20,60,.18); }
.btn.main { background: linear-gradient(180deg, #ff5a5f, var(--c)); color: #fff; box-shadow: 0 8px 22px rgba(230,57,70,.45); }
.btn.big { min-height: 70px; font-size: 23px; font-weight: 900; }
.btn.big small { display: block; font-size: 13px; font-weight: 700; opacity: .9; }
.btn.ghost { background: #eef2fb; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; }
.tile { border: 0; border-radius: 20px; background: rgba(255,255,255,.95); padding: 12px; text-align: left; min-height: 100px; box-shadow: 0 6px 18px rgba(0,0,0,.2); display: flex; flex-direction: column; gap: 2px; }
.tile i { font-style: normal; font-size: 26px; }
.tile b { font-size: 17px; font-weight: 900; }
.tile small { color: var(--mut); font-weight: 700; font-size: 12.5px; line-height: 1.3; }
.opts { width: 100%; background: rgba(255,255,255,.12); border-radius: 18px; padding: 10px 12px; color: #fff; display: flex; flex-direction: column; gap: 8px; backdrop-filter: blur(6px); }
.opts span { font-weight: 800; font-size: 13px; display: block; margin-bottom: 4px; opacity: .9; }
.opts .chip { background: rgba(255,255,255,.9); }
.foot { color: rgba(255,255,255,.85); font-weight: 700; font-size: 12.5px; text-align: center; line-height: 1.5; }
.foot a { color: #fff; }

.page { max-width: 680px; margin: 0 auto; padding: calc(var(--sat) + 68px) 16px calc(var(--sab) + 40px); min-height: 100%; background: #f2f5fc; }
.top { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.top h2 { margin: 0; font-size: 25px; font-weight: 900; }
.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,90,.1); }
.mut { color: var(--mut); font-size: 14px; margin: 4px 0 10px; line-height: 1.45; }
h3 { margin: 18px 0 8px; font-size: 18px; font-weight: 900; }
h4 { margin: 14px 0 6px; font-size: 15px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.sp3 { margin-bottom: 8px; }
.chip { border: 2px solid #dfe6f3; background: #fff; border-radius: 14px; min-height: 44px; padding: 0 14px; font-weight: 800; color: var(--ink); }
.chip.on { border-color: var(--c); background: #ffecee; color: #a4133c; }
.brief { background: #fff; border-radius: 22px; padding: 16px; box-shadow: 0 6px 18px rgba(10,40,90,.08); text-align: center; }
.brief small { color: var(--c); font-weight: 800; }
.brief h2 { margin: 4px 0 6px; font-size: 23px; font-weight: 900; }
.brief p { margin: 0 0 8px; font-weight: 600; line-height: 1.45; }
.brief.gold { background: linear-gradient(180deg, #fff8dc, #fff); border: 3px solid #ffd23f; }
.vs { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 8px 0; }
.vs b { font-size: 22px; font-weight: 900; color: var(--mut); }
.opps { display: flex; flex-direction: column; gap: 8px; }
.opp { display: flex; gap: 12px; align-items: center; text-align: left; border: 0; background: #fff; border-radius: 18px; padding: 12px; box-shadow: 0 4px 12px rgba(10,40,90,.06); }
.opp div { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.opp small { color: var(--c); font-weight: 800; font-size: 12.5px; }
.opp span { color: var(--mut); font-size: 13px; font-weight: 600; }
.opp em { font-style: normal; color: #ffb400; font-size: 14px; letter-spacing: 1px; white-space: nowrap; }
.tbls { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 560px) { .tbls { grid-template-columns: 1fr; } }
.tbl { background: #fff; border-radius: 18px; padding: 10px; box-shadow: 0 4px 12px rgba(10,40,90,.06); }
.tbl h4 { margin: 0 0 6px; }
.tbl table { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl td, .tbl th { padding: 6px 3px; text-align: center; border-bottom: 1px solid #eef1f8; }
.tbl th { text-align: left; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.tbl tr.me { background: #fff1f2; }
.tbl tr:nth-child(2) td:first-child, .tbl tr:nth-child(3) td:first-child { color: #2fb36b; font-weight: 900; }
.ko { display: grid; gap: 8px; }
.km { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; background: #fff; border-radius: 16px; padding: 10px; font-weight: 800; font-size: 14px; position: relative; padding-top: 22px; }
.km small { position: absolute; top: 5px; left: 12px; color: var(--c); font-size: 11px; }
.km span:last-child { text-align: right; }
.km.me { border: 2px solid var(--c); }
.rec { padding-left: 18px; margin: 0; font-size: 14px; line-height: 1.7; }
.link { border: 0; background: transparent; color: var(--mut); font-weight: 700; text-decoration: underline; margin-top: 14px; min-height: 44px; }

.tabs { display: grid; grid-template-columns: repeat(3, 1fr); background: #e4e9f5; border-radius: 16px; padding: 4px; gap: 4px; margin: 6px 0; }
.tab { border: 0; background: transparent; border-radius: 12px; min-height: 42px; font-weight: 800; }
.tab.on { background: #fff; box-shadow: 0 2px 8px rgba(10,40,90,.1); color: var(--c); }
.styles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.style { border: 2px solid #dfe6f3; background: #fff; border-radius: 16px; padding: 10px; text-align: left; display: flex; flex-direction: column; gap: 3px; }
.style b { font-size: 14.5px; }
.style small { color: var(--mut); font-weight: 600; font-size: 12.5px; line-height: 1.35; }
.style.on { border-color: var(--c); background: #fff4f5; }
.pitch { position: relative; width: 100%; max-width: 420px; margin: 8px auto; aspect-ratio: 34 / 40; border-radius: 18px; background: repeating-linear-gradient(180deg, #47a855 0 10%, #3f9b4b 10% 20%); border: 3px solid #fff; overflow: hidden; }
.pitch::before { content: ''; position: absolute; left: 25%; right: 25%; bottom: -1px; height: 22%; border: 2px solid rgba(255,255,255,.8); border-bottom: 0; }
.pitch::after { content: ''; position: absolute; left: 30%; right: 30%; top: -14%; height: 28%; border: 2px solid rgba(255,255,255,.8); border-radius: 50%; }
.pitch.court { background: #e6a865; aspect-ratio: 15 / 12; }
.pitch.court::before { left: 32%; right: 32%; top: 0; bottom: auto; height: 45%; border: 2px solid #fff; border-top: 0; background: rgba(230,57,70,.25); }
.pitch.court::after { left: 6%; right: 6%; top: -40%; height: 116%; border: 2px solid #fff; border-radius: 0 0 50% 50%; }
.pitch.vcourt { background: #f0a24a; aspect-ratio: 9 / 7; }
.pitch.vcourt::before { left: 0; right: 0; top: 0; bottom: auto; height: 6%; border: 0; background: #1d2340; }
.pitch.vcourt::after { left: 0; right: 0; top: 48%; height: 0; border: 0; border-top: 2px dashed #fff; border-radius: 0; }
.slot { position: absolute; transform: translate(-50%, -50%); border: 0; background: transparent; display: flex; flex-direction: column; align-items: center; gap: 1px; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.6); min-width: 64px; z-index: 1; }
.slot span { font-weight: 900; font-size: 12.5px; line-height: 1.1; }
.slot small { font-weight: 700; font-size: 10.5px; opacity: .95; }
.slot.on .kit { outline: 4px solid #ffe14d; outline-offset: 2px; }
.subs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 420px) { .subs { grid-template-columns: 1fr; } .styles { grid-template-columns: 1fr; } }
.sub { border: 2px solid #dfe6f3; background: #fff; border-radius: 14px; padding: 8px 10px; text-align: left; display: flex; align-items: center; gap: 10px; position: relative; overflow: hidden; min-height: 52px; }
.sub > b { width: 30px; height: 30px; display: grid; place-items: center; background: #eef2fb; border-radius: 10px; flex: none; }
.sub span { display: flex; flex-direction: column; font-weight: 800; font-size: 14px; }
.sub small { color: var(--mut); font-weight: 700; font-size: 12px; }
.sub.on { border-color: #ffb400; background: #fff9e6; }
.sub > i { position: absolute; left: 0; bottom: 0; height: 4px; width: var(--e); background: linear-gradient(90deg, #ff4d4d, #2fb36b); }
.tpbox { background: linear-gradient(135deg, #fff4d6, #ffe7b3); border-radius: 18px; padding: 12px 14px; font-weight: 800; font-size: 17px; margin: 8px 0; }
.tpbox b { font-size: 24px; color: #b26b00; }
.tpbox small { display: block; font-size: 12.5px; color: #7a5a1a; font-weight: 700; margin-top: 2px; }
.plist { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 620px) { .plist { grid-template-columns: 1fr 1fr; } }
.pl { background: #fff; border-radius: 18px; padding: 10px 12px; box-shadow: 0 4px 12px rgba(10,40,90,.06); }
.ph { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.ph div { flex: 1; display: flex; flex-direction: column; }
.ph small { color: var(--mut); font-weight: 700; font-size: 12px; }
.ph em { font-style: normal; font-weight: 900; font-size: 22px; color: var(--c); }
.srow { display: grid; grid-template-columns: 70px 1fr 26px 78px; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; min-height: 36px; }
.bar { display: block; height: 8px; background: #e6ecf7; border-radius: 4px; overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, #ff8a3d, #e63946); }
.up { border: 0; background: #2fb36b; color: #fff; border-radius: 10px; min-height: 34px; font-weight: 800; font-size: 12px; }
.namebox { display: flex; gap: 8px; align-items: center; }
.namebox input { flex: 1; min-width: 0; font: inherit; font-weight: 800; font-size: 17px; padding: 12px 14px; border-radius: 14px; border: 2px solid #dfe6f3; }
.namebox .btn { width: auto; margin: 0; padding: 0 16px; }
.kits { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
@media (max-width: 420px) { .kits { grid-template-columns: repeat(3, 1fr); } }
.kitp { border: 3px solid transparent; background: #fff; border-radius: 16px; padding: 8px 4px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.kitp.on { border-color: var(--c); }
.kitp small { font-size: 11px; font-weight: 700; color: var(--mut); text-align: center; line-height: 1.2; }

.ov { min-height: 100%; display: grid; place-items: center; padding: calc(var(--sat) + 16px) 16px 16px; background: rgba(10,18,45,.55); backdrop-filter: blur(3px); }
.panel { width: 100%; max-width: 420px; background: #fff; border-radius: 26px; padding: 20px; text-align: center; box-shadow: 0 24px 60px rgba(10,20,60,.35); }
.panel.wide { max-width: 600px; text-align: left; }
.panel h2 { margin: 0 0 6px; font-size: 25px; font-weight: 900; }
.score-big { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 6px 0 10px; }
.score-big b { font-size: 40px; font-weight: 900; }
.score-big span { font-weight: 900; padding: 6px 10px; border-radius: 10px; background: #f2f5fc; border-bottom: 4px solid var(--k); }
table.st { width: 100%; border-collapse: collapse; margin: 6px 0; font-size: 14px; }
table.st td { font-weight: 900; width: 26%; }
table.st th { font-weight: 700; color: var(--mut); font-size: 13px; }
table.st td, table.st th { padding: 7px 4px; border-bottom: 1px solid #eef1f8; }
.rules { background: #fff; border-radius: 20px; padding: 12px 16px; margin: 10px 0; border-left: 8px solid var(--z); box-shadow: 0 6px 18px rgba(10,40,90,.08); }
.rules h3 { margin: 2px 0 6px; color: var(--z); }
.rules ul { margin: 0; padding-left: 18px; }
.rules li { padding: 4px 0; font-weight: 600; font-size: 14.5px; line-height: 1.45; }
@media (orientation: landscape) and (max-height: 500px) {
  .home { padding-top: calc(var(--sat) + 56px); gap: 8px; max-width: 820px; display: grid; grid-template-columns: 1fr 1fr; align-items: start; }
  .home > .logo, .home > .foot { grid-column: 1 / -1; }
  .home > .grid, .home > .opts { grid-column: 2; }
  .home > .sports, .home > .clubcard, .home > .btn { grid-column: 1; }
  .home > .grid { grid-row: 2 / span 3; }
  .logo .mark { display: none; }
  .logo h1 { font-size: 34px; }
  .logo p { font-size: 14px; }
  .spt { min-height: 54px; flex-direction: row; gap: 6px; }
  .spt i { font-size: 20px; }
  .btn.big { min-height: 58px; font-size: 20px; margin: 0; }
  .tile { min-height: 78px; padding: 10px; }
  .tile i { font-size: 20px; }
}
