:root {
  --maincolor: #0D0E0E;
  --highlightcolor: #F9BC08;
  --backcolor: #F4F4F4;
  --textspec: #888;
  --avgcolor: #aa9451;
  --aboveavg: #0D0E0E;
  --boxcolor: #FFFFFF;
}

[data-theme="dark"] {
  --maincolor: #F4F4F4;
  --highlightcolor: #F9BC08;
  --backcolor: #0D0E0E;
  --textspec: #888;
  --avgcolor: #aa9451;
  --aboveavg: #F4F4F4;
  --boxcolor: #1A1E22;
}
* { font-family: 'Segoe UI', Aptos, sans-serif; }
body { position: relative; max-width:80%; margin: 0 auto; background: linear-gradient(135deg, var(--backcolor), var(--backcolor) 65%, var(--highlightcolor)); color: var(--maincolor); }
.header-logo { max-width: 10rem; height: auto; margin-top:1rem; }
h1 { color: var(--highlightcolor); margin: 0 auto; text-align:center; font-size:3rem; margin-top:1rem;}
h2 { font-weight: bold; color: var(--maincolor); font-size:1.75rem; }
h3 { font-weight: 600; color: var(--highlightcolor); font-size:1.5rem; text-align:center; }

p {color: var(--maincolor); font-size:1.125rem;}
label { display: block; margin-top: 0.625rem; font-size: 1.125rem; font-weight: bold; }
input, select {width: 100%; padding: 0.5rem; box-sizing: border-box; border-radius: 1rem; border: 1px solid var(--textspec); margin-top: 0.25rem; background: var(--backcolor); color: var(--maincolor); font-size: 1.125rem; }

.narrow-form { width: 80%; margin: 0 auto; }
.inline-label { display: flex; align-items: center; gap: 0.75rem; }
.inline-label select { flex: 1; }

.grid5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1rem; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin: 0 auto; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.grid2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; margin: 0; padding: 0; align-items: center; }
button {margin-top: 1.25rem; padding: 0.625rem 1.25rem; border-radius: 2rem; border: none; cursor: pointer; font-weight: bold; font-size:1rem; background: var(--highlightcolor); color: #0D0E0E;}
.fixed-value { border-color: var(--highlightcolor); opacity: 0.6; cursor: not-allowed; }
.score { font-size: 3rem; font-weight: bold; margin-top: 1.25rem; color: var(--highlightcolor); text-align: center; }
.ring-wrap { display: flex; flex-direction: column; align-items: center; margin-bottom: 0; }
.ring { width: 15rem; height: 15rem; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.ring-inner { width: 10rem; height: 10rem; border-radius: 50%; background: var(--boxcolor); display: flex; align-items: center; justify-content: center; font-weight: bold; color: var(--maincolor); font-size: 3rem; }
.ring-caption { font-size: 0.85rem; color: var(--textspec); text-align: center; margin-top: 1rem; }
.narrative { background: var(--boxcolor); border-radius: 1rem; padding: 1.5rem; text-align: center; width: 60%; margin: 0 auto; }
.narrative .lead { font-size: 1.125rem; line-height: 1.6; text-align: center; }
.narrative .pct { font-size: 3.5rem; font-weight: bold; color: var(--highlightcolor); margin: 0 0; text-align: center; }
.narrative .label { font-size: 1rem; color: var(--textspec); text-transform: uppercase; letter-spacing: 0.05rem; text-align: center; }
.narrative .tagline { font-size: 1.5rem; font-weight: bold; color: var(--maincolor); text-align: center; }
#results-section, #lookup-results-section { background: var(--boxcolor); border-radius: 1rem; padding: 1.5rem; margin-top: 1.5rem; }
.bar-label { font-size: 1rem; width: 70%; margin: 0rem auto; margin-bottom: 0.5rem; text-align: left; }
.bar-row, .bar-row * { margin: 0; padding: 0; }
.bar-row { margin: 0 auto; width: 40%; }
.bar-label.focus { font-weight: bold; }
.bar-fill { position: absolute; left: 0; top: 0; height: 100%; width: var(--rel-pct); background: var(--maincolor); border-radius: 1rem; }
.bar-fill.focus { background: var(--highlightcolor); }
.bar-range p { margin: 0; }
.bar-track { position: relative; height: 1.5rem; background: var(--backcolor); border-radius: 1rem; border: 1px solid var(--maincolor); margin: 0; padding: 0; }
.bar-range { display: flex; justify-content: space-between; font-size: 1rem; color: var(--textspec); margin: 0; padding: 0; }
.bar-threshold { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--highlightcolor); }
.player-card { border-radius: 2rem; overflow: hidden; text-align: center; background: var(--boxcolor); border-bottom: 0.3rem solid var(--maincolor); transition: transform 0.15s ease, box-shadow 0.15s ease;}
.player-card img { width: 100%; height: auto; display: block; }
.player-card p { margin: 0.5rem 0; font-size: 1rem; }
.player-card:hover {transform: translateY(-0.3rem); box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15); cursor: pointer;}
.player-card-link {text-decoration: none;}
.theme-toggle {position: absolute; top: 1rem; right: 1rem; margin: 0; background: none; border: none; padding: 0.4rem; cursor: pointer; font-size: 1.25rem; color:var(--highlightcolor);}
.score-icon { height: 1em; width: auto; vertical-align: middle; }
.modal-backdrop { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(128,128,128,0.55); align-items: center; justify-content: center; z-index: 10; }
#affirmModal form { text-align: left; }
.modal-box { width: 50%; max-width: 40rem; max-height: 90%; overflow-y: auto; position: relative; text-align: left; background: var(--boxcolor); border-radius: 1rem; padding: 1.5rem; padding-top: 1rem; box-sizing: border-box; overflow-wrap: break-word; }
.modal-close { position: absolute; top: 0.75rem; right: 0.75rem; background: none; border: none; cursor: pointer; font-size: 1.25rem; color: var(--highlightcolor); }
.modal-wide { width: 60%; max-width: 75rem; }

