:root {
  color-scheme: light;
  --ink: #18201b;
  --muted: #647067;
  --line: #dce4dc;
  --field: #2f8a49;
  --field-dark: #24733b;
  --gold: #e0ad31;
  --coral: #dd624c;
  --teal: #247f83;
  --blue: #376aa6;
  --bg: #f5f7f3;
  --panel: #ffffff;
  --shadow: 0 14px 38px rgba(27, 39, 29, 0.11);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: clip;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

.app-shell {
  display: grid;
  grid-template-columns: 296px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px;
  overflow-y: auto;
  color: #f8fff8;
  background:
    linear-gradient(rgba(18, 69, 38, 0.93), rgba(18, 69, 38, 0.96)),
    repeating-linear-gradient(90deg, #1f7b3b 0 54px, #258844 54px 108px);
}

.sidebar-header {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 36px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 0;
  margin-bottom: 0;
}

.mobile-filter-toggle {
  display: none;
}

.sidebar-toggle {
  display: grid;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 8px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.sidebar-toggle-icon {
  width: 9px;
  height: 9px;
  border-bottom: 2px solid currentColor;
  border-left: 2px solid currentColor;
  transform: translateX(2px) rotate(45deg);
}

.brand-mark {
  display: grid;
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  font-weight: 800;
}

.brand h1,
.brand p,
.filter-section h2,
.topbar h2,
.section-title h2 {
  margin: 0;
}

.brand h1 {
  font-size: 1.05rem;
  line-height: 1.2;
}

.brand p {
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.87rem;
}

.filter-section {
  margin-top: 28px;
}

.filter-section h2 {
  margin-bottom: 10px;
  font-size: 0.82rem;
  letter-spacing: 0;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.72);
}

.segmented,
.chip-list {
  display: grid;
  gap: 8px;
}

.filter-button,
.chip-button {
  min-width: 0;
  min-height: 40px;
  padding: 9px 12px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  color: #f8fff8;
  background: rgba(255, 255, 255, 0.08);
  text-align: left;
}

.filter-button[aria-pressed="true"],
.chip-button[aria-pressed="true"] {
  color: #15341f;
  background: #f3f8ef;
  border-color: #f3f8ef;
}

.clear-filters {
  width: 100%;
  min-height: 40px;
  margin-top: 22px;
  padding: 9px 12px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  color: #ffffff;
  background: transparent;
  font-weight: 750;
}

.clear-filters:disabled {
  cursor: default;
  opacity: 0.45;
}

main {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--teal);
  font-size: 0.79rem;
  font-weight: 800;
  text-transform: uppercase;
}

.topbar h2 {
  max-width: 700px;
  font-size: 3.4rem;
  line-height: 1.02;
  overflow-wrap: anywhere;
}

.topbar-actions {
  display: flex;
  flex: 0 0 min(520px, 100%);
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
}

.language-toggle {
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--teal);
  border-radius: 8px;
  color: #ffffff;
  background: var(--teal);
  font-weight: 800;
  white-space: nowrap;
}

.search {
  display: flex;
  align-items: center;
  width: min(360px, 100%);
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 8px 18px rgba(26, 38, 26, 0.06);
}

.search span {
  color: var(--muted);
  font-size: 1.25rem;
}

.search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
}

.overview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.overview > div {
  min-height: 90px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.metric {
  display: block;
  font-size: 1.8rem;
  font-weight: 850;
}

.metric-label {
  color: var(--muted);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.72fr);
  gap: 20px;
  align-items: start;
}

.library,
.detail-panel,
.detail,
.demo-visual {
  min-width: 0;
}

.section-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-title h2 {
  font-size: 1.1rem;
}

.section-title span {
  color: var(--muted);
  font-size: 0.9rem;
}

.drill-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(236px, 1fr));
  gap: 14px;
}

.drill-card {
  display: grid;
  gap: 12px;
  min-height: 250px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 8px 22px rgba(28, 39, 30, 0.06);
  text-align: left;
}

