/* ---------------------------------------------------------------------------
   immerse — gumroad-style neo-brutalist
   white · black 1px borders · hard offset shadows · pink #FF90E8 · yellow #F1F333
--------------------------------------------------------------------------- */

:root {
  --bg: #ffffff;
  --black: #000000;
  --gray: #f4f4f0;
  --gray-mid: #dddddd;
  --muted: #666666;
  --pink: #ff90e8;
  --yellow: #f1f333;
  --purple: #90a8ed;
  --green: #23a094;
  --orange: #ffc900;
  --red: #dc341e;
  --radius: 4px;
  --font: "Space Grotesk", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--black);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
}

button { font: inherit; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
a { color: var(--black); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { background: var(--pink); }

::selection { background: var(--pink); color: var(--black); }

:focus-visible {
  outline: 2px solid var(--black);
  outline-offset: 2px;
}

/* ------------------------------------------------------------------ header */

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 28px;
  border-bottom: 1px solid var(--black);
  background: var(--bg);
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.01em;
  color: var(--black);
  text-decoration: none;
}
.wordmark:hover { background: none; }

.wordmark::before {
  content: "";
  width: 16px;
  height: 16px;
  background: var(--pink);
  border: 1px solid var(--black);
  border-radius: 3px;
  display: inline-block;
}

.wordmark .hl { background: none; padding: 0; }

.tagline {
  font-size: 13px;
  color: var(--muted);
}

/* ----------------------------------------------------------------- marquee */

.marquee {
  border-bottom: 1px solid var(--black);
  background: var(--pink);
  overflow: hidden;
  padding: 7px 0;
}

.marquee-track {
  display: flex;
  width: max-content;
  animation: marquee 26s linear infinite;
}
.marquee:hover .marquee-track { animation-play-state: paused; }

.marquee-run {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
}

.marquee-run span {
  padding: 0 14px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}

.marquee-run .star { padding: 0; font-size: 11px; }

@keyframes marquee {
  to { transform: translateX(-50%); }
}

/* -------------------------------------------------------------------- home */

.home {
  max-width: 880px;
  margin: 0 auto;
  padding: 64px 28px 96px;
}

.hero-title {
  font-weight: 700;
  font-size: clamp(36px, 5.5vw, 58px);
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin: 0 0 18px;
  max-width: 17ch;
}

.hero-title .hl {
  display: inline-block;
  background: var(--pink);
  border: 1px solid var(--black);
  border-radius: var(--radius);
  padding: 0 10px 2px;
  transform: rotate(-1deg);
}

.hero-sub {
  color: var(--black);
  font-size: 18px;
  margin: 0 0 40px;
  max-width: 52ch;
}

.add-form {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}

.add-form input {
  flex: 1;
  padding: 13px 16px;
  border: 1px solid var(--black);
  border-radius: var(--radius);
  background: var(--bg);
  font-size: 16px;
}
.add-form input:focus { outline: none; box-shadow: 3px 3px 0 var(--black); }
.add-form input::placeholder { color: var(--muted); }

/* the gumroad button: flat by default, lifts with a hard shadow on hover */
.btn {
  padding: 13px 24px;
  border: 1px solid var(--black);
  border-radius: var(--radius);
  background: var(--pink);
  color: var(--black);
  font-weight: 500;
  font-size: 16px;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn:hover:not(:disabled) {
  transform: translate(-3px, -3px);
  box-shadow: 3px 3px 0 var(--black);
}
.btn:active:not(:disabled) { transform: none; box-shadow: none; }
.btn:disabled { background: var(--gray); color: var(--muted); cursor: wait; }

.form-status {
  min-height: 24px;
  font-size: 14px;
  color: var(--muted);
}
.form-status.error { color: var(--red); }

/* ---------------------------------------------------------------- podcasts */

.show-list { display: flex; flex-direction: column; gap: 10px; }

.show-row {
  border: 1px solid var(--black);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg);
}

.show-main {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 14px 10px 10px;
  border: none;
  background: none;
  text-align: left;
  font: inherit;
}
.show-main:hover { background: var(--gray); }

.show-main img {
  width: 52px;
  height: 52px;
  border-radius: 6px;
  border: 1px solid var(--black);
  object-fit: cover;
  flex: 0 0 auto;
}

.show-info { display: flex; flex-direction: column; min-width: 0; }
.show-info strong { font-size: 15.5px; }
.show-meta {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.show-open {
  margin-left: auto;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  flex: 0 0 auto;
}
.show-main:hover .show-open { color: var(--black); }

.episode-list { border-top: 1px solid var(--black); }

.episode-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--gray-mid);
}
.episode-row:last-child { border-bottom: none; }

