:root {
  color-scheme: dark;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg: #050607;
  --panel: #0d1114;
  --panel-2: #13181d;
  --panel-3: #171d22;
  --text: #f7f7f5;
  --muted: #a7adb4;
  --dim: #6f7882;
  --line: rgba(255, 255, 255, 0.14);
  --line-strong: rgba(255, 255, 255, 0.24);
  --red: #ef1f25;
  --red-dark: #980f15;
  --green: #75c943;
  --black: #000;
  --white: #fff;
  --radius: 8px;
  --shadow: 0 22px 80px rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
}

body,
button,
input,
select {
  font: inherit;
}

button,
select,
input {
  color: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid rgba(239, 31, 37, 0.9);
  outline-offset: 3px;
}

img {
  display: block;
  width: 100%;
}

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

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  grid-template-rows: 72px minmax(0, 1fr) auto;
  background:
    linear-gradient(90deg, rgba(239, 31, 37, 0.08), transparent 28%),
    radial-gradient(circle at 80% 0%, rgba(255, 255, 255, 0.05), transparent 32%),
    var(--bg);
}

.topbar {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 230px minmax(260px, 1fr) 280px auto auto;
  align-items: center;
  gap: 16px;
  min-height: 72px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 6, 7, 0.92);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 2px solid var(--white);
  border-left-color: var(--red);
  border-bottom-color: var(--red);
  border-radius: 8px;
  color: var(--red);
  font-weight: 1000;
  transform: skew(-8deg);
}

.brand strong {
  display: block;
  font-size: 1.2rem;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.brand small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.search-wrap,
.select-wrap {
  display: grid;
  gap: 4px;
}

.search-wrap span,
.select-wrap span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.search-wrap input,
.select-wrap select,
.top-button {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--panel-2), #0d1013);
  padding: 0 18px;
  font-weight: 700;
  color: var(--text);
}

.search-wrap input::placeholder {
  color: var(--dim);
}