.policy-box { max-height: 12rem; overflow-y: auto; text-align: left; font-size: 0.8rem; border: 1px solid var(--textspec); border-radius: 1rem; padding: 0.75rem; margin-top: 0.5rem; }
.policy-box p { font-size: 0.8rem; }
/* .policy-box a, .narrative a { color: var(--highlightcolor); } */
.login-card-img { width: 20rem; height: auto; display: block; margin: 1rem auto; }
.admin-details { text-align: center; margin: 1rem; }
.admin-summary { font-size: 0.75rem; color: var(--textspec); cursor: pointer; }
.admin-form { margin: 0.42rem auto; width: 30%; text-align:center; }
.modal-box .admin-form { width: 80%; }
.admin-input { width: 95%; font-size: 1rem; margin-bottom: 0.1rem; display: block; }
.admin-badge, .tab-btn-red { background: var(--highlightcolor); color: var(--backcolor); }

.admin-table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
.admin-table th, .admin-table td { padding: 0.5rem; text-align: left; border-bottom: 1px solid var(--textspec); font-size: 0.85rem; }
.admin-table td { white-space: nowrap; }
.admin-table select { width: auto; padding: 0.2rem 0.4rem; border-radius: 0.5rem; font-size: 0.85rem; margin-top: 0; }
.admin-note { font-size: 1rem; color: var(--textspec); }
.button-row { margin-top: 0.5rem; display: flex; gap: 1rem; justify-content: center; }

.footer-container { width: 100%; background: none; }
.form-container { width: 50%; display: flex; flex-direction: column; justify-content: flex-end; margin: 2rem auto; text-align: center; }
.form-container p { font-size: 0.75rem; margin: 0.25rem 0; color: var(--maincolor); align-self: center; cursor: pointer; user-select: none; }
.header-container-main { display: flex; align-items: center; justify-content: center; gap: 1rem; width: 50%; text-align: center; margin: 1rem auto; margin-bottom:0; }
.header-container-main > * { flex-shrink: 0; margin: 0; vertical-align: middle; }
.header-container-main a { display: flex; align-items: center; gap: 1rem; text-decoration: none; color: inherit; }
.social-buttons { display: inline-flex; align-items: center; background-color: var(--backcolor); border-radius: 2rem; padding: 0.5rem 1rem; gap: 1.5rem; justify-content: center; width: fit-content; align-self: center; margin: 0 auto; }
.icon-small { width: 1.5rem; height: 1.5rem; font-size: 1.5rem; margin: 0; display: block; }
.swipe-hint { display: none; }

.centered-block { width: 40%; margin: 0 auto; }
.edit-toggle { display: inline-block; margin-left: 0.5rem; }
.edit-toggle summary { color: var(--highlightcolor); cursor: pointer; font-size: 0.8rem; list-style: none; }
.edit-toggle summary::-webkit-details-marker { display: none; }
textarea { width: 100%; padding: 0.5rem; box-sizing: border-box; border-radius: 1rem; border: 1px solid var(--textspec); margin-top: 0.25rem; background: var(--backcolor); color: var(--maincolor); }
.edit-toggle form { display: inline-flex; align-items: center; gap: 0.5rem; margin-top: 0.4rem; }
.edit-toggle select, .edit-toggle input[type="text"] { width: auto; display: inline-block; margin-top: 0; }
.edit-toggle button { margin-top: 0; padding: 0.4rem 1rem; font-size: 0.85rem; }
.edit-toggle[open] { display: inline-flex; align-items: center; gap: 0.5rem; }
.edit-toggle summary { display: inline; }

.puck-icon { width: 1.5rem; vertical-align: middle; }
.table-btn { margin-top: 0; padding: 0.3rem 0.6rem; font-size: 0.75rem; }
.coach-puck-btn { position: fixed; top: auto; bottom: 1.5rem; right: 1.5rem; background: var(--maincolor); color: var(--backcolor); border-radius: 2rem; width: auto; height: 2.5rem; padding: 0 1.2rem; display: flex; align-items: center; gap: 0.5rem; white-space: nowrap; }
.coach-puck-icon { width: 1.8rem; height: 1.8rem; }

