/* ============================================================
   blatt.css — shared styles for interactive Sprachmut worksheets
   (Unterrichtsblätter). Extends styles.css design tokens; load
   AFTER styles.css on every /de/arbeitsblaetter/<slug>.html page.
   ============================================================ */

.sheet-wrap {
  background: var(--cream);
  padding: 32px 0 80px;
}

.sheet {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- Action bar ---------- */
.sheet-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  background: var(--paper);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 18px 22px;
  margin-bottom: 28px;
}

.sheet-actions .btn-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.sheet-note {
  font-size: 0.84rem;
  color: #655c7c;
  margin-bottom: 20px;
}

.sheet-note.save-error {
  display: none;
  color: var(--terracotta);
  font-weight: 600;
}

.sheet-note.save-error.is-visible {
  display: block;
}

.sheet-reset {
  background: none;
  border: 1px solid rgba(30, 18, 51, 0.18);
  color: var(--ink);
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 0.86rem;
  padding: 9px 16px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background 0.15s ease;
}

.sheet-reset:hover {
  background: rgba(30, 18, 51, 0.06);
}

/* ---------- Header ---------- */
.sheet-header-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.sheet-logo-img {
  width: 52px;
  height: auto;
  flex-shrink: 0;
  border-radius: 10px;
}

.sheet-title-bubble {
  background: var(--purple);
  border-radius: 18px;
  padding: 14px 22px 16px;
  transform: rotate(-1.2deg);
  box-shadow: 0 6px 0 0 var(--purple-deep);
  display: inline-block;
}

.sheet-title-bubble h1 {
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  color: #FBF7FF;
  font-size: clamp(1.5rem, 4vw, 2rem);
  line-height: 1.15;
}

.sheet-meta-pills {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.sheet-meta-pill {
  background: var(--ink);
  border-radius: 999px;
  padding: 6px 14px;
  font-family: 'Inter', sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  color: #FBF7FF;
}

/* ---------- Blocks ---------- */
.block {
  margin-bottom: 32px;
  break-inside: avoid;
  page-break-inside: avoid;
}

.block-header {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border-radius: 16px;
  padding: 8px 18px;
  margin-bottom: 14px;
}

.block-header.c-purple { background: var(--purple); transform: rotate(-0.8deg); }
.block-header.c-lime { background: var(--lime); transform: rotate(0.6deg); }
.block-header.c-terracotta { background: var(--terracotta); transform: rotate(-0.6deg); }
.block-header.c-ink { background: var(--ink); transform: rotate(0.6deg); }

.block-header .num {
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #FBF7FF;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.block-header h2 {
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  font-size: 1.2rem;
}

.block-header.c-purple h2,
.block-header.c-ink h2,
.block-header.c-terracotta h2 { color: #FBF7FF; }
.block-header.c-lime h2 { color: var(--ink); }

.block-body p {
  font-size: 1rem;
  line-height: 1.55;
  color: var(--ink);
  margin-bottom: 10px;
}

.hint {
  font-family: 'Caveat', cursive;
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--purple-deep);
  margin-top: 4px;
}

/* ---------- Chips / prompts ---------- */
.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.chip {
  background: var(--purple-10);
  color: var(--purple-deep);
  font-size: 0.88rem;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 999px;
}

.prompt-list {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.prompt-item {
  background: var(--paper);
  border: 1px solid rgba(90, 23, 224, 0.14);
  border-radius: 12px;
  padding: 12px 16px;
  font-family: 'Caveat', cursive;
  font-weight: 600;
  font-size: 1.25rem;
  color: var(--purple-deep);
}

/* ---------- Example / write-in fields ---------- */
.example-box {
  background: var(--paper);
  border: 2px dashed var(--lime);
  border-radius: 16px;
  padding: 16px 18px;
  margin-bottom: 20px;
}

.example-tag,
.tag-ex {
  display: inline-block;
  background: var(--lime);
  color: var(--ink);
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  font-size: 0.72rem;
  border-radius: 999px;
  padding: 3px 10px;
  margin-left: 8px;
  vertical-align: middle;
}

.write-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 24px;
  margin-top: 10px;
}

.field-row {
  display: flex;
  flex-direction: column;
}

.field-row label {
  font-family: 'Caveat', cursive;
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--purple-deep);
  margin-bottom: 4px;
}

.write-input,
.write-textarea {
  width: 100%;
  border: none;
  border-bottom: 2px dotted #9c94b8;
  background: transparent;
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  color: var(--ink);
  padding: 6px 2px;
  resize: none;
  overflow: hidden;
}

.write-input:focus-visible,
.write-textarea:focus-visible {
  outline: none;
  border-bottom-color: var(--purple);
}

.filled-example {
  font-family: 'Caveat', cursive;
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--purple-deep);
  display: block;
  padding: 6px 2px;
  border-bottom: 2px solid var(--lime);
}