.top-button {
  padding-inline: 22px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.top-button.active {
  border-color: rgba(239, 31, 37, 0.8);
  color: var(--red);
}

.sidebar {
  grid-row: 2 / 3;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 18px 14px 110px;
  border-right: 1px solid var(--line);
  background: rgba(10, 14, 17, 0.84);
}

.pattern-button {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  text-align: left;
}

.pattern-button.active {
  border-color: var(--red);
  box-shadow: inset 4px 0 0 var(--red);
}

.pattern-button span {
  font-weight: 850;
}

.pattern-button strong {
  color: var(--muted);
}

.sidebar-note {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.sidebar-note h2 {
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-note p {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.5;
  font-size: 0.9rem;
}

.main-panel {
  grid-row: 2 / 3;
  min-width: 0;
  padding: 20px 20px 124px;
}

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

.view-home .sidebar,
.view-analyzer .sidebar {
  display: none;
}

.view-home .main-panel,
.view-analyzer .main-panel {
  grid-column: 1 / -1;
}

.view-home .main-panel {
  padding: 24px 28px 44px;
}

.home-view {
  max-width: 1240px;
  margin: 0 auto;
}

.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(360px, 0.75fr);
  gap: 24px;
  align-items: stretch;
  min-height: min(590px, calc(100vh - 148px));
}

.hero-copy,
.hero-preview,
.media-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(13, 17, 20, 0.9);
  box-shadow: var(--shadow);
}

.hero-copy {
  display: grid;
  align-content: center;
  gap: 26px;
  padding: clamp(28px, 5vw, 68px);
}

.hero-copy h1 {
  max-width: 760px;
  font-size: clamp(4.2rem, 10vw, 8.4rem);
  line-height: 0.84;
  letter-spacing: 0;
}

.big-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.big-steps span {
  display: grid;
  gap: 8px;
  min-height: 108px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 900;
}

.big-steps strong {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
}

.hero-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.hero-actions .secondary-action,
.hero-actions .primary-action {
  position: static;
  width: 100%;
}

.hero-preview {
  position: relative;
  overflow: hidden;
  padding: 0;
  color: var(--text);
  text-align: left;
}

.hero-preview img {
  height: 100%;
  min-height: 520px;
  object-fit: cover;
}

.hero-preview div {
  position: absolute;
  inset: auto 18px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border: 1px solid rgba(117, 201, 67, 0.7);
  border-radius: var(--radius);
  background: rgba(3, 5, 6, 0.82);
}

.hero-preview strong {
  font-size: 1.5rem;
}

.hero-preview span {
  color: var(--green);
  font-weight: 1000;
}

.media-shelf {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.media-card {
  overflow: hidden;
  padding: 0;
  color: var(--text);
  text-align: left;
}

.media-card img {
  height: 210px;
  object-fit: cover;
  border-bottom: 1px solid var(--line);
}

.media-card span,
.media-card strong,
.media-card small {
  display: block;
  padding-inline: 16px;
}

.media-card span {
  padding-top: 14px;
  color: var(--red);
  font-size: 0.76rem;
  font-weight: 1000;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.media-card strong {
  padding-top: 6px;
  font-size: 1.35rem;
}

.media-card small {
  padding-top: 6px;
  padding-bottom: 16px;
  color: var(--muted);
  font-weight: 800;
}

.section-heading,
.exercise-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
  margin-bottom: 18px;
}

.section-heading p,
.exercise-heading p,
.panel-title p {
  color: var(--red);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.section-heading h1,
.exercise-heading h1 {
  margin-top: 6px;
  font-size: clamp(2rem, 3vw, 3.45rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.section-heading span {
  flex: 0 0 auto;
  color: var(--muted);
  font-weight: 800;
}

.ghost-button,
.primary-mini {
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  font-weight: 850;
}

.primary-mini {
  border-color: rgba(239, 31, 37, 0.7);
  background: var(--red);
  color: white;
}

.analysis-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}

.video-panel,
.science-rail,
.demo-strip,
.cue-card,
.library-preview,
.exercise-table {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(13, 17, 20, 0.88);
  box-shadow: var(--shadow);
}

.video-panel {
  position: relative;
  overflow: hidden;
  min-height: 510px;
}

.video-panel.wrong {
  border-color: rgba(239, 31, 37, 0.75);
}

.video-panel.correct {
  border-color: rgba(117, 201, 67, 0.75);
}

.video-label {
  position: absolute;
  inset: 0 0 auto;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 66px;
  padding: 0 20px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.78), transparent);
}

.video-label strong {
  color: var(--red);
  font-size: 1.55rem;
  letter-spacing: 0.08em;
}

.video-panel.correct .video-label strong {
  color: var(--green);
}

.video-label span {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: transparent;
}

.video-label span::before {
  content: "×";
  color: var(--red);
  font-size: 3.8rem;
  line-height: 1;
  font-weight: 900;
}

.video-panel.correct .video-label span::before {
  content: "✓";
  color: var(--green);
  font-size: 3rem;
}

.video-panel img {
  width: 100%;
  height: 100%;
  min-height: 510px;
  object-fit: cover;
}

.callouts {
  position: absolute;
  inset: 96px 18px 74px;
  pointer-events: none;
}

.callout {
  position: absolute;
  max-width: 190px;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid rgba(239, 31, 37, 0.95);
  border-radius: 6px;
  background: rgba(7, 8, 9, 0.82);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 850;
  text-align: left;
  pointer-events: auto;
}

.correct .callout {
  border-color: rgba(117, 201, 67, 0.95);
}

.c1 {
  top: 8%;
  left: 5%;
}

.c2 {
  top: 26%;
  right: 5%;
}

.c3 {
  bottom: 26%;
  left: 7%;
}

.c4 {
  bottom: 14%;
  right: 8%;
}

.video-controls {
  position: absolute;
  inset: auto 18px 18px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 16px;
}

.video-controls span {
  height: 6px;
  border-radius: 999px;
  background:
    linear-gradient(90deg, var(--red), var(--red) 48%, rgba(255, 255, 255, 0.26) 49%),
    rgba(255, 255, 255, 0.18);
}

.correct .video-controls span {
  background:
    linear-gradient(90deg, var(--green), var(--green) 54%, rgba(255, 255, 255, 0.26) 55%),
    rgba(255, 255, 255, 0.18);
}

.video-controls strong {
  font-size: 0.85rem;
}

.science-rail {
  padding: 18px;
}

.panel-title h2 {
  margin-top: 5px;
  font-size: 1.35rem;
  line-height: 1;
}

.rail-block {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.rail-block h3 {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.rail-block ul,
.cue-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rail-block li,
.cue-list li {
  position: relative;
  padding-left: 22px;
  color: var(--text);
  line-height: 1.35;
}

.rail-block li::before,
.cue-list li::before {
  content: "";
  position: absolute;
  top: 0.45em;
  left: 0;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--green);
}

.rail-block p {
  font-weight: 850;
}

.rail-block small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.35;
}

.rail-note {
  margin-top: 18px;
  padding: 14px;
  border: 1px solid rgba(239, 31, 37, 0.35);
  border-radius: var(--radius);
  background: rgba(239, 31, 37, 0.08);
}

.rail-note p {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.45;
}

.lower-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(300px, 0.7fr);
  gap: 12px;
  margin-top: 12px;
}

.demo-strip,
.cue-card {
  padding: 16px;
}

.demo-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.demo-step {
  display: grid;
  grid-template-columns: 96px 28px 1fr;
  align-items: center;
  gap: 10px;
  min-height: 86px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  color: var(--text);
  text-align: left;
}

.demo-step img {
  height: 68px;
  border-radius: 5px;
  object-fit: cover;
}

.demo-step span {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--muted);
  font-weight: 900;
}

