/*
 * Tokens: SharedSnapshotChapterPage / SectionTitle / Type.kt / Color.kt (Purple40).
 * Layout: ChapterPage FitWidthEqualHeightFlowRow → CSS grid 2 columns, 8px gap; vertical rhythm 16px blocks.
 */
:root {
  --on-surface: #1c1b1f;
  --on-surface-variant: #49454f;
  --primary: #6650a4;
  --primary-hover: #564395;
  --surface-container-high: #e8def8;
  --outline: #79747e;
  --background: #ffffff;
  /* Page column width — matches chapter cover / title image (hero) */
  --share-grid-max-width: 520px;
  /* Vertical gap between major sections in .wrap (same rhythm as former DYK → captioned comic, 64dp) */
  --share-space-block: 64px;
  --share-space-after-title: 16px;
  /* Breathing room below last block (install CTA / comic) */
  --share-page-padding-bottom: 128px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--on-surface);
  background: var(--background);
  font-family: "Roboto", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* ChapterPage `parseBoldAndQuoted`: italic + semi-bold + primary for paired quotes. */
.share-rich-quoted {
  font-style: italic;
  font-weight: 600;
  color: var(--primary);
}

.share-dyk-bullet {
  white-space: pre;
}

/* Column: flex gap gives consistent space before every block (avoids margin/collapse issues) */
.wrap {
  max-width: var(--share-grid-max-width);
  width: 100%;
  margin: 0 auto;
  padding: 8px 20px var(--share-page-padding-bottom);
  display: flex;
  flex-direction: column;
  gap: var(--share-space-block);
}

/* Chapter title + summary: same title→body gap as .content-section (16dp) */
.chapter-lead-block {
  display: flex;
  flex-direction: column;
  gap: var(--share-space-after-title);
  min-width: 0;
}

/* App mark — logo_book.png (ChapterPage scroll: no text brand) */
.share-brand-row {
  display: flex;
  justify-content: center;
  margin: 0;
}

.share-logo-book {
  display: block;
  height: auto;
  max-height: 56px;
  width: auto;
  max-width: min(220px, 100%);
}

/* Chapter.displayName — Typography.titleLarge (Type.kt: 26sp / 28 / ExtraLight) */
.chapter-display-name {
  font-size: 26px;
  line-height: 28px;
  font-weight: 200;
  margin: 0;
  text-align: center;
  color: var(--on-surface);
  letter-spacing: 0;
  hyphens: auto;
}

/* Hero cover (ChapterPage top illustration) — width matches bullets/terms grids */
.chapter-hero {
  margin: 0 auto;
  width: 100%;
  max-width: var(--share-grid-max-width);
}

.hero-img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
  object-fit: contain;
  background: var(--surface-container-high);
}

.punchline-block {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0;
}

/* Image-only punchline (no dialogue) — stacked card like single LoadableImage */
.punchline-img-wrap {
  margin: 0 auto;
  width: 100%;
  max-width: var(--share-grid-max-width);
}

.punchline-img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  background: var(--surface-container-high);
}

/* PunchlineComicWithSideBubble — SpeechBubble.kt: image weight 1.2, bubble 1, gap 8dp */
.punchline-comic-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: var(--share-grid-max-width);
  margin-left: auto;
  margin-right: auto;
}

.punchline-comic-img-wrap {
  flex: 1.2 1 0;
  min-width: 0;
  aspect-ratio: 1 / 1;
}

.punchline-comic-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* PunchlineBubbleFill / PunchlineBubbleText; shadowElevation 2.dp → drop-shadow */
.punchline-bubble-drop {
  flex: 1 1 0;
  min-width: 0;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.14)) drop-shadow(0 1px 3px rgba(0, 0, 0, 0.08));
}

.punchline-bubble-surface {
  position: relative;
  background: #e8fff4;
  color: #111111;
  border-radius: 20px;
  margin-left: 12px;
  padding: 14px 14px 14px 26px;
}

