:root {
  --canvas: #f6fbff;
  --paper: #ffffff;
  --paper-soft: #f8fcff;
  --ink: #102033;
  --ink-soft: #33475f;
  --muted: #738295;
  --line: rgba(19, 54, 89, 0.13);
  --line-strong: rgba(10, 102, 194, 0.34);
  --blue: #0a66c2;
  --blue-deep: #073f7a;
  --cyan: #13bfd5;
  --cyan-soft: #e8fbff;
  --danger: #b3261e;
  --danger-soft: #fff5f3;
  --success: #087852;
  --shadow-small: 0 10px 26px rgba(12, 39, 68, 0.07);
  --shadow-panel: 0 24px 70px rgba(10, 44, 77, 0.11);
  --shadow-active: 0 24px 62px rgba(10, 102, 194, 0.16);
  --heading-font: "Fraunces", Georgia, "Times New Roman", serif;
  --body-font: "Manrope", "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--ink);
  font-family: var(--body-font);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(241, 250, 255, 0.9) 48%, rgba(231, 251, 255, 0.86)),
    linear-gradient(115deg, rgba(10, 102, 194, 0.11), transparent 34%),
    linear-gradient(292deg, rgba(19, 191, 213, 0.18), transparent 40%),
    var(--canvas);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(10, 102, 194, 0.045) 1px, transparent 1px),
    linear-gradient(rgba(10, 102, 194, 0.035) 1px, transparent 1px);
  background-size: 88px 88px;
  mask-image: linear-gradient(to bottom, black, transparent 72%);
}

body::after {
  content: "";
  position: fixed;
  inset: auto 0 0;
  height: 34vh;
  pointer-events: none;
  background: linear-gradient(to top, rgba(255, 255, 255, 0.74), transparent);
}

button,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: calc(100vw - 165px);
  max-width: 1850px;
  margin: 0 35px 0 130px;
  padding: 34px 0 52px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) auto;
  align-items: end;
  gap: 28px;
  margin-bottom: 28px;
}

.topbar > div:first-child {
  margin-left: 28px;
}

.topbar h1,
.section-head h2,
.draft-title h2 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  max-width: 810px;
  color: #0b2239;
  font-family: var(--heading-font);
  font-size: clamp(46px, 6.4vw, 82px);
  font-weight: 600;
  line-height: 0.94;
}

.lead-copy {
  max-width: 650px;
  margin: 18px 0 0;
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1.7;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(400px, 0.85fr) minmax(520px, 1.15fr);
  gap: clamp(20px, 2vw, 30px);
  align-items: start;
}

.status-row,
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.status-row {
  flex-wrap: wrap;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-end;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: var(--shadow-small);
  backdrop-filter: blur(18px);
}

.status-pill.ok {
  color: var(--success);
  border-color: rgba(8, 120, 82, 0.24);
}

.status-pill.fail {
  color: var(--danger);
  border-color: rgba(179, 38, 30, 0.28);
}

.status-pill.muted {
  color: var(--muted);
}

.credit-summary {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 11px;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  box-shadow: none;
  backdrop-filter: none;
  white-space: nowrap;
}

.credit-card {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 160px;
  min-height: 50px;
  padding: 12px 16px;
  border-radius: 8px;
  line-height: 1;
  overflow: hidden;
  white-space: nowrap;
  transition: transform 170ms ease, box-shadow 170ms ease, border-color 170ms ease;
}

.credit-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(110deg, transparent, rgba(255, 255, 255, 0.34), transparent);
  transform: translateX(-120%);
  transition: transform 420ms ease;
}

.credit-card:hover {
  transform: translateY(-1px);
}

.credit-card:hover::after {
  transform: translateX(120%);
}

.credit-card-free {
  border: 1px solid rgba(7, 63, 122, 0.46);
  background:
    linear-gradient(135deg, rgba(10, 102, 194, 0.98), rgba(10, 139, 212, 0.95) 54%, rgba(19, 191, 213, 0.92)),
    var(--blue);
  color: #ffffff;
  box-shadow: 0 18px 36px rgba(10, 102, 194, 0.24);
}

