:root{color-scheme:dark;--bg:#0c0b10;--panel:#17131e;--panel2:#201a28;--line:#34283b;--text:#f8f3f9;--muted:#a99caf;--pink:#ff3c99;--pink2:#ff79b8;--green:#32d9a0}*{box-sizing:border-box}body{margin:0;background:radial-gradient(circle at 80% -20%,#361329 0,transparent 35%),var(--bg);font-family:Inter,system-ui,-apple-system,Segoe UI,Arial,sans-serif;color:var(--text)}button,input,select,textarea{font:inherit}button{cursor:pointer;background:#292130;border:1px solid #483348;color:#fff;border-radius:12px;padding:11px 16px;font-weight:700;transition:.15s}button:hover{border-color:var(--pink2)}button:active{transform:scale(.98)}button:disabled{opacity:.55;cursor:not-allowed}input,select,textarea{width:100%;min-width:0;padding:12px 13px;border:1px solid #433248;background:#110e17;color:white;border-radius:10px;outline:none}input:focus,select:focus,textarea:focus{border-color:var(--pink)}label{font-size:12px;color:var(--muted);display:grid;gap:7px}header{height:74px;padding:0 26px;display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid #2d2333;background:#110e17}.brand{display:flex;align-items:center;gap:12px}.brand b{font-size:20px;letter-spacing:.5px}.brand em{font-style:normal;color:var(--pink)}.brand small{display:block;color:var(--muted);font-size:9px;letter-spacing:1.7px;margin-top:4px}.logo{display:grid;place-items:center;background:linear-gradient(140deg,#ff72b5,#e91b77);width:42px;height:42px;border-radius:13px;font-size:26px}.badge{border:1px solid #3c2a3b;background:#241a29;border-radius:100px;padding:9px 13px;font-size:11px;color:#c9b4c9}.badge.pink{color:var(--pink2)}.shell{display:grid;grid-template-columns:235px minmax(0,1fr);min-height:calc(100dvh - 74px)}aside{border-right:1px solid #302536;padding:30px 14px;display:flex;flex-direction:column}.caption,.eyebrow{color:var(--pink2);letter-spacing:2px;font-size:10px;font-weight:900}.caption{padding:0 16px 15px}nav{display:grid;gap:5px}nav button{width:100%;text-align:left;background:transparent;border:0;color:#c7b9c9;font-weight:600;padding:14px 15px}nav button.active{background:#3a1b32;color:#ff85c2;border-left:3px solid var(--pink)}.aside-note{margin-top:auto;border-top:1px solid var(--line);padding:18px 12px;color:var(--pink2);font-size:10px;font-weight:800;line-height:1.8}.aside-note span{color:var(--muted);font-weight:400}main{padding:30px clamp(16px,3.3vw,48px);min-width:0;max-width:1500px;width:100%}.page{display:none}.page.active{display:block}.title{display:flex;justify-content:space-between;align-items:center;gap:12px;margin:0 0 22px}h1{font-size:clamp(27px,3.4vw,44px);margin:8px 0 0;letter-spacing:-1.2px}h1 span{color:var(--pink)}h2{font-size:16px;margin:0 0 20px}.hero{border:1px solid #572b47;border-radius:22px;background:linear-gradient(110deg,#32152c 0%,#211323 70%,#1a1220);padding:35px;display:flex;justify-content:space-between;align-items:center;overflow:hidden}.hero p{color:#c6b6c5;max-width:470px;line-height:1.6}.hero-icon{font-size:100px;opacity:.85}.primary{background:linear-gradient(110deg,#fa3d96,#d51e78);border:0;box-shadow:0 6px 24px #ff24822b}.stats{display:grid;grid-template-columns:repeat(4,1fr);gap:14px;margin:20px 0}.stat{padding:22px;background:var(--panel);border:1px solid var(--line);border-radius:16px}.stat b{display:block;font-size:32px;margin-top:10px}.stat small{color:var(--muted)}.card{background:var(--panel);border:1px solid var(--line);border-radius:18px;padding:23px;margin:0 0 18px}.quick{display:flex;flex-wrap:wrap;gap:10px}.notice,.hint{font-size:12px;color:var(--muted);line-height:1.65}.notice{border:1px solid #483046;border-radius:12px;padding:14px;margin-top:16px}.formrow{display:flex;align-items:end;gap:10px;flex-wrap:wrap}.formrow>input,.formrow>label,.formrow>select{flex:1;min-width:150px}.formgrid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px;align-items:end}.formgrid>button{align-self:end}.row-between{display:flex;justify-content:space-between;align-items:center;gap:15px;margin-bottom:16px}.row-between h2{margin:0}.row-between input{max-width:270px}.tablewrap{overflow-x:auto}table{width:100%;border-collapse:collapse;font-size:13px;min-width:530px}th{text-align:left;color:#ae99ae;font-size:11px;font-weight:700;letter-spacing:.4px;background:#241b2a}td,th{padding:13px;border-bottom:1px solid #35283a}td button{padding:7px 10px;font-size:11px}tr:hover td{background:#201925}.rank{font-weight:900;color:var(--pink2)}.eventcards{display:grid;grid-template-columns:repeat(auto-fill,minmax(245px,1fr));gap:12px}.eventcard{background:#211a29;border:1px solid #433047;padding:18px;border-radius:13px}.eventcard b{display:block;margin:9px 0}.eventcard small{color:var(--muted)}.eventcard .row-between{margin:10px 0 0}.filebtn{display:inline-flex;align-items:center;background:#292130;border:1px solid #483348;color:#fff;border-radius:12px;padding:11px 16px;font-size:14px;font-weight:700;cursor:pointer}.timer-config{display:flex;align-items:end;gap:10px}.timer-config label{flex:1}.timer-box{background:#110d17;border:1px solid #5c2a4a;border-radius:22px;padding:18px;max-width:760px;margin:auto}.timer-top{display:flex;justify-content:space-between;gap:8px;font-size:11px;font-weight:900;color:var(--pink2);letter-spacing:1px}.timer-sub{color:#86758a;font-size:9px}#clock{text-align:center;font-size:clamp(48px,8vw,82px);font-variant-numeric:tabular-nums;font-weight:900;letter-spacing:-3px;padding:9px 0}.start{width:100%;background:linear-gradient(120deg,#0b9c75,#25c998);border:0;font-size:18px;padding:15px}.lanes{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px;margin:12px 0}.lane{min-height:83px;background:linear-gradient(135deg,#50203d,#2a1a2c);border:1px solid #7a345b;border-radius:13px;padding:9px;display:flex;align-items:center;justify-content:space-between;flex-direction:column;touch-action:manipulation;user-select:none;-webkit-user-select:none}.lane b{font-size:13px}.lane span{font-size:22px;font-weight:900;font-variant-numeric:tabular-nums}.lane.done{background:linear-gradient(130deg,#123b35,#15352c);border-color:#268c70}.lane.empty{opacity:.4}.timer-actions{display:flex;gap:8px}.timer-actions button{flex:1;padding:11px 5px;font-size:12px}#toast{position:fixed;bottom:25px;left:50%;transform:translateX(-50%);background:#39253a;border:1px solid #9e4278;border-radius:12px;padding:12px 18px;box-shadow:0 12px 45px #0008;display:none;z-index:100;font-size:13px;max-width:90vw}.focus header,.focus aside,.focus .title,.focus .timer-config,.focus #timer>.hint{display:none}.focus .shell{display:block;min-height:100dvh}.focus main{padding:0;max-width:none}.focus .page{display:none}.focus #timer{display:block}.focus .timer-box{border:0;border-radius:0;max-width:none;height:100dvh;height:100svh;display:flex;flex-direction:column;padding:env(safe-area-inset-top,8px) 10px env(safe-area-inset-bottom,8px)}.focus .lanes{flex:1;min-height:0;grid-template-rows:repeat(4,minmax(0,1fr))}.focus .lane{min-height:0}.focus #clock{font-size:clamp(38px,7vh,62px);padding:2px}.focus .start{padding:10px}.focus .timer-actions{margin-top:auto}.focus .timer-actions button{padding:10px 2px}@media(max-width:800px){header{height:64px;padding:0 12px}.shell{display:block}aside{padding:8px;border-right:0;border-bottom:1px solid var(--line)}.caption,.aside-note{display:none}nav{display:flex;overflow-x:auto;scrollbar-width:none;gap:4px}nav button{width:auto;white-space:nowrap;padding:11px 13px;font-size:12px}main{padding:18px 12px}.hero{padding:24px}.hero-icon{font-size:55px}.stats{grid-template-columns:repeat(2,1fr)}.formgrid{grid-template-columns:repeat(2,minmax(0,1fr))}.card{padding:16px}.timer-box{padding:12px}.timer-top{font-size:10px}.timer-sub{display:none}}@media(max-width:420px){.brand b{font-size:16px}.brand small{font-size:7px}.badge{font-size:9px;padding:7px}.formgrid{grid-template-columns:1fr}.timer-config{flex-wrap:wrap}.timer-config label{min-width:40%}.timer-box .lane{min-height:70px}.timer-box .lane span{font-size:19px}.timer-actions button{font-size:11px}#clock{font-size:51px}.focus .lane{min-height:0}.focus .lane span{font-size:clamp(15px,3.4vh,23px)}}

/* V2: mobile, branding and compact timer */
.owner-link{color:#ff83c2;font-weight:800;font-size:12px;text-decoration:none;margin-left:auto;margin-right:14px}.site-footer{padding:22px 16px;text-align:center;color:#ad9ab0;font-size:12px;border-top:1px solid #34283b;background:#110e17}.site-footer a,.hero a{color:#ff83c2;font-weight:800;text-decoration:none}.focus .site-footer{display:none}.focus .timer-actions{flex-wrap:wrap}.focus .timer-actions button{min-width:0}.focus .timer-box{height:100dvh;max-height:100dvh;overflow:hidden}.focus .lanes{margin:6px 0;gap:6px}.focus .timer-top{flex-shrink:0}.focus .timer-actions{flex-shrink:0}.focus .start{flex-shrink:0}.focus .lane{padding:3px 6px}.focus .lane b{font-size:clamp(10px,1.8vh,13px)}.focus .lane span{font-size:clamp(15px,3vh,22px)}
@media(max-width:600px){.owner-link{font-size:10px;margin-right:7px}.brand small{letter-spacing:.3px}.badge{display:none}.timer-actions{flex-wrap:wrap}.timer-actions button{flex:1 1 40%}.focus .timer-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:5px}.focus .timer-actions button{font-size:10px;padding:7px 2px}.focus .timer-box{padding:calc(env(safe-area-inset-top) + 4px) 8px calc(env(safe-area-inset-bottom) + 4px)}.focus #clock{font-size:clamp(32px,6.2vh,54px)}.focus .start{font-size:15px;padding:9px}.focus .lanes{grid-template-rows:repeat(4,minmax(0,1fr))}}

/* V3 usability and mobile lane picker */
.picker-backdrop[hidden]{display:none!important}.picker-backdrop{position:fixed;inset:0;z-index:9999;background:rgba(5,3,9,.88);display:flex;align-items:center;justify-content:center;padding:14px}.picker-panel{width:min(100%,520px);max-height:85dvh;overflow:auto;background:#1d1426;border:1px solid #b33879;border-radius:18px;padding:16px;box-shadow:0 16px 70px #000a}.picker-panel h2{margin:0 0 10px}.picker-panel input{width:100%;margin:8px 0}.picker-list{max-height:52dvh;overflow:auto;display:grid;gap:8px;margin:12px 0}.picker-list button{text-align:left;display:flex;flex-direction:column;gap:3px;padding:12px 14px;min-height:55px;background:#2b1b33;border:1px solid #613453;border-radius:12px;color:white}.picker-list button small{color:#f0b9d4}.lane.empty{opacity:1;border-style:dashed}.lane.empty b{color:#f9a5d2}.lane{touch-action:manipulation;user-select:none;-webkit-user-select:none}.sport-group{background:#211626;border:1px solid #5c3052;border-radius:14px;margin:12px 0;padding:12px}.sport-group summary{cursor:pointer;font-weight:800;color:#ff89c3}.sport-group summary span{float:right;font-size:12px;color:#e0b3cb}.event-group{padding:10px 0;border-top:1px solid #57324c;margin-top:10px}.event-group>b{color:#ffb8d9}.podium-row{display:flex;align-items:center;gap:10px;padding:8px 4px;border-bottom:1px solid #473044}.podium-row strong{font-size:20px;min-width:28px}.podium-row span{flex:1}.podium-row small{color:#c6b5c5}.podium-row>b{color:#f8c0dd}.edit-line{display:flex;flex-direction:column;margin:9px 0}.state-chip{font-size:11px;color:#f5a8d0;white-space:nowrap}@media(max-width:600px){.picker-panel{max-height:90dvh}.timer-box .lane{min-height:0}.timer-box .lanes{gap:6px}.timer-actions{gap:5px}.timer-actions button{font-size:11px;padding:8px 6px}.sport-group{padding:9px}}

/* V4 */.enroll-box{margin:15px 0;padding:14px;border:1px solid #58334e;border-radius:13px;background:#211626}.checks{display:flex;flex-wrap:wrap;gap:8px;margin:8px 0 15px}.check-pill{display:flex;align-items:center;gap:7px;background:#2d1b30;border:1px solid #65405b;padding:9px 11px;border-radius:10px;color:#ffe1f0;font-size:12px;cursor:pointer}.check-pill input{width:16px;min-width:16px;height:16px;accent-color:#ff3c99}.formrow select#athleteSportFilter{max-width:240px}.row-between #athleteSportFilter{max-width:200px}.row-between{flex-wrap:wrap}.timer-actions button{min-height:38px}@media(max-width:600px){.row-between #athleteSportFilter{max-width:100%}.timer-box .lanes{grid-template-columns:repeat(2,minmax(0,1fr))}.focus .timer-actions button{min-height:36px}}
.progress-track{height:12px;background:#34243a;border-radius:20px;overflow:hidden;margin:12px 0}.progress-fill{height:100%;background:linear-gradient(90deg,#d92d83,#ff7cbb);transition:width .2s}.progress-events{display:grid;gap:10px}.progress-sport{background:#241b2c;border:1px solid #44304c;border-radius:12px;padding:10px}.progress-sport summary{display:flex;justify-content:space-between;cursor:pointer;gap:12px;color:#ffe5f2}.progress-sport summary span{color:#ffa8d1}.progress-item{display:flex;justify-content:space-between;align-items:center;gap:10px;padding:10px 3px;border-top:1px solid #403046}.progress-item>div{display:grid;gap:4px;min-width:0}.progress-item b{font-size:13px}.progress-item small{color:#c6a7bc}.progress-item label{white-space:nowrap;font-size:12px;color:#ffd0e5}.progress-item input{accent-color:#ed4a9e;width:18px;height:18px;vertical-align:middle}@media(max-width:480px){.progress-item{align-items:flex-start}.progress-item label{padding-top:3px}}

/* V4.3: homepage action and backup controls */
.home-quick,.home-backup{margin-top:18px}.home-quick h2,.home-backup h2{color:#ff9acb}.quick-grid,.backup-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.quick-grid button,.backup-grid button,.backup-upload{min-height:57px;display:flex;align-items:center;justify-content:center;text-align:center}.backup-upload{width:100%;background:#39263f;border:1px solid #754366;color:#fff;font-size:14px}.backup-help{color:#f3d6e5;font-size:13px;line-height:1.7;border-left:3px solid #ef4d9e;background:#291b2c;padding:12px;border-radius:8px}.home-backup .hint{margin:9px 0}.home-backup .quick{margin-top:12px}@media(max-width:420px){.quick-grid button,.backup-grid button,.backup-upload{font-size:12px;padding:10px 6px;min-height:56px}}

.catalog-toolbar{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin:14px 0}.catalog-cards{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.catalog-sport{border:1px solid #5c3150;background:#251a2c;border-radius:12px;padding:13px}.catalog-sport summary{cursor:pointer;font-weight:800;color:#ffc1df}.catalog-sport summary small{display:block;font-size:11px;color:#b7a3b8;margin:5px 0}.catalog-presets{display:grid;gap:7px;margin-top:12px}.catalog-preset{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:8px;background:#1b1522;border-radius:9px}.catalog-preset span{font-size:12px}.catalog-preset small{color:#c39ab5}.catalog-preset button{padding:7px 9px;font-size:11px;white-space:nowrap}@media(max-width:650px){.catalog-toolbar{grid-template-columns:1fr 1fr}.catalog-toolbar label:first-child{grid-column:1/-1}.catalog-cards{grid-template-columns:1fr}}

/* V4.5: cấu hình cấp học, menu và điện thoại */
.setup-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;align-items:end}.setup-grid label{display:flex;flex-direction:column;gap:7px}.setup-grid button{min-height:48px}.nav-export{width:100%;margin-top:8px;border-color:#aa3973!important;color:#ffc4df!important}.setup-card{border:1px solid #713253}.setup-card h2{color:#ff8bc4}
@media(max-width:760px){.setup-grid{grid-template-columns:1fr 1fr}.setup-grid label:first-child{grid-column:1/-1}.setup-grid button{grid-column:1/-1}.setup-grid input,.setup-grid select{min-width:0;width:100%}}

/* HKPD V4.6 match engine */
#matches .formgrid{margin:12px 0}#matches input,#matches select{min-height:43px}#scoreFieldsV46{margin:16px 0;padding:14px;border:1px solid #61304f;border-radius:14px;background:#241829}#scoreFieldsV46 .v46-score-row{display:grid;grid-template-columns:1fr 46px 1fr;gap:8px;align-items:center;margin:9px 0}#scoreFieldsV46 input{text-align:center;font-size:19px;font-weight:700;min-width:0}#scoreFieldsV46 .v46-score-row span{text-align:center;font-weight:700;color:#f7a5cd}#matches .v46-teams{display:flex;flex-wrap:wrap;gap:8px;margin-top:12px}#matches .v46-teams span{background:#38233b;border-radius:10px;padding:8px;font-size:13px}#matches .v46-teams button{padding:2px 6px;margin-left:6px}#matches .v46-status{color:#f8a4d1;font-weight:700}#matches table{min-width:700px}#matches .quick{display:flex;gap:8px;flex-wrap:wrap}#matches .hint{line-height:1.5}

#judgePanelV46[hidden]{display:none!important}#judgeInputsV46{display:grid;grid-template-columns:repeat(auto-fit,minmax(120px,1fr));gap:10px;margin:10px 0}#judgeInputsV46 input{width:100%;min-height:42px}#judgePanelV46 h3{color:#ff8cbd}

/* V4.7: adaptable lane grid and prominent new heat */
.timer-config .lane-count-label{flex:0 0 118px}.timer-config #laneCount{text-align:center;font-weight:800;font-size:17px}.timer-actions .new-heat{background:#3a2945;border:1px solid #ff79b8;color:#ffd3e8}.focus .lanes{grid-template-rows:repeat(var(--lane-rows,4),minmax(0,1fr))!important}.timer-box .lanes{grid-template-rows:repeat(var(--lane-rows,4),minmax(70px,auto))}@media(max-width:600px){.timer-config .lane-count-label{flex:1 1 95px}.focus .timer-actions{grid-template-columns:repeat(3,minmax(0,1fr))}.focus .timer-actions button{font-size:10px;min-height:38px}}

/* V4.8 - timer configuration, responsive and readable */
.timer-config-responsive{display:grid;grid-template-columns:minmax(0,2fr) minmax(0,1.25fr) minmax(105px,.6fr) auto;gap:12px;align-items:end}
.timer-config-responsive label{min-width:0;width:100%;display:flex;flex-direction:column;gap:7px;flex:auto}
.timer-config-responsive select,.timer-config-responsive input{width:100%;max-width:100%;min-width:0;min-height:48px;font-size:14px;line-height:1.35}
.timer-config-responsive #timerEvent{font-size:13px;text-overflow:ellipsis}
.timer-config-responsive .lane-count-label{flex:auto;min-width:0}
.timer-config-responsive>button{min-height:48px;white-space:nowrap}
@media(max-width:700px){
 .timer-config-responsive{grid-template-columns:minmax(0,3fr) minmax(100px,2fr);gap:12px;padding:15px}
 .timer-config-responsive>label:first-child{grid-column:1/-1}
 .timer-config-responsive .lane-count-label{grid-column:2}
 .timer-config-responsive>button{grid-column:1/-1;width:100%}
 .timer-config-responsive label{min-width:0!important}
 .timer-config-responsive select,.timer-config-responsive input{min-height:48px;font-size:15px}
 .timer-config-responsive #timerEvent{font-size:14px}
 .timer-config-responsive #heatName{font-size:15px}
 .timer-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
 .timer-actions button{width:100%;min-width:0;font-size:12px;min-height:44px;white-space:normal}
 .focus .timer-actions{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:360px){.timer-config-responsive{grid-template-columns:minmax(0,1.65fr) minmax(100px,1fr);gap:8px;padding:12px}.timer-config-responsive select{font-size:13px}}