.punchline-bubble-surface::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  border-style: solid;
  border-width: 14px 12px 14px 0;
  border-color: transparent #e8fff4 transparent transparent;
}

.punchline-bubble-text {
  margin: 0;
  font-size: 16px;
  line-height: 24px;
  font-weight: 500;
  text-align: center;
  white-space: pre-wrap;
  hyphens: auto;
}

.punchline-text {
  font-size: 16px;
  line-height: 24px;
  margin: 0;
  color: var(--on-surface);
  text-align: center;
}

/* Section blocks — Spacer(16.dp) after SectionTitle (Bullets, Terms, DidYouKnow, …) */
.content-section {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--share-space-after-title);
}

.content-section.summary-section {
  gap: 0;
}

/* SectionTitle: 26sp centered black */
.section-title {
  text-align: center;
  font-size: 26px;
  line-height: 28px;
  font-weight: 900;
  color: #000000;
  margin: 0;
  padding: 0 16px;
}

.section-body {
  margin: 0;
}

/* Upsell under bullets / terms grids on shared chapter page */
.share-create-chapter-hint {
  margin: 16px 16px 0;
  padding: 0;
  text-align: center;
  font-size: 15px;
  line-height: 22px;
  font-weight: 500;
  letter-spacing: 0.25px;
  color: var(--on-surface-variant, #5f6368);
}

.summary-text {
  font-size: 16px;
  line-height: 24px;
  letter-spacing: 0.5px;
  font-weight: 400;
  margin: 0;
  white-space: pre-wrap;
  hyphens: auto;
  color: var(--on-surface);
  text-align: center;
}

.summary-text strong {
  font-weight: 700;
}

.read-full-summary-link {
  display: block;
  margin: 12px auto 0;
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  font-size: 16px;
  line-height: 24px;
  font-weight: 500;
  color: var(--primary);
  cursor: pointer;
  text-align: center;
  text-decoration: underline;
  max-width: 100%;
}

.read-full-summary-link:hover {
  color: var(--primary-hover);
}

.share-basic-dialog {
  border: none;
  border-radius: 16px;
  padding: 0;
  max-width: min(520px, calc(100vw - 40px));
  width: 100%;
  background: var(--background);
  color: var(--on-surface);
  box-shadow:
    0 4px 8px rgba(0, 0, 0, 0.12),
    0 12px 24px rgba(0, 0, 0, 0.16);
}

.share-basic-dialog::backdrop {
  background: rgba(0, 0, 0, 0.4);
}

.share-basic-dialog-surface {
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.share-basic-dialog-header {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

/* Enrollment popup: title left, close right (read-summary uses centered title) */
.share-basic-dialog-header--enroll {
  align-items: center;
}

.share-basic-dialog-title {
  margin: 0;
  font-size: 22px;
  line-height: 28px;
  font-weight: 400;
  color: var(--on-surface);
  flex: 1;
  text-align: center;
}

.share-basic-dialog-title--start {
  text-align: left;
  font-weight: 600;
  min-width: 0;
}

.share-basic-dialog-close {
  border: none;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  padding: 8px;
  cursor: pointer;
  color: var(--on-surface);
  border-radius: 8px;
}

.share-basic-dialog-close:hover {
  background: var(--surface-container-high);
}

.share-basic-dialog-scroll {
  max-height: min(60vh, 480px);
  overflow-y: auto;
  text-align: start;
  white-space: pre-wrap;
  hyphens: auto;
}

.share-basic-dialog-scroll.body-large {
  font-size: 16px;
  line-height: 24px;
  letter-spacing: 0.5px;
  font-weight: 400;
}

.share-basic-dialog-scroll strong {
  font-weight: 700;
}

/* Web test form in dialog — avoid pre-wrap inherited from read-summary dialog scroll */
.share-basic-dialog-scroll.share-enroll-dialog-scroll {
  white-space: normal;
}

/* FitWidthEqualHeightFlowRow: 2 columns, 8px gap — key points; narrower than full wrap */
.bullets-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  max-width: var(--share-grid-max-width);
  margin-left: auto;
  margin-right: auto;
}

/* Background from shareLandingPostIt.ts (playful_XX_light); inline style overrides */
.bullet-cell {
  border-radius: 12px;
  padding: 12px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bullet-title {
  font-size: 18px;
  line-height: 1.2;
  font-weight: 900;
  margin: 0;
  color: var(--on-surface);
  text-align: center;
}

/* bodyLarge — match .summary-text (not titleMedium) */
.bullet-text {
  font-size: 16px;
  line-height: 24px;
  letter-spacing: 0.5px;
  font-weight: 400;
  margin: 0;
  white-space: pre-wrap;
  hyphens: auto;
  color: var(--on-surface);
  text-align: center;
}

.bullet-text strong {
  font-weight: 700;
}

/* Terms: same grid; 8px under title like FlipCard front (ChapterPage Terms) */
.terms-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  max-width: var(--share-grid-max-width);
  margin-left: auto;
  margin-right: auto;
}

.term-cell {
  border-radius: 12px;
  padding: 12px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.term-word {
  font-size: 18px;
  line-height: 1.2;
  font-weight: 900;
  margin: 0;
  color: var(--on-surface);
  text-align: center;
}

.term-def {
  font-size: 16px;
  line-height: 24px;
  letter-spacing: 0.5px;
  font-weight: 400;
  margin: 0;
  color: var(--on-surface);
  text-align: center;
}

.term-def strong {
  font-weight: 700;
}

.dyk-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: center;
}

/* Did you know / common mistakes lines — same bodyLarge as .summary-text */
.body-medium-line {
  font-size: 16px;
  line-height: 24px;
  letter-spacing: 0.5px;
  font-weight: 400;
  margin: 0;
  white-space: pre-wrap;
  hyphens: auto;
  color: var(--on-surface);
  text-align: center;
}

/* CaptionedCartoonDisplay: SectionTitle + Spacer(16.dp) + Card + Spacer(16.dp) + dialogue */
.comic-block {
  gap: 16px;
}

.comic-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: var(--share-grid-max-width);
  margin-left: auto;
  margin-right: auto;
}

.comic-panel {
  border-radius: 32px;
  overflow: hidden;
  background: var(--surface-container-high);
  margin: 0;
}

.comic-img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  vertical-align: middle;
}