.poss-note {
  background: var(--purple-10);
  border-radius: 10px;
  padding: 12px 16px;
  margin-top: 12px;
  font-size: 0.92rem;
  color: var(--ink);
  line-height: 1.5;
}

.poss-note strong {
  color: var(--purple-deep);
}

/* ---------- Link card (replaces print QR code) ---------- */
.qr-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--paper);
  border: 1px solid rgba(90, 23, 224, 0.14);
  border-radius: 12px;
  padding: 14px 16px;
  margin-top: 10px;
  text-decoration: none;
  max-width: 420px;
}

.qr-card::before {
  content: "▶";
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 10px;
  background: var(--purple-10);
  color: var(--purple);
  font-size: 1rem;
}

.qr-card .qr-label {
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  font-size: 0.96rem;
  color: var(--ink);
}

.qr-card .qr-sub {
  font-size: 0.84rem;
  color: var(--purple);
  text-decoration: underline;
}

/* ---------- Grammatical-case highlights (consistent color per case
   across every worksheet: Nominativ blue, Dativ green, Akkusativ orange) ---------- */
.case-nom:not(.chip),
.case-akk:not(.chip),
.case-dat:not(.chip) {
  border: 0;
  border-radius: 3px;
  padding: 0 4px;
  font-weight: 600;
  white-space: nowrap;
}