.ep-info { display: flex; flex-direction: column; min-width: 0; }
.ep-title { font-size: 14.5px; }
.ep-meta { font-size: 12.5px; color: var(--muted); }

.ep-add { margin-left: auto; flex: 0 0 auto; }
.ep-add:disabled { background: var(--gray); cursor: wait; }

/* podcast player in the study view */
.pod-player {
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--black);
  border-radius: var(--radius);
  box-shadow: 4px 4px 0 var(--black);
  padding: 14px;
  background: var(--bg);
}

.pod-art {
  width: 86px;
  height: 86px;
  border-radius: 6px;
  border: 1px solid var(--black);
  object-fit: cover;
  flex: 0 0 auto;
}

.pod-player audio { flex: 1; min-width: 0; }

/* ----------------------------------------------------------- how it works */

.how {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin: 44px 0 8px;
}

.how-card {
  border: 1px solid var(--black);
  border-radius: var(--radius);
  box-shadow: 4px 4px 0 var(--black);
  padding: 18px 18px 16px;
  background: var(--bg);
}

.how-num {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--black);
  border-radius: 50%;
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 10px;
}
.how-num.n1 { background: var(--pink); }
.how-num.n2 { background: var(--yellow); }
.how-num.n3 { background: var(--purple); }

.how-card h3 {
  margin: 0 0 6px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.how-card p {
  margin: 0;
  font-size: 14.5px;
  color: var(--muted);
}

.section-label {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--black);
  border-top: 1px solid var(--black);
  padding-top: 14px;
  margin: 56px 0 18px;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

.video-card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--bg);
  border: 1px solid var(--black);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.video-card:hover {
  transform: translate(-3px, -3px);
  box-shadow: 4px 4px 0 var(--black);
  background: var(--bg);
}
.video-card:active { transform: none; box-shadow: none; }

.video-card img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
  border-bottom: 1px solid var(--black);
}

.video-card .card-body { padding: 12px 14px 14px; }

.video-card h3 {
  font-weight: 700;
  font-size: 15px;
  line-height: 1.3;
  margin: 0 0 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.lang-chip {
  background: var(--yellow);
  border: 1px solid var(--black);
  border-radius: var(--radius);
  padding: 0 7px;
  font-size: 11.5px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--black);
}

.card-delete {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  border-radius: var(--radius);
  border: 1px solid var(--black);
  background: var(--bg);
  color: var(--black);
  font-size: 14px;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.12s ease;
}
.video-card:hover .card-delete, .card-delete:focus-visible { opacity: 1; }
.card-delete:hover { background: var(--red); color: #fff; }

.empty-note { color: var(--muted); }

/* -------------------------------------------------------------- video view */

.study {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 1fr);
  gap: 24px;
  max-width: 1360px;
  margin: 0 auto;
  padding: 24px 28px 40px;
  align-items: start;
}

.study-left { min-width: 0; }

.video-head { margin: 0 0 16px; }

.back-link {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--black);
  text-decoration: none;
  border-bottom: 1px solid var(--black);
}
.back-link:hover { background: var(--yellow); }

.video-title {
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: clamp(20px, 2.6vw, 28px);
  line-height: 1.15;
  margin: 10px 0 6px;
}

.video-byline {
  font-size: 14px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 10px;
}

.player-frame {
  position: relative;
  aspect-ratio: 16/9;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--black);
  box-shadow: 4px 4px 0 var(--black);
}
.player-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; }

/* transcript */

.transcript-panel {
  margin-top: 24px;
  background: var(--bg);
  border: 1px solid var(--black);
  border-radius: var(--radius);
  box-shadow: 4px 4px 0 var(--black);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--black);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.panel-head { flex-wrap: wrap; gap: 8px; }

.panel-head label { display: flex; align-items: center; gap: 8px; }

.panel-tools { display: flex; align-items: center; gap: 8px; }

.speed { display: flex; border: 1px solid var(--black); border-radius: var(--radius); overflow: hidden; }
.speed button {
  border: none;
  background: var(--bg);
  font-size: 12px;
  padding: 4px 8px;
  border-right: 1px solid var(--black);
}
.speed button:last-child { border-right: none; }
.speed button:hover { background: var(--gray); }
.speed button.on { background: var(--black); color: var(--bg); }

.tool-btn {
  border: 1px solid var(--black);
  background: var(--yellow);
  border-radius: var(--radius);
  font-size: 12px;
  padding: 4px 10px;
  text-transform: none;
  letter-spacing: normal;
}
.tool-btn:hover { background: var(--bg); }