.comic-dialogue {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 16px 16px;
  text-align: center;
}

.comic-dialogue-line {
  font-size: 16px;
  line-height: 19px;
  letter-spacing: 0.5px;
  font-weight: 600;
  font-style: italic;
  margin: 0;
  color: var(--on-surface);
}

/* Toiminnot — FitWidthEqualHeightFlowRow max 2 columns (ChapterPage Actions) */
.actions-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  max-width: var(--share-grid-max-width);
  margin-left: auto;
  margin-right: auto;
}

/* Toiminnot tiles: icon on top (~50% cell width), label — white bg (web); Android uses playful_* tints */
.btn-actions-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 72px;
  padding: 12px 16px;
  background: #ffffff;
  color: var(--on-surface);
  border: 1px solid var(--outline);
  border-radius: 16px;
  text-decoration: none;
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  text-align: center;
  cursor: pointer;
  box-sizing: border-box;
  appearance: none;
  width: 100%;
}

button.btn-actions-tile {
  margin: 0;
}

.btn-actions-tile:hover {
  background: rgba(29, 27, 32, 0.06);
}

.btn-actions-tile:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.actions-tile-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 50%;
  max-width: 120px;
  aspect-ratio: 1;
}

.actions-tile-icon {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.actions-tile-label {
  display: block;
  line-height: 1.25;
}

/* Single column only on very narrow viewports; ~390px+ phones keep 2 columns */
@media (max-width: 380px) {
  .bullets-grid,
  .terms-grid {
    grid-template-columns: 1fr;
  }
}

/* M3 FilledButton shape 16dp */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 10px 24px;
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  border-radius: 16px;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  border: none;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: transparent;
  color: var(--on-surface);
  border: 1px solid var(--outline);
}