.case-nom { background: #DCEBFF; color: #1B4F9C; }
.case-akk { background: #FBE3D6; color: #A04A22; }
.case-dat { background: #E3F4C4; color: #3F6B08; }

.chip.case-nom { background: #DCEBFF; color: #1B4F9C; }
.chip.case-akk { background: #FBE3D6; color: #A04A22; }
.chip.case-dat { background: #E3F4C4; color: #3F6B08; }

.grammar-table td.c-nom-cell { background: #EEF5FF; color: #1B4F9C; }
.grammar-table td.c-akk-cell { background: #FDF0E9; color: #A04A22; }
.grammar-table td.c-dat-cell { background: #F1F9E1; color: #3F6B08; font-weight: 600; }

/* ---------- Grammar table ---------- */
.grammar-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}

.grammar-table th,
.grammar-table td {
  text-align: left;
  padding: 8px 10px;
  font-size: 0.92rem;
  border-bottom: 1px solid rgba(90, 23, 224, 0.14);
}

.grammar-table th {
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  color: var(--purple);
}

.grammar-table td.hl {
  color: var(--purple-deep);
  font-weight: 600;
}

.sent {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.sent span {
  background: var(--paper);
  border: 1px solid rgba(90, 23, 224, 0.14);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.94rem;
}

.sent .plus {
  border: 0;
  background: none;
  padding: 0;
  color: #9c94b8;
}

.sent .v { background: var(--purple); color: #fff; border-color: var(--purple); font-weight: 600; }
.sent .p { background: var(--lime); color: var(--ink); border-color: var(--lime); font-weight: 600; }
.sent .t { background: var(--terracotta); color: #fff; border-color: var(--terracotta); font-weight: 600; }

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}

.info-card {
  background: var(--purple-10);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--ink);
}

.info-card h5 {
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  font-size: 0.86rem;
  color: var(--purple);
  margin-bottom: 4px;
}

/* ---------- Timeline ---------- */
.timeline {
  background: var(--paper);
  border: 1px solid rgba(90, 23, 224, 0.14);
  border-radius: 12px;
  padding: 18px 20px;
  margin-top: 14px;
}

.tl-axis {
  position: relative;
  height: 20px;
  margin-left: 90px;
  font-size: 0.76rem;
  color: #6b6388;
}

.tl-axis span {
  position: absolute;
  transform: translateX(-50%);
}

.tl-row {
  display: flex;
  align-items: center;
  margin-top: 10px;
}

.tl-lab {
  width: 90px;
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  font-size: 0.86rem;
  color: var(--purple-deep);
}

.tl-track {
  position: relative;
  flex: 1;
  height: 24px;
  background: var(--purple-10);
  border-radius: 12px;
  border-right: 2px dashed var(--purple);
}

.tl-bar {
  position: absolute;
  top: 0;
  height: 100%;
  border-radius: 12px;
  font-size: 0.76rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  padding: 0 6px;
}

.tl-note {
  margin-left: 90px;
  margin-top: 10px;
  font-size: 0.82rem;
  color: #6b6388;
  font-style: italic;
  line-height: 1.4;
}

/* ---------- Exercises ---------- */
.exercise {
  margin-bottom: 20px;
}

.exercise-label {
  display: inline-block;
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  font-size: 1rem;
  color: var(--purple-deep);
  margin-bottom: 10px;
}

.ex-item {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.ex-item .arrow {
  color: var(--lime-deep);
  font-weight: 700;
  flex-shrink: 0;
}

.ex-item .src {
  font-size: 0.96rem;
  color: var(--ink);
  flex-shrink: 0;
  min-width: 140px;
}

.ex-item .src.wide {
  min-width: 220px;
}

.ex-item .write-input {
  flex: 1;
  min-width: 140px;
}

.gap-text {
  font-size: 0.98rem;
  line-height: 2.2;
  color: var(--ink);
}

.gap-text .write-input.gap {
  display: inline-block;
  width: 110px;
  margin: 0 4px;
}

.reading {
  background: var(--paper);
  border: 1px solid rgba(90, 23, 224, 0.14);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 0.98rem;
  line-height: 1.6;
  margin-top: 10px;
}

.q-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 24px;
  margin-top: 12px;
}

.q-grid .q {
  font-size: 0.96rem;
  margin-bottom: 4px;
}

/* ---------- Final challenge ---------- */
.final-text-area {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tip {
  background: var(--terracotta);
  border-radius: 12px;
  padding: 14px 16px;
  margin-top: 16px;
  transform: rotate(-0.6deg);
}

.tip p {
  font-family: 'Caveat', cursive;
  font-weight: 600;
  font-size: 1.2rem;
  color: #FBF7FF;
  line-height: 1.3;
}

.sheet-footer-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 36px;
  padding-top: 20px;
  border-top: 1px solid rgba(90, 23, 224, 0.14);
  flex-wrap: wrap;
  gap: 8px;
}

.sheet-footer-inline .logo-big {
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: 1.6rem;
  color: var(--purple);
}

.sheet-footer-inline .tagline {
  font-family: 'Caveat', cursive;
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--ink);
}

/* ---------- Reading text with a portrait next to the intro line ---------- */
.avatar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.avatar-circle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid var(--lime);
}

/* ---------- Info card (grammar explainer box) ---------- */
.card {
  background: var(--paper);
  border: 1px solid rgba(90, 23, 224, 0.14);
  border-left: 4px solid var(--lime);
  border-radius: 10px;
  padding: 12px 16px;
  margin-top: 10px;
}

.card h4 {
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  font-size: 0.96rem;
  color: var(--ink);
  margin-bottom: 4px;
}

/* ---------- Steckbrief (short profile fill-in grid) ---------- */
.steckbrief-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 20px;
  margin-top: 10px;
  background: var(--paper);
  border: 1px solid rgba(90, 23, 224, 0.14);
  border-radius: 12px;
  padding: 16px 18px;
}

.sb-field .sb-label {
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  font-size: 0.84rem;
  color: var(--purple);
  margin-bottom: 4px;
}

/* ---------- Highlighted takeaway box ---------- */
.dash-box {
  border: 2px dashed var(--purple);
  background: var(--purple-10);
  border-radius: 10px;
  padding: 12px 16px;
  margin-top: 16px;
  font-size: 0.94rem;
  line-height: 1.5;
}

/* ---------- Recurring character card (Alba) with portrait ---------- */
.alba-card {
  background: var(--paper);
  border: 1px solid rgba(90, 23, 224, 0.14);
  border-radius: 12px;
  padding: 18px 22px;
}

.alba-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 10px;
}

.alba-head img {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: 2px solid var(--lime);
  object-fit: cover;
  flex-shrink: 0;
}

.alba-head .who {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--purple);
}

.alba-card p {
  font-size: 0.98rem;
  line-height: 1.6;
  margin-bottom: 10px;
}

/* Dativ highlight inside running text (green, bold) */
.dat {
  color: #2E9E4F;
  font-weight: 700;
}

/* ---------- Question + answer line ---------- */
.q-item {
  margin-top: 10px;
}

.q-item .q {
  display: block;
  font-size: 0.96rem;
  color: var(--ink);
}

/* ---------- Group switcher (answers kept separately per pair/group) ---------- */
.group-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  flex: 1 1 100%;
  font-size: 0.86rem;
  color: #655c7c;
}

.group-bar button {
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  font-size: 0.86rem;
  border: 0;
  border-radius: 999px;
  padding: 7px 14px;
  cursor: pointer;
  background: var(--purple-10);
  color: var(--purple-deep);
}

.group-bar button.active {
  background: var(--lime);
  color: var(--ink);
}

.group-bar button:focus-visible {
  outline: 3px solid var(--purple);
  outline-offset: 2px;
}

/* ---------- Picture vocab grid (icon + word-with-article field) ---------- */
.pic-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 10px;
}

.pic {
  background: var(--paper);
  border: 1px solid rgba(90, 23, 224, 0.14);
  border-radius: 12px;
  padding: 12px 14px 10px;
  text-align: center;
}

.pic svg {
  width: 56px;
  height: 56px;
  display: block;
  margin: 0 auto 8px;
}

.pic .write-input,
.pic .write-textarea {
  text-align: left;
}

/* ---------- Multiple-choice icon grid (check-in question) ---------- */
.choice-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 10px;
}

.choice {
  background: var(--paper);
  border: 1px solid rgba(90, 23, 224, 0.14);
  border-radius: 12px;
  padding: 10px 6px;
  text-align: center;
}

.choice .letter {
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--purple);
}

