/* ===== Design Tokens ===== */
:root {
  --bg: #f8f5f2;          /* light tan background */
  --panel: #ffffff;       /* white panels */
  --accent: #6c63ff;      /* futuristic purple */
  --accent-alt: #00c7b7;  /* teal highlight */
  --text: #2a2a2a;        /* soft black text */
  --muted: #7a7a7a;       /* secondary text */
  --border: #e0ddd9;      /* soft neutral border */
  --shadow: rgba(0, 0, 0, 0.08);
  --ok: #00c7b7;
  --warn: #f5a623;
}

/* ===== Base ===== */
* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", "IBM Plex Sans Thai", system-ui, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body {
  padding-top: 74px;
}

.center {
  display: block;
  text-align: center;
}

.inline {
  display: inline-block;
}

.hidden {
  display: none !important;
}

/* ===== Layout / Containers ===== */
.container {
  max-width: 860px;
  margin: 40px auto;
  padding: 32px;
  background: var(--panel);
  border-radius: 16px;
  box-shadow: 0 10px 30px var(--shadow);
  border: 1px solid var(--border);
}

.page-stack {
  display: grid;
  gap: 32px;
  margin: 40px 0;
}

.page-stack > .container {
  margin: 0 auto;
  width: min(100%, 860px);
}

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(248, 245, 242, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.topbar-backdrop {
  display: none;
}

.lang-bar {
  display: flex;
  justify-content: center;
  margin: 18px 0 -8px;
}

.topbar-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar-menu-toggle {
  display: none;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
}

.topbar-menu-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: var(--text);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.topbar-links {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}

.topbar-links a.nav-button.active,
.topbar-links a.nav-button.active:visited,
.topbar-links a.nav-button.active:hover,
.topbar-links a.nav-button.active:focus,
.topbar-links a.nav-button[aria-current="page"],
.topbar-links a.nav-button[aria-current="page"]:visited,
.topbar-links a.nav-button[aria-current="page"]:hover,
.topbar-links a.nav-button[aria-current="page"]:focus {
  background: var(--accent);
  color: var(--panel);
  border-color: transparent;
  box-shadow: 0 3px 10px rgba(108, 99, 255, 0.18);
  text-decoration: none;
}

.topbar-links a.nav-button.active.secondary-action,
.topbar-links a.nav-button[aria-current="page"].secondary-action {
  background: var(--accent);
  color: var(--panel);
  border-color: var(--accent);
}

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

.nav-button {
  min-width: 0;
  padding: 7px 11px;
  font-size: 12px;
  text-decoration: none;
  border-width: 1px;
  line-height: 1.15;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-user-email {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  color: var(--muted);
}

.topbar-logout-btn {
  min-width: 0;
  padding: 6px 10px;
  font-size: 12px;
  line-height: 1.15;
}

.topbar-auth-link {
  min-width: 0;
  padding: 6px 10px;
  font-size: 12px;
  text-decoration: none;
  line-height: 1.15;
}

.row {
  display: flex;
  gap: 16px;
}

.row > * {
  flex: 1;
}

/* Responsive layout */
@media (max-width: 720px) {
  body.menu-open {
    overflow: hidden;
  }
  body {
    padding-top: 88px;
  }
  .topbar {
    background: rgba(248, 245, 242, 0.96);
    backdrop-filter: blur(16px);
  }
  .topbar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 999;
    border: 0;
    padding: 0;
    background: rgba(42, 42, 42, 0);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease, background 0.22s ease;
  }
  body.menu-open .topbar-backdrop {
    opacity: 1;
    pointer-events: auto;
    background: rgba(42, 42, 42, 0.28);
  }
  .topbar-menu-toggle {
    display: inline-flex;
    margin-left: auto;
    position: relative;
    z-index: 1002;
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
  }
  .topbar-inner {
    padding: 12px 16px;
    align-items: center;
    flex-direction: row;
    position: relative;
    min-height: 68px;
  }
  .topbar-links,
  .topbar-right {
    position: absolute;
    left: 16px;
    right: 16px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-10px);
    transition: opacity 0.22s ease, transform 0.22s ease;
  }
  .topbar.menu-open .topbar-links,
  .topbar.menu-open .topbar-right {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }
  .topbar.menu-open .topbar-links {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    top: calc(100% + 10px);
    padding: 16px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.95));
    border: 1px solid rgba(108, 99, 255, 0.12);
    border-radius: 18px 18px 14px 14px;
    box-shadow: 0 20px 34px rgba(15, 23, 42, 0.12);
  }
  .topbar.menu-open .topbar-right {
    display: flex;
    top: calc(100% + 10px + 16px + 4 * 42px + 3 * 10px + 18px);
    padding: 0 16px 16px;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.95), rgba(255, 255, 255, 0.98));
    border: 1px solid rgba(108, 99, 255, 0.12);
    border-top: 0;
    border-radius: 0 0 18px 18px;
    box-shadow: 0 20px 34px rgba(15, 23, 42, 0.12);
  }
  .topbar.menu-open .topbar-menu-toggle span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }
  .topbar.menu-open .topbar-menu-toggle span:nth-child(2) {
    opacity: 0;
  }
  .topbar.menu-open .topbar-menu-toggle span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }
  .funnel-hero-card {
    padding: 26px 18px;
  }
  .funnel-hero h1 {
    max-width: none;
    font-size: clamp(1.9rem, 9vw, 2.8rem);
  }
  .funnel-kicker {
    font-size: 0.68rem;
    letter-spacing: 0.14em;
  }
  .funnel-lead {
    font-size: 1rem;
  }
  .funnel-sublead {
    font-size: 0.94rem;
  }
  .row {
    flex-wrap: wrap;
  }
  .row > * {
    flex: 1 1 100%;
  }
  .plan-grid {
    grid-template-columns: 1fr;
  }
  .comparison-grid {
    grid-template-columns: 1fr;
  }
  .row.actions.funnel-actions,
  .row.actions.left-actions {
    gap: 10px;
    margin-top: 8px;
  }
  .row.actions.funnel-actions > *,
  .row.actions.left-actions > * {
    flex: 1 1 100%;
  }
  .row.actions.funnel-actions a,
  .row.actions.left-actions a {
    width: 100%;
    min-width: 0;
  }
  .comparison-block,
  .ats-checklist,
  .ats-mistakes,
  .social-proof-block {
    margin-top: 18px;
  }
  .card.funnel-section-card,
  .card.social-proof-block {
    padding: 20px 16px 22px;
  }
  .funnel-section-card h2,
  .funnel-final-card h2 {
    max-width: none;
    margin-bottom: 10px;
  }
  .proof-metrics {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .review-marquee {
    margin-top: 14px;
    -webkit-mask-image: none;
    mask-image: none;
  }
  .review-track {
    animation-duration: 34s;
  }
  .review-card {
    width: min(260px, 84vw);
    padding: 16px;
  }
  .proof-card-centered {
    max-width: none;
  }
  .account-actions {
    justify-content: flex-start;
  }
  .nav-button {
    width: 100%;
    padding: 10px 12px;
    font-size: 12px;
    line-height: 1.2;
    text-align: center;
    border-radius: 12px;
  }
  .lang-bar {
    margin: 14px 0 -12px;
  }
  .topbar-user-email {
    display: none;
  }
  .topbar-user {
    gap: 8px;
  }
  .topbar-logout-btn {
    padding: 5px 9px;
    font-size: 11px;
    line-height: 1.2;
  }
  .topbar-auth-link {
    padding: 8px 12px;
    font-size: 12px;
    line-height: 1.2;
  }
  .toast-banner {
    padding: 12px 14px;
  }
}