.btn-secondary:hover {
  background: rgba(29, 27, 32, 0.08);
}

/* Bottom install promo — copy + second primary CTA, centered */
.install-more-body-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--share-space-after-title);
}

.install-more-text {
  margin: 0;
  font-size: 16px;
  line-height: 24px;
  letter-spacing: 0.5px;
  font-weight: 400;
  text-align: center;
  color: var(--on-surface);
  hyphens: auto;
}

.install-more-cta {
  display: flex;
  justify-content: center;
  width: 100%;
}

.error-page {
  box-sizing: border-box;
  max-width: var(--share-grid-max-width);
  width: 100%;
  margin: 0 auto;
  padding: 2rem;
  font-family: "Roboto", system-ui, sans-serif;
  color: var(--on-surface);
  text-align: center;
}

/* —— Share quick exercises (chapter questions) —— (keep in sync with server/public/kidea/share-landing.css) */
.share-exercises-section .section-body {
  width: 100%;
}

.share-exercises-root {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.share-exercise-card {
  background: rgba(29, 27, 32, 0.04);
  border-radius: 12px;
  padding: 16px;
  border: 1px solid var(--outline);
}

.share-exercise-prompt {
  margin: 0 0 12px;
  font-size: 16px;
  line-height: 1.4;
}

.share-exercise-hangman-word,
.hangman-display {
  font-size: 1.25rem;
  letter-spacing: 0.06em;
  margin: 0 0 8px;
  word-break: break-word;
}

.share-exercise-hangman-tries {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 10px;
  color: var(--on-surface);
  text-align: center;
  width: 100%;
  box-sizing: border-box;
}

.share-exercise-hint.share-hangman-hint {
  text-align: center;
  width: 100%;
  box-sizing: border-box;
  font-size: 16px;
  line-height: 1.45;
}

.share-exercise-hint {
  font-size: 14px;
  opacity: 0.85;
  margin: 0 0 12px;
}

.share-hangman-letter-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 14px;
  justify-content: center;
}

.share-hangman-letter-btn {
  box-sizing: border-box;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0 6px;
  margin: 0;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1;
  border-radius: 8px;
  border: 1px solid var(--outline);
  background: rgba(255, 255, 255, 0.55);
  color: var(--on-surface);
  cursor: pointer;
}

.share-hangman-letter-btn:hover:not(:disabled) {
  background: rgba(29, 27, 32, 0.08);
}

.share-hangman-letter-btn:disabled {
  cursor: default;
  opacity: 0.45;
}

.share-exercise-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.share-exercise-input {
  flex: 1;
  min-width: 140px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--outline);
  font: inherit;
}

.share-exercise-status {
  margin: 8px 0 0;
  min-height: 1.25em;
  font-size: 15px;
  text-align: center;
  width: 100%;
  box-sizing: border-box;
}

.share-exercise-status.ok,
.share-exercise-status.bad {
  font-size: clamp(1.5rem, 5vw, 2.35rem);
  font-weight: 700;
  line-height: 1.3;
  padding: 18px 12px;
  margin-top: 20px;
}

.share-exercise-status.ok {
  color: #1b5e20;
}

.share-exercise-status.bad {
  color: #b3261e;
}

.share-cloze-sentence {
  margin-bottom: 12px;
}

.share-cloze-flow {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
  align-items: center;
  line-height: 1.5;
}

.share-cloze-text {
  white-space: pre-wrap;
}

.share-cloze-select,
.share-categorize-select,
.share-match-select {
  font: inherit;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--outline);
  max-width: 100%;
}