.demo-step strong {
  line-height: 1.25;
}

.cue-list {
  margin-top: 14px;
}

.library-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 12px;
}

.exercise-table {
  overflow: hidden;
}

.table-row {
  width: 100%;
  display: grid;
  grid-template-columns: 1.25fr 0.65fr 1fr 0.9fr 1.4fr;
  gap: 16px;
  align-items: center;
  min-height: 56px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  text-align: left;
}

button.table-row:hover,
.table-row.selected {
  background: rgba(239, 31, 37, 0.09);
}

.table-head {
  min-height: 44px;
  background: #0b0e11;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.table-row strong,
.table-row small {
  display: block;
}

.table-row small {
  margin-top: 3px;
  color: var(--muted);
}

.library-preview {
  align-self: start;
  overflow: hidden;
}

.library-preview img {
  aspect-ratio: 1.1;
  object-fit: cover;
  object-position: top center;
  border-bottom: 1px solid var(--line);
}

.library-preview h2,
.library-preview p {
  padding-inline: 18px;
}

.library-preview h2 {
  padding-top: 18px;
  font-size: 1.35rem;
}

.library-preview p {
  padding-top: 8px;
  padding-bottom: 18px;
  color: var(--muted);
  line-height: 1.5;
}

.action-bar {
  grid-column: 1 / -1;
  position: fixed;
  inset: auto 0 0;
  z-index: 22;
  display: grid;
  grid-template-columns: minmax(240px, 0.9fr) minmax(220px, 0.5fr) minmax(300px, 1.1fr);
  gap: 12px;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--line);
  background: rgba(5, 6, 7, 0.94);
  backdrop-filter: blur(16px);
}

.secondary-action,
.primary-action,
.set-status {
  min-height: 82px;
  border-radius: var(--radius);
}