.choice svg {
  width: 36px;
  height: 36px;
  display: block;
  margin: 4px auto;
}

.choice .lab {
  font-size: 0.82rem;
}

/* ---------- Numbered write-line (recipe steps, dialog turns) ---------- */
.numline {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 8px;
}

.numline .n {
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  color: var(--purple);
  font-size: 0.86rem;
  min-width: 18px;
  flex-shrink: 0;
}

.numline .write-input,
.numline .write-textarea {
  flex: 1;
}

/* ---------- Sub-headings and long blocks ---------- */
.sub-label {
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  font-size: 1rem;
  color: var(--purple-deep);
  margin: 20px 0 8px;
}

.sub-label:first-child {
  margin-top: 0;
}

.block.flow {
  break-inside: auto;
  page-break-inside: auto;
}

.two-col .write-textarea {
  border: 1px solid rgba(90, 23, 224, 0.18);
  border-bottom-style: dotted;
  border-radius: 8px;
  padding: 8px 10px;
  background: var(--paper);
}

/* ---------- Responsive ---------- */
@media (max-width: 700px) {
  .write-grid,
  .two-col,
  .q-grid,
  .steckbrief-grid {
    grid-template-columns: 1fr;
  }

  .pic-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .choice-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .sheet-actions {
    flex-direction: column;
    align-items: stretch;
  }

  /* Wide tables (e.g. the Dativ case table, 5 columns) would otherwise
     push the whole page wider than the viewport; scroll just the table. */
  .grammar-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }
}

@media (max-width: 480px) {
  /* Percentage-positioned timeline bars collide with their labels once the
     track gets this narrow, so fall back to a simple stacked legend. */
  .tl-axis {
    display: none;
  }

  .tl-row {
    flex-direction: column;
    align-items: flex-start;
    margin-top: 14px;
  }

  .tl-lab {
    width: auto;
    margin-bottom: 6px;
  }

  .tl-track {
    position: static;
    width: 100%;
    height: auto;
    min-height: 0;
    background: none;
    border-right: none;
  }

  .tl-bar {
    position: static;
    left: auto !important;
    width: auto !important;
    display: inline-flex;
    height: auto;
    white-space: normal;
    padding: 6px 10px;
  }

  .tl-note {
    margin-left: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sheet-reset {
    transition: none;
  }
}

/* ---------- Print ---------- */
@media print {
  .no-print {
    display: none !important;
  }

  body {
    background: #FBF7FF;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .sheet-wrap {
    padding: 0;
    background: #FBF7FF;
  }

  .sheet {
    max-width: 100%;
    padding: 0 8mm;
  }

  .block {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .write-input,
  .write-textarea {
    border-bottom: 0.4mm dotted #9c94b8;
  }

  .write-input:focus-visible,
  .write-textarea:focus-visible {
    outline: none;
  }

  @page {
    size: A4;
    margin: 14mm 10mm;
  }

  .pb {
    break-before: page;
    page-break-before: always;
  }

  .keep {
    break-inside: avoid;
    page-break-inside: avoid;
  }
}

/* ---------- Scenario cards, comparison table, note title ---------- */
.scen-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-bottom: 14px;
}

.scen {
  background: var(--paper);
  border: 2px solid var(--purple-10);
  border-top: 5px solid var(--terracotta);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  break-inside: avoid;
  page-break-inside: avoid;
}

.scen h4 {
  font-family: 'Fredoka', sans-serif;
  font-size: 1rem;
  color: var(--purple-deep);
  margin-bottom: 6px;
}

.scen p {
  font-size: 0.9rem;
  margin: 3px 0;
}

.vs-table td.k {
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  color: var(--purple-deep);
}

.note-title {
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--purple-deep);
  margin: 18px 0 8px;
}

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

/* Akkusativ highlight (orange) and Mingle card, Alba am Schalter */
.akk { color: #D9661F; font-weight: 700; }
.mingle-card {
  background: var(--purple-10);
  border-radius: var(--radius-md);
  padding: 18px;
  margin: 12px 0;
  text-align: center;
  min-height: 90px;
}
.mingle-small { font-size: 0.9rem; color: #655c7c; margin: 4px 0; }
.mingle-big { font-family: 'Fredoka', sans-serif; font-size: 1.6rem; font-weight: 600; margin: 6px 0; }
.mingle-say { font-size: 1.1rem; font-weight: 600; margin: 6px 0; }