.panel-head select {
  font-size: 13px;
  background: var(--bg);
  border: 1px solid var(--black);
  border-radius: var(--radius);
  padding: 3px 6px;
  max-width: 180px;
  text-transform: none;
  letter-spacing: normal;
  cursor: pointer;
}
.panel-head select:hover { background: var(--gray); }

.transcript-scroll {
  max-height: 46vh;
  overflow-y: auto;
  padding: 10px 8px 14px;
  scroll-behavior: smooth;
}

.t-line {
  display: flex;
  gap: 12px;
  align-items: baseline;
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  position: relative;
}
.t-line:hover { background: var(--gray); }

/* blind mode: lines are blurred until revealed */
.transcript-scroll.blind .t-text:not(.revealed) {
  filter: blur(5px);
  user-select: none;
}
.transcript-scroll.blind .t-text:not(.revealed):hover { filter: blur(4px); }

.t-controls {
  margin-left: auto;
  display: flex;
  gap: 5px;
  align-items: center;
  opacity: 0;
  transition: opacity 0.12s ease;
  flex: 0 0 auto;
}
.t-line:hover .t-controls, .t-controls:focus-within { opacity: 1; }

.t-btn {
  border: 1px solid var(--black);
  background: var(--bg);
  border-radius: var(--radius);
  font-size: 11.5px;
  padding: 2px 8px;
  white-space: nowrap;
}
.t-btn:hover { background: var(--pink); }
.t-loop.on { background: var(--purple); opacity: 1 !important; }
.t-line .t-loop.on { opacity: 1; }

.t-score {
  flex: 0 0 auto;
  font-size: 11.5px;
  font-weight: 500;
  border: 1px solid var(--black);
  border-radius: 999px;
  padding: 0 7px;
  font-variant-numeric: tabular-nums;
}
.t-score.good { background: var(--green); color: var(--bg); }
.t-score.mid { background: var(--orange); }
.t-score.bad { background: var(--red); color: var(--bg); }

.t-time {
  font-size: 12px;
  color: var(--muted);
  flex: 0 0 44px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.t-line:hover .t-time { color: var(--black); }

.t-text { font-size: 16px; }

/* the line being spoken: yellow block, black border */
.t-line.active {
  background: var(--yellow);
  border-color: var(--black);
}
.t-line.active .t-time { color: var(--black); font-weight: 500; }

/* ----------------------------------------------------- practice side panel */

.chat {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--black);
  border-radius: var(--radius);
  box-shadow: 4px 4px 0 var(--black);
  position: sticky;
  top: 20px;
  height: calc(100vh - 44px);
  min-height: 420px;
}

[hidden] { display: none !important; }

.side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--black);
}

.side-title {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.practice-view {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.practice-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.practice-empty {
  margin: auto 0;
  color: var(--muted);
  font-size: 14.5px;
}
.practice-empty p { margin: 0 0 10px; }

.echo-card {
  border: 1px solid var(--black);
  border-radius: var(--radius);
  padding: 12px 14px;
  background: var(--bg);
  animation: rise 0.18s ease-out;
}

.echo-status { font-size: 14.5px; }
.echo-status.error { color: var(--red); }

.echo-rec-actions { margin-left: 8px; }

.echo-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.echo-score {
  font-weight: 700;
  font-size: 18px;
  border: 1px solid var(--black);
  border-radius: var(--radius);
  padding: 1px 9px;
}
.echo-score.good { background: var(--green); color: var(--bg); }
.echo-score.mid { background: var(--orange); }
.echo-score.bad { background: var(--red); color: var(--bg); }

.echo-time { font-size: 12px; color: var(--muted); }

.echo-target { font-size: 16.5px; margin-bottom: 6px; }
.w-hit { background: var(--yellow); }
.w-miss { background: var(--red); color: var(--bg); border-radius: 3px; padding: 0 2px; }

.echo-heard { font-size: 13.5px; color: var(--muted); margin-bottom: 6px; }

.echo-tip {
  font-size: 13.5px;
  border-left: 3px solid var(--purple);
  padding-left: 9px;
  margin-bottom: 8px;
}

.echo-actions { display: flex; gap: 7px; }

@keyframes rise {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

/* ------------------------------------------------------------------ mobile */

@media (max-width: 900px) {
  .study { grid-template-columns: 1fr; padding: 16px; }
  .chat { position: static; height: 70vh; }
  .transcript-scroll { max-height: 38vh; }
  .topbar { padding: 14px 16px; }
  .home { padding: 40px 16px 64px; }
  .add-form { flex-direction: column; }
  .how { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .marquee-track { animation: none; }
  .transcript-scroll { scroll-behavior: auto; }
}