.credit-card-paid {
  border: 1px solid rgba(7, 63, 122, 0.2);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.99), rgba(239, 250, 255, 0.97) 52%, rgba(222, 246, 252, 0.95)),
    #ffffff;
  color: var(--blue-deep);
  box-shadow: 0 14px 30px rgba(7, 63, 122, 0.09), inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

.credit-card-paid::before {
  content: "";
  position: absolute;
  inset: 1px;
  border: 1px solid rgba(255, 255, 255, 0.64);
  border-radius: 7px;
  pointer-events: none;
}

.credit-prefix,
.credit-name {
  position: relative;
  z-index: 1;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.credit-prefix {
  color: var(--blue-deep);
  margin-right: 2px;
  font-family: var(--heading-font);
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  opacity: 1;
}

.credit-amount {
  position: relative;
  z-index: 1;
  font-size: 25px;
  font-weight: 800;
  letter-spacing: 0;
}

.credit-card-paid .credit-amount {
  background: linear-gradient(135deg, var(--blue-deep), var(--blue), var(--cyan));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.credit-summary-empty .credit-card-free {
  background: linear-gradient(135deg, #6d7f92, #8ea1b4);
  box-shadow: 0 14px 28px rgba(51, 71, 95, 0.14);
}

.auth-panel {
  position: relative;
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(520px, 1.1fr);
  align-items: center;
  gap: 18px;
  margin-bottom: 22px;
  padding: 18px 20px;
  border: 1px solid rgba(255, 255, 255, 0.86);
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(232, 251, 255, 0.82));
  box-shadow: var(--shadow-small);
  backdrop-filter: blur(20px);
}

.auth-panel h2 {
  margin: 0 0 8px;
  color: #101f31;
  font-size: 22px;
  font-weight: 600;
}

.auth-panel p:not(.eyebrow) {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.6;
}

.auth-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(130px, 1fr)) auto auto auto;
  align-items: center;
  gap: 10px;
}

.auth-form input {
  width: 100%;
  min-height: 40px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.auth-form input:focus {
  border-color: rgba(10, 102, 194, 0.56);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(19, 191, 213, 0.11);
}

.question-rail {
  position: fixed;
  z-index: 20;
  left: 0;
  top: 96px;
  width: 42px;
  height: 128px;
  max-height: calc(100vh - 120px);
  padding: 8px 5px;
  border: 1px solid rgba(255, 255, 255, 0.86);
  border-left: 0;
  border-radius: 0 12px 12px 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(236, 250, 255, 0.9));
  box-shadow: 8px 18px 36px rgba(12, 39, 68, 0.12);
  backdrop-filter: blur(18px);
  overflow: hidden;
  transition: width 220ms ease, height 220ms ease, padding 220ms ease, background 220ms ease, box-shadow 220ms ease, border-color 220ms ease;
}

.question-rail::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(10, 102, 194, 0.12);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.42);
  transition: opacity 180ms ease;
}

.rail-hint {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 84px;
  display: flex;
  align-items: baseline;
  gap: 3px;
  justify-content: center;
  color: var(--blue-deep);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  transform: translate(-50%, -50%) rotate(-90deg);
  transition: opacity 160ms ease, transform 180ms ease;
}

.rail-hint-hover {
  color: var(--blue);
  transform: translateY(-4px);
}

.question-rail:hover,
.rail-pinned .question-rail {
  width: 112px;
  height: auto;
  padding: 12px 10px;
  border-color: rgba(10, 102, 194, 0.16);
  border-left: 0;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: var(--shadow-small);
}

.question-rail:hover::before,
.rail-pinned .question-rail::before {
  opacity: 0;
}

.question-rail:hover .rail-hint,
.rail-pinned .rail-hint {
  opacity: 0;
  transform: translate(-50%, -50%) rotate(-90deg) translateY(-6px);
  pointer-events: none;
}

.rail-toggle {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 90px;
  min-height: 30px;
  margin: 0 auto 10px;
  border: 1px solid rgba(10, 102, 194, 0.14);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  opacity: 0;
  transform: translateX(-10px);
  transition: opacity 180ms ease, transform 180ms ease, background 180ms ease, color 180ms ease, border-color 180ms ease;
}

.question-rail:hover .rail-toggle,
.rail-pinned .rail-toggle {
  opacity: 1;
  transform: translateX(0);
}