.drill-card.active {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(36, 127, 131, 0.14), var(--shadow);
}

.mini-field,
.demo-field {
  display: block;
  width: 100%;
  border-radius: 8px;
  background: var(--field);
}

.mini-field {
  aspect-ratio: 32 / 13;
  height: auto;
}

.drill-card h3 {
  margin: 0;
  font-size: 1rem;
}

.drill-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-self: end;
}

.badge {
  padding: 4px 7px;
  border-radius: 999px;
  color: #263027;
  background: #ecf1e7;
  font-size: 0.78rem;
  font-weight: 700;
}

.detail-panel {
  position: sticky;
  top: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.detail {
  display: grid;
  gap: 18px;
  padding: 18px;
}

.detail-header {
  display: grid;
  gap: 10px;
}

.detail-header h2 {
  margin: 0;
  font-size: 1.55rem;
}

.detail-header p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.demo-visual {
  position: relative;
  display: grid;
  gap: 8px;
  margin: 0;
}

.demo-field {
  aspect-ratio: 45 / 26;
  height: auto;
}

.demo-caption {
  min-height: 24px;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 800;
  text-align: center;
}

.animation-controls {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 6px;
}

.animation-toggle,
.animation-restart,
.animation-fullscreen {
  display: grid;
  width: 38px;
  height: 38px;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  color: #ffffff;
  background: rgba(24, 32, 27, 0.72);
  font-size: 0.95rem;
  line-height: 1;
}

body.fullscreen-fallback-open {
  overflow: hidden;
}

.demo-visual:fullscreen,
.demo-visual:-webkit-full-screen,
.demo-visual.fullscreen-fallback {
  box-sizing: border-box;
  width: var(--fullscreen-width, 100vw);
  height: var(--fullscreen-height, 100vh);
  height: var(--fullscreen-height, 100dvh);
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  grid-template-rows: minmax(0, 1fr) auto auto auto;
  background: #101a13;
}

.demo-visual.fullscreen-fallback {
  position: fixed;
  z-index: 1000;
  inset: 0;
}

.demo-visual:fullscreen .demo-field,
.demo-visual:-webkit-full-screen .demo-field,
.demo-visual.fullscreen-fallback .demo-field {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
}

.demo-visual:fullscreen .animation-controls,
.demo-visual:-webkit-full-screen .animation-controls,
.demo-visual.fullscreen-fallback .animation-controls {
  top: max(20px, env(safe-area-inset-top));
  right: max(20px, env(safe-area-inset-right));
}

[dir="rtl"] .demo-visual:fullscreen .animation-controls,
[dir="rtl"] .demo-visual:-webkit-full-screen .animation-controls,
[dir="rtl"] .demo-visual.fullscreen-fallback .animation-controls {
  right: auto;
  left: max(20px, env(safe-area-inset-left));
}

.demo-visual:fullscreen .demo-caption,
.demo-visual:-webkit-full-screen .demo-caption,
.demo-visual.fullscreen-fallback .demo-caption,
.demo-visual:fullscreen .animation-legend,
.demo-visual:-webkit-full-screen .animation-legend,
.demo-visual.fullscreen-fallback .animation-legend {
  color: #ffffff;
}

@media (orientation: landscape) and (max-height: 520px) {
  .demo-visual:fullscreen,
  .demo-visual:-webkit-full-screen,
  .demo-visual.fullscreen-fallback {
    gap: 5px;
    padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  }

  .demo-visual:fullscreen .demo-caption,
  .demo-visual:-webkit-full-screen .demo-caption,
  .demo-visual.fullscreen-fallback .demo-caption {
    min-height: 18px;
    font-size: 0.8rem;
  }

  .demo-visual:fullscreen .animation-legend,
  .demo-visual:-webkit-full-screen .animation-legend,
  .demo-visual.fullscreen-fallback .animation-legend {
    gap: 4px 10px;
    font-size: 0.65rem;
  }
}

[dir="rtl"] .animation-controls {
  right: auto;
  left: 10px;
}

.animation-phases {
  display: flex;
  gap: 5px;
  height: 6px;
  margin-top: 1px;
}

.animation-phases span {
  min-width: 16px;
  border-radius: 999px;
  background: #dce4dc;
}

.animation-phases span.complete {
  background: #8ab8ba;
}

.animation-phases span.active {
  background: var(--teal);
}

.animation-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 14px;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.73rem;
  font-weight: 700;
}