.share-cloze-pick {
  display: inline-block;
  font-weight: 700;
  font-size: 1.05em;
  padding: 6px 12px;
  border-radius: 8px;
  vertical-align: baseline;
}

.share-cloze-pick-ok {
  color: #1b5e20;
  background: rgba(27, 94, 32, 0.14);
}

.share-cloze-pick-bad {
  color: #b3261e;
  background: rgba(179, 38, 30, 0.1);
}

.share-cloze-retry-wrap {
  display: none;
  justify-content: center;
  width: 100%;
  margin-top: 16px;
  box-sizing: border-box;
}

.share-cloze-retry-wrap.share-cloze-retry-visible {
  display: flex;
}

.share-categorize-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

.share-categorize-item-label {
  flex: 1;
  min-width: 120px;
}

.share-match-titles {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  justify-content: space-between;
  margin-bottom: 8px;
}

.share-match-left-cell {
  flex: 1;
  min-width: 120px;
}

.share-match-col-title {
  font-weight: 600;
  margin: 0 0 8px;
  font-size: 15px;
}

.share-match-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

/* Sentence ordering: draggable word chips (parity with app) */
.share-order-chips-wrap {
  position: relative;
  margin: 0 0 16px;
  min-height: 48px;
}

.share-order-chips-wrap--dragging {
  touch-action: none;
}

/* Touch / coarse pointer: tap word → then tap caret or another word to place (no drag) */
.share-order-chips-wrap--tap .share-order-chip {
  cursor: pointer;
  touch-action: manipulation;
}

.share-order-tap-carets-layer {
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  pointer-events: none;
  box-sizing: border-box;
}

.share-order-tap-caret {
  position: absolute;
  width: 72px;
  min-height: 36px;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  align-items: stretch;
  justify-content: center;
  pointer-events: auto;
  box-sizing: border-box;
}

.share-order-tap-caret-line {
  display: block;
  width: 3px;
  min-height: 32px;
  height: 100%;
  border-radius: 1.5px;
  background: var(--primary, #6750a4);
  flex-shrink: 0;
  align-self: stretch;
}

.share-order-chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  align-items: flex-start;
}