/* ===== Typography ===== */
h1 {
  font-size: 30px;
  letter-spacing: 0.3px;
  font-weight: 600;
  color: var(--accent);
  margin: 0 0 1rem;
}

h2 {
  font-size: 26px;
  letter-spacing: 0.3px;
  font-weight: 600;
  color: var(--accent);
  margin: 0 0 1rem;
}

label {
  display: block;
  margin: 16px 0 8px;
  color: var(--muted);
  font-weight: 500;
}

.help {
  color: var(--muted);
  font-size: 14px;
  margin: 4px 0 0;
}

.toast-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 20px;
  border-radius: 0;
  color: var(--text);
  box-shadow: 0 -6px 20px rgba(29, 26, 22, 0.08);
  z-index: 1200;
  animation: toast-rise 180ms ease-out;
}

.toast-message {
  flex: 1 1 auto;
  font-size: 14px;
  line-height: 1.45;
  text-align: center;
}

.toast-close {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 999px;
  background: rgba(29, 26, 22, 0.08);
  color: var(--text);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.toast-close:hover {
  background: rgba(29, 26, 22, 0.14);
}

.status-ok {
  background: #dff3e8;
}

.status-warn {
  background: #f7ebcf;
}

.status-error {
  background: #f6dde0;
}

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

.normal {
  color: var(--text);
  font-size: 16px;
  margin: 4px 0 0;
}

/* ===== Inputs ===== */
input,
textarea,
select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fafafa;
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
  outline: none;
}