.secondary-action,
.primary-action {
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  background: linear-gradient(180deg, var(--panel-2), #090a0b);
  color: var(--text);
}

.primary-action {
  border-color: rgba(239, 31, 37, 0.85);
  background: linear-gradient(180deg, #f8272d, #bb1218);
}

.secondary-action span,
.primary-action span {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  font-weight: 1000;
  letter-spacing: 0.05em;
}

.secondary-action small,
.primary-action small {
  color: rgba(255, 255, 255, 0.76);
  font-weight: 800;
}

.set-status {
  display: grid;
  place-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.set-status.recording {
  border-color: rgba(117, 201, 67, 0.85);
}

.set-status span,
.set-status small {
  color: var(--muted);
  font-weight: 800;
}

.set-status strong {
  font-size: 1.65rem;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 118px;
  z-index: 40;
  max-width: min(420px, calc(100vw - 40px));
  padding: 14px 16px;
  border: 1px solid rgba(117, 201, 67, 0.65);
  border-radius: var(--radius);
  background: #0f1611;
  box-shadow: var(--shadow);
  color: var(--text);
  font-weight: 850;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.72);
}

.preq-modal {
  position: relative;
  width: min(680px, 100%);
  padding: 24px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #0c1013;
  box-shadow: var(--shadow);
}

.preq-modal > p {
  color: var(--red);
  font-weight: 1000;
  letter-spacing: 0.1em;
}

.preq-modal h2 {
  margin-top: 8px;
  font-size: clamp(1.8rem, 4vw, 2.7rem);
  line-height: 1;
}

.close-button {
  position: absolute;
  top: 18px;
  right: 18px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.preq-grid {
  display: grid;
  gap: 10px;
  margin-top: 22px;
}

.preq-item {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 12px;
  align-items: center;
  min-height: 54px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-2);
  font-weight: 850;
}

.preq-item input {
  width: 18px;
  height: 18px;
  accent-color: var(--red);
}

.modal-actions {
  display: flex;
  justify-content: end;
  gap: 12px;
  margin-top: 22px;
}

@media (max-width: 1180px) {
  .topbar {
    grid-template-columns: 1fr 1fr;
  }

  .brand {
    grid-column: 1 / -1;
  }

  .analysis-grid,
  .library-grid,
  .home-hero {
    grid-template-columns: 1fr;
  }

  .science-rail {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }

  .science-rail .panel-title,
  .science-rail .rail-note {
    grid-column: 1 / -1;
  }

  .hero-preview img {
    max-height: 520px;
  }
}

@media (max-width: 820px) {
  .app-shell {
    display: block;
  }

  .topbar {
    position: static;
    grid-template-columns: 1fr;
  }

  .brand strong {
    white-space: normal;
  }

  .sidebar {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .pattern-button {
    flex: 0 0 132px;
  }

  .sidebar-note {
    display: none;
  }

  .main-panel {
    padding: 16px 12px 260px;
  }

  .view-home .main-panel {
    padding: 12px 12px 28px;
  }

  .home-hero {
    min-height: 0;
  }

  .hero-copy {
    padding: 24px 18px;
    gap: 18px;
  }

  .hero-copy h1 {
    font-size: clamp(3.1rem, 18vw, 4.8rem);
  }

  .big-steps,
  .hero-actions,
  .media-shelf {
    grid-template-columns: 1fr;
  }

  .big-steps span {
    min-height: 72px;
    grid-template-columns: 34px 1fr;
    align-items: center;
  }

  .hero-preview img {
    min-height: 360px;
  }

  .media-card img {
    height: 220px;
  }

  .section-heading,
  .exercise-heading {
    align-items: start;
    flex-direction: column;
  }

  .lower-grid,
  .demo-steps,
  .science-rail {
    grid-template-columns: 1fr;
  }

  .video-panel,
  .video-panel img {
    min-height: 430px;
  }

  .table-row {
    grid-template-columns: 1fr;
    gap: 5px;
    padding-block: 12px;
  }

  .table-head {
    display: none;
  }

  .action-bar {
    grid-template-columns: 1fr;
  }

  .secondary-action,
  .primary-action,
  .set-status {
    min-height: 68px;
  }
}
