:root {
  color-scheme: light;
  font-family: system-ui, "Noto Sans TC", sans-serif;
  color: #222320;
  background: #f4f5f2;
  --border: #dce0d9;
  --muted: #515750;
  --accent: #a34016;
  --accent-light: #fff0e4;
  --surface: #fff;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 280px; }
button, input, select, textarea { font: inherit; }
button, summary { cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3, p { margin: 0; overflow-wrap: anywhere; }
h1 { font-size: clamp(1.75rem,4vw,2.5rem); letter-spacing: -.04em; }
h2 { font-size: 1.17rem; }
h3 { font-size: 1.06rem; }
small, .muted { color: var(--muted); }
.muted { margin: .4rem 0; }
.site-header { background: #1f2422; color: #fff; padding: 0 max(1rem,calc((100vw - 1260px)/2)); }
.site-brand, nav, .section-toolbar, .month-toolbar, .session-actions, .filters, .subnav, .settings, .dialog-header, .dialog-actions, .drill-form-title {
  display: flex; align-items: center; gap: .65rem;
}
.site-brand { padding: .75rem 0; flex-wrap: wrap; }
.site-brand > strong { letter-spacing: .12em; font-size: 1.15rem; color: #ffab75; }
#team-button { color: #fff; text-align: left; white-space: normal; overflow-wrap: anywhere; }
#team-season { color: #ddd; margin-inline-start: .65rem; }
nav { gap: .4rem; }
nav a { text-decoration: none; padding: .7rem .8rem; border-radius: .45rem .45rem 0 0; }
nav a[aria-current="page"] { background: #f4f5f2; color: #222320; font-weight: 700; }
main { width: min(1260px,calc(100% - 2rem)); margin: 1.5rem auto; }
.section-toolbar, .dialog-header, .drill-form-title { justify-content: space-between; }
.surface { background: var(--surface); border: 1px solid var(--border); border-radius: .8rem; padding: 1rem; min-width: 0; }
.primary-button, .secondary-button, .text-button, .danger-button, .icon-button, .mark {
  padding: .45rem .7rem; min-height: 2.6rem; border-radius: .5rem; border: 1px solid transparent; font-weight: 650;
}
.primary-button { background: var(--accent); color: #fff; white-space: nowrap; }
.primary-button:hover { background: #873211; }
.secondary-button, .icon-button, .mark { background: #fff; color: inherit; border-color: var(--border); }
.secondary-button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-light); color: var(--accent); }
.text-button { background: transparent; color: var(--accent); }
.text-button:hover { text-decoration: underline; }
.danger-button { background: #a32c2c; color: #fff; }
#next-goal { background: var(--accent-light); color: #6a321b; margin-top: .85rem; padding: .25rem .6rem; border-radius: .55rem; }
#next-goal span { margin-inline-start: .5rem; }
.month-layout { margin-top: .9rem; display: grid; grid-template-columns: minmax(0,2fr) minmax(0,1fr); gap: 1rem; align-items: start; }
.month-toolbar { margin-bottom: .65rem; flex-wrap: wrap; }
.month-toolbar h2 { text-align: center; min-width: 7rem; }
.month-toolbar .secondary-button { min-width: 2.6rem; font-size: 1.3rem; padding: 0; }
.month-grid { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); gap: .2rem; }
.weekday { text-align: center; color: var(--muted); padding-bottom: .35rem; }
.calendar-day, .outside-day {
  min-width: 0; min-height: 6rem; border: 1px solid var(--border); border-radius: .35rem; background: #fff; text-align: left; color: inherit;
  display: flex; flex-direction: column; align-items: flex-start; gap: .16rem; padding: .3rem;
}
.outside-day { background: #f5f6f4; border-color: transparent; }
.calendar-day:hover { background: #f5f6f4; }
.calendar-day[aria-pressed="true"] { border-color: var(--accent); background: #fff9f5; box-shadow: inset 0 0 0 1px var(--accent); }
.date-number { display: grid; min-width: 1.55rem; height: 1.55rem; place-items: center; border-radius: 50%; }
.is-today .date-number { background: var(--accent); color: #fff; font-weight: 700; }
.event-tag { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .87rem; padding: .08rem .26rem; border-radius: .25rem; }
.event-tag.practice { background: #e5f1e9; color: #204e39; }
.event-tag.competition { background: #f8e7dc; color: #7b3618; }
.more-events { font-size: .8rem; }
.day-session, .day-goal, .flow { border-top: 1px solid var(--border); padding-top: .65rem; margin-top: .65rem; }
.day-goal span { color: var(--muted); }
.session-picker, .session-actions { margin-top: .6rem; display: flex; flex-wrap: wrap; gap: .35rem; }
.flow ol { padding-inline-start: 1.5rem; }
.flow li { margin-top: .45rem; }
.flow li span { color: var(--muted); white-space: nowrap; }
.flow p { margin-top: .5rem; white-space: pre-wrap; }
#goals-list, .subnav { margin: .85rem 0; }
.goal-card { margin-bottom: .55rem; }
.goal-card > summary { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr) auto; align-items: center; gap: .5rem; overflow-wrap: anywhere; }
.status-pill { background: #eef1ed; border-radius: .4rem; padding: .2rem .45rem; white-space: nowrap; }
.goal-body { margin-top: .65rem; padding-top: .65rem; border-top: 1px solid var(--border); }
.goal-body p { white-space: pre-wrap; margin: .3rem 0 .65rem; }
.goal-body ul { padding-inline-start: 1rem; }
.filters { gap: .75rem; margin: .75rem 0; flex-wrap: wrap; }
label { display: grid; gap: .28rem; font-weight: 650; min-width: 0; }
input, select, textarea { width: 100%; min-width: 0; color: inherit; background: #fff; border-radius: .35rem; padding: .48rem; border: 1px solid #aeb6ab; }
textarea { resize: vertical; }
table { width: 100%; border-collapse: collapse; text-align: left; table-layout: fixed; }
th, td { padding: .45rem .25rem; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
thead { color: var(--muted); }
th:first-child { width: 37%; }
#roster-count { font-size: .86rem; font-weight: 500; white-space: nowrap; }
.session-label { max-width: 25rem; margin-top: .5rem; }
.attendance-summary { display: flex; flex-wrap: wrap; gap: .65rem; margin: .65rem 0; }
.attendance-summary span { background: #f1f3f0; padding: .2rem .4rem; border-radius: .3rem; }
.attendance-row { display: grid; grid-template-columns: minmax(5rem,1fr) auto; align-items: center; gap: .4rem; border-top: 1px solid var(--border); padding: .45rem 0; }
.attendance-row > strong { overflow-wrap: anywhere; }
.attendance-row > div { display: flex; gap: .25rem; flex-wrap: wrap; }
.mark[aria-pressed="true"] { background: #e7ece7; border-color: #727b73; }
.mark.present[aria-pressed="true"] { background: #dff2e7; color: #23523a; border-color: #488163; }
.mark.leave[aria-pressed="true"] { background: #fff2cb; color: #634516; border-color: #a87325; }
.mark.absent[aria-pressed="true"] { background: #fae3e1; color: #812d2b; border-color: #ac5752; }
#attendance-monthly { margin-top: 1.25rem; padding-top: .9rem; border-top: 1px solid var(--border); }
.monthly-player { border-bottom: 1px solid var(--border); padding: .6rem 0; }
.monthly-player summary { display: grid; grid-template-columns: minmax(0,1fr) repeat(3,auto); gap: .75rem; overflow-wrap: anywhere; }
.monthly-player summary strong::before { content: "+ "; color: var(--accent); }
.monthly-player[open] summary strong::before { content: "− "; }
.monthly-player ul { list-style: none; padding: 0 .5rem; margin: .4rem 0; }
.monthly-player li { padding: .35rem 0; display: flex; justify-content: space-between; gap: .4rem; }
.monthly-player li strong { white-space: nowrap; }
.settings { margin-top: 1.2rem; flex-wrap: wrap; color: var(--muted); font-size: .875rem; }
.settings summary { margin: .5rem 0; }
dialog { width: min(36rem,calc(100% - 1.5rem)); max-height: calc(100% - 1.5rem); overflow: auto; padding: 1rem; border: 1px solid var(--border); border-radius: .8rem; color: inherit; }
dialog::backdrop { background: #171a20a6; }
dialog form { display: grid; gap: .65rem; }
.dialog-actions { justify-content: flex-end; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .65rem; }
.drill-field { display: grid; grid-template-columns: minmax(0,1fr) 5rem auto; gap: .3rem; margin: .3rem 0; }
.form-error { color: #a32c2c; }
.form-error:empty { display: none; }
.form-help { color: var(--muted); font-size: .875rem; }
.toast { position: fixed; inset: auto 1rem 1rem; width: fit-content; max-width: calc(100% - 2rem); background: #222822; color: #fff; border-radius: .5rem; padding: .6rem .9rem; display: none; z-index: 2; }
.toast.visible { display: block; }
@media (max-width: 830px) {
  .month-layout { grid-template-columns: 1fr; gap: .65rem; }
}
@media (max-width: 500px) {
  main { width: calc(100% - 1rem); margin-top: .8rem; }
  .site-header { padding-inline: .5rem; }
  .site-brand, nav a { padding-inline: .5rem; }
  nav { gap: .15rem; }
  .surface { padding: .55rem; }
  .month-grid { gap: .12rem; }
  .calendar-day, .outside-day { min-height: 4.9rem; padding: .16rem; }
  .event-tag { padding-inline: .11rem; }
  .attendance-row { grid-template-columns: 1fr; }
  .attendance-row > div { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); }
  .mark { padding-inline: .15rem; }
  .monthly-player summary { gap: .4rem; }
  .goal-card > summary { grid-template-columns: minmax(0,1fr) auto; }
  .goal-card > summary > span:nth-child(2) { grid-row: 2; }
}

.system-card { margin-bottom: .75rem; }
.system-card > .secondary-button { margin: .5rem 0; }
.tactic-card { border-top: 1px solid var(--border); padding: .55rem 0; }
.tactic-card > summary { display: flex; align-items: center; justify-content: space-between; gap: .5rem; overflow-wrap: anywhere; }
.tactic-card > summary strong::before { content: "＋ "; color: var(--accent); }
.tactic-card[open] > summary strong::before { content: "− "; }
.tactic-body { padding: .65rem 0 0 .3rem; }
.tactic-body p { margin: .25rem 0 .6rem; white-space: pre-wrap; }
.tactic-links { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.tactic-links a { display: inline-flex; align-items: center; }
.tactic-image { display: block; max-width: 100%; max-height: 32rem; margin: .5rem 0; object-fit: contain; }
#tactic-fields { display: grid; gap: .65rem; }
.drill-tactic { grid-column: 1 / -1; }
.tactic-checkbox { display: flex; align-items: flex-start; gap: .5rem; padding: .4rem 0; }
.tactic-checkbox input { width: 1.1rem; height: 1.1rem; flex-shrink: 0; }
@media (max-width: 500px) {
  nav { flex-wrap: wrap; }
  nav a { padding-inline: .3rem; }
}

.clip-list { margin-top: .65rem; }
.video-detail { margin-top: .85rem; }
.video-frame { display: block; width: min(100%, 52rem); aspect-ratio: 16 / 9; margin: .55rem 0; border: 0; background: #222; }

:root {
  --border:#e0dbd2; --muted:#5c5851; --accent:#9d3b15; --accent-light:#ffebd9;
  background:#f7f4ed; color:#24221e;
}
.site-header { background:#1a1c1d; padding-top:.4rem; }
.site-brand > strong { font-family: "Arial Black",system-ui,sans-serif; font-weight:950; letter-spacing:.18em; }
nav a[aria-current="page"] { background:#f7f4ed; }
.surface { border-radius:1rem; box-shadow:0 12px 28px #2d20100a; }
p { line-height:1.6; }
.team-hero {
  min-height:22rem; display:flex; align-items:end; color:#fff8ef;
  border-radius:1.25rem; overflow:hidden;
  background:linear-gradient(90deg,#191b1df2,#191b1d66 62%,#18161622),#18191b url('/hero.webp') center right/cover;
}
.hero-copy { max-width:42rem; padding:clamp(1.3rem,5vw,4rem); }
.hero-copy > p:first-child { color:#ffbc88; font-weight:750; }
.hero-copy h1 { font-size:clamp(2.2rem,5vw,4.5rem); line-height:1.1; margin:.45rem 0 .6rem; }
.hero-meta { font-weight:700; }
.hero-copy .tactic-links { margin-top:.8rem; }
.hero-copy .text-button { color:#ffca9d; padding-inline:0; }
.home-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:.85rem; margin-top:.85rem; }
.home-card { padding:clamp(.85rem,2vw,1.4rem); }
.home-card > .text-button { display:inline-block; }
.weekly-practice + .weekly-practice { border-top:1px solid var(--border); margin-top:.6rem; padding-top:.6rem; }
.weekly-practice button { text-align:left; padding-inline:0; }
.announcement { background:var(--accent-light); padding:.7rem 1rem; border-radius:.6rem; margin-bottom:.75rem; white-space:pre-wrap; }
.team-admin { margin-top:1rem; }
.team-admin form { display:flex; flex-wrap:wrap; align-items:end; gap:.5rem; margin:.65rem 0; }
.team-admin form label { flex:1 1 14rem; }
.member-row { padding:.45rem 0; overflow-wrap:anywhere; }
.member-row code { user-select:all; }
.court-board { display:block; width:min(100%,32rem); height:auto; border-radius:.65rem; margin:.65rem 0; }
.board-tabs { display:flex; gap:.35rem; flex-wrap:wrap; margin:.55rem 0; }
.board-view { margin:.55rem 0 1rem; }
.board-cue { font-weight:650; }
#editor-court { cursor:crosshair; }
#board-editor > label, #board-editor > .form-grid { margin:.5rem 0; }
body:not([data-role="owner"]) :is(.admin-only,#team-button,#add-button,#add-goal,#add-system,#add-match,#add-player,#bulk-players,[data-add-date],[data-edit],[data-delete],[data-edit-goal],[data-edit-player],[data-add-tactic],[data-edit-system],[data-edit-tactic],[data-add-clip],[data-edit-match],[data-edit-clip]) { display:none !important; }
.mark:disabled { cursor:default; opacity:1; }
@media (max-width:580px) {
  .team-hero { min-height:17rem; background-position:64% center; }
  .home-grid { grid-template-columns:1fr; }
  nav a { padding:.55rem .28rem; font-size:.88rem; }
  nav { flex-wrap:wrap; }
}
.team-label { font-weight:650; overflow-wrap:anywhere; }
#team-button { font-size:.9rem; }

.playbook-tools { display:flex; align-items:center; gap:.8rem; flex-wrap:wrap; margin:.85rem 0; }
.playbook-tools .subnav { margin:0; }
#tactic-search { flex:1 1 12rem; max-width:24rem; }
.compact-tactic { margin-bottom:.45rem; padding:.7rem .85rem; }
.compact-tactic summary small { display:block; margin:.18rem 0 0 1.45rem; }
.compact-tactic .tactic-body { padding:.65rem 0 0; }
.tactic-more { margin-bottom:.5rem; }
.tactic-more h3 { margin-top:.45rem; }
.playbook-management { margin-top:.85rem; }
.playbook-management > button { margin-top:.65rem; }
.manage-system { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:.45rem; padding:.6rem 0; border-bottom:1px solid var(--border); }
.guide-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.6rem;margin:.8rem 0}
.guide-tile{text-align:left;color:inherit}.guide-tile strong,.guide-tile small{display:block}.guide-tile strong{font-size:1.1rem;margin-top:.25rem}.guide-tile[aria-pressed=true]{border-color:var(--accent);background:var(--accent-light)}
.guide-detail{margin-bottom:.8rem}.guide-detail label{max-width:22rem}.guide-ref{padding:.65rem 0;border-bottom:1px solid var(--border)}.guide-ref a{font-weight:700;color:var(--accent);overflow-wrap:anywhere}#position-fields fieldset{border:1px solid var(--border);margin:.5rem 0;border-radius:.5rem}
.portal{background:#f6f3ed}.portal-head{background:#191d1c;color:white;display:flex;align-items:center;gap:2rem;padding:.85rem max(1rem,calc((100vw - 1260px)/2));flex-wrap:wrap}
.portal-wordmark{display:grid;line-height:1.1;text-decoration:none;font-family:"Archivo Black",system-ui,sans-serif;font-weight:950;font-style:italic;letter-spacing:.06em;font-size:1.45rem;color:#ffc49a}.portal-wordmark span{font:600 .8rem system-ui;color:#fff;margin-top:.25rem}
.portal-head nav{flex:1}.portal-login{margin-left:auto;background:#ffad71;border:0;padding:.7rem 1.1rem;border-radius:.5rem;font-weight:750}.portal-title{display:flex;flex-wrap:wrap;align-items:baseline;gap:.8rem;margin:.6rem 0}.portal-title span,.captain-link{color:var(--muted);font-size:.9rem}.portal-title h2{font-size:1.5rem}
.game-strip{display:flex;gap:.7rem;overflow-x:auto;scroll-snap-type:x proximity}.game-strip>p,#films>p{padding:.75rem 0;color:var(--muted)}
.game-card{flex:0 0 min(17rem,85%);scroll-snap-align:start;background:white;border:1px solid var(--border);border-top:3px solid var(--accent);padding:1rem}.game-card h3{margin-top:.6rem}
.portal-hero{margin:1rem 0 1.5rem;min-height:clamp(20rem,43vw,34rem);display:flex;align-items:end;padding:clamp(1.5rem,5vw,4.5rem);color:white;border-radius:1rem;background:linear-gradient(90deg,#101415e3,#10141520),#202220 url('/hero.webp') center/cover}
.portal-hero h1{font-size:clamp(2.2rem,6vw,5rem)}.portal-hero a{display:inline-block;color:#ffd6b7;margin-top:1rem}.portal #films a{display:block;padding:.65rem 0}.club-home,#club-logout{color:#ffbd8c}
@media(max-width:650px){.portal-head{gap:.45rem}.portal-head nav{order:3;flex:1 1 100%}.portal-head nav a{padding:.5rem .65rem}.portal main{width:calc(100% - 1.2rem)}}

.cs-badge{display:block;flex:none;width:44px;height:44px;filter:drop-shadow(0 0 1px #fff) drop-shadow(0 0 1px #fff);object-fit:contain}.portal-wordmark{display:inline-flex;align-items:center;gap:8px}
