:root {
  --ink: #111111;
  --ink-soft: #4a4a4a;
  --paper: #ffffff;
  --card: #ffffff;
  --red: #e8390c;
  --red-dark: #c42e09;
  --line: #e6e6e6;
  --danger: #b42318;
  --shadow: 0 18px 50px rgba(17, 17, 17, 0.12);
  --sans: "Poppins", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 400;
}

button, input { font: inherit; }

.eyebrow {
  margin: 0 0 0.6rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--red);
}

.gate {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
}

.brand-logo {
  display: block;
  height: 46px;
  width: auto;
  max-width: 240px;
  align-self: flex-start;
  flex: none;
  object-fit: contain;
  object-position: left center;
}

.brand-logo-gate {
  height: 58px;
  max-width: 300px;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  min-width: 0;
}

.gate-story {
  background: #fde8e1;
  color: var(--ink);
  padding: 7vh 7vw;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 2rem;
}

.gate-story .eyebrow { color: var(--red); }

.gate-story h1 {
  margin: 0;
  font-size: clamp(3.2rem, 6vw, 5.6rem);
  font-weight: 600;
  line-height: 0.95;
  letter-spacing: -0.03em;
}

.gate-story h1 span {
  display: block;
  color: var(--red);
}

.lede {
  max-width: 28rem;
  margin: 1.5rem 0 0;
  font-size: 1.15rem;
  line-height: 1.5;
  color: var(--ink-soft);
}

.gate-card {
  margin: auto;
  width: min(440px, calc(100% - 3rem));
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 2.2rem 2rem 2rem;
}

.gate-card h2 {
  margin: 0 0 0.45rem;
  font-size: 1.85rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.gate-card p {
  margin: 0 0 1.4rem;
  color: var(--ink-soft);
  line-height: 1.5;
}

.gate-card label {
  display: block;
  margin-bottom: 0.45rem;
  font-size: 0.86rem;
  font-weight: 600;
}

.gate-card input {
  width: 100%;
  border: 1px solid rgba(23, 36, 28, 0.18);
  background: #fff;
  border-radius: 6px;
  padding: 0.9rem 1rem;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
}

.gate-card input:focus {
  outline: 2px solid rgba(232, 57, 12, 0.35);
  border-color: var(--red);
}

.gate-card button,
.player-close,
.text-button {
  cursor: pointer;
}

.gate-card button {
  width: 100%;
  margin-top: 1rem;
  border: 0;
  border-radius: 6px;
  padding: 0.9rem 1rem;
  background: var(--red);
  color: #ffffff;
  font-weight: 600;
}

.gate-card button:hover { background: var(--red-dark); }
.gate-card button:disabled { opacity: 0.65; cursor: progress; }

.form-error {
  margin: 0.75rem 0 0;
  color: var(--danger);
  font-size: 0.92rem;
}

.library {
  width: min(1120px, calc(100% - 2.5rem));
  margin: 0 auto;
  padding: 2rem 0 4rem;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding-bottom: 1.2rem;
  border-bottom: 1px solid var(--line);
}

.topbar > div { min-width: 0; }

.topbar h1 {
  margin: 0;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.text-button {
  flex: none;
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 6px;
  padding: 0.55rem 0.95rem;
  color: var(--red);
  border-color: var(--red);
  white-space: nowrap;
}

.text-button:hover { color: #ffffff; background: var(--red); }

.practice-notes {
  margin: 1.4rem 0 1.3rem;
  color: var(--ink);
  line-height: 1.55;
}

.practice-notes p {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: 0.35rem 0;
}

.practice-notes svg {
  width: 1.2rem;
  height: 1.2rem;
  flex: none;
  fill: none;
  stroke: var(--red);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.practice-notes .motto {
  margin-top: 0.7rem;
  font-size: 1.22rem;
  font-weight: 700;
}

.practice-notes .motto svg {
  width: 1.4rem;
  height: 1.4rem;
}

.library-footer {
  margin-top: 2.6rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.92rem;
  line-height: 1.6;
}

.library-footer p { margin: 0.35rem 0; }

.library-footer p + p { margin-top: 0.85rem; }

.library-description {
  max-width: 40rem;
  color: var(--ink-soft);
  line-height: 1.55;
}

.library-status { color: var(--ink-soft); }

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.video-card {
  padding: 0;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 18px;
  overflow: hidden;
  text-align: left;
  color: inherit;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(20, 35, 28, 0.05);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.video-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #1a1a1a;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.play-mark {
  position: absolute;
  left: 0.9rem;
  bottom: 0.9rem;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 50%;
  background: rgba(255, 253, 248, 0.94);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}

.play-mark::before {
  content: "";
  position: absolute;
  top: 0.82rem;
  left: 1.05rem;
  border-style: solid;
  border-width: 0.48rem 0 0.48rem 0.78rem;
  border-color: transparent transparent transparent var(--red);
}

.duration {
  position: absolute;
  right: 0.75rem;
  bottom: 0.75rem;
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
  background: rgba(13, 24, 19, 0.78);
  color: #fff;
  font-size: 0.78rem;
  letter-spacing: 0.03em;
}

.card-copy { padding: 0.95rem 1rem 1.1rem; }

.card-copy h2 {
  margin: 0.15rem 0 0.25rem;
  font-size: 1.12rem;
  font-weight: 600;
  line-height: 1.3;
}

.card-copy p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.card-copy .eyebrow,
.player-copy .eyebrow { color: var(--red); }

.player-dialog {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 1.25rem;
}

.player-dialog[hidden],
.library[hidden],
.gate[hidden],
.loading-overlay[hidden],
.terms-dialog[hidden] { display: none; }

.terms-dialog {
  position: fixed;
  inset: 0;
  z-index: 25;
  display: grid;
  place-items: center;
  padding: 1.25rem;
}

.terms-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 17, 17, 0.72);
}

.terms-panel {
  position: relative;
  width: min(480px, 100%);
  background: #ffffff;
  color: var(--ink);
  border-radius: 20px;
  padding: 1.7rem 1.6rem 1.4rem;
  box-shadow: var(--shadow);
}

.terms-panel h2 {
  margin: 0.2rem 0 0.7rem;
  font-size: 1.55rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.terms-panel p {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.55;
}

.terms-panel a {
  color: var(--red);
  font-weight: 600;
}

.terms-name {
  margin: 0.15rem 0 0.85rem;
  color: var(--ink);
  font-size: 1.35rem;
  font-weight: 700;
}

.terms-panel .terms-name { color: var(--ink); }

.agree-check {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-top: 1.15rem;
  color: var(--ink);
  font-weight: 600;
  cursor: pointer;
}

.agree-check input {
  width: 1.15rem;
  height: 1.15rem;
  margin: 0;
  accent-color: var(--red);
}

#terms-error {
  margin-top: 0.85rem;
  color: var(--danger);
  font-size: 0.92rem;
}

.terms-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.4rem;
}

.terms-actions .text-button { background: #ffffff; }

#terms-accept {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-width: 7.4rem;
  border: 0;
  border-radius: 6px;
  padding: 0.7rem 1.2rem;
  background: var(--red);
  color: #ffffff;
  font-weight: 600;
  cursor: pointer;
}

#terms-accept:hover { background: var(--red-dark); }
#terms-accept:disabled { opacity: 0.45; cursor: not-allowed; }
#terms-accept.is-busy:disabled { opacity: 1; cursor: progress; }
#terms-decline:disabled { opacity: 0.45; cursor: not-allowed; }

.button-spinner {
  width: 0.95rem;
  height: 0.95rem;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 15;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.88);
}