.animation-legend span {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.legend-line {
  display: inline-block;
  width: 24px;
  height: 0;
  border-top: 3px solid;
}

.player-line {
  border-color: #6c7a70;
  border-top-style: dashed;
}

.ball-line {
  border-color: #72b9da;
}

.gate-line {
  border-color: var(--gold);
  border-top-width: 6px;
  opacity: 0.65;
}

[dir="rtl"] .sidebar-toggle-icon {
  transform: translateX(-2px) rotate(225deg);
}

.step-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.step-list li {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  align-items: start;
  color: var(--muted);
  line-height: 1.45;
}

.step-list span {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  color: #ffffff;
  background: var(--blue);
  font-size: 0.82rem;
  font-weight: 800;
}

.coach-notes,
.training-options {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: 8px;
  background: #f1f5ee;
}

.coach-notes h3,
.training-options h3,
.video-panel h3 {
  margin: 0;
  font-size: 0.98rem;
}

.coach-notes p,
.training-options li,
.video-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.training-options {
  background: #eef6f6;
}

.training-options ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
}

[dir="rtl"] .brand,
[dir="rtl"] .sidebar-header,
[dir="rtl"] .topbar,
[dir="rtl"] .topbar-actions,
[dir="rtl"] .section-title,
[dir="rtl"] .search,
[dir="rtl"] .step-list li {
  direction: rtl;
}

[dir="rtl"] .filter-button,
[dir="rtl"] .chip-button,
[dir="rtl"] .drill-card,
[dir="rtl"] .detail,
[dir="rtl"] .overview > div {
  text-align: right;
}

[dir="rtl"] .training-options ul {
  padding-right: 18px;
  padding-left: 0;
}

.video-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.video-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 12px;
  border-radius: 8px;
  color: #ffffff;
  background: var(--teal);
  font-weight: 800;
  text-decoration: none;
}

.empty {
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--panel);
}

.detail-empty {
  margin: 18px;
}

@media (min-width: 721px) and (min-height: 521px),
  (min-width: 721px) and (pointer: fine) {
  .app-shell.sidebar-collapsed {
    grid-template-columns: 76px minmax(0, 1fr);
  }

  .sidebar-collapsed .sidebar {
    padding: 16px 12px;
    overflow: hidden;
  }

  .sidebar-collapsed .sidebar-header {
    flex-direction: column;
    gap: 12px;
    margin-bottom: 0;
  }

  .sidebar-collapsed .brand > div,
  .sidebar-collapsed .filter-panel {
    display: none;
  }

  .sidebar-collapsed .brand-mark {
    flex-basis: 44px;
    width: 44px;
    height: 44px;
  }

  .sidebar-collapsed .sidebar-toggle-icon {
    transform: translateX(-2px) rotate(225deg);
  }

  [dir="rtl"] .sidebar-collapsed .sidebar-toggle-icon {
    transform: translateX(2px) rotate(45deg);
  }
}

@media (max-width: 1080px) {
  .app-shell,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .sidebar,
  .detail-panel {
    position: static;
    height: auto;
  }

  .detail-panel {
    grid-row: 1;
  }

  .library {
    grid-row: 2;
  }

  .sidebar {
    padding: 18px;
  }

  .topbar h2 {
    font-size: 2.5rem;
  }

  .segmented,
  .chip-list {
    grid-template-columns: repeat(auto-fit, minmax(116px, 1fr));
  }
}

