/*
 * material-k6-sky.css
 *
 * Общий визуальный слой для всех материалов под палитру K6 Sky soft.
 * Подключается через <link rel="stylesheet"> в каждом материале.
 *
 * Контракт: материалы должны использовать те классы и id которые
 * описаны в этом файле. Подробнее — _shared/MATERIAL_CONTRACT.md
 */

* { box-sizing: border-box; margin: 0; padding: 0; }

  :root {
    --bg-page:       #bcdcef;
    --bg-orb:        #dceffb;
    --bg-card:       #ffffff;
    --bg-card-soft:  #f4faff;

    --ink:           #0c2a44;
    --ink-soft:      rgba(12,42,68,0.65);
    --ink-faded:     rgba(12,42,68,0.45);
    --cream:         #fffaee;

    --blue:          #3da0e8;
    --orange:        #f4a040;
    --orange-soft:   rgba(244,160,64,0.20);
    --orange-bg:     rgba(244,160,64,0.10);

    --success:       #5cb37b;
    --success-bg:    #e8f5ed;
    --success-ink:   #2d6b3f;
    --error:         #d44545;
    --error-bg:      #fbe8e8;
    --error-ink:     #8a1f1f;

    --line:          rgba(12,42,68,0.18);
    --line-soft:     rgba(12,42,68,0.08);

    --slot-bg:       #fffaee;
    --shadow-card:   0 1px 0 rgba(12,42,68,0.04);
    --shadow-card-h: 0 8px 24px rgba(12,42,68,0.10);
  }

  html { -webkit-text-size-adjust: 100%; }

  body {
    font-family: 'Manrope', -apple-system, sans-serif;
    background: var(--bg-page);
    color: var(--ink);
    line-height: 1.6;
    padding: 24px 16px calc(96px + env(safe-area-inset-bottom));
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
    font-size: 16px;
  }

  body::before {
    content: '';
    position: fixed;
    top: -120px;
    right: -120px;
    width: 360px;
    height: 360px;
    border-radius: 50%;
    background: var(--bg-orb);
    pointer-events: none;
    z-index: 0;
  }

  .container { position: relative; z-index: 1; max-width: 720px; margin: 0 auto; }

  header {
    text-align: left;
    padding: 8px 0 32px;
    margin-bottom: 8px;
  }

  header::before { display: none; }

  .eyebrow {
    font-family: 'Manrope', sans-serif;
    font-size: 12px;
    font-weight: 600;
    color: var(--ink);
    opacity: 0.65;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    margin-bottom: 14px;
  }

  .eyebrow::before {
    content: '✦';
    margin-right: 8px;
    color: var(--blue);
    font-size: 12px;
  }

  h1 {
    font-family: 'Manrope', sans-serif;
    font-size: clamp(2.5rem, 7vw, 3.5rem);
    color: var(--ink);
    font-weight: 800;
    letter-spacing: -0.025em;
    line-height: 1;
    margin: 0;
  }

  h1 em {
    font-style: normal;
    color: var(--ink);
    opacity: 0.55;
    font-weight: 800;
  }

  .subtitle {
    font-family: 'Manrope', sans-serif;
    color: var(--ink);
    opacity: 0.7;
    margin: 14px 0 0;
    font-size: 16px;
    line-height: 1.5;
    max-width: 560px;
    font-weight: 400;
  }

  .card {
    background: var(--bg-card);
    border-radius: 22px;
    padding: 28px 28px 26px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-card);
    border: none;
    position: relative;
    overflow: hidden;
  }

  .card::before { display: none; }

  .card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    flex-wrap: wrap;
  }

  .stamp {
    background: var(--ink);
    color: var(--cream);
    padding: 5px 12px;
    border-radius: 4px;
    font-family: 'Manrope', sans-serif;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    flex-shrink: 0;
    transform: none;
    box-shadow: none;
  }

  .stamp.blue,
  #task-1 .stamp,
  #task-2 .stamp,
  #task-3 .stamp,
  #task-4 .stamp {
    background: var(--blue);
    color: #ffffff;
  }

  .stamp.olive {
    background: var(--success);
    color: #ffffff;
    box-shadow: none;
  }

  .card h2 {
    font-family: 'Manrope', sans-serif;
    font-size: 22px;
    color: var(--ink);
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.005em;
  }

  .instructions {
    color: var(--ink-soft);
    font-size: 15px;
    margin: 8px 0 22px;
    font-style: italic;
    border-left: 2px solid var(--orange);
    padding-left: 12px;
    line-height: 1.5;
  }

  .dialogue {
    background: var(--bg-card-soft);
    border-radius: 14px;
    padding: 18px 20px;
    margin-bottom: 14px;
    border-left: 3px solid var(--blue);
  }
  .dialogue:last-child { margin-bottom: 0; }

  .dialogue-header {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 6px;
    flex-wrap: wrap;
  }

  .dialogue-num {
    font-family: 'Manrope', sans-serif;
    font-style: normal;
    font-size: 18px;
    color: var(--blue);
    font-weight: 700;
    line-height: 1;
  }

  .dialogue-title {
    font-family: 'Manrope', sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: var(--ink);
    line-height: 1.3;
  }

  .skill-badge {
    font-family: 'Manrope', sans-serif;
    font-size: 10px;
    color: var(--ink);
    background: var(--bg-orb);
    padding: 4px 10px;
    border-radius: 999px;
    font-weight: 700;
    letter-spacing: 0.10em;
    text-transform: uppercase;
    margin-left: auto;
  }

  .dialogue-setting {
    font-size: 15px;
    color: var(--ink-faded);
    font-style: italic;
    margin: 8px 0 14px;
    padding-bottom: 10px;
    border-bottom: 1px dashed var(--line);
    line-height: 1.55;
  }

  .dialogue-line {
    display: grid;
    grid-template-columns: 36px 1fr;
    gap: 10px;
    margin-bottom: 6px;
    font-size: 16px;
    line-height: 1.5;
    align-items: baseline;
  }

  @media (max-width: 540px) {
    .dialogue-line { grid-template-columns: 30px 1fr; gap: 8px; }
  }

  .speaker {
    font-family: 'Manrope', sans-serif;
    font-size: 13px;
    font-weight: 700;
    color: var(--blue);
    text-align: right;
    padding-top: 2px;
    letter-spacing: 0.05em;
  }

  .speaker.maxim { color: var(--ink); }

  .line-text { color: var(--ink); }

  .line-text b,
  .line-text strong {
    background: var(--orange-soft);
    font-weight: 600;
    padding: 2px 4px;
    border-radius: 3px;
    color: var(--ink);
  }

  .line-text del {
    background: var(--error-bg);
    color: var(--error-ink);
    text-decoration: line-through;
    text-decoration-color: var(--error);
    text-decoration-thickness: 2px;
    padding: 0 4px;
    border-radius: 3px;
  }

  .stage {
    color: var(--ink-faded);
    font-style: italic;
    font-size: 14px;
    line-height: 1.5;
  }

  .rapid-fire {
    background: var(--orange-bg);
    border-left: 2px solid var(--orange);
    padding: 12px 14px;
    border-radius: 8px;
    margin: 4px 0 8px;
    font-size: 16px;
    line-height: 1.5;
    color: var(--ink);
    font-weight: 500;
    position: relative;
  }

  .vocab-grid {
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-card);
  }

  .vocab-row {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    border-bottom: 1px solid var(--line-soft);
  }
  .vocab-row:last-child { border-bottom: none; }
  .vocab-row:nth-child(even) { background: var(--bg-card-soft); }

  @media (max-width: 600px) {
    .vocab-row { grid-template-columns: 1fr; }
    .vocab-row > .vocab-de { border-right: none; border-bottom: 1px dashed var(--line-soft); }
  }

  .vocab-row > div {
    padding: 12px 16px;
    font-size: 16px;
    line-height: 1.4;
  }

  .vocab-de {
    font-weight: 700;
    color: var(--ink);
    border-right: 1px dashed var(--line-soft);
  }

  .vocab-de .article {
    color: var(--blue);
    font-weight: 500;
    font-style: italic;
    margin-right: 4px;
    font-size: 13px;
  }

  .vocab-ru { color: var(--ink-soft); }

  .vocab-row.warning {
    background: var(--error-bg);
  }

  .vocab-row.warning .vocab-de {
    color: var(--error-ink);
  }

  .vocab-row.warning .vocab-de::before {
    content: '⚠ ';
    margin-right: 4px;
  }

  .word-bank {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 18px 18px 16px;
    background: var(--bg-card-soft);
    border-radius: 12px;
    margin-bottom: 22px;
    position: relative;
  }

  .word-bank::after {
    content: 'Wortschatz';
    position: absolute;
    top: -10px;
    left: 14px;
    background: var(--bg-card);
    padding: 0 8px;
    font-family: 'Manrope', sans-serif;
    font-size: 10px;
    color: var(--ink-faded);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    font-weight: 600;
  }

  .token {
    background: var(--bg-card);
    border: 1.5px solid var(--ink);
    color: var(--ink);
    padding: 7px 14px;
    border-radius: 999px;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    font-size: 15px;
    transition: transform 0.15s, box-shadow 0.15s, opacity 0.2s;
    box-shadow: 0 1px 0 var(--ink);
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  .token:not(.placed):hover {
    transform: translateY(-1px);
    background: var(--orange);
    color: var(--ink);
    border-color: var(--ink);
    box-shadow: 0 4px 12px rgba(12,42,68,0.16);
  }

  .token.placed {
    opacity: 0.32;
    cursor: not-allowed;
  }

  .token.token--selected {
    background: var(--orange) !important;
    transform: translateY(-2px) !important;
    box-shadow:
      0 0 0 2px var(--ink),
      0 4px 12px rgba(12,42,68,0.20) !important;
    opacity: 1 !important;
  }

  .token.token--used {
    opacity: 0.3 !important;
    pointer-events: none !important;
  }

  .token.dragging {
    background: var(--orange);
    color: var(--ink);
    border-color: var(--ink);
    box-shadow: 0 4px 12px rgba(12,42,68,0.20);
  }

  .token.ghost {
    position: fixed;
    z-index: 9999;
    pointer-events: none;
    opacity: 0.95;
    background: var(--orange);
    color: var(--ink);
    border-color: var(--ink);
    box-shadow: 0 4px 12px rgba(12,42,68,0.20);
    transform: translate(-50%, -50%) rotate(-2deg);
  }

  .ex-sentences { display: flex; flex-direction: column; gap: 14px; }
  .ex-line { font-size: 16px; line-height: 2.05; color: var(--ink); }
  .ex-num {
    display: inline-block;
    width: 24px;
    color: var(--blue);
    font-family: 'Manrope', sans-serif;
    font-weight: 700;
    margin-right: 4px;
    font-size: 16px;
  }

  .text-input {
    border: none;
    background: var(--bg-orb);
    border-bottom: 2px solid var(--blue);
    padding: 4px 12px;
    font-family: 'Manrope', sans-serif;
    font-size: 16px;
    font-weight: 600;
    color: var(--ink);
    width: 130px;
    outline: none;
    transition: all 0.18s;
    border-radius: 4px 4px 0 0;
  }
  .text-input.wide { width: 200px; }
  .text-input:focus {
    border-bottom-color: var(--ink);
    background: #ffffff;
  }
  .text-input.correct {
    border-bottom-color: var(--success);
    background: var(--success-bg);
    color: var(--success-ink);
  }
  .text-input.incorrect {
    border-bottom-color: var(--error);
    background: var(--error-bg);
    color: var(--error-ink);
  }

  .match-grid { display: flex; flex-direction: column; gap: 12px; }

  .match-row {
    display: grid;
    grid-template-columns: 1fr 240px;
    gap: 16px;
    align-items: center;
  }
  @media (max-width: 600px) { .match-row { grid-template-columns: 1fr; gap: 6px; } }

  .match-de {
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 14px;
    font-weight: 700;
    font-size: 15px;
    color: var(--ink);
    line-height: 1.3;
  }

  .match-drop, .word-slot, .slot {
    cursor: pointer;
    transition: all 0.18s;
    min-height: 44px;
  }

  .match-drop, .word-slot {
    background: var(--slot-bg);
    border: 1.5px dashed var(--line);
    border-radius: 8px;
  }

  .match-drop:hover, .word-slot:hover, .slot:hover {
    border-color: var(--ink);
  }

  .match-drop {
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    line-height: 1.35;
  }

  .match-drop:empty::before {
    content: '↳ перевод';
    color: var(--ink-faded);
    font-weight: 400;
    font-style: italic;
    font-size: 14px;
  }

  .match-drop.filled,
  .word-slot.filled,
  .slot.filled {
    background: var(--orange);
    border-style: solid;
    border-color: var(--ink);
    color: var(--ink);
    font-weight: 600;
  }

  .match-drop.drop-active,
  .word-slot.drop-active,
  .slot.drop-active {
    background: var(--orange-soft);
    border-color: var(--ink);
    transform: scale(1.02);
  }

  .match-drop.correct,
  .word-slot.correct,
  .slot.correct {
    background: var(--success-bg) !important;
    border-style: solid;
    border-color: var(--success) !important;
    color: var(--success-ink) !important;
  }

  .match-drop.incorrect,
  .word-slot.incorrect,
  .slot.incorrect {
    background: var(--error-bg) !important;
    border-style: solid;
    border-color: var(--error) !important;
    color: var(--error-ink) !important;
  }

  .word-slot--wrong-scope {
    animation: wrongScope 0.3s ease;
  }

  @keyframes wrongScope {
    0%, 100% { border-color: var(--line); }
    50% { border-color: var(--error); background: rgba(212,69,69,0.06); }
  }

  .builder {
    background: var(--bg-card-soft);
    border-radius: 12px;
    padding: 16px 18px;
    margin-bottom: 16px;
    border-left: 3px solid var(--success);
  }

  .builder-label {
    font-family: 'Manrope', sans-serif;
    font-size: 11px;
    color: var(--blue);
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    margin-bottom: 4px;
    display: block;
  }

  .builder-russian {
    color: var(--ink-soft);
    font-size: 15px;
    font-style: italic;
    margin-bottom: 12px;
  }
  .builder-russian::before { content: '«'; color: var(--ink-faded); }
  .builder-russian::after  { content: '»'; color: var(--ink-faded); }

  .builder-target {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 12px 14px;
    background: var(--bg-card);
    border: 1.5px dashed var(--line);
    border-radius: 8px;
    min-height: 56px;
    margin-bottom: 12px;
    align-items: center;
  }

  .word-slot {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 56px;
    height: 36px;
    padding: 0 12px;
    font-weight: 600;
    font-size: 15px;
    color: var(--ink);
    line-height: 1;
    min-height: 40px;
  }

  .word-slot:empty::before {
    content: attr(data-pos);
    color: var(--ink-faded);
    font-weight: 400;
    font-size: 14px;
    font-style: italic;
  }

  .builder-pool {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 12px;
    background: var(--bg-card);
    border: 1px dashed var(--line-soft);
    border-radius: 8px;
  }

  .builder-pool .token {
    padding: 7px 13px;
    font-size: 15px;
    border-radius: 999px;
  }

  .mini-dialog {
    background: var(--bg-card-soft);
    border-radius: 10px;
    padding: 14px 18px;
    margin-bottom: 14px;
    border-left: 3px solid var(--success);
    font-size: 16px;
    line-height: 1.7;
  }

  .mini-num {
    font-family: 'Manrope', sans-serif;
    font-size: 11px;
    color: var(--blue);
    font-weight: 700;
    letter-spacing: 0.12em;
    margin-bottom: 6px;
    display: block;
    text-transform: uppercase;
  }

  .mini-dialog .speaker {
    text-align: left;
    width: auto;
    margin-right: 8px;
    display: inline-block;
    font-size: 13px;
  }

  .slot {
    display: inline-block;
    min-width: 200px;
    min-height: 32px;
    padding: 4px 12px;
    background: var(--slot-bg);
    border: 1.5px dashed var(--line);
    border-radius: 8px;
    text-align: center;
    vertical-align: baseline;
    font-weight: 600;
    font-size: 15px;
    color: var(--ink);
    line-height: 1.3;
  }

  .slot:empty::before {
    content: '?';
    color: var(--ink-faded);
    font-weight: 400;
    font-style: italic;
    font-size: 14px;
  }

  .btn-row {
    display: flex;
    gap: 10px;
    margin-top: 24px;
    flex-wrap: wrap;
  }

  button {
    font-family: 'Manrope', sans-serif;
    font-size: 15px;
    font-weight: 700;
    padding: 12px 22px;
    border-radius: 999px;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
    letter-spacing: 0.02em;
  }

  .btn-primary {
    background: var(--ink);
    color: var(--cream);
    border: 1px solid var(--ink);
  }
  .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(12,42,68,0.20);
  }
  .btn-primary:active { transform: translateY(0); }

  .btn-secondary {
    background: var(--bg-card);
    color: var(--ink);
    border: 1px solid var(--line);
  }
  .btn-secondary:hover {
    background: var(--bg-orb);
    border-color: var(--ink);
    transform: translateY(-1px);
  }
  .btn-secondary:active { transform: translateY(0); }

  .btn-ghost {
    background: transparent;
    color: var(--ink-soft);
    border: 1px dashed var(--line);
  }
  .btn-ghost:hover {
    background: var(--bg-orb);
    color: var(--ink);
    border-color: var(--ink);
    border-style: solid;
  }

  .feedback {
    margin-top: 18px;
    padding: 12px 16px;
    border-radius: 12px;
    font-weight: 600;
    display: none;
    font-size: 15px;
    border-left: 4px solid;
  }
  .feedback.show {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
  }
  .feedback .score {
    font-family: 'Manrope', sans-serif;
    background: var(--bg-card);
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 700;
  }
  .feedback.success {
    background: var(--success-bg);
    color: var(--success-ink);
    border-color: var(--success);
  }
  .feedback.partial {
    background: var(--orange-bg);
    color: #7a5a14;
    border-color: var(--orange);
  }
  .feedback.error {
    background: var(--error-bg);
    color: var(--error-ink);
    border-color: var(--error);
  }

  .feedback__retry {
    margin-left: 12px;
    padding: 8px 15px;
    background: var(--bg-card);
    color: var(--ink);
    border: 1px solid var(--ink);
    border-radius: 999px;
    font-family: 'Manrope', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
  }
  .feedback__retry:hover {
    background: var(--ink);
    color: var(--cream);
  }
  @media (max-width: 480px) {
    .feedback__retry {
      display: block;
      margin: 10px 0 0 0;
      width: 100%;
      padding: 11px;
    }
  }

  .solutions {
    margin-top: 20px;
    padding: 16px 18px;
    background: var(--bg-card-soft);
    border-radius: 12px;
    font-size: 15px;
    display: none;
    border-left: 4px solid var(--success);
  }
  .solutions.show { display: block; }
  .solutions-title {
    font-family: 'Manrope', sans-serif;
    font-weight: 700;
    color: var(--success-ink);
    margin-bottom: 10px;
    font-size: 16px;
  }
  .solutions ol, .solutions ul { padding-left: 22px; }
  .solutions li {
    margin-bottom: 6px;
    color: var(--ink);
    line-height: 1.55;
    font-size: 15px;
  }
  .solutions li strong {
    color: var(--blue);
    font-weight: 700;
  }

  footer {
    text-align: center;
    color: var(--ink-soft);
    font-size: 15px;
    padding: 32px 16px 0;
    margin-top: 24px;
    font-style: italic;
  }
  footer .ornament {
    font-size: 18px;
    color: var(--blue);
    margin: 8px 0;
    letter-spacing: 0.5em;
  }

  .lesson-reset-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    color: var(--ink-soft);
    border: 1px solid var(--line);
    padding: 12px 22px;
    border-radius: 999px;
    font-family: 'Manrope', sans-serif;
    font-size: 14px;
    font-weight: 600;
    font-style: normal;
    cursor: pointer;
    margin-top: 18px;
    transition: all 0.15s ease;
  }

  .lesson-reset-btn:hover {
    background: rgba(12, 42, 68, 0.04);
    color: var(--ink);
    border-color: var(--ink);
    transform: translateY(-1px);
  }

  .lesson-reset-btn:active {
    transform: translateY(0);
  }

  .lesson-reset-btn span[aria-hidden] {
    font-size: 14px;
    line-height: 1;
    font-style: normal;
  }

  .tap-hint-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1200;
    display: none;
    align-items: center;
    gap: 8px;
    padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
    background: var(--ink);
    color: var(--cream);
    font-family: 'Manrope', sans-serif;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 2px 8px rgba(12,42,68,0.20);
    animation: hintBarSlide 0.2s ease-out;
  }
  .tap-hint-bar.is-active { display: flex; }
  @keyframes hintBarSlide {
    from { transform: translateY(-100%); }
    to   { transform: translateY(0); }
  }
  .tap-hint-bar__icon {
    font-size: 14px;
    color: var(--orange);
    flex-shrink: 0;
  }
  .tap-hint-bar__text {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: baseline;
    gap: 6px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
  .tap-hint-bar__label {
    opacity: 0.7;
    font-size: 13px;
  }
  .tap-hint-bar__word {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .tap-hint-bar__cta {
    font-size: 13px;
    opacity: 0.85;
    flex-shrink: 0;
  }
  @media (max-width: 380px) {
    .tap-hint-bar__cta { display: none; }
  }
  @media (min-width: 900px) {
    .tap-hint-bar {
      top: 72px;
      left: 24px;
      right: auto;
      max-width: 420px;
      border-radius: 12px;
      padding: 10px 14px;
    }
  }

  .tap-instruction {
    margin: 0 0 20px;
    padding: 10px 14px;
    background: var(--orange-bg);
    border-left: 3px solid var(--orange);
    border-radius: 8px;
    font-size: 15px;
    font-style: italic;
    color: var(--ink-soft);
    line-height: 1.55;
  }
  .tap-instruction__alt {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    opacity: 0.85;
  }
  @media (max-width: 480px) {
    .tap-instruction { font-size: 12px; }
  }

  @media (max-width: 540px) {
    body { padding: 16px 12px calc(96px + env(safe-area-inset-bottom)); }
    .card { padding: 24px 20px 22px; }
    .text-input { width: 110px; }
    .text-input.wide { width: 160px; }
    .slot { min-width: 160px; }
    .word-slot { min-width: 48px; padding: 0 10px; }
  }


.course-promo.author {
    max-width: 720px;
    margin: 32px auto 0;
    padding: 32px;
    border-top: none;
    background: var(--bg-card);
    border-radius: 22px;
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 28px;
    align-items: start;
    box-shadow: var(--shadow-card);
  }
  .course-promo .author-photo {
    width: 140px;
    height: 180px;
    overflow: hidden;
    border-radius: 14px;
    background: var(--bg-card-soft);
  }
  .course-promo .author-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    display: block;
  }
  .course-promo .author-name-kicker {
    font-size: 13px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--blue);
    font-weight: 700;
    margin-bottom: 8px;
  }
  .course-promo .author-name {
    font-family: 'Manrope', sans-serif;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.005em;
    margin: 0 0 12px;
    color: var(--ink);
  }
  .course-promo .author-bio {
    font-size: 16px;
    line-height: 1.6;
    color: var(--ink-soft);
    margin: 0 0 22px;
  }
  .course-promo .course-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--ink);
    color: var(--cream);
    text-decoration: none;
    padding: 14px 24px;
    font-family: 'Manrope', sans-serif;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: none;
    border-radius: 999px;
    transition: all 0.2s;
  }
  .course-promo .course-cta:hover {
    background: var(--ink);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(12,42,68,0.20);
  }
  .course-promo .course-cta .arrow {
    display: inline-block;
    transition: transform 0.2s;
  }
  .course-promo .course-cta:hover .arrow { transform: translateX(3px); }
  .course-promo .course-subtext {
    font-family: 'Manrope', sans-serif;
    font-style: italic;
    font-size: 13px;
    color: var(--ink-faded);
    margin-top: 12px;
  }
  @media (max-width: 640px) {
    .course-promo.author {
      grid-template-columns: 1fr;
      gap: 20px;
      padding: 24px;
      margin: 24px auto 0;
    }
    .course-promo .author-photo { width: 130px; height: 165px; }
    .course-promo .author-name { font-size: 22px; }
  }


body { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }

  .app-bottom-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 200;
    display: flex;
    justify-content: center;
    background: var(--bg-card);
    border-top: 1px solid var(--line-soft);
    box-shadow: 0 -2px 12px rgba(12,42,68,0.06);
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  }

  .app-bottom-bar__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    max-width: 420px;
    min-width: 200px;
    background: var(--ink);
    color: var(--cream);
    text-decoration: none;
    padding: 14px 20px;
    border-radius: 999px;
    font-family: 'Manrope', sans-serif;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.15s ease;
    -webkit-tap-highlight-color: transparent;
  }
  .app-bottom-bar__btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(12,42,68,0.20);
  }
  .app-bottom-bar__btn:active { transform: translateY(0); }
  .app-bottom-bar__btn:focus-visible {
    outline: 2px solid var(--blue);
    outline-offset: 3px;
  }
  .app-bottom-bar__arrow { font-size: 16px; line-height: 1; }

  .app-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(188,220,239,0.85);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    pointer-events: none;
  }
  .app-loading-overlay--active {
    display: flex;
    flex-direction: column;
    pointer-events: auto;
    animation: appLoadingFade 0.15s ease-out;
  }
  .app-loading-overlay__spinner {
    width: 36px; height: 36px;
    border: 3px solid var(--bg-orb);
    border-top-color: var(--ink);
    border-radius: 50%;
    animation: appLoadingSpin 0.7s linear infinite;
  }
  .app-loading-overlay__text {
    margin-top: 14px;
    font-family: 'Manrope', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: var(--ink);
    text-align: center;
  }
  @keyframes appLoadingFade { from { opacity: 0; } to { opacity: 1; } }
  @keyframes appLoadingSpin { to { transform: rotate(360deg); } }

  @media (min-width: 900px) {
    body { padding-bottom: 24px !important; }
    .app-bottom-bar {
      top: 24px; bottom: auto; left: 24px; right: auto;
      display: block;
      padding: 0;
      background: transparent;
      border-top: 0;
      box-shadow: none;
    }
    .app-bottom-bar__btn {
      width: auto;
      min-width: auto;
      padding: 10px 18px;
      font-size: 13px;
      box-shadow: var(--shadow-card);
    }
  }