textarea {
  min-height: 220px;
  resize: vertical;
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(108, 99, 255, 0.25);
  background: var(--panel);
}

/* ===== Buttons ===== */
button.primary,
a.primary,
a.primary:visited {
  padding: 12px 20px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-alt));
  color: var(--panel);
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.2s, opacity 0.2s;
  width: auto;
  min-width: 180px;
  text-align: center;
}

button.primary:hover,
a.primary:hover,
a.primary:focus {
  box-shadow: 0 4px 12px rgba(108, 99, 255, 0.3);
  text-decoration: none;
  color: var(--panel);
}

button.primary:active {
  transform: translateY(1px);
}

button.primary:disabled {
  opacity: 0.6;
  cursor: default;
  box-shadow: none;
}

button.secondary-action,
a.secondary-action,
a.secondary-action:visited {
  min-width: 0;
  background: #fff;
  color: var(--accent);
  border: 1px solid var(--accent);
}

button.secondary-action:hover,
a.secondary-action:hover {
  box-shadow: 0 4px 12px rgba(108, 99, 255, 0.12);
  color: var(--accent);
}

#backToTop {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: none;
  z-index: 999;
}

/* Shared action row (forms + results) */
.row.actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 12px 0;
}

.row.actions > * {
  flex: 0 0 auto;
}

.funnel-hero {
  display: grid;
  gap: 14px;
}

.funnel-hero h1 {
  margin-bottom: 0;
  font-size: clamp(2.3rem, 4vw, 3.8rem);
  line-height: 1.02;
  letter-spacing: -0.04em;
  max-width: 11ch;
  margin-left: auto;
  margin-right: auto;
}

.hero-badge-wrap {
  display: flex;
  justify-content: center;
  margin-top: 2px;
}

.funnel-hero-card {
  background:
    radial-gradient(circle at top left, rgba(244, 114, 182, 0.12), transparent 32%),
    radial-gradient(circle at top right, rgba(108, 99, 255, 0.16), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.94));
  border-color: rgba(108, 99, 255, 0.18);
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.08);
  padding: 38px 34px;
  position: relative;
  overflow: hidden;
  border-radius: 18px;
}

.funnel-hero-card::after {
  content: "";
  position: absolute;
  inset: -30% auto auto 58%;
  width: 280px;
  height: 280px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0));
  pointer-events: none;
}