@media (max-width: 720px),
  (orientation: landscape) and (max-height: 520px) and (pointer: coarse) {
  .app-shell {
    width: 100%;
  }

  .sidebar {
    width: 100%;
    padding: 14px 16px;
    overflow: visible;
  }

  .sidebar-header {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0;
  }

  .brand {
    min-width: 0;
    margin-bottom: 0;
  }

  .brand-mark {
    flex-basis: 42px;
    width: 42px;
    height: 42px;
  }

  .brand h1 {
    font-size: 0.94rem;
  }

  .brand p {
    font-size: 0.8rem;
  }

  .mobile-filter-toggle {
    display: inline-flex;
    flex: 0 0 auto;
    gap: 8px;
    align-items: center;
    min-height: 40px;
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, 0.38);
    border-radius: 8px;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
    font-weight: 800;
  }

  .sidebar-toggle {
    display: none;
  }

  .active-filter-count {
    display: grid;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    place-items: center;
    border-radius: 10px;
    color: #15341f;
    background: #ffffff;
    font-size: 0.75rem;
  }

  .filter-toggle-icon {
    width: 8px;
    height: 8px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: translateY(-2px) rotate(45deg);
    transition: transform 160ms ease;
  }

  .mobile-filter-toggle[aria-expanded="true"] .filter-toggle-icon {
    transform: translateY(2px) rotate(225deg);
  }

  .filter-panel:not(.open) {
    display: none;
  }

  .filter-section {
    margin-top: 18px;
  }

  main {
    width: 100%;
    padding: 18px 16px 28px;
  }

  .topbar {
    gap: 14px;
    align-items: stretch;
    flex-direction: column;
  }

  .topbar h2 {
    font-size: 1.85rem;
    line-height: 1.08;
  }

  .topbar-actions {
    flex: none;
    align-items: stretch;
    flex-direction: column;
  }

  .language-toggle,
  .search {
    width: 100%;
  }

  .overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .overview > div {
    min-height: 76px;
    padding: 12px;
  }

  .overview > div:last-child {
    grid-column: 1 / -1;
  }

  .metric {
    font-size: 1.45rem;
  }

  .metric-label {
    font-size: 0.84rem;
  }

  .segmented,
  .chip-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .content-grid {
    gap: 18px;
  }

  .detail {
    gap: 14px;
    padding: 14px;
  }

  .detail-header h2 {
    font-size: 1.35rem;
  }

  .drill-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .drill-card {
    width: 100%;
    min-width: 0;
  }

  .mini-field,
  .demo-field {
    max-width: 100%;
  }

  .section-title {
    align-items: start;
  }
}

@media (orientation: landscape) and (max-height: 520px) and (pointer: coarse) {
  .sidebar {
    padding: 10px 16px;
  }

  .brand p {
    display: none;
  }

  .brand-mark {
    flex-basis: 38px;
    width: 38px;
    height: 38px;
  }

  .filter-panel.open {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 16px;
    align-items: start;
  }

  .filter-panel .filter-section {
    margin-top: 12px;
  }

  .filter-panel .filter-section:nth-of-type(3),
  .filter-panel .clear-filters {
    grid-column: 1 / -1;
  }

  #categoryFilters {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .filter-panel .clear-filters {
    margin-top: 0;
  }

  main {
    padding: 14px 16px 22px;
  }

  .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 0.95fr);
    gap: 12px;
    align-items: end;
    margin-bottom: 14px;
  }

  .topbar h2 {
    font-size: 1.45rem;
  }

  .topbar-actions {
    gap: 8px;
    align-items: center;
    flex-direction: row;
  }

  .language-toggle {
    width: auto;
    min-height: 42px;
  }

  .search {
    min-height: 42px;
  }

  .overview {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 14px;
  }

  .overview > div {
    min-height: 68px;
    padding: 10px 12px;
  }

  .overview > div:last-child {
    grid-column: auto;
  }

  .drill-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  .animation-toggle,
  .animation-restart {
    display: none;
  }
}
