/* Courtnote · mid-tone "Night court" theme */
:root {
  --bg: #3D5475; --card: #4D6589; --card2: #46607f; --nav: #34496A; --deep: #283D5C; --ink: #1E2D45;
  --text: #FFFFFF; --muted: #DCE4EF; --soft: #EEF2F7; --line: rgba(255,255,255,.14);
  --sky: #4BB4DE; --skytext: #BFE8F7; --sand: #EFDBCB; --blue: #345DA7; --ball: #F4F9A8;
  --g: #2E9E5B; --gbg: #E3F4EA; --gfg: #17583A; --a: #E0A21C; --abg: #FFF4D9; --afg: #6B4A00; --r: #D9483B; --rbg: #FDECEA; --rfg: #8E2219;
  --radius: 20px; --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  --font: Inter, system-ui, -apple-system, "Segoe UI", sans-serif; --display: "Space Grotesk", Inter, system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--deep); color: var(--text); font-family: var(--font); -webkit-font-smoothing: antialiased; }
body { overscroll-behavior-y: none; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
p { margin: 0; line-height: 1.5; }
h1, h2, h3 { margin: 0; font-family: var(--display); letter-spacing: -0.02em; }
h1 { font-size: 30px; line-height: 1.1; }
h2 { font-size: 17px; font-family: var(--font); letter-spacing: 0; }
h3 { font-size: 20px; }
:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.app { max-width: 520px; margin: 0 auto; height: 100%; display: flex; flex-direction: column; background: var(--bg); position: relative; }
.boot { margin: auto; font-family: var(--display); font-size: 28px; font-weight: 700; opacity: .7; }
.main { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 4px 20px 28px; display: flex; flex-direction: column; gap: 16px; }
.main.bare { padding-top: calc(24px + var(--safe-t)); }
body.busy { cursor: progress; }
body.busy .btn.primary, body.busy .btn.sand { opacity: .7; }

/* header + nav */
.top { display: flex; align-items: center; justify-content: space-between; padding: calc(14px + var(--safe-t)) 20px 10px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.logo { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: var(--card); flex-shrink: 0; }
.logo.ph { display: flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 700; color: var(--deep); background: var(--sand); }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-family: var(--display); font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text small { font-size: 11px; color: var(--muted); }
.tabs { display: flex; background: var(--nav); padding: 6px 6px calc(8px + var(--safe-b)); }
.tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0; min-height: 50px; font-size: 11px; font-weight: 600; color: #C9D3E1; position: relative; }
.tabs a.on { color: var(--sand); }
.tabs .dot { position: absolute; top: 2px; left: calc(50% + 6px); background: var(--sky); color: var(--ink); font-size: 10px; border-radius: 999px; padding: 0 5px; line-height: 16px; }
.preview { display: flex; align-items: center; gap: 8px; justify-content: center; flex-wrap: wrap; background: var(--sand); color: var(--deep); font-size: 12px; font-weight: 600; padding: calc(6px + var(--safe-t)) 12px 6px; }
.preview select { border: 1px solid rgba(40,61,92,.3); border-radius: 8px; background: #fff; color: var(--deep); padding: 3px 6px; font-size: 12px; }

/* layout */
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-s { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: center; gap: 12px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.grow { flex: 1; min-width: 0; }
.block { display: block; }
.center-stack { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 16px; padding-top: 48px; }
.narrow { display: flex; flex-direction: column; gap: 16px; }

/* text */
.pagehead { display: flex; flex-direction: column; gap: 4px; }
.sub, .muted { color: var(--muted); }
.small { font-size: 13px; }
.kicker { font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.kicker.sky, .skytext { color: var(--skytext); }
.sand { color: var(--sand); }
.strong { font-weight: 700; }
.lead { font-size: 16px; color: var(--soft); }
.hint { font-size: 12px; color: var(--muted); text-align: center; line-height: 1.5; }
.hint.left { text-align: left; }
.h-big { font-family: var(--display); font-size: 24px; font-weight: 700; display: block; }
.h-mid { font-size: 17px; font-weight: 700; }
.h-focus { font-family: var(--display); font-size: 24px; font-weight: 700; margin-top: 4px; }
.num { font-family: var(--display); font-size: 30px; font-weight: 700; }
.sectionhead { display: flex; align-items: baseline; justify-content: space-between; margin-top: 6px; }
.back { display: inline-flex; align-items: center; gap: 4px; align-self: flex-start; padding: 6px 0; font-weight: 600; }
.linkish { color: var(--skytext); font-weight: 600; }
.empty { border: 1.5px dashed rgba(255,255,255,.3); border-radius: 18px; padding: 20px; text-align: center; color: var(--muted); font-size: 14px; line-height: 1.5; }

/* cards */
.card { background: var(--card); border-radius: var(--radius); padding: 16px; display: block; }
.card.navy { background: var(--deep); }
.card.sandcard { background: var(--sand); color: var(--deep); display: flex; flex-direction: column; gap: 4px; }
.card.sandcard .kicker { color: var(--deep); }
.card.done-card { display: flex; align-items: center; gap: 10px; color: var(--skytext); font-weight: 600; }
.card.dashed { background: transparent; border: 1.5px dashed rgba(255,255,255,.3); }
.card.small-card { display: flex; flex-direction: column; gap: 4px; }
.link-card { display: flex; flex-direction: column; gap: 6px; min-height: 112px; }
.row-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; min-height: 56px; }
.row-card.plain { background: transparent; border: none; border-top: 1px solid var(--line); border-radius: 0; padding: 10px 0; text-align: left; width: 100%; }
.timecol { display: flex; flex-direction: column; min-width: 50px; }
.timecol b { font-family: var(--display); font-size: 18px; }
.timecol small { font-size: 12px; color: var(--muted); }
.weekno { font-family: var(--display); color: var(--skytext); width: 32px; }

/* controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 12px 16px; border-radius: 14px; border: 1.5px solid rgba(255,255,255,.35); background: transparent; font-weight: 700; font-size: 15px; text-align: center; }
.btn.primary { background: var(--deep); border-color: var(--deep); }
.btn.sand { background: var(--sand); border-color: var(--sand); color: var(--deep); }
.btn.ghost { border-color: transparent; color: var(--soft); font-weight: 600; }
.btn.danger { color: #FFC9C2; }
.btn.small { min-height: 40px; padding: 8px 12px; font-size: 13px; }
.btn[disabled] { opacity: .45; cursor: default; }
.filebtn { position: relative; }
.iconbtn { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 50%; border: none; background: var(--card); flex-shrink: 0; }
.iconbtn.sm { width: 36px; height: 36px; font-weight: 700; font-size: 18px; }
.iconbtn.sand { background: var(--sand); color: var(--deep); }
.iconbtn.lg { width: 52px; height: 52px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; }
.chip { border: 1.5px solid rgba(255,255,255,.3); background: transparent; border-radius: 999px; padding: 8px 14px; min-height: 40px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.chip.on { background: var(--sand); border-color: var(--sand); color: var(--deep); }
.chip.warn { color: #FFC9C2; border-color: rgba(255,201,194,.5); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; background: var(--nav); border-radius: 14px; }
.seg .chip { border: none; border-radius: 10px; min-height: 42px; }
.seg7 .chip { padding: 8px 0; font-size: 12px; }
.pill { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 700; background: rgba(255,255,255,.12); white-space: nowrap; }
.pill.sky { background: rgba(75,180,222,.2); color: var(--skytext); }
.pill.sand { background: var(--sand); color: var(--deep); }
.pill.warn { background: rgba(224,162,28,.2); color: #FFE2A6; }
.pill.small { font-size: 11px; padding: 3px 8px; }

/* forms */
.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
input:not([type=file]):not([type=checkbox]), textarea, select { width: 100%; border: 1px solid transparent; background: var(--nav); color: var(--text); border-radius: 14px; padding: 12px 14px; min-height: 48px; font-size: 16px; font-weight: 400; }
textarea { resize: vertical; line-height: 1.45; }
input::placeholder, textarea::placeholder { color: #AEBBD0; }
input:focus, textarea:focus { border-color: var(--sky); outline: none; }
input[type=date], input[type=time] { color-scheme: dark; }

/* avatars */
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--sand); color: var(--deep); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.avatar.blue { background: var(--blue); color: #fff; }
.avatar.lg { width: 60px; height: 60px; font-size: 20px; font-family: var(--display); }
.avatar.sm { width: 30px; height: 30px; font-size: 10px; }
.avatar.ghost { background: transparent; border: 1.5px dashed rgba(255,255,255,.4); color: var(--muted); }
.avatars { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.avatars.sm { gap: 4px; }
.av-col { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; color: var(--soft); }
.player-row { gap: 14px; }

/* progress */
.ring { position: relative; display: inline-block; flex-shrink: 0; }
.ring svg { position: absolute; inset: 0; }
.ring-label { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; font-family: var(--display); font-weight: 700; font-size: 18px; }
.ring-label strong { font-size: 34px; line-height: 1; }
.ring-label small { font-family: var(--font); font-weight: 500; font-size: 12px; color: var(--muted); }
.hero-level { display: flex; align-items: center; gap: 18px; }
.bar { display: block; width: 100%; max-width: 160px; height: 8px; border-radius: 999px; background: rgba(255,255,255,.12); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--sand); border-radius: 999px; }
.tile { background: var(--card); border-radius: 18px; padding: 14px 6px 12px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.tile-name { font-size: 13px; font-weight: 600; }
.delta { font-size: 11px; font-weight: 700; color: var(--muted); }
.delta.up { color: var(--skytext); }
.heat { display: grid; grid-template-columns: 104px repeat(var(--cols), minmax(0, 1fr)); gap: 3px; align-items: center; }
.heat-name { font-size: 12px; font-weight: 600; }
.heat-cell { height: 24px; border-radius: 5px; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,.08); }
.heat-cell.l1 { background: #6F86A8; } .heat-cell.l2 { background: #BFE3F3; color: var(--ink); } .heat-cell.l3 { background: var(--sky); color: var(--ink); }
.heat-cell.l4 { background: var(--sand); color: var(--deep); } .heat-cell.l5 { background: #fff; color: var(--deep); }

/* reports */
.report { display: flex; flex-direction: column; gap: 14px; }
.quote { font-size: 15px; color: var(--soft); font-style: italic; background: var(--nav); border-radius: 14px; padding: 12px 14px; }
.stat { background: var(--nav); border-radius: 16px; padding: 12px; display: flex; flex-direction: column; }
.stat b { font-family: var(--display); font-size: 26px; color: var(--sand); line-height: 1.1; }
.stat small { display: none; }
.stat span { font-size: 12px; color: var(--muted); }
.techgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.techtile { background: var(--nav); border-radius: 16px; padding: 10px 8px; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; font-size: 12px; font-weight: 600; }
.techtile b { font-family: var(--display); font-size: 22px; }
.techtile small { color: var(--muted); font-size: 11px; font-weight: 500; }
.line { display: flex; gap: 10px; font-size: 14px; line-height: 1.45; }
.plus { color: var(--skytext); font-weight: 700; } .arrow { color: var(--sand); font-weight: 700; }
.homework { display: flex; flex-direction: column; gap: 6px; background: var(--sand); color: var(--deep); border-radius: 14px; padding: 12px 14px; font-size: 14px; }
.homework .kicker { color: var(--deep); }
.list-s { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--soft); }
.shout { display: flex; gap: 10px; align-items: center; background: var(--nav); border-radius: 14px; padding: 12px; color: var(--sand); font-size: 14px; }
.shout span { color: var(--text); }
.answer { background: var(--nav); border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.light { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 4px 10px 4px 8px; font-size: 12px; font-weight: 600; }
.light i { width: 8px; height: 8px; border-radius: 50%; }
.light.g { background: var(--gbg); color: var(--gfg); } .light.g i { background: var(--g); }
.light.a { background: var(--abg); color: var(--afg); } .light.a i { background: var(--a); }
.light.r { background: var(--rbg); color: var(--rfg); } .light.r i { background: var(--r); }
.g-text { color: #A7E3BF; } .r-text { color: #FFC9C2; }
.light-row { display: grid; grid-template-columns: 76px repeat(3, minmax(0, 1fr)); gap: 6px; align-items: center; }
.light-name { font-size: 14px; font-weight: 500; }
.lightbtn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; border-radius: 12px; border: 1.5px solid rgba(255,255,255,.25); background: transparent; font-size: 13px; font-weight: 600; }
.lightbtn i { width: 8px; height: 8px; border-radius: 50%; }
.lightbtn.g i { background: var(--g); } .lightbtn.a i { background: var(--a); } .lightbtn.r i { background: var(--r); }
.lightbtn.g.on { background: var(--gbg); color: var(--gfg); border-color: var(--g); }
.lightbtn.a.on { background: var(--abg); color: var(--afg); border-color: var(--a); }
.lightbtn.r.on { background: var(--rbg); color: var(--rfg); border-color: var(--r); }

/* wrap-up */
.progressdots { display: flex; gap: 6px; }
.progressdots i { flex: 1; height: 5px; border-radius: 999px; background: rgba(255,255,255,.18); }
.progressdots i.done { background: var(--sky); } .progressdots i.cur { background: var(--sand); }
.rate-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line); }
.rate-row:first-of-type { border-top: none; }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper b { min-width: 30px; text-align: center; font-family: var(--display); }
.stepper.big b { font-size: 22px; }
.stepper.big .iconbtn { width: 44px; height: 44px; font-size: 22px; font-weight: 700; background: var(--nav); }
.dots5 { display: flex; gap: 6px; }
.dots5 button { width: 24px; height: 24px; border-radius: 50%; border: 2px solid rgba(255,255,255,.35); background: transparent; padding: 0; }
.dots5 button.on { background: var(--sand); border-color: var(--sand); }
.more summary { cursor: pointer; font-size: 13px; color: var(--skytext); font-weight: 600; padding: 6px 0; }
.more .chips { margin-top: 8px; }
.bigcheck { width: 84px; height: 84px; border-radius: 50%; background: var(--sand); color: var(--deep); display: flex; align-items: center; justify-content: center; }

/* groups */
.slots { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; margin-top: 4px; }
.slots i { height: 6px; border-radius: 999px; background: rgba(255,255,255,.18); }
.slots i.on { background: var(--sky); }
.qrcard { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.qr { background: #fff; border-radius: 16px; padding: 6px; line-height: 0; }
.code { font-family: var(--display); letter-spacing: .12em; color: var(--sand); }
.qrcard .row2 { width: 100%; }

/* exercises */
.ex-card { display: flex; flex-direction: column; gap: 8px; padding: 12px; }
.thumbbox { display: flex; justify-content: center; align-items: center; background: var(--nav); border-radius: 14px; padding: 8px; }
.thumbwrap { line-height: 0; }
svg.court { display: block; max-width: 100%; height: auto; }
.court-card { display: flex; gap: 14px; align-items: flex-start; }
.court-wrap { line-height: 0; flex-shrink: 0; }
.court-wrap.tap svg { cursor: crosshair; touch-action: manipulation; }
.caption { font-size: 15px; font-weight: 600; min-height: 44px; }
.numline { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.45; }
.numline b { width: 24px; height: 24px; flex-shrink: 0; border-radius: 50%; background: var(--sky); color: var(--ink); font-size: 12px; display: flex; align-items: center; justify-content: center; }
.video { width: 100%; border-radius: 18px; background: #000; max-height: 60vh; }
.animator { display: flex; gap: 12px; align-items: flex-start; }
.animator .court-wrap svg { width: 180px; height: 360px; }
.elchip { display: flex; align-items: center; gap: 8px; border: 1.5px solid transparent; background: var(--nav); border-radius: 12px; padding: 8px 10px; min-height: 44px; font-size: 13px; font-weight: 600; text-align: left; width: 100%; }
.elchip.on { background: var(--sand); color: var(--deep); }
.sw { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--deep); flex-shrink: 0; }
.sw.player { background: var(--sand); } .sw.coach { background: #fff; } .sw.opp { background: #fff; border-style: dashed; } .sw.ball { background: var(--ball); }

/* player home */
.countdown { background: var(--sand); color: var(--deep); border-radius: 16px; padding: 8px 12px; display: flex; flex-direction: column; align-items: center; min-width: 64px; }
.countdown b { font-family: var(--display); font-size: 28px; line-height: 1; }
.countdown small { font-size: 11px; font-weight: 700; }
.timeline { display: flex; flex-direction: column; }
.tl-item { display: flex; align-items: center; gap: 14px; padding: 10px 0; border-left: 2px solid var(--line); margin-left: 7px; padding-left: 16px; position: relative; }
.tl-dot { position: absolute; left: -8px; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--sky); background: var(--bg); }
.tl-dot.key { background: var(--sand); border-color: var(--sand); }

/* player card */
.pcard { background: var(--deep); border-radius: 28px; padding: 22px; display: flex; flex-direction: column; gap: 16px; }
.brandmini { display: inline-flex; align-items: center; gap: 6px; font-family: var(--display); font-weight: 700; }
.brandmini i { width: 10px; height: 10px; border-radius: 50%; background: var(--sand); }
.pcard-level { display: flex; align-items: center; gap: 14px; background: var(--card); border-radius: 18px; padding: 12px 16px; }
.pcard-level b { font-family: var(--display); font-size: 48px; color: var(--sand); line-height: 1; }
.skill { display: grid; grid-template-columns: 1fr auto 74px; gap: 10px; align-items: center; font-size: 13px; font-weight: 600; }
.skill small { color: var(--muted); font-size: 11px; text-align: right; font-weight: 500; }
.segs { display: grid; grid-template-columns: repeat(5, 16px); gap: 3px; }
.segs i { height: 8px; border-radius: 3px; background: rgba(255,255,255,.15); }
.segs i.sky { background: var(--sky); } .segs i.sand { background: var(--sand); }
.cardicon { width: 36px; height: 52px; border-radius: 8px; background: var(--blue); border: 2px solid var(--sand); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.cardicon i { width: 12px; height: 12px; border-radius: 50%; background: var(--sand); }

/* welcome */
.welcome { display: flex; flex-direction: column; gap: 18px; padding-top: 6vh; }
.welcome h1 { font-size: 44px; }
.hero-mark { line-height: 0; }
.invite { margin-top: 12px; padding-top: 18px; border-top: 1px solid var(--line); }
.hero { background: var(--deep); border-radius: 22px; padding: 20px; display: flex; flex-direction: column; gap: 6px; }
.hero .big { font-size: 26px; font-family: var(--display); }

/* toast */
.toast { position: fixed; left: 50%; bottom: calc(92px + var(--safe-b)); transform: translate(-50%, 20px); background: var(--deep); color: #fff; padding: 12px 18px; border-radius: 999px; font-size: 14px; font-weight: 600; box-shadow: 0 8px 24px rgba(0,0,0,.25); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: 90vw; text-align: center; z-index: 10; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 521px) { body { background: #2E4262; } .app { box-shadow: 0 0 60px rgba(0,0,0,.25); } }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

/* fixes after first visual pass */
.main > * { flex-shrink: 0; }
.grow > strong, .grow > span { display: block; }
.preview select { width: auto; min-height: 0; padding: 3px 6px; font-size: 12px; border-radius: 8px; background: #fff; color: var(--deep); }
.tl-item { min-height: 56px; }
.tl-dot { flex: none; width: 14px !important; height: 14px !important; top: 50%; margin-top: -7px; padding: 0; }