.loading-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  color: var(--ink);
  font-weight: 500;
}

.loading-card p { margin: 0; }

.spinner {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  border: 3px solid #f6d2c6;
  border-top-color: var(--red);
  animation: spin 0.75s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .spinner,
  .button-spinner { animation: none; }
  .spinner { border-top-color: var(--red); }
}

.player-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 17, 17, 0.72);
}

.player-panel {
  position: relative;
  width: min(960px, 100%);
  max-height: calc(100vh - 2.5rem);
  overflow: auto;
  background: #111111;
  color: #ffffff;
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.player-close {
  position: absolute;
  top: 0.8rem;
  right: 0.8rem;
  z-index: 2;
  border: 0;
  border-radius: 999px;
  padding: 0.4rem 0.75rem;
  background: rgba(255, 253, 248, 0.92);
  color: var(--ink);
  font-weight: 600;
}

.player-stage video {
  width: 100%;
  max-height: 68vh;
  background: #000;
  display: block;
}

.player-copy { padding: 1.1rem 1.3rem 1.4rem; }

.player-copy h2 {
  margin: 0 0 0.4rem;
  font-size: 1.6rem;
  font-weight: 600;
}

.player-copy p {
  margin: 0;
  color: rgba(246, 241, 231, 0.78);
  line-height: 1.5;
  white-space: pre-wrap;
}

@media (max-width: 860px) {
  .gate { grid-template-columns: 1fr; }
  .gate-story { min-height: 46vh; padding: 1.5rem 1.4rem 2.6rem; }
  .brand-logo-gate { height: 48px; }
  .gate-card { margin: -2rem auto 2rem; }
  .brand-block { flex-direction: column; align-items: flex-start; gap: 0.7rem; }
}