.funnel-kicker {
  margin: 0;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

.funnel-lead {
  max-width: 44rem;
  margin: 6px auto 0;
  font-size: 1.08rem;
  line-height: 1.7;
}

.funnel-sublead {
  max-width: 42rem;
  margin: 2px auto 0;
  font-size: 0.98rem;
  line-height: 1.7;
}

.funnel-actions {
  margin-top: 14px;
}

.funnel-section-card,
.funnel-final-card {
  border-radius: 16px;
  padding: 26px 24px 28px;
}

.funnel-section-card h2,
.funnel-final-card h2 {
  max-width: 18ch;
  line-height: 1.08;
  margin-bottom: 12px;
}

.funnel-section-card > p,
.funnel-final-card > p,
.social-proof-block > p.help,
.funnel-section-card .checklist-list {
  max-width: 46rem;
}

.social-proof-block {
  background:
    radial-gradient(circle at top left, rgba(244, 114, 182, 0.12), transparent 34%),
    linear-gradient(180deg, rgba(108, 99, 255, 0.08), rgba(255, 255, 255, 0.95));
}

.social-proof-grid {
  margin-top: 22px;
}

.proof-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0 0;
}

.proof-stat {
  border: 1px solid rgba(108, 99, 255, 0.14);
  border-radius: 14px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.04);
  text-align: center;
}

.proof-stat strong {
  display: block;
  color: var(--accent);
  font-size: clamp(1.5rem, 3vw, 2rem);
  line-height: 1;
  letter-spacing: -0.04em;
}

.proof-stat span {
  display: block;
  margin-top: 8px;
  color: var(--text);
  font-size: 0.93rem;
  line-height: 1.5;
}

.review-marquee {
  position: relative;
  overflow: hidden;
  margin-top: 22px;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
}

.review-track {
  display: flex;
  gap: 16px;
  width: max-content;
  animation: review-scroll 28s linear infinite;
  will-change: transform;
}

.review-marquee:hover .review-track {
  animation-play-state: paused;
}

.review-card {
  width: 280px;
  border: 1px solid rgba(108, 99, 255, 0.16);
  border-radius: 16px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.06);
}

.review-card h3 {
  margin: 10px 0 8px;
  font-size: 1rem;
  line-height: 1.35;
}

.review-card p {
  margin: 0;
  color: var(--text);
  line-height: 1.6;
}

.review-stars {
  color: #f59e0b;
  letter-spacing: 0.08em;
  font-size: 0.92rem;
}

.review-meta {
  display: inline-block;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.83rem;
}

.proof-card {
  background: rgba(255, 255, 255, 0.75);
  border-color: rgba(108, 99, 255, 0.18);
}

.proof-card-centered {
  grid-column: 1 / -1;
  max-width: calc(50% - 8px);
  justify-self: center;
}

.funnel-section-card {
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.06);
}

.funnel-final-card {
  background:
    radial-gradient(circle at top right, rgba(244, 114, 182, 0.14), transparent 32%),
    linear-gradient(180deg, rgba(108, 99, 255, 0.08), rgba(255, 255, 255, 0.98));
  text-align: center;
}

.funnel-final-card h2,
.funnel-final-card > p {
  margin-left: auto;
  margin-right: auto;
}

.funnel-final-card .left-actions {
  justify-content: center;
}

.left-actions {
  justify-content: flex-start;
}

.account-header {
  align-items: flex-start;
}

.account-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

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

.plan-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  background: #fff;
}

.plan-card h3 {
  margin: 0 0 8px;
  color: var(--accent);
}

.plan-card p {
  margin: 6px 0;
}

.plan-card.active-plan {
  border-color: var(--accent);
  box-shadow: 0 10px 24px rgba(108, 99, 255, 0.12);
}

.comparison-block {
  margin-top: 28px;
}

.comparison-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.comparison-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  background: #fff;
}

.comparison-card h3 {
  margin: 0 0 8px;
  color: var(--accent);
}

.comparison-card p {
  margin: 0;
  line-height: 1.65;
}

.comparison-summary {
  margin: 16px 0 0;
  color: var(--text);
  font-weight: 500;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 14px;
}

.breadcrumb a {
  color: var(--accent);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--accent-alt);
  text-decoration: underline;
}

.breadcrumb-sep {
  color: var(--muted);
}

.ats-checklist {
  margin-top: 24px;
}

.ats-mistakes {
  margin-top: 24px;
}

.checklist-list {
  margin: 14px 0 0;
  padding-left: 22px;
}

.checklist-list li {
  margin: 10px 0;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0 0;
  color: var(--muted);
}

