:root{
  --bg:#f3f6fa;--card:#fff;--text:#1f2937;--muted:#6b7280;
  --blue:#1f5f99;--dark:#153f66;--soft:#dcecf8;--green:#e5f4ea;
  --border:#d7dee7;--shadow:0 2px 10px rgba(20,40,70,.08);--danger:#a61b1b
}
*{box-sizing:border-box}
html,body{margin:0;background:var(--bg);color:var(--text);font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif}
button,input,select,textarea{font:inherit}
button{cursor:pointer;touch-action:manipulation;-webkit-tap-highlight-color:transparent}
button>span{pointer-events:none;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}
/* v6.0.2: use the live visual viewport height supplied by JS.
   100dvh remains the safe fallback before/without JavaScript. */
:root{--app-viewport-height:100dvh}
.app-body{height:var(--app-viewport-height,100dvh);overflow:hidden}
@supports not (height:100dvh){
  :root{--app-viewport-height:100vh}
  .app-body{height:var(--app-viewport-height,100vh)}
}
.app{max-width:1050px;height:100%;margin:auto;padding:0 8px 8px;display:flex;flex-direction:column;overflow:hidden}
.app-header{flex:none;background:var(--bg);padding-top:8px;padding-bottom:10px;z-index:60}
.brand-row{display:flex;align-items:center;justify-content:space-between}
.brand{font-size:21px;font-weight:900;padding:8px 2px 10px}
.logout{text-decoration:none;color:#52606d;font-size:24px;padding:4px 8px;line-height:1}
.tabs{display:grid;grid-template-columns:repeat(3,1fr);gap:4px;background:var(--dark);border-radius:14px;padding:5px;box-shadow:var(--shadow)}
.tab{border:0;border-radius:10px;padding:12px 5px;background:transparent;color:#dbe9f5;font-weight:800}.tab.active{background:#fff;color:var(--dark)}
main{flex:1;min-height:0}.panel{display:none;height:100%;min-height:0}.panel.active{display:block}
.card{height:100%;min-height:0;background:var(--card);border:1px solid var(--border);border-radius:16px;box-shadow:var(--shadow);overflow:hidden;display:flex;flex-direction:column}
.card-sticky-head{flex:none;background:#fff}.toolbar{display:flex;gap:8px;flex-wrap:wrap;padding:10px;border-bottom:1px solid var(--border);background:#fbfcfe}
.btn{border:0;border-radius:11px;padding:11px 14px;font-weight:800;display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:46px}
.primary{background:var(--blue);color:#fff}.secondary{background:#edf3f8;color:#294963}.ghost{background:#fff;border:1px solid var(--border);color:#334155}.danger{background:#fdecec;color:var(--danger);border:1px solid #f2caca}.full{width:100%}.compact{padding:9px 11px}.plus{color:#fff;font-weight:900;font-size:20px;line-height:1}
.iconbtn{width:42px;height:42px;min-width:42px;border:0;border-radius:11px;background:#edf3f8;font-size:19px;display:inline-flex;align-items:center;justify-content:center}.muted{color:var(--muted)}.empty{padding:28px;text-align:center;color:var(--muted)}.center{text-align:center}
.players-scroll,.attendance-scroll,.equipment-scroll{flex:1;min-height:0;max-height:none;overflow-y:auto;overflow-x:hidden;-webkit-overflow-scrolling:touch;overscroll-behavior:contain;scroll-padding-top:0}.players-scroll>:first-child,.attendance-scroll>:first-child,.equipment-scroll>:first-child{scroll-margin-top:0}

/* Avoid browser/Google long-press text selection inside the app; form fields remain selectable. */
.app,.app button,.player-row,.att-row,.eq-card{-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}.sheet input,.sheet textarea,.sheet select{-webkit-user-select:text;user-select:text;-webkit-touch-callout:default}

/* players */
.players-head,.player-row{display:grid;grid-template-columns:minmax(135px,1fr) 78px 78px;gap:6px;align-items:center}.players-head{padding:12px 14px;background:#f6f8fb;color:#52606d;font-weight:850;font-size:13px;border-bottom:1px solid var(--border)}.players-head .total,.player-row .total{display:none}.player-row{padding:12px 14px;border-bottom:1px solid #edf0f4;background:#fff;min-height:64px}.player-row:active{background:#f3f7fb}.player-name{font-weight:850;line-height:1.15;white-space:normal;overflow-wrap:anywhere;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;cursor:pointer}.player-last{display:flex;align-items:center;justify-content:flex-end;gap:8px}.row-actions{display:flex;gap:6px;align-items:center}.small-action{width:38px;height:38px;min-width:38px;padding:0;border:0;border-radius:10px;background:#edf3f8;color:#294963;font-weight:900}.delete-action{background:#fdecec;color:#a61b1b}

/* attendance */
.daybar{padding:12px;border-bottom:1px solid var(--border);background:#fbfcfe}.daytop{display:flex;align-items:center;gap:8px;margin-bottom:10px}.datepill{min-height:42px;padding:8px 12px;border-radius:12px;background:var(--blue);color:#fff;font-weight:900;display:flex;align-items:center}.datepill.locked{background:#7f8a96}.lockbtn{width:42px;height:42px;border:0;border-radius:10px;background:#eef3f7;font-size:20px}.daytype{font-size:19px;font-weight:900}.daymeta{font-size:13px;color:var(--muted);font-weight:700}.dayactions{display:grid;grid-template-columns:1fr 1fr;gap:8px}.att-row{display:grid;grid-template-columns:minmax(140px,1fr) 110px;min-height:64px;border-bottom:1px solid var(--border);background:#fff}.att-name{display:flex;align-items:center;padding:10px 14px;font-weight:850}.att-toggle{display:flex;align-items:center;justify-content:center;border:0;border-left:1px solid var(--border);background:#fff}.att-toggle.locked{background:#f4f5f6}.bigcheck{width:48px;height:48px;border:3px solid #9aa6b2;border-radius:13px;display:flex;align-items:center;justify-content:center}.bigcheck svg{width:26px;height:26px;display:block;stroke:currentColor;stroke-width:3.2;stroke-linecap:round;stroke-linejoin:round;fill:none}.att-toggle.checked .bigcheck{background:var(--green);border-color:#4b9966;color:#197044}.att-toggle.locked .bigcheck{background:#eceff2;border-color:#c7ced6}.att-toggle.checked.locked .bigcheck{color:#8d96a0}.att-footer{position:static;flex:none;width:100%;box-sizing:border-box;padding:11px 13px;display:flex;justify-content:space-between;align-items:center;color:var(--muted);font-size:13px;background:#fff}

/* overlays/forms */
.overlay{position:fixed;inset:0;background:rgba(15,23,42,.42);display:none;z-index:100;align-items:flex-end;justify-content:center}.overlay.show{display:flex}.sheet{width:min(650px,100%);max-height:92dvh;overflow:auto;background:#fff;border-radius:20px 20px 0 0;padding:16px}.sheet.full{height:92dvh}.sheet-head{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:12px}.sheet h2,.sheet h3{margin:0}.field{margin-bottom:10px}.field label{display:block;font-size:13px;font-weight:800;color:#52606d;margin-bottom:5px}.field input,.field textarea,.field select{width:100%;border:1px solid var(--border);border-radius:10px;padding:11px 12px;background:#fff;color:var(--text)}.field input[type="date"]{color-scheme:light;background:#fff}.field textarea{min-height:95px}.actions{display:flex;gap:8px;margin-top:12px}.actions .btn{flex:1;min-height:48px;padding:11px 16px;line-height:1.2}.actions .btn>span{white-space:normal;overflow-wrap:anywhere;text-align:center;line-height:1.2}

/* profile */
.profile-top{display:flex;gap:14px;align-items:center;margin-bottom:14px}.profile-photo,.profile-photo-button{width:96px;height:96px;border-radius:50%}.profile-photo{object-fit:cover;background:#e9eef4;display:block}.profile-photo-button{border:0;padding:0;background:transparent}.photo-placeholder{width:96px;height:96px;border-radius:50%;background:#dcecf8;color:#1f5f99;display:flex;align-items:center;justify-content:center;font-size:42px;font-weight:900}.profile-name-wrap{min-width:0}.profile-name{font-size:22px;font-weight:900;overflow-wrap:anywhere;line-height:1.1}.profile-position{margin-top:5px;color:var(--muted);font-weight:800}.stats-grid,.stats{display:grid;grid-template-columns:repeat(2,1fr);gap:8px;margin:12px 0 16px}.stat{background:#f5f8fb;border-radius:12px;padding:10px;text-align:center}.stat strong,.stat-n{font-size:20px;font-weight:900;display:block}.stat small,.stat-l{font-size:11px;color:var(--muted);font-weight:800}.info-list,.info-grid{display:grid;gap:10px}.info-item,.info{padding:5px 1px;background:transparent}.info-item .label,.info-label{font-size:11px;font-weight:850;color:#6b7280;text-transform:uppercase}.info-item .value,.info-value{font-size:16px;font-weight:750;margin-top:4px;white-space:pre-wrap}.counter{display:grid;grid-template-columns:1fr auto auto auto;gap:8px;align-items:center;margin-bottom:8px}.counter button{width:38px;height:38px;border:0;border-radius:10px;background:#edf3f8;font-size:22px;font-weight:900}.counter .num,.counter .v{min-width:44px;text-align:center;font-weight:900}

/* history */
.month{border:1px solid var(--border);border-radius:13px;margin-bottom:10px;overflow:hidden}.month-head{width:100%;border:0;background:#f3f7fb;padding:12px 14px;display:flex;justify-content:space-between;font-weight:900}.month-body{display:none}.month.open .month-body{display:block}.history-row{display:grid;grid-template-columns:minmax(0,1fr) 42px 100px;gap:8px;align-items:center;padding:11px 12px;border-top:1px solid var(--border)}.history-title{font-weight:900}.history-meta{font-size:13px;color:var(--muted)}

/* equipment */
.eq-topbar{display:flex;align-items:center;justify-content:space-between;padding:10px;border-bottom:1px solid var(--border);background:#fbfcfe}.eq-title{font-size:19px;font-weight:900}.eq-top-actions{display:flex;gap:7px}.eq-tools{display:flex;gap:8px;flex-wrap:wrap;padding:10px;border-bottom:1px solid var(--border);background:#fbfcfe}.eq-list{padding:10px;display:grid;gap:10px}.eq-card{border:1px solid var(--border);border-radius:14px;overflow:hidden;background:#fff}.eq-head{display:grid;grid-template-columns:56px minmax(0,1fr) auto auto;gap:10px;align-items:center;padding:12px}.eq-subblock{border-top:1px solid #edf0f4}.eq-subrow{display:grid;grid-template-columns:42px minmax(0,1fr) auto auto;gap:9px;align-items:center;padding:10px 12px 10px 24px}.eq-thumb,.eq-letter{width:56px;height:56px;border-radius:10px;object-fit:cover;background:#e9eef4}.eq-thumb{cursor:zoom-in}.eq-letter{color:#718096;display:flex;align-items:center;justify-content:center;font-size:22px;font-weight:900}.eq-subrow .eq-thumb,.eq-subrow .eq-letter{width:42px;height:42px}.eq-name{font-weight:900;overflow-wrap:anywhere}.eq-qty{font-weight:900;color:var(--blue);font-size:18px;text-align:center}.eq-add{padding:10px;border-top:1px solid #edf0f4}.eq-note{font-size:13px;line-height:1.35;color:#52606d;background:#fff;padding:8px 12px;white-space:pre-wrap}.eq-subblock .eq-note{padding-left:34px}.eq-category-note{border-top:1px solid #edf0f4;font-size:14px;font-weight:750;color:#435266}.eq-reorder-actions{display:flex;gap:5px}.eq-reorder-actions .small-action{width:34px;height:34px;min-width:34px}

/* photo chooser + lightbox */
.photo-picker{width:100%;border:0;background:transparent;padding:0;text-align:left;cursor:pointer;display:flex;flex-direction:column;align-items:flex-start;gap:8px;color:var(--muted);font:inherit}.photo-picker img,.photo-picker-placeholder{width:108px;height:108px;border-radius:14px;object-fit:cover;background:#e9eef4}.photo-picker-placeholder{display:flex;align-items:center;justify-content:center;color:#718096;font-size:42px;font-weight:900}.photo-actions{display:flex;gap:12px;align-items:stretch;margin-top:14px;flex-wrap:nowrap}.photo-choice{width:126px;min-height:92px;border:0;border-radius:14px;padding:12px 10px;font:inherit;font-weight:800;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:7px;cursor:pointer}.photo-choice.secondary{background:#edf3f8;color:#294963}.photo-choice.primary{background:var(--blue);color:#fff}.photo-choice-icon{font-size:28px;line-height:1}.photo-sheet{max-width:460px}.hidden-file{position:fixed;left:-9999px;opacity:0;pointer-events:none}.image-overlay{z-index:180;align-items:center;padding:18px}.image-lightbox{position:relative;max-width:min(94vw,900px);max-height:90dvh;display:flex;align-items:center;justify-content:center}.image-lightbox img{display:block;max-width:94vw;max-height:86dvh;object-fit:contain;border-radius:14px;background:#fff;box-shadow:0 12px 40px rgba(0,0,0,.32)}.image-close{position:absolute;right:-4px;top:-48px;background:#fff}

/* login */
.login-wrap{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:18px}.login-card{width:min(420px,100%);background:#fff;border:1px solid var(--border);border-radius:18px;padding:24px;box-shadow:var(--shadow)}.login-card h1{text-align:center;margin:5px 0}.login-card p{text-align:center;color:var(--muted)}.login-card label{display:block;font-weight:800;margin:13px 0 5px}.login-card input{width:100%;padding:12px;border:1px solid var(--border);border-radius:10px}.login-ball{text-align:center;font-size:42px}.login-error{background:#fdecec;color:var(--danger);padding:10px;border-radius:10px;margin:10px 0}.account-link{display:block;margin:14px auto 0;border:0;background:transparent;color:#315d84;text-decoration:underline;font:inherit;font-weight:700;cursor:pointer}.login-success{background:#e8f5ec;color:#23603b;padding:10px;border-radius:10px;margin:10px 0}.account-sheet h3{margin:16px 0 6px}.edit-mode-check svg{width:26px;height:26px;display:block;stroke:#111;stroke-width:3.2;stroke-linecap:round;stroke-linejoin:round;fill:none}.lock-svg{width:24px;height:24px;display:block;fill:none;stroke:#294963;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.toast{position:fixed;left:50%;bottom:28px;transform:translateX(-50%) translateY(20px);opacity:0;z-index:200;background:#172a3a;color:#fff;padding:10px 14px;border-radius:999px;font-weight:850;transition:.18s;pointer-events:none!important}.toast.show{opacity:1;transform:translateX(-50%) translateY(0)}

@media(min-width:760px){.players-head,.player-row{grid-template-columns:minmax(220px,1.5fr) 110px 110px 110px}.players-head .total,.player-row .total{display:block}.att-row{grid-template-columns:minmax(240px,1fr) 150px}.info-grid{grid-template-columns:1fr 1fr}.stats-grid,.stats{grid-template-columns:repeat(3,1fr)}.sheet{border-radius:20px;margin-bottom:18px}.overlay{align-items:center}.sheet.full{height:auto;max-height:88dvh}}


/* v6.0.3 — Equipment-only fixes. Do not alter the global viewport/layout rules. */
#equipmentCard{min-height:0}
#equipmentRows.equipment-scroll{
  flex:1 1 auto;
  min-height:0;
  overflow-y:auto!important;
  overflow-x:hidden;
  display:block;
  padding:10px;
  -webkit-overflow-scrolling:touch;
  overscroll-behavior:contain;
}
#equipmentRows .eq-card + .eq-card{margin-top:10px}
#equipmentRows .eq-note{display:block!important}
#equipmentRows .eq-item-note{border-top:0}
#equipmentRows .eq-category-note{border-top:1px solid #edf0f4}


/* v6.0.4 Equipment polish: note hierarchy + removable equipment photo */
.photo-edit-wrap{position:relative;width:108px;max-width:100%}
.photo-edit-wrap .photo-picker{width:108px}
.photo-edit-wrap .photo-picker span{font-size:12px;line-height:1.25}
.photo-remove{position:absolute;top:-7px;right:-7px;width:28px;height:28px;border:0;border-radius:50%;background:#fff;color:#a61b1b;box-shadow:0 2px 8px rgba(20,40,70,.22);font-size:18px;font-weight:900;line-height:1;display:flex;align-items:center;justify-content:center;z-index:2}
.photo-remove:active{transform:scale(.96)}