.coach-puck-panel { display: none; position: fixed; bottom: 6rem; right: 1.5rem; width: 22rem; max-height: 30rem; overflow-y: auto; z-index: 6; background: #FFFFFF; color: #0D0E0E; }
.coach-puck-panel.open { display: block; }
.coach-puck-panel p { color: #0D0E0E; text-align: left; }
.coach-puck-bubble { max-width: 85%; padding: 0.6rem 1rem; border-radius: 1.2rem; margin: 0.4rem 0; text-align: left; }
.coach-puck-user { margin-right: auto; background: #0D0E0E; color: #FFFFFF; border-bottom-left-radius: 0.3rem; }
.coach-puck-bot { margin-left: auto; background: #F4F4F4; color: #0D0E0E; border-bottom-right-radius: 0.3rem; white-space: pre-line;}
.coach-puck-option, .coach-puck-download { display: inline-block; width: fit-content; max-width: 90%; text-align: left; margin: 0.3rem 0.2rem; padding: 0.6rem 1.1rem; border-radius: 1.2rem; background: var(--highlightcolor); color: #0D0E0E; text-decoration: none; font-size: 0.9rem; font-weight: 600; box-shadow: 0 0.1rem 0.3rem rgba(0,0,0,0.12); transition: background 0.15s ease, transform 0.1s ease; border: none; }

.coach-puck-drills { display: flex; flex-direction: column; gap: 0.4rem; margin: 0.4rem 0 0.8rem 0; }
.coach-puck-video { display: block; text-align: left; padding: 0.6rem 1rem; background: #F4F4F4; color: #0D0E0E; border-left: 3px solid var(--highlightcolor); border-radius: 0.3rem 1.2rem 1.2rem 0.3rem; text-decoration: none; font-size: 0.9rem; font-weight: 600; cursor: pointer; }
.coach-puck-video:hover { background: #E4E4E4; }
.coach-puck-row { margin-top: 0.5rem; }
.coach-puck-nav, .coach-puck-reset, .coach-puck-download { display: inline-block; width: fit-content; max-width: 90%; text-align: left; margin: 0.3rem 0.2rem; padding: 0.6rem 1.1rem; border-radius: 1.2rem; color: #FFFFFF; text-decoration: none; font-size: 0.9rem; font-weight: 600; box-shadow: 0 0.1rem 0.3rem rgba(0,0,0,0.12); border: none; cursor: pointer; }
.coach-puck-option:hover { background: #e0a800; cursor: pointer; transform: translateY(-1px); }

.coach-puck-nav { background: #0D0E0E; }
.coach-puck-nav:hover { background: #333333; }
.coach-puck-reset { background: #B3433F; }
.coach-puck-reset:hover { background: #983631; }
.coach-puck-download { background: #2F7D4F; }
.coach-puck-download:hover { background: #266641; }
.coach-puck-chart { width: 100%; height: auto; display: block; margin: 0.4rem 0; }

#videoFrame { width: 100%; aspect-ratio: 16 / 9; border: 0; }
#videoFrame.short { height: 70vh; width: calc(70vh * 9 / 16); aspect-ratio: auto; display: block; margin: 0 auto; }
.modal-box:has(#videoFrame.short) { width: fit-content; }
.radio-label { font-weight: normal; font-size: 1rem; margin-top: 0.5rem; }
.radio-label input { width: auto; display: inline; }

@media print {
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
  body * { visibility: hidden; }
  html { font-size: 16px !important; }
  #results-section, #results-section * { visibility: visible; }
  #results-section { position: absolute; left: 0; top: 0; width: 100%; }
  .grid4 { grid-template-columns: repeat(4, 1fr) !important; }
  .grid2 { grid-template-columns: repeat(2, 1fr) !important; }
  #saveBtn { display: none; }
  #improve-section { break-inside: avoid; page-break-inside: avoid; }
}

@media (max-width: 1000px) {
  html { font-size: 12px; }
  .header-logo { max-width: 8rem; }
  body { max-width: 100%; box-sizing: border-box; padding: 0 1rem; }
  .centered-block { width: 100%; }
  .edit-toggle[open], .edit-toggle form { flex-wrap: wrap; }
  .table-scroll { overflow-x: auto; }
  .grid2 { grid-template-columns: 1fr; }
  .grid5, .grid4, .grid3 { grid-template-columns: repeat(2, 1fr); }
  .bar-row, .narrative { width: 90%; }
  .modal-box { width: 90%; }
  .login-card-img { width: 100%; max-width: 20rem; }
  .coach-puck-btn { top: 90%; bottom: auto; right: 0; border-radius: 2rem 0 0 2rem; padding-right: 0.8rem; }
  .swipe-hint { display: block; text-align: center; color: var(--maincolor); font-size: 0.9rem; margin-bottom:0; margin-top:0; }
  .modal-wide { width: 90%; }
}