#auth-form {
  max-width: 420px;
  margin: 0 auto;
}

#auth-form label,
#auth-form .help,
#password-recovery-form label,
#password-recovery-form .help {
  text-align: center;
}

#auth-form input[type="email"],
#auth-form input[type="password"],
#password-recovery-form input[type="password"] {
  display: block;
  width: min(100%, 320px);
  margin-left: auto;
  margin-right: auto;
}

.password-field-wrap {
  position: relative;
  width: min(100%, 320px);
  margin-left: auto;
  margin-right: auto;
}

.password-field-wrap input {
  width: 100%;
  padding-right: 76px;
}

.password-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.password-toggle:hover {
  color: var(--accent-alt);
}

#auth-form .checkbox-row {
  justify-content: center;
}

#password-recovery-form {
  max-width: 420px;
  margin: 0 auto;
}

.checkbox-row input {
  width: auto;
}

.link-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
}

.link-button:hover {
  color: var(--accent-alt);
}

.inline-note {
  margin-top: 10px;
}

.section-spaced {
  margin-top: 28px;
}

.section-spaced-lg {
  margin-top: 56px;
}

.narrow-section {
  max-width: 700px;
  margin: 0 auto;
}

.history-list {
  display: grid;
  gap: 12px;
}

.history-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  background: #fff;
}

.history-meta {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.history-title {
  margin: 0 0 4px;
  color: var(--text);
  font-size: 17px;
}

.history-empty {
  padding: 16px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  color: var(--muted);
}

.site-footer {
  margin: 28px auto 0;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.site-footer a {
  color: var(--muted);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.homepage-badge-strip {
  display: flex;
  justify-content: center;
  margin: 18px auto 0;
}

.homepage-badge-strip img {
  display: block;
  max-width: 100%;
  height: auto;
}

.legal-content p,
.legal-content li {
  color: var(--text);
}

.legal-content ul {
  margin: 0 0 20px 18px;
}

#submission-saved-cv-picker {
  margin: 12px 0 16px;
}

/* Language switch button */
.lang-switch {
  position: relative;
  width: 120px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.7);
  background: #e5e7eb;
  padding: 0 8px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  outline: none;
  appearance: none;
  font: inherit;
  color: inherit;
  direction: ltr;
  unicode-bidi: isolate;
}

.lang-switch:focus-visible {
  box-shadow: 0 0 0 2px rgba(108, 99, 255, 0.4);
}

.lang-label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  z-index: 1;
  color: var(--muted);
  -webkit-user-select: none; /* Safari / iOS */
  user-select: none;
  direction: ltr;
  unicode-bidi: isolate;
}

.lang-knob {
  position: absolute;
  width: 32px;
  height: 26px;
  border-radius: 999px;
  background: var(--panel);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.2);
  left: 44px; /* EN position (center) */
  transition: left 0.18s ease;
}

/* Active state: EN */
.lang-switch.lang-en .lang-label[data-lang-value="en"] {
  color: var(--accent);
  font-weight: 600;
}

/* Active state: TH */
.lang-switch.lang-th .lang-label[data-lang-value="th"] {
  color: var(--accent);
  font-weight: 600;
}

/* Active state: AR */
.lang-switch.lang-ar .lang-label[data-lang-value="ar"] {
  color: var(--accent);
  font-weight: 600;
}

/* Move knob for TH (right position) */
.lang-switch.lang-th .lang-knob {
  left: 86px;
}

/* Move knob for AR (left position) */
.lang-switch.lang-ar .lang-knob {
  left: 2px;
}

/* ===== FAQ Section ===== */
/* separator between FAQ title and first question */
#faq h2 + .faq-item {
  border-top: 1px solid var(--border);
}

.faq-item {
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
}

