:root {
  --background: #ffffff;
  --foreground: #111315;
  --secondary: #f3f4f6;
  --muted: #f8fafc;
  --border: #e5e7eb;
  --muted-text: #6b7280;
  --orange: #ff7a00;
  --orange-dark: #994700;
  --blue: #6ea8ff;
  --red: #ba1a1a;
  --shadow: 0 18px 40px rgba(17, 19, 21, 0.08);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--background);
  color: var(--foreground);
  font-family: ui-rounded, "SF Pro Rounded", "SF Pro Display", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

body {
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  background: #f9f9ff;
}

.screen {
  min-height: 100vh;
  padding: 18px 16px calc(92px + var(--safe-bottom));
}

.live-screen {
  height: auto;
  min-height: 100vh;
  overflow-y: auto;
  padding: 14px 16px calc(106px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 48px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--orange-dark);
  font-weight: 900;
  font-size: 24px;
  letter-spacing: 0;
}

.brand-ball {
  display: inline-block;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(17, 19, 21, 0.18);
  border-radius: 50%;
  position: relative;
  flex: 0 0 auto;
  background:
    radial-gradient(circle at 36% 30%, #ffb16b 0 10%, #ff7a00 42%, #d94f00 100%);
  overflow: hidden;
  box-shadow: 0 3px 8px rgba(17, 19, 21, 0.12);
}

.brand-ball::before,
.brand-ball::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
}

.brand-ball::before {
  background:
    linear-gradient(90deg, transparent 0 47%, rgba(0, 0, 0, 0.58) 48% 54%, transparent 55%),
    linear-gradient(0deg, transparent 0 47%, rgba(0, 0, 0, 0.58) 48% 54%, transparent 55%);
}

.brand-ball::after {
  border-left: 2px solid rgba(0, 0, 0, 0.58);
  border-right: 2px solid rgba(0, 0, 0, 0.58);
  transform: scaleX(0.62);
}

.brand-ball.small {
  width: 30px;
  height: 30px;
}

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: transparent;
  color: var(--foreground);
  font-size: 24px;
}

.info-btn {
  font-size: 14px;
  font-weight: 1000;
  color: var(--orange-dark);
  border: 1px solid rgba(153, 71, 0, 0.22);
  background: white;
}