/* Insertion caret: hidden until drag targets a new position */
.share-order-drag-caret {
  position: absolute;
  left: 0;
  top: 0;
  width: 3px;
  height: 0;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 1.5px;
  background: var(--primary, #6750a4);
  opacity: 0;
  pointer-events: none;
  z-index: 4;
  transition: opacity 0.1s ease;
  box-sizing: border-box;
}

.share-order-drag-caret.share-order-drag-caret--visible {
  opacity: 1;
}

.share-order-actions {
  display: flex;
  justify-content: center;
  width: 100%;
}

.share-exercise-card--sentence-order .share-exercise-status {
  text-align: center;
}

.share-order-chip {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.25;
  color: #1d1b20;
  cursor: grab;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  max-width: 100%;
  word-break: break-word;
  text-align: center;
  transition: box-shadow 0.12s ease, opacity 0.12s ease;
}

/* Must follow `.share-order-chip` so the white ring is not overridden by its box-shadow. */
.share-order-chip.share-order-chip--selected {
  border-color: #000;
  box-shadow: 0 0 0 3px #000, 0 1px 2px rgba(0, 0, 0, 0.08);
  z-index: 2;
  position: relative;
}

.share-order-chip.share-order-chip--selected.share-order-chip--wrong {
  box-shadow: 0 0 0 3px #000, inset 0 0 0 3px #c62828, 0 1px 2px rgba(0, 0, 0, 0.08);
}

.share-order-chips-wrap--dragging .share-order-chip:not(.share-order-chip--dragging) {
  cursor: grabbing;
}

.share-order-chip:active {
  cursor: grabbing;
}

.share-order-chip--dragging {
  opacity: 0.5;
  pointer-events: none;
  cursor: grabbing;
  z-index: 2;
}

.share-order-chip--wrong:not(.share-order-chip--selected) {
  box-shadow: inset 0 0 0 3px #c62828, 0 1px 2px rgba(0, 0, 0, 0.08);
}

.share-order-list {
  margin: 0 0 12px;
  padding-left: 1.25rem;
}

.share-order-item {
  margin-bottom: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}

.share-order-text {
  flex: 1;
  min-width: 120px;
}

.share-order-btns {
  display: flex;
  gap: 6px;
}

.btn-tight {
  padding: 6px 12px;
  min-height: 36px;
  font-size: 14px;
}

.share-wordcube-grid {
  margin: 0 0 12px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 8px;
  overflow: auto;
  font-size: 14px;
  line-height: 1.35;
}

.share-wordcube-words {
  margin: 0 0 8px;
  padding-left: 1.25rem;
}

.share-exercise-note {
  margin: 0 0 8px;
  font-size: 15px;
}

.share-match-image-terms {
  margin: 0 0 8px;
  padding-left: 1.25rem;
  font-size: 14px;
}

.share-exercise-cta {
  margin: 8px 0 0;
  font-size: 14px;
  font-weight: 500;
  opacity: 0.9;
}

.share-exercise-sub {
  margin: 8px 0 4px;
  font-size: 14px;
  font-weight: 600;
}

/* ========== Kidea marketing home (from server/data/web/home.css) — single file for CDN deploy ========== */

/* Pager + home-only layout. Keep tokens aligned with ../public/kidea/share-landing.css when that file changes. */

/* Language switcher — top right on all locales (PNG flags: Windows often renders regional-indicator emoji as “GB” text) */
.home-lang-switch {
  position: fixed;
  top: max(8px, env(safe-area-inset-top, 0px));
  right: max(8px, env(safe-area-inset-right, 0px));
  /* Above consent bar (99999) and full-bleed carousel layers so taps are never eaten */
  z-index: 100000;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 4px 0;
  list-style: none;
  pointer-events: auto;
}

.home-lang-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  min-height: 2rem;
  padding: 2px 4px;
  border-radius: 8px;
  text-decoration: none;
  line-height: 1;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  box-sizing: border-box;
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(103, 80, 164, 0.2);
}

.home-lang-flag-img {
  display: block;
  width: 28px;
  height: auto;
  border-radius: 2px;
  /* Let hits target the image too — avoids rare WebKit quirks with pointer-events:none on children of <a> */
  pointer-events: auto;
}

@media (max-width: 767px) {
  .home-lang-switch {
    gap: 4px;
    padding: 2px 0;
  }

  .home-lang-flag-img {
    width: calc(28px * 0.67);
  }

  .home-lang-link {
    min-width: 36px;
    min-height: 36px;
    padding: 4px 6px;
  }
}

.home-lang-link:hover {
  background: rgba(29, 27, 32, 0.06);
}

.home-lang-link:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.home-lang-link[aria-current="page"] {
  border-color: var(--primary);
  background: var(--surface-container-high);
}

/* Break out of `.wrap` so tiles can use the full viewport width (not capped at 520px). */
.home-pager.home-pager--full-bleed {
  width: 100vw;
  max-width: none;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
}

.home-pager {
  margin: 0 auto;
  width: 100%;
  max-width: var(--share-grid-max-width);
}

.home-pager-viewport {
  /* Pager layout — JS reads these via getComputedStyle (keep in sync). */
  --home-pager-gap: 8px;
  --home-pager-cols: 7;
  --home-pager-track-gaps: 4;
  --home-pager-visible: 5;
  position: relative;
  container-type: inline-size;
  container-name: home-pager;
  width: 100%;
  overflow: hidden;
  background: transparent;
}