/* turn the question into a flex container */
.faq-question {
  width: 100%;
  padding: 12px 0;
  text-align: left;
  font-size: 16px;
  background: none;
  border: none;
  cursor: pointer;
  font-weight: 600;

  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* the + icon */
.faq-question::after {
  content: "+";
  font-size: 32px;
  font-weight: 200;
  color: var(--border);
  transition: transform 0.2s ease;
}

/* rotate + when active */
.faq-question.active::after {
  transform: rotate(45deg);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease;
}

.faq-answer p {
  margin: 8px 0;
}

/* ===== Cards / Separators / Badges ===== */
.card {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  box-shadow: 0 2px 6px var(--shadow);
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 24px 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--panel);
  font-weight: 500;
}

/* ===== Youtube placeholder ===== */
.yt-lite {
  position: relative;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;          /* centers horizontally */
  padding-top: 56.25%;     /* 16:9 ratio */
  background-size: cover;
  background-position: center;
  cursor: pointer;
  border-radius: 12px;     /* optional, looks cleaner */
  overflow: hidden;        /* ensures rounded corners work */
}

/* dark overlay */
.yt-lite::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
}

/* play icon */
.yt-lite::after {
  content: "▶";
  position: absolute;
  color: white;
  font-size: 64px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-shadow: 0 2px 8px rgba(0,0,0,0.6);
}

/* iframe styling */
.yt-lite iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Hide the play icon after clicking */
.yt-lite.playing::after {
  opacity: 0;
}
.yt-lite.playing::before {
  opacity: 0;
}

/* ===== Links ===== */
a,
a:visited {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover,
a:focus {
  color: var(--accent-alt);
  text-decoration: underline;
}

/* ===== Payment block (inline Stripe UI) ===== */
#pay-inline {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-top: 1.5rem;
}

#pay-inline.hidden {
  display: none;
}

#pay-inline h3 {
  margin-top: 0.5rem;
  color: var(--accent);
}

#pay-inline .help {
  margin-bottom: 1rem;
}

/* ===== Spinner ===== */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(108, 99, 255, 0.3);
  border-top-color: var(--accent-alt);
  border-radius: 50%;
  display: inline-block;
  vertical-align: middle;
  margin-right: 8px;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ===== Results page ===== */
.mono {
  white-space: pre-wrap;
  font-family: "JetBrains Mono", Menlo, Monaco, Consolas, monospace;
  background: var(--bg);
  padding: 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 14px;
}

/* ===== Markdown rendering tweaks ===== */
.markdown p {
  margin: 6px 0;
}

.markdown ul,
.markdown ol {
  margin: 8px 0 8px 20px;
  padding: 0;
}

.markdown li {
  margin: 4px 0;
}

.markdown h1,
.markdown h2,
.markdown h3,
.markdown h4,
.markdown h5,
.markdown h6 {
  margin: 12px 0 6px;
}

.markdown table {
  margin: 12px 0;
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--border);
}

.markdown table th,
.markdown table td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  vertical-align: top;
}

.markdown table thead th {
  background: #f9fafb;
  font-weight: 600;
}

/* ===== RTL (Arabic) adjustments for Markdown ===== */
html[dir="rtl"] .markdown {
  direction: rtl;
  text-align: right;
}

html[dir="rtl"] .markdown table {
  direction: rtl;
}

html[dir="rtl"] .markdown table th,
html[dir="rtl"] .markdown table td {
  text-align: right;
}

html[dir="rtl"] .markdown ul,
html[dir="rtl"] .markdown ol {
  margin: 8px 20px 8px 0;
}

/* ===== RTL (Arabic) hard override for any tables on the page (Results safety net) ===== */
html[dir="rtl"] table {
  direction: rtl;
}

html[dir="rtl"] th,
html[dir="rtl"] td {
  text-align: right;
}

/* Keep code-like content readable inside RTL contexts */
html[dir="rtl"] code,
html[dir="rtl"] pre {
  direction: ltr;
  text-align: left;
}

@keyframes review-scroll {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(calc(-50% - 8px));
  }
}

@media (prefers-reduced-motion: reduce) {
  .review-track {
    animation: none;
  }

  .lang-knob,
  .faq-answer,
  .faq-question::after,
  .toast-banner,
  a,
  button.primary,
  a.primary {
    transition: none;
  }
}