.hero-photo {
  margin: 6px -16px 0;
  min-height: 54vh;
  background:
    linear-gradient(180deg, rgba(249, 249, 255, 0) 42%, #f9f9ff 100%),
    url("https://images.unsplash.com/photo-1546519638-68e109498ffc?auto=format&fit=crop&w=1000&q=80") center / cover;
}

.hero-card {
  margin-top: -92px;
  position: relative;
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.eyebrow {
  color: var(--orange-dark);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  margin-top: 22px;
  font-size: clamp(30px, 8vw, 46px);
  line-height: 1.12;
  font-weight: 900;
}

h2 {
  font-size: 30px;
  line-height: 1.15;
  font-weight: 900;
}

h3 {
  font-size: 20px;
  line-height: 1.2;
  font-weight: 900;
}

.copy {
  margin-top: 18px;
  color: #4f5560;
  font-size: 17px;
  line-height: 1.55;
}

.cta-stack {
  display: grid;
  gap: 14px;
  margin-top: 28px;
}

.btn {
  min-height: 60px;
  border-radius: 13px;
  padding: 0 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.btn-primary {
  background: var(--orange);
  color: white;
  box-shadow: 0 12px 22px rgba(255, 122, 0, 0.24);
}

.btn-secondary {
  background: var(--secondary);
  color: var(--foreground);
}

.btn-dark {
  background: var(--foreground);
  color: white;
}

.btn-ghost {
  background: transparent;
  color: var(--foreground);
}

.metric-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 36px;
}

.metric-card,
.panel,
.mode-card,
.review-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
}

.metric-card {
  padding: 18px;
  min-height: 120px;
}

.metric-label,
.label {
  color: var(--muted-text);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.stat {
  margin-top: 24px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 39px;
  line-height: 1;
  letter-spacing: 0;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  padding: 8px 14px calc(8px + var(--safe-bottom));
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.nav-item {
  min-height: 52px;
  border-radius: 14px;
  background: transparent;
  display: grid;
  place-items: center;
  color: #4f5560;
  font-size: 11px;
  font-weight: 900;
}

.nav-item.active {
  background: transparent;
  color: var(--orange);
}

.setup-header {
  margin-top: 42px;
}

.progress {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 30px;
}

.progress span {
  height: 6px;
  border-radius: 999px;
  background: #dce2f3;
}

.progress .done {
  background: var(--orange);
}

.mode-list {
  display: grid;
  gap: 14px;
  margin-top: 30px;
}

.mode-card {
  min-height: 128px;
  padding: 24px;
  text-align: left;
  color: var(--foreground);
}

.mode-card.selected {
  background: #ffdbc8;
  border-color: rgba(255, 122, 0, 0.45);
}

.mode-card .mode-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  color: var(--orange-dark);
  font-weight: 900;
}

.mode-taxonomy {
  display: grid;
  justify-items: end;
  gap: 4px;
  text-align: right;
}

.mode-taxonomy strong {
  font-size: 13px;
  letter-spacing: 0.14em;
}

.mode-taxonomy small {
  color: rgba(153, 71, 0, 0.72);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.06em;
}

.mode-card p {
  margin-top: 14px;
  color: #555b65;
  line-height: 1.45;
}

.sticky-actions {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 18;
  padding: 14px 16px calc(14px + var(--safe-bottom));
  background: rgba(255, 255, 255, 0.95);
  border-top: 1px solid rgba(153, 71, 0, 0.2);
}

.config-grid {
  display: grid;
  gap: 18px;
  margin-top: 30px;
}

.panel {
  padding: 20px;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.choice-grid.one {
  grid-template-columns: 1fr;
}

.choice {
  min-height: 52px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: white;
  color: var(--foreground);
  font-weight: 800;
}

.choice.selected {
  border-color: var(--orange);
  background: #ffdbc8;
  color: var(--orange-dark);
}

.ready-list {
  margin-top: 24px;
  display: grid;
  gap: 12px;
}

.ready-item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.ready-item strong {
  text-align: right;
}

.live-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.live-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.live-title strong {
  color: var(--orange-dark);
  font-size: 24px;
  line-height: 1;
  font-weight: 1000;
  text-transform: uppercase;
}

.timer-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 7px 11px;
  border: 1px solid rgba(153, 71, 0, 0.32);
  border-radius: 12px;
  background: white;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 20px;
}

.record-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--red);
  opacity: 0.55;
}

.score-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.score-card {
  min-height: 88px;
  border: 1px solid rgba(153, 71, 0, 0.25);
  border-radius: 16px;
  background: white;
  padding: 14px;
}

.score-card.highlight {
  border-color: var(--orange);
}

.score-value {
  margin-top: 8px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: clamp(36px, 12vw, 52px);
  font-weight: 900;
  line-height: 0.92;
  letter-spacing: 0;
}

.orange {
  color: var(--orange);
}

.game-strip {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  padding: 10px 12px;
}

.spot-route,
.letters {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  align-items: center;
  justify-content: center;
}

.spot {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  background: white;
  color: var(--muted-text);
  font-size: 11px;
  font-weight: 900;
}

.spot.done,
.spot.active {
  background: var(--orange);
  color: white;
  border-color: var(--orange);
}

.letter {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  font-weight: 900;
  color: var(--muted-text);
}

.letter.lit {
  border-color: var(--orange);
  background: #ffdbc8;
  color: var(--orange-dark);
}

.court {
  margin: 10px 0 6px;
  min-height: 130px;
  display: grid;
  place-items: center;
}

.court-map {
  width: min(52vw, 220px);
  aspect-ratio: 1.2;
  position: relative;
  border: 1px solid rgba(153, 71, 0, 0.16);
  border-bottom: 0;
  opacity: 0.82;
  overflow: hidden;
}

.court-map::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -68%;
  width: 118%;
  aspect-ratio: 1;
  border: 2px solid rgba(153, 71, 0, 0.12);
  border-radius: 50%;
  transform: translateX(-50%);
}

.court-map::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 31%;
  height: 58%;
  border: 2px solid rgba(153, 71, 0, 0.14);
  border-bottom: 0;
  transform: translateX(-50%);
}

.active-dot {
  position: absolute;
  left: 50%;
  bottom: 38%;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 0 13px rgba(255, 122, 0, 0.16);
  transform: translate(-50%, 50%);
}

