/* style.css — Clean Light UI (no blotchy background)
   Scoped mostly to your classes. */

/* ===== Tokens ===== */
:root{
  --bg: #f4f6fb;        /* page background */
  --surface: #ffffff;   /* cards */
  --surface2:#fbfcff;

  --text:#0f172a;
  --muted:#475569;
  --muted2:#64748b;

  --border: rgba(2,6,23,.10);
  --border2: rgba(2,6,23,.06);

  --accent:#2563eb;
  --accent2:#1d4ed8;

  --ok:#16a34a;
  --warn:#f59e0b;

  --shadow: 0 18px 48px rgba(2,6,23,.10);
  --shadow2: 0 10px 24px rgba(2,6,23,.08);
  --shadow3: 0 2px 10px rgba(2,6,23,.06);

  --r: 14px;
  --r2: 18px;

  --max: 980px;

  --ui: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", "Helvetica Neue", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;

  --focus: 0 0 0 4px rgba(37,99,235,.16);
}

/* ===== Base (minimal global) ===== */
*{ box-sizing:border-box; }
html,body{ margin:0; padding:0; }
body{
  font-family: var(--ui);
  color: var(--text);

  /* Option A (recommended): pure clean background, no artifacts */
  background: var(--bg);

  /* Option B: very soft single gradient (uncomment if you want slight depth)
  background: linear-gradient(180deg, #f7f8fc 0%, #f2f5fb 60%, #eef2fa 100%);
  */
}

.page{
  width:100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 28px 14px 64px;
}

/* Focus ring */
:focus{ outline:none; }
:focus-visible{ box-shadow: var(--focus); border-radius: 12px; }

/* ===== Header ===== */
.course-header{
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--r2);
  box-shadow: var(--shadow2);
  padding: 20px 20px 18px;
  margin: 0 0 14px;
}

.course-label{
  display:inline-flex;
  align-items:center;
  gap:10px;
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted2);
  margin-bottom: 10px;
}

.course-label-dot{
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(37,99,235,.10);
}

.course-title{
  margin: 0 0 8px;
  font-size: clamp(26px, 3.2vw, 40px);
  line-height: 1.08;
  letter-spacing: -0.03em;
  font-weight: 800;
}

.course-subtitle{
  margin: 0;
  max-width: 760px;
  font-size: 15px;
  color: var(--muted);
}

.course-meta{
  margin-top: 14px;
  display:flex;
  flex-wrap:wrap;
  gap: 8px;
}

.course-meta-pill{
  border: 1px solid var(--border2);
  background: var(--surface2);
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 12px;
  color: var(--muted);
}

.course-note{
  margin-top: 12px;
  border: 1px dashed rgba(2,6,23,.16);
  background: rgba(37,99,235,.04);
  border-radius: var(--r);
  padding: 10px 12px;
  font-size: 13px;
  color: var(--muted);
}

.course-note b{ color: var(--text); }

/* ===== TG CTA ===== */
.tg-cta{
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--r2);
  box-shadow: var(--shadow3);
  padding: 14px 14px;
  margin: 0 0 14px;

  display:flex;
  gap: 12px;
  align-items:flex-start;
  justify-content:space-between;
}

.tg-cta-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding: 12px 14px;
  border-radius: 12px;

  background: var(--accent);
  color: #fff;
  text-decoration:none;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  font-size: 12px;

  border: 1px solid rgba(29,78,216,.35);
  box-shadow: 0 10px 22px rgba(37,99,235,.18);
  transition: transform .08s ease, background .12s ease;
  white-space: nowrap;
}

.tg-cta-btn:hover{ background: var(--accent2); }
.tg-cta-btn:active{ transform: translateY(1px); }

.tg-cta-caption{
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.tg-cta-caption > div{ margin: 0 0 4px; }
.tg-cta-caption > div:last-child{ margin: 0; }

.tg-cta--finish{
  margin-top: 14px;
  flex-direction: column;
  align-items:flex-start;
}

.tg-finish-tips{
  width:100%;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border2);
  color: var(--muted);
  font-size: 14px;
}

.tg-finish-tip{ margin: 0 0 8px; }
.tg-finish-tip:last-child{ margin:0; }
.tg-finish-tip b{ color: var(--text); }

/* ===== Steps ===== */
.steps-wrapper{
  display:flex;
  flex-direction:column;
  gap: 12px;
  margin-bottom: 14px;
}

.step{
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--r2);
  box-shadow: var(--shadow3);
  overflow:hidden;
}

.step-header{
  display:flex;
  gap: 12px;
  align-items:flex-start;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border2);
  background: linear-gradient(180deg, rgba(2,6,23,.02), rgba(2,6,23,.00));
}

.step-number{
  flex: 0 0 auto;
  min-width: 44px;
  height: 34px;
  padding: 0 10px;
  border-radius: 999px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight: 800;
  font-size: 13px;
  color: var(--text);
  background: rgba(37,99,235,.10);
  border: 1px solid rgba(37,99,235,.18);
}

