:root {
  --bg: #f4f5f8;
  --ink: #151515;
  --muted: #696b72;
  --red: #ff2f14;
  --deep-red: #9b0805;
  --line: rgba(20, 20, 20, 0.08);
  --card: #ffffff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

.page-shell {
  width: min(100%, 430px);
  min-height: 100vh;
  margin: 0 auto;
  background: #f3f4f6;
  box-shadow: 0 0 38px rgba(0, 0, 0, 0.14);
}

.hero {
  position: relative;
  z-index: 5;
  overflow: hidden;
  padding: calc(12px + env(safe-area-inset-top)) 8px 10px;
  color: #fff;
  background: #080506;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 0%, rgba(255, 67, 40, 0.34), transparent 28%),
    radial-gradient(circle at 92% 70%, rgba(255, 47, 20, 0.36), transparent 26%),
    linear-gradient(135deg, #050505 0%, #141010 58%, #430906 100%);
}

.hero-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: 0.18;
}

.topbar,
.purchase-panel {
  position: relative;
  z-index: 1;
}

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

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

.brand-logo {
  display: block;
  flex: 0 0 auto;
  width: 104px;
  height: auto;
  object-fit: contain;
}

.brand-kicker {
  margin: 0 0 2px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
}

h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.1;
  letter-spacing: 0;
}

.sold-card {
  display: grid;
  min-width: 78px;
  padding: 7px 9px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  text-align: center;
  backdrop-filter: blur(10px);
}

.sold-card span {
  color: #fff;
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
}

.sold-card small,
.course-meta small {
  color: rgba(255, 255, 255, 0.68);
  font-size: 11px;
}

.purchase-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.95);
  color: var(--ink);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.22);
}

.course-meta {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.course-meta strong {
  font-size: 16px;
  line-height: 1.25;
}

.course-meta small {
  color: #73757c;
  line-height: 1.35;
}

.tag {
  width: fit-content;
  padding: 4px 8px;
  border-radius: 5px;
  color: var(--deep-red);
  background: #fff0ed;
  font-size: 12px;
  font-weight: 800;
}

.price-block {
  color: var(--red);
  white-space: nowrap;
}

.currency {
  font-size: 17px;
  font-weight: 900;
}

.price {
  font-size: 40px;
  font-weight: 800;
  line-height: 1;
}

.buy-button,
.primary-button,
.code-button {
  border: 0;
  cursor: pointer;
  transition: transform 0.18s ease, opacity 0.18s ease, box-shadow 0.18s ease;
}

.buy-button {
  grid-column: 1 / -1;
  width: 100%;
  min-height: 46px;
  border-radius: 6px;
  color: #fff;
  background: linear-gradient(135deg, #ff2f14, #ff5a1f);
  font-size: 17px;
  font-weight: 900;
  box-shadow: 0 12px 24px rgba(255, 47, 20, 0.28);
}

.buy-button:active,
.primary-button:active,
.code-button:active {
  transform: scale(0.98);
}

.tabs {
  position: relative;
  z-index: 4;
  display: grid;
  grid-template-columns: 1fr;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
}

.tabs a {
  position: relative;
  padding: 14px 4px;
  color: #4a4b50;
  text-align: center;
  text-decoration: none;
  font-size: 14px;
  font-weight: 800;
}

.tabs a.active {
  color: #111;
}

.tabs a.active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 7px;
  width: 22px;
  height: 3px;
  border-radius: 999px;
  background: var(--red);
  transform: translateX(-50%);
}

.poster-section {
  display: grid;
  justify-items: center;
  padding: 8px;
}

.poster-section img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.14);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  align-items: flex-end;
  justify-content: center;
}

.modal.is-open {
  display: flex;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.58);
}

.modal-card {
  position: relative;
  width: min(calc(100% - 16px), 430px);
  padding: 22px 18px calc(18px + env(safe-area-inset-bottom));
  border-radius: 10px 10px 0 0;
  background: #fff;
  box-shadow: 0 -18px 40px rgba(0, 0, 0, 0.24);
  animation: rise 0.22s ease-out;
}

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

.close-button {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 7px;
  background: #f0f1f3;
  color: #333;
  font-size: 24px;
  line-height: 1;
}

.modal-eyebrow {
  margin: 0 0 6px;
  color: var(--red);
  font-size: 13px;
  font-weight: 900;
}

.modal-card h2 {
  margin: 0 42px 8px 0;
  font-size: 24px;
}

.modal-note {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.form {
  display: grid;
  gap: 14px;
}

.form label {
  display: grid;
  gap: 8px;
  color: #333;
  font-size: 14px;
  font-weight: 800;
}

.form input {
  width: 100%;
  min-height: 48px;
  border: 1px solid #dedfe4;
  border-radius: 6px;
  padding: 0 12px;
  outline: none;
  background: #fafafa;
  font-size: 16px;
}

.form input:focus {
  border-color: var(--red);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(255, 47, 20, 0.1);
}

.code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px;
  gap: 8px;
}