.rail-toggle:hover,
.rail-toggle[aria-pressed="true"] {
  border-color: rgba(10, 102, 194, 0.28);
  background: #eef9fd;
  color: var(--blue-deep);
}

.rail-toggle-text {
  display: inline;
}

.rail-list {
  display: grid;
  justify-items: center;
  gap: 7px;
  opacity: 0;
  transform: translateX(-16px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.question-rail:hover .rail-list,
.rail-pinned .rail-list {
  opacity: 1;
  transform: translateX(0);
}

.rail-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(10, 102, 194, 0.16);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  text-align: center;
  transition: background 170ms ease, border-color 170ms ease, color 170ms ease, transform 170ms ease, box-shadow 170ms ease;
}

.rail-button:hover,
.rail-button.active {
  border-color: transparent;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  color: #ffffff;
  transform: translateX(2px);
  box-shadow: 0 10px 18px rgba(10, 102, 194, 0.2);
}

.rail-button.answered:not(.active) {
  border-color: rgba(8, 120, 82, 0.45);
  background: linear-gradient(180deg, rgba(236, 253, 245, 0.98), rgba(212, 248, 232, 0.9));
  color: var(--success);
  box-shadow: inset 0 0 0 1px rgba(8, 120, 82, 0.08), 0 8px 18px rgba(8, 120, 82, 0.08);
}

.rail-button.missing {
  border-color: rgba(179, 38, 30, 0.4);
  background: var(--danger);
  color: #ffffff;
}

.builder,
.result-section {
  position: relative;
  display: grid;
  gap: 16px;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.86);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(249, 253, 255, 0.84));
  box-shadow: var(--shadow-panel);
  backdrop-filter: blur(22px);
}

.builder::before,
.result-section::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(19, 191, 213, 0.28), rgba(10, 102, 194, 0.2));
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  pointer-events: none;
}

.result-section {
  position: sticky;
  top: 20px;
  overflow: hidden;
}

.section-head h2,
.draft-title h2 {
  color: #101f31;
  font-size: 24px;
  font-weight: 600;
  line-height: 1.14;
}

.result-heading {
  align-items: center;
  padding: 4px 2px 8px;
  border-bottom: 1px solid rgba(10, 102, 194, 0.09);
}

.draft-button-group {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.generate-button {
  min-width: 132px;
  min-height: 44px;
  font-size: 14px;
}

.sample-output-button {
  min-height: 44px;
}

.draft-title {
  padding-top: 4px;
}

.question-list {
  display: grid;
  gap: 11px;
}

.question-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 8px 24px rgba(12, 39, 68, 0.055);
  transform: translateZ(0);
  transition: border-color 190ms ease, box-shadow 220ms ease, transform 220ms ease, background 220ms ease;
}

.question-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: linear-gradient(180deg, var(--blue), var(--cyan));
  opacity: 0;
  transition: opacity 180ms ease;
}

.question-card:hover {
  transform: translateY(-2px);
  border-color: rgba(10, 102, 194, 0.24);
  box-shadow: 0 16px 38px rgba(12, 39, 68, 0.085);
}

