/* Semantic theme layer. Courts and photograph overlays keep their intentional contrast. */
html[data-theme]{--surface:var(--panel);--surface2:var(--panel2);--ink:var(--white);--accent:var(--lime);--on-accent:#11281c;--soft-accent:#193a32;--danger:#ffb1ae;--pc-shadow:0 20px 60px #0004}
html[data-theme="midnight"]{--bg:#081820;--panel:#112a36;--panel2:#1b3946;--white:#eff8f5;--muted:#b1c7cc;--line:#3b5a63;--lime:#d8ff79;--teal:#8be2cb}
html[data-theme="pearl"]{color-scheme:light;--bg:#f5f8f6;--panel:#fff;--panel2:#eaf0ed;--white:#17372f;--muted:#466257;--line:#b9cbc2;--lime:#17654d;--teal:#146b59;--on-accent:#fff;--soft-accent:#e1f1e7;--danger:#a33239;--pc-shadow:0 20px 60px #17372f15}
html[data-theme="ocean"]{color-scheme:dark;--bg:#052b35;--panel:#0c3946;--panel2:#15505c;--white:#e8f9f8;--muted:#b2d3d8;--line:#477581;--lime:#9be8e4;--teal:#a6e7ff;--on-accent:#072f38;--soft-accent:#174d55;--danger:#ffc2ae;--pc-shadow:0 20px 60px #001a263d}
html[data-theme="clay"]{color-scheme:light;--bg:#f8f1e9;--panel:#fffaf4;--panel2:#f0e4d6;--white:#42362d;--muted:#6d5948;--line:#cfbdaa;--lime:#995239;--teal:#8b4932;--on-accent:#fff;--soft-accent:#f1dfd0;--danger:#a02f35;--pc-shadow:0 20px 60px #4b301c14}
html[data-theme]:not([data-theme="midnight"]) body{background:var(--bg)!important;color:var(--ink)!important}
html[data-theme]:not([data-theme="midnight"]) body>header{background:var(--surface)!important;border-color:var(--line)!important;color:var(--ink)!important}
html[data-theme]:not([data-theme="midnight"]) body :is(.brand,.g5-title,.hero h1,.v55-hero h2,.v55-hero-body h2,.v64-hero h2,.v71-top h3,.pi65-context strong,.pd-header h2){color:var(--ink)!important}
html[data-theme]:not([data-theme="midnight"]) body :is(.panel,.g5-panel,.g6-panel,.coachCard,.content-card,.v55-card,.v55-kpi,.v55-pathitem,.v55-hero,.v55-hero-body,.skillbox,.weekPanel,.sessionCard,.sessionRow,.weekCheck,.assessmentHero,.assessment-hero,.planHeadline,.plan,.quote,.readingItem,.kpi,.metric,.g5-workshop,.g5-court-wrap,.g5-controls-card,.g5-recap>div,.iq6-guidance,.iq6-statusrow,.iq6-advpanel,.iq6-summary,.v57-safekeeping,.v57-example,.v57-compare,.v71-lab,.v71-brief>div,.v71-breakdown div,.v71-answer,.v61-vision,.v61-drilllink,.v62-contact,.v62-timeline,.v63-wrap,.v63-content,.v64-frame,.v64-feature,.v64-list,.v64-numbox,.v64-coachcard,.v64-test,.v64-result,.v64-moment,.pi65-console,.pq68-motion,.pq68-readout,.pq68-metric,.pq69-actionstrip,.pq70-board,.pq70-metrics>div,.pq70-comparison>div,.fc,.fc-choice,.fc-choice header,.fc-reason,.pd-card,.pd-stat,.pd-drill,.pd-voice,.app-welcome,.app-help,.pi65-dialog,.v55-dropdown){background:var(--surface)!important;border-color:var(--line)!important;color:var(--ink)!important;box-shadow:var(--pc-shadow)!important}
html[data-theme]:not([data-theme="midnight"]) body :is(.v55-hero:before,.v55-hero-body:before){background:none!important}
html[data-theme]:not([data-theme="midnight"]) body :is(p,li,label,small,.subtle,.asidecopy,.situation,.courtnote,.meta,.footer,.runtime,.iq6-caption,.iq6-helper,.iq6-courtcoach,.g5-sub,.g5-micro,.g5-label,.g5-source,.g5-courtfoot,.g5-inputhint,.g6-movehint,.g6-replaytext,.v55-smallprint,.v55-mini,.v55-herofoot,.v55-herofoot span,.v55-form label,.v55-focusrow .text small,.v55-card p,.v57-weekdesc small,.v71-sub,.v71-progress,.v61-disclaimer,.v61-minirow span,.v61-switch,.v62-small,.v63-note,.v63-desc,.v64-footer,.v64-heightnote,.v64-unit small,.v64-moment span,.pi65-context small,.pq68-caption,.pq68-note,.pq68-progress,.pq68-colorchips,.pq69-actiontext small,.pq70-sub,.pq70-metrics span,.pq70-comparison span,.fc-caption,.fc-badge,.fc-rubric,.fc-timeline,.fc-selects label,.fc-controls label,.fc-choice header small,.pd-caption,.pd-small,.pd-label,.pd-empty,.pd-entry-top,.pd-stat span,.pd-history p,.pd-check,.pd-result-fields label,.app-status){color:var(--muted)!important}
html[data-theme]:not([data-theme="midnight"]) body .fc #fc-event{color:var(--muted)!important}
html[data-theme]:not([data-theme="midnight"]) body :is(h2,h3,h4,.scorebig,.games,.scoreboard strong,.g5-scoreline strong,.g5-headline,.g5-cue strong,.g5-recap b,.g5-tally strong,.iq6-advnum,.iq6-feedback b,.v55-kpi strong,.v57-compare strong,.v71-scoreline strong,.v71-scoreline b,.v71-answer b,.v63-content b,.pq68-metric strong,.pq68-titlebar h3,.pq70-title,.pq70-hinthead>b,.pq70-metrics strong,.pd-stat b,.pd-drill h4,.fc-choice header strong,.fc-feedback,.app-welcome strong){color:var(--ink)!important}
html[data-theme]:not([data-theme="midnight"]) body :is(a,.link,.textButton,.smalltop,.eyebrow,.g5-kicker,.g6-heading b,.iq6-eyebrow,.v55-cardlabel,.v55-eyebrow,.v55-textlink,.v71-kicker,.v61-eyebrow,.v62-overline,.v63-kicker,.v64-eyebrow,.v64-eyeline,.pq68-kicker,.pq70-eyebrow,.pd-kicker,.pd-live,.fc summary small,.fc summary>span:last-child,.fc-choice header>span){color:var(--teal)!important}
html[data-theme]:not([data-theme="midnight"]) body :is(input:not([type="range"]):not([type="checkbox"]):not([type="radio"]),select,textarea){background:var(--surface)!important;color:var(--ink)!important;border-color:var(--line)!important;color-scheme:inherit}
html[data-theme]:not([data-theme="midnight"]) body :is(input,textarea)::placeholder{color:var(--muted)!important;opacity:.85}
html[data-theme] body :is(input[type="checkbox"],input[type="radio"],input[type="range"]){accent-color:var(--accent)}
html[data-theme]:not([data-theme="midnight"]) body :is(button,.v55-more>summary,.v57-upload){background:var(--surface2)!important;color:var(--ink)!important;border-color:var(--line)!important;box-shadow:none!important}
html[data-theme]:not([data-theme="midnight"]) body :is(button:hover,.v55-more>summary:hover){background:var(--soft-accent)!important;color:var(--ink)!important;border-color:var(--accent)!important}
html[data-theme]:not([data-theme="midnight"]) body :is(button.active,button.selected,button[aria-pressed="true"],button.primary,button.v55-action,button.g5-large,button.g5-hit,button.iq6-fire,button.iq6-primary,button.v63-strong,button.v64-primary,button.v64-play,button.pq68-primary,button.pq69-watch,button.v71-start,button.v71-next,button.pd-primary,button.wp-primary,button.pm-primary,button[data-fc-action="play"],button.pc-save,.app-actions button:first-child,.v55-navigation>button.active,.pd-nav.active){background:var(--accent)!important;border-color:var(--accent)!important;color:var(--on-accent)!important;box-shadow:none!important}
html[data-theme]:not([data-theme="midnight"]) body :is(button.active,button.selected,button[aria-pressed="true"],button.primary,button.v55-action,button.g5-large,button.g5-hit,button.iq6-fire,button.iq6-primary,button.pd-primary,button.wp-primary,button.pm-primary,button.pc-save,.v55-navigation>button.active) :is(b,strong,small,span){color:var(--on-accent)!important}
html[data-theme]:not([data-theme="midnight"]) body :is(.mark,.v55-focusrow .rank,.v55-stepnum,.v57-weeknum,.v64-unitnum,.pi65-context-icon,.g5-step.active b){background:var(--accent)!important;color:var(--on-accent)!important}
html[data-theme]:not([data-theme="midnight"]) body :is(.tag,.pill,.g5-tag,.g5-step,.g5-steps,.v55-chip,.v71-entry,.v71-pill,.v61-shotpill,.v62-tag,.v63-pill,.v64-pill,.pq68-pill,.iq6-factors span,.pd-tag,.pd-private,.pd-status,.wp-status,.pm-status,.hint,.feedback,.g5-feedback,.g5-question,.g6-insight,.iq6-feedback,.v55-mini,.v64-unit.active,.fc-reason){background:var(--soft-accent)!important;color:var(--ink)!important;border-color:var(--line)!important}
html[data-theme]:not([data-theme="midnight"]) body :is(.feedback.bad,.g5-feedback.negative,.iq6-feedback.warning,.v62-contact.warn,.pd-status[data-error="true"],.wp-status[data-error="true"],.pm-status[data-error="true"]){border-color:var(--danger)!important;color:var(--danger)!important}
html[data-theme]:not([data-theme="midnight"]) body :is(.pd-danger,.pd-status[data-error="true"],.wp-status[data-error="true"],.pm-status[data-error="true"]){color:var(--danger)!important}
html[data-theme] body button.pd-recording{background:#932e3f!important;color:white!important;border-color:#c85a69!important}
html[data-theme]:not([data-theme="midnight"]) body :is(.g5-sticky,.mobileDock,.pq67-court-actionhint){background:var(--surface)!important;border-color:var(--line)!important;color:var(--ink)!important}
html[data-theme]:not([data-theme="midnight"]) body :is(.g5-docktip,.iq6-dockhint,.pq67-court-actionhint strong){color:var(--muted)!important}
html[data-theme]:not([data-theme="midnight"]) body :is(.progress,.bar,.v55-bar,.iq6-meter,.pq69-progress){background:var(--surface2)!important}
html[data-theme]:not([data-theme="midnight"]) body :is(.progress i,.bar i,.v55-bar>i,.iq6-meter i,.pq69-progress>span){background:var(--accent)!important}
/* The legacy court and learning modules use ID-scoped declarations. */
html[data-theme] #guided{--surface:var(--panel);--iv:var(--accent)}
html[data-theme]:not([data-theme="midnight"]) body #guided :is(.g5-panel,.g5-workshop,.g5-court-wrap,.g5-scoreline){background:var(--surface)!important;background-image:none!important;border-color:var(--line)!important;color:var(--ink)!important}
html[data-theme]:not([data-theme="midnight"]) body #guided .g5-scoreline strong{color:var(--ink)!important}
html[data-theme]:not([data-theme="midnight"]) body #videos .v64-frame{background:var(--surface)!important;background-image:none!important;border-color:var(--line)!important;color:var(--ink)!important}
html[data-theme]:not([data-theme="midnight"]) body.is-guided #guided .g5-sticky{background:var(--surface)!important;border-color:var(--line)!important;color:var(--ink)!important}
html[data-theme]:not([data-theme="midnight"]) body #videos .v64-studio{--v64-ink:var(--ink);--v64-sub:var(--muted);--v64-acid:var(--accent);--v64-teal:var(--teal);--v64-stroke:var(--line);color:var(--ink)}
html[data-theme] #performance-diary{--pd-ink:var(--ink);--pd-muted:var(--muted);--pd-line:var(--line);--pd-green:var(--accent)}
html[data-theme]:not([data-theme="midnight"]) body .scoreboard{background:var(--surface2)!important;border-color:var(--line)!important}
html[data-theme]:not([data-theme="midnight"]) body :is(.v55-hero-body em,.pq66-sectionlabel>span,.pq69-eye,.label){color:var(--teal)!important}
html[data-theme]:not([data-theme="midnight"]) body :is(.v71-entry b,.pq69-actionstrip strong){color:var(--ink)!important}
html[data-theme]:not([data-theme="midnight"]) body :is(.v71-entry span,.g5-tally,.pq68-empty,.sectitle span,.statusline span){color:var(--muted)!important}
html[data-theme]:not([data-theme="midnight"]) body .scoreboard .games span{color:var(--muted)!important}
/* Retain readable white typography over photography and dark court diagrams. */
html[data-theme]:not([data-theme="midnight"]) body :is(.pq66-hero-photo,.pq66-photo-card,.pq66-feature-band){background-color:#102a34!important;color:#f0f8f4!important}
html[data-theme]:not([data-theme="midnight"]) body button.pq66-photo-card,html[data-theme]:not([data-theme="midnight"]) body button.pq66-photo-card:hover{background-color:#102a34!important;color:#f0f8f4!important}
html[data-theme]:not([data-theme="midnight"]) body :is(.pq66-hero-photo,.pq66-photo-card,.pq66-feature-band) :is(p,h2,h3,strong,small,span,a){color:#f0f8f4!important}
html[data-theme]:not([data-theme="midnight"]) body button.pq66-photo-card .pq66-card-bottom small{color:#f0f8f4!important}
html[data-theme]:not([data-theme="midnight"]) body .pq66-photo-card .pq66-card-arrow{background:#244751!important;color:#f0f8f4!important}
html[data-theme]:not([data-theme="midnight"]) body :is(.v61-drawing,.v64-viewport,.pq68-stage){background:#0c2835!important;color:#dceeea!important}
html[data-theme]:not([data-theme="midnight"]) body :is(.v61-drawing,.v64-viewport,.pq68-stage) :is(p,small,span){color:#dceeea!important}
html[data-theme] body :is(button,a,input,select,textarea,summary):focus-visible{outline:3px solid var(--accent)!important;outline-offset:3px}
/* Preferences dialog */
.pc-dialog{width:min(720px,calc(100% - 24px));max-height:90dvh;overflow:auto;padding:28px;border-radius:24px;border:1px solid var(--line);background:var(--surface);color:var(--ink);box-shadow:var(--pc-shadow);box-sizing:border-box}
.pc-dialog::backdrop{background:#03151cb8;backdrop-filter:blur(5px)}
.pc-dialog *{box-sizing:border-box}.pc-titlebar{display:flex;justify-content:space-between;gap:15px;align-items:start}.pc-titlebar h2{font-size:clamp(26px,5vw,35px);line-height:1.13;letter-spacing:-.04em;margin:8px 0 0}.pc-eyebrow{font-size:10px;letter-spacing:.16em;font-weight:800;color:var(--teal)}.pc-close{font-size:25px!important;line-height:1;min-width:44px;flex:none}.pc-dialog button{min-height:44px;padding:10px 15px;border-radius:11px;border:1px solid var(--line);background:var(--surface2);color:var(--ink);font:inherit;font-size:14px;cursor:pointer}.pc-intro{line-height:1.6;font-size:14px;color:var(--muted);margin-bottom:24px}.pc-fieldset{border:0;border-top:1px solid var(--line);padding:18px 0 0;margin:22px 0}.pc-fieldset legend{padding-right:12px;font-size:13px;font-weight:750;color:var(--ink)}.pc-themes{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px}.pc-theme{display:flex;flex-direction:column;position:relative;padding:10px;border:1px solid var(--line);border-radius:14px;cursor:pointer;min-width:0;gap:5px;background:var(--surface)}.pc-theme input{position:absolute;left:14px;top:14px;accent-color:var(--accent);width:17px;height:17px;margin:0}.pc-theme:has(input:checked){outline:2px solid var(--accent);outline-offset:2px}.pc-theme:has(input:focus-visible){outline:3px solid var(--accent);outline-offset:3px}.pc-theme strong{font-size:13px;font-weight:750}.pc-theme small{font-size:10px;line-height:1.5;color:var(--muted);min-height:30px}.pc-selected{display:none;position:absolute;right:10px;top:11px;color:var(--on-accent);background:var(--accent);font-size:12px;border-radius:50%;width:19px;height:19px;text-align:center;line-height:19px}.pc-theme:has(input:checked) .pc-selected{display:block}.pc-swatch{height:62px;padding:33px 6px 7px;display:flex;align-items:end;gap:5px;border-radius:7px;overflow:hidden;border:1px solid #9993}.pc-swatch i{display:block;height:13px;width:19px;border-radius:4px}.pc-swatch-midnight{background:#081820}.pc-swatch-midnight i{background:#d8ff79}.pc-swatch-midnight i:nth-child(2){background:#294a57}.pc-swatch-midnight i:nth-child(3){background:#8be2cb}.pc-swatch-pearl{background:#f5f8f6}.pc-swatch-pearl i{background:#17654d}.pc-swatch-pearl i:nth-child(2){background:#cdded5}.pc-swatch-pearl i:nth-child(3){background:#fff;border:1px solid #b9cbc2}.pc-swatch-ocean{background:#052b35}.pc-swatch-ocean i{background:#9be8e4}.pc-swatch-ocean i:nth-child(2){background:#15505c}.pc-swatch-ocean i:nth-child(3){background:#a6e7ff}.pc-swatch-clay{background:#f8f1e9}.pc-swatch-clay i{background:#995239}.pc-swatch-clay i:nth-child(2){background:#d9bd9e}.pc-swatch-clay i:nth-child(3){background:#f0e4d6}.pc-hint{font-size:12px!important;line-height:1.6;color:var(--muted);margin:12px 0 0}.pc-focuses{display:flex;gap:8px}.pc-segment{flex:1;cursor:pointer;position:relative}.pc-segment input{position:absolute;opacity:0;width:1px;height:1px}.pc-segment span{display:block;padding:12px;border:1px solid var(--line);border-radius:11px;text-align:center;background:var(--surface2);color:var(--ink);font-size:14px}.pc-segment input:checked+span{background:var(--accent);color:var(--on-accent);border-color:var(--accent);font-weight:750}.pc-segment input:focus-visible+span{outline:3px solid var(--accent);outline-offset:3px}.pc-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:13px}.pc-label{display:flex;flex-direction:column;gap:8px;font-size:12px;font-weight:700;color:var(--muted);min-width:0}.pc-label select,.pc-label textarea{width:100%;min-width:0;min-height:46px;border:1px solid var(--line);background:var(--surface);color:var(--ink);font:inherit;font-size:16px;padding:11px;border-radius:11px;color-scheme:inherit}.pc-label textarea{resize:vertical;line-height:1.6}.pc-days{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:6px}.pc-days label{position:relative;cursor:pointer}.pc-days input{position:absolute;opacity:0;width:1px;height:1px}.pc-days input+span{display:block;text-align:center;min-height:44px;padding:12px 2px;border:1px solid var(--line);border-radius:10px;background:var(--surface2);color:var(--ink);font-size:12px}.pc-days abbr{text-decoration:none}.pc-days input:checked+span{background:var(--accent);color:var(--on-accent);border-color:var(--accent);font-weight:750}.pc-days input:focus-visible+span{outline:3px solid var(--accent);outline-offset:2px}.pc-equipment{display:grid;grid-template-columns:1fr 1fr;gap:10px}.pc-equipment label{display:flex;align-items:center;gap:10px;min-height:44px;line-height:1.4;font-size:13px;border:1px solid var(--line);padding:9px 11px;border-radius:11px;background:var(--surface)}.pc-equipment input{width:18px;height:18px;flex:none;margin:0;accent-color:var(--accent)}.pc-goal{margin:20px 0}.pc-motion{display:flex;gap:12px;align-items:start;padding:16px;background:var(--surface2);border-radius:12px;border:1px solid var(--line);cursor:pointer}.pc-motion input{width:18px;height:18px;flex:none;margin:3px 0 0}.pc-motion strong,.pc-motion small{display:block}.pc-motion strong{font-size:13px}.pc-motion small{font-size:12px;line-height:1.5;margin-top:4px;color:var(--muted)}.pc-status{font-size:13px;line-height:1.5;color:var(--teal);min-height:20px}.pc-status[data-error="true"]{color:var(--danger)}.pc-footer{display:flex;justify-content:flex-end;gap:10px;position:sticky;bottom:-28px;padding:16px 0 5px;background:var(--surface);margin-top:12px}.pc-dialog .pc-save{background:var(--accent)!important;color:var(--on-accent)!important;border-color:var(--accent)!important;font-weight:750}.pc-shortcut{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:0 0 20px;padding:0 2px;color:var(--muted);font-size:12px}.pc-shortcut button{border:1px solid var(--line);background:var(--surface2);color:var(--ink);border-radius:10px;padding:9px 13px;min-height:44px;font:inherit;font-size:12px;cursor:pointer}.pc-sr{position:absolute;width:1px;height:1px;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}
html[data-padel-motion="reduced"] *,html[data-padel-motion="reduced"] *::before,html[data-padel-motion="reduced"] *::after{scroll-behavior:auto!important;animation:none!important;transition:none!important}
@media(max-width:560px){.pc-dialog{padding:20px;max-height:92dvh}.pc-themes{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.pc-theme small{min-height:15px}.pc-grid{grid-template-columns:1fr 1fr}.pc-grid .pc-label:last-child{grid-column:1/-1}.pc-footer{bottom:-20px}.pc-shortcut{align-items:flex-start;flex-direction:column;gap:6px}.pc-shortcut button{width:100%;text-align:left}.pc-equipment{grid-template-columns:1fr}.pc-days{gap:4px}.pc-days input+span{font-size:11px}.pc-dialog h2{font-size:28px}}
@media(prefers-reduced-motion:reduce){.pc-dialog *{scroll-behavior:auto!important;animation:none!important;transition:none!important}}