.code-button {
  min-height: 48px;
  border-radius: 6px;
  color: #fff;
  background: #222;
  font-size: 14px;
  font-weight: 900;
}

.code-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.form-message {
  min-height: 18px;
  margin: -4px 0 0;
  color: var(--red);
  font-size: 13px;
}

.primary-button {
  width: 100%;
  min-height: 50px;
  border-radius: 6px;
  color: #fff;
  background: linear-gradient(135deg, #ff2f14, #ff5a1f);
  font-size: 16px;
  font-weight: 900;
  box-shadow: 0 12px 24px rgba(255, 47, 20, 0.22);
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.66;
  box-shadow: none;
}

.primary-button.ghost {
  margin-top: 12px;
  color: var(--red);
  background: #fff0ed;
  box-shadow: none;
}

.pay-card {
  text-align: center;
}

.qr-shell {
  display: grid;
  width: 210px;
  height: 210px;
  place-items: center;
  margin: 8px auto 16px;
  border: 10px solid #fff;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.16);
}

.qr-code {
  display: flex;
  justify-content: center;
  align-items: center;
}


.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 30;
  max-width: calc(100vw - 40px);
  padding: 10px 14px;
  border-radius: 999px;
  color: #fff;
  background: rgba(0, 0, 0, 0.82);
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (min-width: 720px) {
  body {
    padding: 32px 20px;
  }

  .tabs {
    position: static;
  }

  .page-shell {
    border-radius: 10px;
    overflow: hidden;
  }
}

@media (min-width: 960px) {
  body {
    background:
      radial-gradient(circle at 18% 0%, rgba(255, 47, 20, 0.12), transparent 28%),
      radial-gradient(circle at 82% 12%, rgba(20, 20, 20, 0.08), transparent 30%),
      #f1f2f5;
  }

  .page-shell {
    width: min(1180px, 100%);
    background: transparent;
    box-shadow: none;
  }

  .hero {
    padding: 24px 32px 26px;
    border-radius: 10px 10px 0 0;
  }

  .hero-bg {
    background:
      radial-gradient(circle at 12% 12%, rgba(255, 81, 48, 0.34), transparent 26%),
      radial-gradient(circle at 88% 36%, rgba(255, 47, 20, 0.32), transparent 24%),
      linear-gradient(135deg, #050505 0%, #160d0d 54%, #520a06 100%);
  }

  .topbar {
    max-width: 1100px;
    margin: 0 auto;
  }

  .brand {
    gap: 16px;
  }

  .brand-logo {
    width: 152px;
  }

  .brand-kicker {
    font-size: 15px;
  }

  h1 {
    font-size: 38px;
  }

  .sold-card {
    min-width: 128px;
    padding: 14px 18px;
    border-radius: 8px;
  }

  .sold-card span {
    font-size: 34px;
  }

  .sold-card small {
    font-size: 14px;
  }

  .purchase-panel {
    grid-template-columns: minmax(0, 1fr) auto 188px;
    max-width: 1100px;
    min-height: 108px;
    margin: 24px auto 0;
    padding: 20px 24px;
    border-radius: 8px;
  }

  .course-meta {
    gap: 8px;
  }

  .course-meta strong {
    font-size: 28px;
  }

  .course-meta small {
    max-width: 560px;
    font-size: 14px;
  }

  .tag {
    padding: 6px 12px;
    font-size: 14px;
  }

  .currency {
    font-size: 24px;
  }

  .price {
    font-size: 58px;
  }

  .buy-button {
    grid-column: auto;
    min-height: 52px;
    font-size: 18px;
  }

  .tabs {
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    border-right: 1px solid var(--line);
    border-left: 1px solid var(--line);
  }

  .tabs a {
    padding: 20px 8px;
    font-size: 17px;
  }

  .tabs a.active::after {
    bottom: 10px;
    width: 34px;
  }

  .poster-section {
    display: grid;
    justify-items: center;
    padding: 14px 0 48px;
    background: #f5f6f9;
  }

  .poster-section img {
    width: min(760px, calc(100% - 32px));
    border-radius: 6px;
    box-shadow: 0 18px 46px rgba(0, 0, 0, 0.18);
  }

  .modal {
    align-items: center;
    padding: 32px;
  }

  .modal-card {
    width: 460px;
    padding: 28px;
    border-radius: 10px;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
  }

  .pay-card {
    width: 500px;
  }

  .modal-card h2 {
    font-size: 30px;
  }

  .qr-shell {
    width: 238px;
    height: 238px;
  }

  .toast {
    bottom: 36px;
  }
}

@media (max-width: 360px) {
  .purchase-panel {
    grid-template-columns: 1fr;
  }

  .price-block {
    justify-self: start;
  }

  .code-row {
    grid-template-columns: 1fr;
  }
}