.question-card.open {
  border-color: rgba(10, 102, 194, 0.42);
  background: linear-gradient(180deg, #ffffff, #f7fdff);
  box-shadow: var(--shadow-active);
}

.question-card.answered:not(.missing) {
  border-color: rgba(8, 120, 82, 0.28);
  background: linear-gradient(180deg, #ffffff, rgba(239, 253, 247, 0.92));
}

.question-card.answered:not(.missing)::before {
  background: linear-gradient(180deg, #0b8f61, #38d39f);
  opacity: 1;
}

.question-card.open::before {
  opacity: 1;
}

.question-card.missing {
  border-color: rgba(179, 38, 30, 0.52);
  background: linear-gradient(180deg, #fffafa, var(--danger-soft));
}

.question-card.missing::before {
  background: var(--danger);
  opacity: 1;
}

.question-summary {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: 72px;
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 14px 15px;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.question-number {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(10, 102, 194, 0.17);
  border-radius: 6px;
  background: linear-gradient(180deg, #ffffff, #eff9fd);
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
  transition: background 180ms ease, color 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.question-card.open .question-number {
  border-color: var(--blue);
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  color: #ffffff;
  transform: scale(1.04);
}

.question-card.answered:not(.missing):not(.open) .question-number {
  border-color: rgba(8, 120, 82, 0.42);
  background: linear-gradient(135deg, #0b8f61, #38d39f);
  color: #ffffff;
  box-shadow: 0 8px 16px rgba(8, 120, 82, 0.15);
}

.question-card.missing .question-number {
  border-color: var(--danger);
  background: var(--danger);
  color: #ffffff;
}

.question-title {
  display: grid;
  gap: 4px;
}

.question-title strong {
  color: #142338;
  font-size: 15px;
  font-weight: 600;
}

.question-title span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 450;
}

.question-card.answered:not(.missing) .question-title span {
  color: var(--success);
  font-weight: 700;
}

.question-card.missing .question-title span {
  color: var(--danger);
}

.expand-label {
  min-width: 78px;
  padding: 7px 10px;
  border: 1px solid rgba(10, 102, 194, 0.2);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.76);
  color: var(--blue);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
  transition: background 180ms ease, color 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.question-summary:hover .expand-label {
  transform: translateX(2px);
}

.question-card.open .expand-label {
  border-color: transparent;
  background: #0b2239;
  color: #ffffff;
}

.question-card.missing .expand-label {
  border-color: rgba(179, 38, 30, 0.28);
  color: var(--danger);
}

.question-card.open.missing .expand-label {
  border-color: transparent;
  background: #0b2239;
  color: #ffffff;
}

.question-body {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: 0fr;
  padding: 0 15px 0 77px;
  opacity: 0;
  transform: translateY(-8px);
  transition: grid-template-rows 320ms cubic-bezier(0.2, 0.8, 0.2, 1), padding 320ms cubic-bezier(0.2, 0.8, 0.2, 1), opacity 180ms ease, transform 320ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.question-body-inner {
  min-height: 0;
  overflow: hidden;
  display: grid;
  gap: 11px;
}

.question-card.open .question-body {
  grid-template-rows: 1fr;
  padding-bottom: 17px;
  opacity: 1;
  transform: translateY(0);
}

.question-body p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-line;
}

textarea {
  width: 100%;
  min-height: 122px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
  line-height: 1.56;
  resize: vertical;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

textarea::placeholder {
  color: #9aa7b5;
}

textarea:focus {
  border-color: rgba(10, 102, 194, 0.56);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(19, 191, 213, 0.11), inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.question-card.missing textarea {
  border-color: rgba(179, 38, 30, 0.5);
  box-shadow: 0 0 0 4px rgba(179, 38, 30, 0.08);
}

.hint-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.primary-button,
.secondary-button {
  min-height: 40px;
  padding: 9px 15px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  transition: background 170ms ease, border-color 170ms ease, box-shadow 170ms ease, transform 170ms ease, color 170ms ease;
}

.primary-button {
  border: 1px solid rgba(7, 63, 122, 0.9);
  background: linear-gradient(135deg, var(--blue), #0a8bd4 55%, var(--cyan));
  color: #ffffff;
  box-shadow: 0 12px 24px rgba(10, 102, 194, 0.22);
}

.primary-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 30px rgba(10, 102, 194, 0.28);
}

.secondary-button {
  border: 1px solid rgba(19, 54, 89, 0.16);
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink-soft);
  box-shadow: 0 8px 18px rgba(12, 39, 68, 0.045);
}

.secondary-button:hover {
  border-color: var(--line-strong);
  background: #ffffff;
  color: var(--blue-deep);
  transform: translateY(-1px);
}

.button-success,
.button-success:hover {
  border-color: rgba(8, 120, 82, 0.48);
  background: linear-gradient(135deg, #087852, #12b884);
  color: #ffffff;
  box-shadow: 0 14px 26px rgba(8, 120, 82, 0.22);
  transform: translateY(-1px) scale(1.02);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
  box-shadow: none;
}

.notice,
.message-box {
  padding: 12px 13px;
  border-radius: 7px;
  font-size: 13px;
  line-height: 1.5;
}

.notice {
  border: 1px solid rgba(10, 102, 194, 0.18);
  background: #eff8ff;
  color: var(--blue-deep);
}

.message-box {
  border: 1px solid rgba(179, 38, 30, 0.24);
  background: var(--danger-soft);
  color: var(--danger);
  white-space: pre-wrap;
  margin-top: 12px;
}

.message-box.info {
  border-color: rgba(10, 102, 194, 0.18);
  background: #eff8ff;
  color: var(--blue-deep);
}

.hidden {
  display: none !important;
}

.markdown-preview {
  min-height: 520px;
  max-height: 58vh;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(252, 254, 255, 0.96)),
    var(--paper);
  overflow: auto;
  line-height: 1.66;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.markdown-preview.empty {
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(237, 250, 255, 0.9)),
    repeating-linear-gradient(0deg, transparent 0 31px, rgba(10, 102, 194, 0.045) 32px);
}

.markdown-preview h1,
.markdown-preview h2,
.markdown-preview h3 {
  margin: 0 0 12px;
  letter-spacing: 0;
}

.markdown-preview h1 {
  color: #0d2238;
  font-family: var(--heading-font);
  font-size: 34px;
  font-weight: 600;
  line-height: 1.1;
}

.markdown-preview h2 {
  margin-top: 24px;
  color: var(--blue);
  font-size: 18px;
  font-weight: 700;
}

.markdown-preview h3 {
  margin-top: 18px;
  color: var(--ink-soft);
  font-size: 15px;
  font-weight: 700;
}

.markdown-preview p,
.markdown-preview ul {
  margin: 0 0 13px;
}

.markdown-preview ul {
  padding-left: 22px;
}

.draft-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 18px;
  border: 1px solid rgba(19, 191, 213, 0.22);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(236, 251, 255, 0.9)),
    linear-gradient(90deg, rgba(10, 102, 194, 0.08), transparent);
  box-shadow: var(--shadow-small);
}

.draft-actions h3 {
  margin: 0 0 8px;
  color: #101f31;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0;
}

.draft-actions p:not(.eyebrow) {
  max-width: 560px;
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.6;
}

.action-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.refine-panel {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid rgba(19, 54, 89, 0.12);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, var(--paper-soft));
}

.refine-panel label {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 600;
}

@media (min-width: 1710px) {
  .app-shell {
    width: min(1580px, calc(100vw - 190px));
    margin-right: auto;
    margin-left: auto;
  }
}

@media (max-width: 1500px) {
  .app-shell {
    width: calc(100vw - 150px);
    margin-right: 24px;
    margin-left: 126px;
  }

  .workspace-grid {
    grid-template-columns: minmax(410px, 0.96fr) minmax(520px, 1.04fr);
    gap: 24px;
  }
}

@media (max-width: 1320px) {
  .app-shell {
    width: calc(100vw - 136px);
    margin-right: 20px;
    margin-left: 116px;
  }

  .workspace-grid {
    grid-template-columns: minmax(390px, 0.98fr) minmax(0, 1.02fr);
    gap: 20px;
  }

  .builder,
  .result-section {
    padding: 18px;
  }
}

@media (max-width: 1180px) {
  .app-shell {
    width: calc(100vw - 116px);
    margin-right: 18px;
    margin-left: 98px;
  }

  .topbar {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .status-row {
    align-items: flex-start;
    justify-content: start;
  }

  .workspace-grid {
    grid-template-columns: minmax(360px, 0.95fr) minmax(0, 1.05fr);
    gap: 18px;
  }

  .auth-panel {
    grid-template-columns: 1fr;
  }

  .auth-form {
    grid-template-columns: repeat(3, minmax(130px, 1fr));
  }
}

@media (max-width: 1080px) {
  .app-shell {
    width: min(100vw - 32px, 920px);
    margin: 0 auto;
  }

  .workspace-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .result-section {
    position: static;
  }

  .markdown-preview {
    max-height: none;
  }
}

@media (max-width: 900px) {
  .app-shell {
    width: min(100vw - 24px, 820px);
  }

  .topbar h1 {
    font-size: clamp(42px, 10vw, 66px);
  }

  .lead-copy {
    max-width: 100%;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100vw - 18px, 680px);
    padding-top: 22px;
  }

  .topbar,
  .section-head {
    align-items: stretch;
    display: grid;
  }

  .topbar > div:first-child {
    margin-left: 0;
  }

  .topbar {
    grid-template-columns: 1fr;
  }

  .topbar h1 {
    font-size: clamp(42px, 13vw, 58px);
  }

  .status-row {
    align-items: flex-start;
    justify-content: start;
  }

  .builder,
  .result-section {
    padding: 15px;
  }

  .auth-form {
    grid-template-columns: 1fr 1fr;
  }

  .question-rail {
    display: none;
  }

  .draft-button-group {
    justify-content: start;
  }

  .question-summary {
    grid-template-columns: 46px 1fr;
  }

  .expand-label {
    grid-column: 2;
    width: max-content;
  }

  .question-body {
    padding-left: 15px;
  }

  .draft-actions {
    grid-template-columns: 1fr;
  }

  .action-buttons {
    justify-content: start;
  }
}

@media (max-width: 560px) {
  .app-shell {
    width: min(100vw - 14px, 520px);
    padding-top: 16px;
    padding-bottom: 32px;
  }

  .topbar {
    gap: 18px;
    margin-bottom: 18px;
  }

  .topbar h1 {
    font-size: clamp(36px, 12vw, 48px);
    line-height: 1;
  }

  .lead-copy {
    margin-top: 12px;
    font-size: 14px;
    line-height: 1.6;
  }

  .section-head,
  .status-row,
  .action-buttons {
    gap: 8px;
  }

  .status-pill,
  .auth-form input,
  .auth-form button,
  .secondary-button,
  .primary-button {
    width: 100%;
    justify-content: center;
  }

  .credit-summary {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    gap: 9px;
    justify-content: stretch;
    white-space: normal;
  }

  .credit-prefix {
    width: 100%;
    margin-right: 0;
    text-align: left;
  }

  .credit-card {
    width: 100%;
    justify-content: center;
  }

  .auth-form {
    grid-template-columns: 1fr;
  }

  .draft-button-group {
    width: 100%;
  }

  .question-summary {
    grid-template-columns: 38px 1fr;
    gap: 10px;
    padding: 13px;
  }

  .question-number {
    width: 32px;
    height: 32px;
    font-size: 12px;
  }

  .question-text {
    font-size: 14px;
  }

  .expand-label {
    width: 100%;
    justify-content: center;
  }

  .question-body {
    padding: 0 13px 13px;
  }

  .markdown-preview {
    min-height: 260px;
    padding: 15px;
  }
}

@media print {
  body {
    background: #ffffff;
  }

  body::before,
  body::after,
  .topbar,
  .question-rail,
  .result-heading,
  .draft-title,
  .draft-actions,
  .refine-panel,
  .notice,
  .message-box {
    display: none !important;
  }

  .app-shell,
  .workspace-grid,
  .result-section {
    display: block;
    width: auto;
    margin: 0;
    padding: 0;
    box-shadow: none;
    border: 0;
    background: #ffffff;
  }

  .result-section::before {
    display: none;
  }

  .markdown-preview {
    max-height: none;
    min-height: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
    overflow: visible;
  }
}

/* --- Header Auth Widget --- */
.header-auth {
  display: flex;
  align-items: center;
  gap: 12px;
  align-self: start;
  margin-top: 14px;
  margin-right: 21px;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.credit-badge {
  background: rgba(10, 102, 194, 0.06);
  border: 1px solid rgba(10, 102, 194, 0.15);
  color: var(--blue);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.5px;
  width: 110px;
  text-align: center;
  box-sizing: border-box;
}

.user-username {
  font-family: var(--heading-font);
  font-size: 19px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  cursor: pointer;
  border-bottom: 2px dotted transparent;
  transition: border-color 150ms ease, opacity 150ms ease;
  display: inline-block;
  width: 110px;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-username:hover {
  opacity: 0.9;
  border-bottom-color: var(--cyan);
}

/* --- Modal Overlay & Content --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(16, 31, 49, 0.45);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition: opacity 0.25s ease;
}

.modal-content {
  background: #ffffff;
  width: 100%;
  max-width: 440px;
  padding: 32px 30px;
  border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  position: relative;
  animation: modalEntry 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

.close-modal {
  position: absolute;
  top: 16px;
  right: 16px;
  background: transparent;
  border: none;
  font-size: 24px;
  color: var(--ink-soft);
  cursor: pointer;
  transition: color 0.15s ease;
}

.close-modal:hover {
  color: var(--ink);
}

.modal-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 20px;
}

.modal-form input {
  width: 100%;
  min-height: 42px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
  font-size: 14px;
  transition: border-color 0.15s ease;
}

.modal-form input:focus {
  border-color: var(--blue);
  outline: none;
  background: #ffffff;
}

.link-button {
  background: transparent;
  border: none;
  color: var(--blue-deep);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: underline;
  margin-top: 8px;
  align-self: center;
}

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

.modal-overlay.hidden {
  display: none;
}

/* --- Workspace Credits Layout (Outside Box) --- */
.result-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.credits-container {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding-right: 21px;
}

#billingView {
  text-align: center;
}

.modal-sub {
  margin-bottom: 24px;
  font-size: 13px;
  color: var(--ink-soft);
  text-align: center;
}

.billing-yield-headline {
  font-family: var(--heading-font);
  font-size: 32px;
  font-weight: 800;
  text-align: center;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin: 16px 0 24px;
}

.billing-selector-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 8px;
}

.billing-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  border: 1px solid var(--line-light);
  border-radius: 6px;
  background: #ffffff;
  padding: 0 12px;
  height: 40px;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05);
}

.currency-symbol {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-right: 4px;
  user-select: none;
}

.billing-amount-input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  width: 60px;
  text-align: center;
  padding: 0;
  margin: 0;
}

/* Hide number input spinners */
.billing-amount-input::-webkit-outer-spin-button,
.billing-amount-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.billing-amount-input[type=number] {
  -moz-appearance: textfield;
}

.selector-btn {
  width: 40px;
  height: 40px;
  min-height: 40px !important;
  padding: 0 !important;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 600;
  border-radius: 6px;
}

.billing-rate-info {
  font-size: 12px;
  color: var(--ink-soft);
  text-align: center;
  margin-bottom: 24px;
}

.pay-credits-button {
  width: 100%;
  margin-top: 8px;
}

.gradient-letter {
  position: relative;
  display: inline-block;
  isolation: isolate;
  background:
    radial-gradient(ellipse at 30% 15%, rgba(255, 255, 255, 0.32) 0 5%, rgba(113, 239, 255, 0.2) 7% 14%, transparent 24%),
    linear-gradient(150deg, rgba(255, 255, 255, 0.2) 0 10%, transparent 22%),
    linear-gradient(135deg, #1118e8 0%, #293bff 24%, #075ff0 45%, #079ff5 70%, #24f1df 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: transparent;
  filter:
    drop-shadow(0 -2px 0 rgba(246, 255, 255, 0.9))
    drop-shadow(0 2px 0 rgba(10, 16, 118, 0.95))
    drop-shadow(0 5px 0 rgba(20, 23, 150, 0.42))
    drop-shadow(0 10px 14px rgba(20, 58, 255, 0.42))
    drop-shadow(0 18px 28px rgba(18, 216, 232, 0.34));
  -webkit-text-stroke: 1.05px rgba(5, 16, 118, 0.98);
}

.gradient-letter::before,
.gradient-letter::after {
  content: "J";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.gradient-letter::before {
  z-index: 1;
  color: transparent;
  -webkit-text-fill-color: transparent;
  -webkit-text-stroke: 1.85px rgba(230, 254, 255, 0.86);
  filter: blur(0.08px);
  opacity: 0.82;
  transform: translate(-0.018em, -0.024em);
  text-shadow:
    0 -3px 0 rgba(255, 255, 255, 0.84),
    0 2px 3px rgba(85, 236, 255, 0.36),
    0 6px 10px rgba(8, 18, 128, 0.34);
}

.gradient-letter::after {
  z-index: 2;
  color: transparent;
  -webkit-text-fill-color: transparent;
  background:
    radial-gradient(ellipse at 28% 13%, rgba(255, 255, 255, 0.95) 0 3%, rgba(106, 239, 255, 0.5) 4% 8%, transparent 13%),
    radial-gradient(ellipse at 72% 78%, rgba(126, 246, 255, 0.7) 0 4%, transparent 13%),
    radial-gradient(ellipse at 54% 46%, rgba(85, 219, 255, 0.48) 0 5%, transparent 16%),
    linear-gradient(112deg, transparent 0 15%, rgba(255, 255, 255, 0.78) 21%, rgba(87, 232, 255, 0.32) 30%, transparent 43%),
    linear-gradient(24deg, transparent 0 50%, rgba(81, 234, 255, 0.34) 59%, transparent 72%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-stroke: 0.6px rgba(232, 254, 255, 0.76);
  opacity: 0.72;
  transform: translate(-0.017em, -0.028em);
  filter: blur(0.04px);
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.48),
    1px 0 0 rgba(118, 244, 255, 0.28),
    -1px 0 0 rgba(41, 59, 255, 0.18);
}

/* --- SPA Navigation Bar --- */
.nav-bar {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  justify-content: center;
  gap: 28px;
  padding: 16px 24px;
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: all 300ms ease;
  margin-bottom: 24px;
}

.nav-bar.scrolled {
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 10px 24px;
  border-bottom: 1px solid rgba(19, 54, 89, 0.08);
  box-shadow: 0 4px 20px rgba(10, 102, 194, 0.04);
}

.nav-link {
  background: none;
  border: none;
  font-family: var(--heading-font);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  padding: 6px 0;
  cursor: pointer;
  position: relative;
  transition: color 150ms ease;
}

.nav-link:hover {
  color: var(--blue);
}

.nav-link.active {
  color: var(--blue);
}

.nav-link.active::after {
  content: "";
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--blue);
  border-radius: 1px;
}

.page-view.hidden {
  display: none !important;
}

/* --- Simple Page Card Layout --- */
.simple-page-card {
  border: 1px solid rgba(255, 255, 255, 0.86);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(249, 253, 255, 0.84));
  box-shadow: var(--shadow-panel);
  backdrop-filter: blur(22px);
  padding: 32px;
  max-width: 800px;
  margin: 0 auto;
}

.simple-page-card h2 {
  color: #101f31;
  font-size: 28px;
  font-weight: 600;
  margin: 0 0 8px;
}

.authors-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  margin-top: 24px;
}

@media (max-width: 600px) {
  .authors-grid {
    grid-template-columns: 1fr;
  }
}

.author-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 28px 24px;
  border: 1px solid rgba(19, 54, 89, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.5);
  box-sizing: border-box;
}