.step-title-wrap{ flex: 1 1 auto; min-width: 0; }

.step-name{
  margin: 0;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

.step-description{
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.step-body{
  display:grid;
  grid-template-columns: 1.65fr 1.1fr;
  gap: 14px;
  padding: 14px 16px 16px;
  align-items:start;
}

/* Text block */
.step-text{
  font-size: 15px;
  color: var(--text);
}
.step-text p{ margin: 0 0 10px; }

/* Lists — readable, consistent */
.step-text ul,
.step-text ol{
  margin: 8px 0 12px;
  padding-left: 20px;
  color: var(--muted);
}
.step-text li{ margin: 6px 0; }
.step-text ul li::marker{ color: rgba(37,99,235,.70); }
.step-text ol li::marker{ color: rgba(37,99,235,.70); font-weight: 700; }

/* Inline code */
.step-text code{
  font-family: var(--mono);
  font-size: 13px;
  padding: 2px 6px;
  border-radius: 8px;
  border: 1px solid var(--border2);
  background: rgba(2,6,23,.04);
  color: var(--text);
}

/* Links inside steps */
.step-links{
  margin-top: 10px;
  display:flex;
  flex-wrap:wrap;
  gap: 8px;
}
.step-link{
  display:inline-flex;
  max-width: 520px;
  border-radius: 999px;
  padding: 8px 12px;
  border: 1px solid var(--border2);
  background: var(--surface2);
  text-decoration:none;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow:hidden;
  text-overflow: ellipsis;
  transition: transform .08s ease, border-color .12s ease, background .12s ease;
}
.step-link:hover{
  border-color: rgba(37,99,235,.24);
  background: rgba(37,99,235,.05);
}
.step-link:active{ transform: translateY(1px); }

/* Progress row */
.step-progress{
  margin: 0 0 12px;
  display:flex;
  align-items:center;
  gap: 10px;
  flex-wrap:wrap;
}
.step-done-btn{
  border: 1px solid rgba(2,6,23,.14);
  background: rgba(2,6,23,.02);
  color: var(--text);
  border-radius: 999px;
  padding: 9px 12px;
  cursor:pointer;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  transition: background .12s ease, border-color .12s ease, transform .08s ease;
}
.step-done-btn:hover{
  background: rgba(37,99,235,.08);
  border-color: rgba(37,99,235,.22);
}
.step-done-btn:active{ transform: translateY(1px); }

.step-done-hint{
  font-size: 12px;
  color: var(--muted2);
}

/* Media */
.step-media{
  display:flex;
  flex-direction:column;
  gap: 10px;
  align-items: stretch;
}
.step-media.empty{ min-height: 1px; }

.step-media-box{
  width:100%;
  border-radius: var(--r);
  overflow:hidden;
  border: 1px solid var(--border2);
  background: #fff;
  box-shadow: var(--shadow3);
}
.step-image-wrapper{ position: relative; cursor: zoom-in; }
.step-image{ width:100%; height:auto; background:#fff; }

.step-image-hint{
  position:absolute;
  right: 10px;
  bottom: 10px;
  font-size: 11px;
  color: var(--muted);
  background: rgba(255,255,255,.92);
  border: 1px solid var(--border2);
  border-radius: 999px;
  padding: 6px 10px;
  backdrop-filter: blur(6px);
}
.step-video{ width:100%; display:block; background:#000; }

/* States */
.step.is-done{
  border-color: rgba(22,163,74,.18);
  box-shadow: 0 14px 40px rgba(22,163,74,.10);
}
.step.is-done .step-number{
  background: rgba(22,163,74,.12);
  border-color: rgba(22,163,74,.22);
}

.step.is-current{
  border-color: rgba(37,99,235,.22);
  box-shadow: 0 18px 50px rgba(37,99,235,.12);
}
.step.is-current .step-header{
  background: linear-gradient(180deg, rgba(37,99,235,.08), rgba(37,99,235,.02));
}

/* Locked placeholder */
.step-locked-placeholder{
  background: rgba(255,255,255,.72);
  border: 1px dashed rgba(2,6,23,.16);
  box-shadow: none;
}
.step-locked-placeholder .step-header{ background: transparent; }
.step-locked-placeholder .step-number{
  background: rgba(2,6,23,.05);
  border-color: rgba(2,6,23,.10);
  color: var(--muted);
}
.locked-kicker{
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted2);
  margin: 0 0 6px;
}
.locked-text{
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}
.locked-bar{
  margin-top: 12px;
  height: 8px;
  width: min(420px, 100%);
  border-radius: 999px;
  border: 1px solid var(--border2);
  background: rgba(2,6,23,.04);
  overflow:hidden;
}
.locked-bar::after{
  content:"";
  display:block;
  height:100%;
  width: 38%;
  background: rgba(37,99,235,.20);
}

/* ===== Result ===== */
.result-card{
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--r2);
  box-shadow: var(--shadow2);
  padding: 16px;
}
.result-title{
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.result-subtitle{
  margin: 0 0 12px;
  font-size: 13.5px;
  color: var(--muted);
  max-width: 760px;
}
.result-form{
  display:flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items:center;
}
.result-input{
  flex: 1 1 320px;
  min-width: 0;
  border-radius: 12px;
  border: 1px solid var(--border2);
  background: #fff;
  color: var(--text);
  font-size: 14px;
  padding: 12px 12px;
  font-family: var(--mono);
}
.result-input::placeholder{ color: rgba(100,116,139,.75); }
.result-input:focus{
  border-color: rgba(37,99,235,.36);
  box-shadow: var(--focus);
}
.result-button{
  border-radius: 12px;
  border: 1px solid rgba(37,99,235,.28);
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: .10em;
  text-transform: uppercase;
  padding: 12px 14px;
  cursor: pointer;
  transition: transform .08s ease, background .12s ease, border-color .12s ease;
}
.result-button:hover{
  background: var(--accent2);
  border-color: rgba(29,78,216,.42);
}
.result-button:active{ transform: translateY(1px); }
.result-button:disabled{ opacity: .70; cursor: default; }

.result-hint{
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted2);
}

/* Gate states */
.result-card.is-result-required{
  border-color: rgba(245,158,11,.40);
  box-shadow: 0 18px 50px rgba(245,158,11,.10);
}
.result-card.is-result-required .result-button{
  background: rgba(245,158,11,.92);
  border-color: rgba(245,158,11,.55);
}
.result-card.is-result-saved{
  border-color: rgba(22,163,74,.26);
  box-shadow: 0 18px 50px rgba(22,163,74,.10);
}
.result-card.is-result-saved .result-button{
  background: rgba(22,163,74,.92);
  border-color: rgba(22,163,74,.55);
}
.result-card.shake{ animation: resultShake .32s linear; }
@keyframes resultShake{
  0%{ transform: translateX(0); }
  25%{ transform: translateX(-4px); }
  50%{ transform: translateX(4px); }
  75%{ transform: translateX(-3px); }
  100%{ transform: translateX(0); }
}

/* ===== Modal ===== */
.image-modal{
  position: fixed;
  inset: 0;
  display:none;
  align-items:center;
  justify-content:center;
  padding: 16px;
  background: rgba(2,6,23,.72);
  z-index: 50;
}
.image-modal.open{ display:flex; }

.image-modal-inner{
  width: min(1100px, 96vw);
  max-height: 88vh;
  background: #fff;
  border-radius: var(--r2);
  border: 1px solid rgba(255,255,255,.18);
  box-shadow: 0 30px 90px rgba(2,6,23,.45);
  overflow:hidden;
  position: relative;
}
.image-modal-img{
  max-width: 100%;
  max-height: 88vh;
  object-fit: contain;
}
.image-modal-close{
  position:absolute;
  right: 12px;
  top: 12px;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid var(--border2);
  background: rgba(255,255,255,.92);
  color: var(--text);
  cursor:pointer;
  font-size: 20px;
  display:flex;
  align-items:center;
  justify-content:center;
}
.image-modal-close:hover{ background: #fff; }

/* ===== Responsive ===== */
@media (max-width: 860px){
  .page{ padding: 18px 12px 44px; }
  .course-header{ padding: 18px 16px; }
  .step-body{ grid-template-columns: 1fr; }
  .tg-cta{ flex-direction: column; align-items:flex-start; }
}

@media (max-width: 480px){
  .course-title{ font-size: 24px; }
  .step-header{ padding: 12px 14px; }
  .step-body{ padding: 12px 14px 14px; }
  .result-input{ flex-basis: 100%; }
  .result-button{ width: 100%; }
  .tg-cta-btn{ width: 100%; }
}

[hidden]{ display:none !important; }

/* ===== Entry Screen ===== */
.entry{
  min-height: calc(100vh - 92px);
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 10px 0 24px;
}

.entry-card{
  width: 100%;
  max-width: 720px;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--r2);
  box-shadow: var(--shadow2);
  padding: 22px 20px;
}

.entry-title{
  margin: 0 0 14px;
  font-size: clamp(22px, 3vw, 34px);
  line-height: 1.12;
  letter-spacing: -0.03em;
  font-weight: 900;
}

.entry-points{
  margin: 0 0 18px;
  padding-left: 18px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

.entry-points li{ margin: 6px 0; }

.entry-btn{
  width: 100%;
  border: 1px solid rgba(29,78,216,.35);
  background: var(--accent);
  color: #fff;
  border-radius: 14px;
  padding: 14px 14px;
  cursor: pointer;
  font-weight: 900;
  font-size: 13px;
  letter-spacing: .08em;
  text-transform: uppercase;
  box-shadow: 0 14px 30px rgba(37,99,235,.18);
  transition: transform .08s ease, background .12s ease;
}

.entry-btn:hover{ background: var(--accent2); }
.entry-btn:active{ transform: translateY(1px); }

@media (max-width: 480px){
  .entry{ min-height: calc(100vh - 72px); }
  .entry-card{ padding: 18px 16px; }
}

.step-link--btn{
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}