.court-label {
  margin-top: 10px;
  text-align: center;
  color: #555b65;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tag-panel {
  margin-top: 4px;
  position: relative;
  z-index: 3;
}

.tag-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 6px;
}

.tag {
  flex: 0 0 auto;
  min-height: 40px;
  min-width: 66px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--secondary);
  color: #4f5560;
  font-size: 12px;
  font-weight: 900;
  touch-action: manipulation;
}

.tag.selected {
  background: #ffdbc8;
  color: var(--orange-dark);
}

.live-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  position: relative;
  z-index: 2;
  margin-top: 2px;
}

.score-btn {
  min-height: 72px;
  border-radius: 18px;
  border: 1px solid rgba(153, 71, 0, 0.34);
  font-size: 17px;
  font-weight: 1000;
  letter-spacing: 0.12em;
}

.miss-btn {
  background: #e2e2e5;
  color: var(--foreground);
}

.make-btn {
  background: var(--orange);
  color: white;
  box-shadow: 0 14px 26px rgba(255, 122, 0, 0.26);
}

.live-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 10px 16px calc(10px + var(--safe-bottom));
  display: grid;
  grid-template-columns: 74px 74px 1fr;
  gap: 10px;
  align-items: center;
  border-top: 1px solid rgba(153, 71, 0, 0.22);
  background: rgba(255, 255, 255, 0.95);
}

.mini-control {
  min-height: 54px;
  border-radius: 13px;
  background: transparent;
  color: #555b65;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
}

.mini-control strong {
  display: block;
  color: var(--foreground);
  font-size: 22px;
  line-height: 1;
}

.review-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-top: 18px;
}

.review-card {
  padding: 18px;
}

.review-card.wide {
  grid-column: 1 / -1;
}

.bar {
  height: 6px;
  margin-top: 18px;
  border-radius: 999px;
  background: #e9edf7;
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  background: var(--orange);
}

.coach-card {
  margin-top: 24px;
  padding: 22px;
  border-radius: 16px;
  background: #ffdbc8;
  border: 1px solid rgba(255, 122, 0, 0.28);
}

.breakdown {
  display: grid;
  gap: 10px;
  margin-top: 24px;
}

.break-row {
  display: grid;
  grid-template-columns: 58px 1fr 44px;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  border: 1px solid rgba(153, 71, 0, 0.24);
  border-radius: 12px;
  padding: 0 12px;
  background: white;
}

.history-list,
.lesson-list {
  display: grid;
  gap: 12px;
  margin-top: 24px;
}

.history-row,
.lesson-row {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: white;
}

.lesson-link {
  width: 100%;
  display: grid;
  grid-template-columns: 72px 1fr 22px;
  align-items: center;
  gap: 14px;
  text-align: left;
  color: var(--foreground);
}