.author-photo-wrapper {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  overflow: hidden;
  margin-bottom: 18px;
  border: 2px solid rgba(10, 102, 194, 0.2);
  background: #f1f8fc;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.author-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.author-photo-fallback {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  padding: 8px;
  box-sizing: border-box;
}

.author-card h3 {
  margin: 0 0 4px;
  font-size: 19px;
  color: #101f31;
}

.author-role {
  font-size: 13px;
  font-weight: 600;
  color: var(--blue);
  margin: 0 0 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.author-desc {
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-soft);
  margin: 0 0 20px;
  flex-grow: 1;
  white-space: pre-line;
}

.author-contacts {
  display: flex;
  gap: 16px;
}

.contact-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  text-decoration: none;
  border: 1px solid rgba(19, 54, 89, 0.15);
  padding: 6px 16px;
  border-radius: 20px;
  background: #ffffff;
  transition: all 150ms ease;
}

.contact-link:hover {
  color: var(--blue);
  border-color: var(--blue);
  background: rgba(10, 102, 194, 0.04);
}

/* --- Donation Styling --- */
.author-donation {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.donation-caption {
  font-size: 13px;
  color: #64748b;
  font-style: italic;
  line-height: 1.5;
  margin: 0;
  max-width: 280px;
}

.inline-emoji {
  height: 20px;
  width: 20px;
  vertical-align: middle;
  display: inline-block;
  margin: 0 3px;
}

.qr-link {
  display: inline-block;
  padding: 6px;
  background: #ffffff;
  border: 1px solid rgba(19, 54, 89, 0.08);
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.035);
  transition: transform 200ms ease, border-color 200ms ease;
}

.qr-link:hover {
  transform: scale(1.04);
  border-color: rgba(10, 102, 194, 0.3);
}

.donation-qr {
  width: 110px;
  height: 110px;
  display: block;
  border-radius: 6px;
}