@media (max-width: 1200px) {
  .home-pager-viewport {
    --home-pager-cols: 5;
    --home-pager-track-gaps: 2;
    --home-pager-visible: 3;
  }
}

@media (max-width: 767px) {
  .home-pager-viewport {
    --home-pager-cols: 3;
    --home-pager-track-gaps: 0;
    --home-pager-visible: 1;
  }
}

/* Fade to white at both edges (above track) */
.home-pager-viewport::before,
.home-pager-viewport::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: min(56px, 18%);
  z-index: 1;
  pointer-events: none;
}

.home-pager-viewport::before {
  left: 0;
  background: linear-gradient(to right, var(--background), transparent);
}

.home-pager-viewport::after {
  right: 0;
  background: linear-gradient(to left, var(--background), transparent);
}

.home-pager-track {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: var(--home-pager-gap);
  box-sizing: border-box;
  padding-left: calc(
    (100cqw - var(--home-pager-track-gaps) * var(--home-pager-gap)) / var(--home-pager-cols)
  );
  padding-right: calc(
    (100cqw - var(--home-pager-track-gaps) * var(--home-pager-gap)) / var(--home-pager-cols)
  );
  will-change: transform;
  transition: transform 0.45s ease-in-out;
}

.home-pager-track.home-pager-track--no-transition {
  transition: none;
}

/* One column width = side padding and tile — matches JS `(W - trackGaps*gap) / cols`. */
.home-pager-item {
  flex: 0 0
    calc(
      (100cqw - var(--home-pager-track-gaps) * var(--home-pager-gap)) / var(--home-pager-cols)
    );
  min-width: 0;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface-container-high);
  flex-shrink: 0;
}

.home-pager-item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 12px;
}

.home-lead-paragraphs {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.home-lead-paragraphs .summary-text + .summary-text {
  margin-top: 0;
}

/* Decorative mascots above section titles — same bucket as logo_book.png */
.home-section-deco {
  display: flex;
  justify-content: center;
  margin: 0;
}

.home-section-deco-img {
  display: block;
  height: auto;
  max-height: 120px;
  width: auto;
  max-width: min(220px, 100%);
  object-fit: contain;
}

.home-contact-mail,
.home-contact-link {
  color: var(--primary);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.home-contact-mail:hover,
.home-contact-link:hover {
  color: var(--primary-hover);
}

.home-contact-mail:focus-visible,
.home-contact-link:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 2px;
}

.home-learn-smarter-body {
  display: flex;
  flex-direction: column;
  gap: var(--share-space-after-title);
}

/* Three short cards in one row (share page bullets are 2-col; this block is 3-col). */
.home-learn-smarter-benefits.bullets-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 767px) {
  .home-learn-smarter-benefits.bullets-grid {
    grid-template-columns: 1fr;
  }
}

/* Vertical stack of post-it cards (Perfect for). */
.home-perfect-for-grid.bullets-grid {
  grid-template-columns: 1fr;
}

/* Web test enrollment card (marketing form) — sync with server/data/web/home.css */
.home-web-test-section-body {
  display: flex;
  justify-content: center;
  width: 100%;
  max-width: var(--share-grid-max-width, 720px);
  margin-left: auto;
  margin-right: auto;
}

.home-web-test-card {
  width: 100%;
  max-width: 28rem;
  margin-left: auto;
  margin-right: auto;
}

.home-web-test-card-title {
  margin-bottom: 0.25rem;
}

.home-web-test-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  align-items: stretch;
}

.home-web-test-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
}

.home-web-test-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--on-surface, #1d1b20);
}