.app-finish-overlay {
    position: fixed;
    inset: 0;
    z-index: 9998;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    font-family: 'Manrope', sans-serif;
  }
  .app-finish-overlay.is-visible {
    display: flex;
    animation: appFinishFade 0.4s ease-out;
  }
  @keyframes appFinishFade {
    from { opacity: 0; }
    to   { opacity: 1; }
  }
  .app-finish-overlay__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(12,42,68,0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }
  .app-finish-overlay__card {
    position: relative;
    max-width: 460px;
    width: 100%;
    background: var(--bg-card);
    border: none;
    border-radius: 22px;
    padding: 40px 32px 32px;
    text-align: center;
    box-shadow: 0 24px 60px rgba(12,42,68,0.30);
    animation: appFinishSlide 0.5s ease-out;
    overflow: hidden;
  }
  .app-finish-overlay__card::before {
    content: '';
    position: absolute;
    right: -42px;
    top: -42px;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: var(--bg-orb);
    pointer-events: none;
    z-index: 0;
  }
  .app-finish-overlay__card > * {
    position: relative;
    z-index: 1;
  }
  @keyframes appFinishSlide {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
  }
  .app-finish-overlay__ribbon { display: none; }
  .app-finish-overlay__stamp {
    display: inline-block;
    padding: 6px 14px;
    background: var(--blue);
    color: #ffffff;
    border-radius: 999px;
    font-family: 'Manrope', sans-serif;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    transform: none;
    box-shadow: none;
    margin-bottom: 22px;
  }
  .app-finish-overlay__score {
    font-family: 'Manrope', sans-serif;
    font-size: 72px;
    font-weight: 800;
    color: var(--ink);
    line-height: 1;
    letter-spacing: -0.04em;
    margin-bottom: 8px;
  }
  .app-finish-overlay__score-num { color: var(--ink); }
  .app-finish-overlay__score-slash {
    color: var(--ink-faded);
    font-style: normal;
    font-size: 48px;
    margin: 0 6px;
    font-weight: 500;
  }
  .app-finish-overlay__score-max {
    color: var(--ink-faded);
    font-style: normal;
    font-size: 48px;
    font-weight: 500;
  }
  .app-finish-overlay__pct {
    color: var(--blue);
    font-weight: 600;
    font-size: 14px;
    letter-spacing: 0.05em;
    margin-bottom: 22px;
  }
  .app-finish-overlay__bar {
    height: 8px;
    background: #e6eef5;
    border-radius: 4px;
    overflow: hidden;
    border: none;
    margin-bottom: 26px;
  }
  .app-finish-overlay__bar-fill {
    height: 100%;
    background: var(--ink);
    transition: width 0.8s ease-out;
  }
  .app-finish-overlay__title {
    font-family: 'Manrope', sans-serif;
    font-size: 24px;
    font-weight: 700;
    color: var(--ink);
    margin: 0 0 6px;
    letter-spacing: -0.01em;
  }
  .app-finish-overlay__title em {
    font-family: 'Manrope', sans-serif;
    font-style: normal;
    font-weight: 800;
    color: var(--ink);
    font-size: 1em;
  }
  .app-finish-overlay__sub {
    font-size: 15px;
    color: var(--ink-soft);
    margin: 0 0 28px;
  }
  .app-finish-overlay__btn {
    display: block;
    width: 100%;
    padding: 14px 20px;
    font-size: 14px;
    font-weight: 700;
    border-radius: 999px;
    font-family: 'Manrope', sans-serif;
    cursor: pointer;
    margin-bottom: 10px;
    border: none;
    transition: all 0.15s;
  }
  .app-finish-overlay__btn--primary {
    background: var(--ink);
    color: var(--cream);
  }
  .app-finish-overlay__btn--primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(12,42,68,0.20);
  }
  .app-finish-overlay__btn--ghost {
    background: transparent;
    color: var(--ink-soft);
    border: 1px solid var(--line);
    font-weight: 600;
  }
  .app-finish-overlay__btn--ghost:hover {
    background: var(--bg-orb);
    border-color: var(--ink);
    color: var(--ink);
  }
  @media (max-width: 480px) {
    .app-finish-overlay__card { padding: 32px 20px 24px; }
    .app-finish-overlay__score { font-size: 60px; }
    .app-finish-overlay__score-slash,
    .app-finish-overlay__score-max { font-size: 40px; }
  }