.lesson-link small {
  display: block;
  margin-top: 7px;
  color: var(--muted-text);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.lesson-thumb {
  width: 72px;
  height: 72px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background-image: url("./assets/shooting-101-contact-sheet.png");
  background-size: 300% 200%;
  background-position: center;
}

.lesson-screen {
  padding-bottom: 42px;
}

.lesson-hero {
  margin: 18px -16px 0;
  min-height: 320px;
  background-image:
    linear-gradient(180deg, rgba(249, 249, 255, 0) 56%, #f9f9ff 100%),
    url("./assets/shooting-101-contact-sheet.png");
  background-size: 300% 200%;
  background-position: center;
}

.lesson-article {
  margin-top: -48px;
  position: relative;
  padding: 26px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.lesson-article h1 {
  font-size: clamp(32px, 9vw, 48px);
}

.toc {
  margin-top: 28px;
  padding: 20px;
  border: 1px solid rgba(153, 71, 0, 0.18);
  border-radius: 16px;
  background: #fffbf8;
}

.toc ol {
  margin: 16px 0 0;
  padding-left: 22px;
}

.toc li + li {
  margin-top: 10px;
}

.toc a {
  color: var(--foreground);
  font-weight: 850;
  text-decoration: none;
}

.lesson-section {
  scroll-margin-top: 18px;
  margin-top: 34px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}

.lesson-section h2 {
  margin-top: 8px;
  font-size: 25px;
}

.lesson-section p {
  margin-top: 18px;
  color: #3f4651;
  font-size: 17px;
  line-height: 1.68;
}

.lesson-photo-history,
.lesson-photo-grip {
  background-position: 0% 0%;
}

.lesson-photo-arc {
  background-position: 50% 0%;
}

.lesson-photo-spin {
  background-position: 100% 0%;
}

.lesson-photo-backboard {
  background-position: 0% 100%;
}

.lesson-photo-biomechanics {
  background-position: 50% 100%;
}

.lesson-photo-gather {
  background-position: 100% 100%;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(17, 19, 21, 0.24);
}

.drawer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 41;
  padding: 22px 16px calc(22px + var(--safe-bottom));
  border-radius: 24px 24px 0 0;
  background: white;
  box-shadow: 0 -20px 42px rgba(17, 19, 21, 0.16);
}

.review-actions {
  margin-top: 24px;
  display: grid;
  gap: 14px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(132px + var(--safe-bottom));
  z-index: 45;
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--foreground);
  color: white;
  font-size: 13px;
  font-weight: 900;
  transform: translateX(-50%);
}

@media (min-width: 520px) {
  .app-shell {
    display: grid;
    place-items: start center;
    padding: 24px 0;
  }

  .screen,
  .live-screen {
    width: 430px;
    min-height: min(932px, calc(100vh - 48px));
    height: min(932px, calc(100vh - 48px));
    border: 1px solid var(--border);
    border-radius: 28px;
    overflow-x: hidden;
    overflow-y: auto;
    box-shadow: var(--shadow);
    position: relative;
  }

  .bottom-nav,
  .sticky-actions,
  .live-footer {
    left: 50%;
    width: 430px;
    transform: translateX(-50%);
    border-radius: 0 0 28px 28px;
  }

  .drawer,
  .drawer-backdrop {
    left: 50%;
    width: 430px;
    transform: translateX(-50%);
  }
}

@media (min-width: 960px) {
  .app-shell {
    display: block;
    padding: 0;
  }

  .screen,
  .live-screen {
    width: auto;
    max-width: none;
    min-height: 100vh;
    height: auto;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    overflow: visible;
    padding: 28px clamp(32px, 6vw, 72px) 118px;
  }

  .topbar,
  .setup-header,
  .progress,
  .mode-list,
  .config-grid,
  .ready-list,
  .history-list,
  .lesson-list,
  .lesson-article,
  .review-grid,
  .breakdown,
  .review-actions {
    max-width: 1120px;
    margin-left: auto;
    margin-right: auto;
  }

  .hero-photo {
    max-width: 1120px;
    min-height: 430px;
    margin: 28px auto 0;
    border-radius: 28px;
  }

  .hero-card {
    max-width: 640px;
    margin: -150px auto 0;
  }

  .metric-row {
    max-width: 760px;
    margin-left: auto;
    margin-right: auto;
  }

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

  .score-grid {
    max-width: 1120px;
    margin-left: auto;
    margin-right: auto;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .game-strip,
  .court,
  .tag-panel,
  .live-controls {
    width: min(720px, 100%);
    margin-left: auto;
    margin-right: auto;
  }

  .court {
    min-height: 260px;
  }

  .court-map {
    width: min(460px, 52vw);
  }

  .live-controls {
    margin-top: 16px;
  }

  .bottom-nav,
  .sticky-actions,
  .live-footer {
    left: 50%;
    width: min(620px, calc(100vw - 48px));
    transform: translateX(-50%);
    border-radius: 28px;
    bottom: 24px;
  }

  .drawer,
  .drawer-backdrop {
    left: 50%;
    width: min(520px, calc(100vw - 48px));
    transform: translateX(-50%);
  }

  .lesson-hero {
    max-width: 1120px;
    margin: 28px auto 0;
    border-radius: 28px;
  }

  .lesson-article {
    margin-top: -76px;
  }
}

@media (max-height: 760px) {
  .live-screen {
    padding-top: 10px;
  }

  .score-card {
    min-height: 78px;
    padding: 12px;
  }

  .score-value {
    font-size: clamp(32px, 11vw, 46px);
  }

  .court {
    min-height: 96px;
    margin: 6px 0 4px;
  }

  .court-map {
    width: min(46vw, 190px);
  }

  .score-btn {
    min-height: 64px;
  }
}