.home-web-test-input {
  font: inherit;
  font-size: 16px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(29, 27, 32, 0.2);
  background: rgba(255, 255, 255, 0.85);
  color: var(--on-surface, #1d1b20);
  width: 100%;
  box-sizing: border-box;
}

.home-web-test-input:focus {
  outline: 2px solid var(--primary, #6650a4);
  outline-offset: 1px;
}

.home-web-test-actions {
  display: flex;
  justify-content: center;
  margin-top: 4px;
}

.home-web-test-message {
  margin: 0;
  min-height: 1.25em;
  font-size: 14px;
  text-align: center;
}

.home-web-test-message--ok {
  color: #0d6e0d;
}

.home-web-test-message--err {
  color: #b00020;
}

/*
 * Enrollment `<dialog>` is outside `.wrap`; some deployments served older CSS without `.home-web-test-*`.
 * ID-scoped rules force the same vertical card layout as marketing `index.html` (no inline label + field).
 */
#share-web-test-enroll-dialog .share-enroll-dialog-scroll {
  white-space: normal;
  overflow-x: hidden;
}

#share-web-test-enroll-dialog .home-web-test-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  max-width: none;
  align-items: stretch;
}

#share-web-test-enroll-dialog .home-web-test-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  text-align: left;
  margin: 0;
}

#share-web-test-enroll-dialog .home-web-test-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--on-surface, #1d1b20);
}

#share-web-test-enroll-dialog .home-web-test-input {
  display: block;
  width: 100%;
  margin: 0;
  box-sizing: border-box;
  font: inherit;
  font-size: 16px;
  line-height: 1.25;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(29, 27, 32, 0.22);
  background: #fff;
  color: var(--on-surface, #1d1b20);
  -webkit-appearance: none;
  appearance: none;
}

#share-web-test-enroll-dialog .home-web-test-input:focus {
  outline: 2px solid var(--primary, #6650a4);
  outline-offset: 2px;
}

#share-web-test-enroll-dialog .home-web-test-actions {
  display: flex;
  justify-content: center;
  margin-top: 4px;
}

#share-web-test-enroll-dialog .home-web-test-actions .btn.btn-primary {
  min-height: 44px;
  padding: 12px 28px;
  appearance: none;
  border: none;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
}

#share-web-test-enroll-dialog .home-web-test-message {
  text-align: center;
}

/*
 * share-landing.css sets white-space: pre-wrap on body text so shared-chapter JSON can keep line breaks.
 * That also preserves leading/trailing spaces from pretty-printed HTML. Browsers do not trim text nodes;
 * pre-wrap makes those spaces visible. Normal collapsing fixes static marketing copy.
 */
.wrap .summary-text,
.wrap .body-medium-line,
.wrap .bullet-text {
  white-space: normal;
}

/* Analytics consent — fixed bottom bar (sync with server/data/web/home.css) */
.analytics-consent-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  /* Above in-page fixed UI and typical host overlays */
  z-index: 99999;
  pointer-events: auto;
  box-sizing: border-box;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px 16px;
  padding: max(12px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-right, 0px))
    max(12px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  background: var(--surface-container-highest, #e8e8ed);
  border-top: 1px solid rgba(29, 27, 32, 0.12);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
  font-family: "Roboto", system-ui, sans-serif;
}

html[data-analytics-consent] .analytics-consent-banner {
  display: none;
}

.analytics-consent-text {
  margin: 0;
  flex: 1 1 220px;
  max-width: 42rem;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--on-surface, #1d1b20);
}

.analytics-consent-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex-shrink: 0;
}

.analytics-consent-btn {
  font: inherit;
  font-weight: 500;
  font-size: 0.875rem;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid rgba(29, 27, 32, 0.2);
  background: var(--surface, #fff);
  color: var(--on-surface, #1d1b20);
}

.analytics-consent-btn:hover {
  filter: brightness(0.97);
}

.analytics-consent-btn:focus-visible {
  outline: 2px solid var(--primary, #6750a4);
  outline-offset: 2px;
}

.analytics-consent-btn--primary {
  background: var(--primary, #6750a4);
  color: var(--on-primary, #fff);
  border-color: transparent;
}

.analytics-consent-btn--primary:hover {
  filter: brightness(1.05);
}
