@import url('https://fonts.googleapis.com/css2?family=Noto+Nastaliq+Urdu:wght@400;600&display=swap');

/* ---------- Controls (site dark theme) ---------- */
.ws-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.ws-panel h2.ws-step { display: flex; align-items: center; gap: 12px; font-size: 1.15rem; margin: 0 0 14px; }
.ws-panel h2.ws-step:not(:first-child) { margin-top: 28px; }
.ws-step span { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff; font-size: .9rem; font-weight: 700; flex: none; }
.ws-panel textarea, .ws-panel select, .ws-panel input[type="number"], .ws-panel input[type="text"] {
    width: 100%; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line);
    background: rgba(255, 255, 255, .06); color: var(--text); font: inherit; font-size: .95rem;
}
.ws-panel textarea { font-size: 1.6rem; line-height: 1.4; resize: vertical; min-height: 96px; font-family: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', 'Inter', sans-serif; }
.ws-panel select option { color: #111; }
.ws-panel input[type="color"] { width: 100%; height: 44px; padding: 3px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 255, 255, .06); cursor: pointer; }
.ws-panel textarea:focus, .ws-panel select:focus, .ws-panel input:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.ws-meta-row { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin: 8px 2px 0; font-size: .85rem; color: var(--muted); }
.ws-samples { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0 0; font-size: .85rem; color: var(--muted); }
.ws-samples button, .ws-preview-btns button, .ws-btn-ghost {
    padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255, 255, 255, .06);
    color: var(--text); font: inherit; font-size: .88rem; cursor: pointer;
}
.ws-samples button:hover, .ws-preview-btns button:hover, .ws-btn-ghost:hover { border-color: var(--gold); }
.ws-notice { margin: 12px 0 0; padding: 10px 14px; border-radius: 12px; background: rgba(246, 183, 60, .12); color: var(--gold); font-size: .88rem; }
.ws-help { color: var(--muted); font-size: .88rem; line-height: 1.6; margin: 0 0 12px; }
.ws-chars { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.ws-char { position: relative; padding: 10px 8px 8px; border: 1px solid var(--line); border-radius: 16px; background: rgba(255, 255, 255, .04); text-align: center; cursor: pointer; }
.ws-char.active { border-color: var(--gold); background: rgba(246, 183, 60, .1); }
.ws-char.missing { opacity: .6; border-style: dashed; }
.ws-char b { display: block; font-size: 2rem; font-weight: 500; line-height: 1.2; font-family: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif; }
.ws-char input { width: 100%; margin-top: 4px; padding: 5px 6px !important; border-radius: 8px !important; text-align: center; font-size: .85rem !important; }
.ws-char small { display: block; margin-top: 4px; color: var(--muted); font-size: .72rem; }
.ws-char .ws-x { position: absolute; top: 4px; right: 6px; background: none; border: 0; color: var(--muted); cursor: pointer; font-size: .9rem; padding: 2px 4px; }
.ws-preview { display: flex; gap: 18px; align-items: center; margin-top: 16px; padding: 16px; border-radius: 18px; border: 1px solid var(--line); background: rgba(255, 255, 255, .03); }
.ws-preview[hidden] { display: none; }
.ws-writer { width: 160px; height: 160px; flex: none; background: #fff; border-radius: 12px; }
.ws-writer svg { display: block; }
.ws-preview-side { display: grid; gap: 6px; }
.ws-preview-side strong { font-size: 1.2rem; }
.ws-preview-side small { color: var(--muted); }
.ws-preview-btns { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0; }
.ws-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.ws-options-one { grid-template-columns: 1fr; margin-top: 14px; }
.ws-options label { display: grid; gap: 6px; font-size: .82rem; color: var(--muted); }
.ws-checks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; margin-top: 16px; }
.ws-check { display: flex !important; grid-template-columns: none; align-items: center; gap: 8px; font-size: .88rem; color: var(--text); cursor: pointer; }
.ws-check input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.ws-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 24px 0 12px; }
.ws-btn-primary { padding: 14px 26px; border: 0; border-radius: 999px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; font: inherit; font-weight: 700; cursor: pointer; box-shadow: 0 10px 26px rgba(239, 35, 60, .35); }
.ws-btn-primary:hover { filter: brightness(1.08); }
.ws-btn-ghost { padding: 13px 20px; }
.ws-stage-head { padding: 0 6px; }
.ws-stage-head h2 { margin: 8px 0 0; font-size: 1.4rem; }
.ws-stage-head small { color: var(--muted); font-size: .85rem; font-weight: 400; margin-left: 8px; }
.ws-about p { color: var(--muted); line-height: 1.8; }
.ws-about strong { color: var(--text); }
.ws-credit { font-size: .8rem; }
.ws-credit a { color: var(--gold); }

/* ---------- Paper preview ---------- */
.ws-stage { padding: 14px 18px 30px; overflow: hidden; }
.ws-pages { display: flex; flex-direction: column; align-items: center; gap: 22px; transform-origin: top center; }
.ws-page {
    --ws-grid: #3a9d6e; --ws-char: #1f2933;
    position: relative; flex: none; background: #fff; color: #1f2933; box-shadow: 0 18px 50px rgba(0, 0, 0, .45);
    display: flex; flex-direction: column; overflow: hidden;
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.ws-head { display: flex; align-items: flex-end; gap: 6mm; height: 11mm; font-size: 3.6mm; font-family: 'Inter', sans-serif; flex: none; }
.ws-head .ws-title { font-weight: 700; font-size: 4.6mm; flex: 1 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-head .ws-fill { flex: 0 0 38mm; border-bottom: .25mm solid #444; padding-bottom: .6mm; color: #444; }
.ws-body { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; }
.ws-foot { flex: none; height: 5mm; font-size: 2.6mm; color: #8a94a0; display: flex; justify-content: space-between; align-items: flex-end; font-family: 'Inter', sans-serif; }
.ws-block { display: flex; flex: none; }
.ws-label { flex: none; padding-right: 2mm; display: flex; flex-direction: column; justify-content: center; overflow: hidden; font-family: 'Inter', sans-serif; line-height: 1.2; }
.ws-label .l-py { font-size: 5.6mm; font-weight: 700; color: var(--ws-char); }
.ws-label .l-ur { font-family: 'Noto Nastaliq Urdu', serif; font-size: 3.6mm; line-height: 1.9; color: #3a4552; direction: rtl; text-align: left; }
.ws-label .l-en { font-size: 2.8mm; color: #3a4552; margin-top: .6mm; word-break: break-word; }
.ws-label .l-st { font-size: 2.6mm; color: #7b8794; margin-top: .6mm; }
.ws-cells { display: grid; flex: none; }
.ws-cell { display: block; color: var(--ws-grid); }

@media (max-width: 900px) {
    .ws-layout { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
    .ws-options, .ws-checks { grid-template-columns: 1fr; }
    .ws-preview { flex-direction: column; text-align: center; }
}

/* ---------- Print: only the sheets ---------- */
@media print {
    html, body { background: #fff !important; }
    body.page-worksheet .site-header,
    body.page-worksheet .site-footer,
    body.page-worksheet .ws-ui,
    body.page-worksheet .header-cta { display: none !important; }
    body.page-worksheet .page-shell { padding: 0 !important; margin: 0 !important; max-width: none !important; }
    .ws-stage { padding: 0; overflow: visible; }
    .ws-pages { transform: none !important; zoom: 1 !important; display: block; gap: 0; }
    .ws-page { box-shadow: none; margin: 0; break-after: page; page-break-after: always; }
    .ws-page:last-child { break-after: auto; page-break-after: auto; }
}

/* hero pills (same look as the pinyin page) */
.page-worksheet .pinyin-hero-pills { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }
.page-worksheet .pinyin-hero-pill { display: inline-flex; align-items: center; min-height: 46px; padding: 0 18px; border: 1px solid rgba(255, 255, 255, .12); border-radius: 14px; background: rgba(255, 255, 255, .02); color: #f4f4f4; font-weight: 500; }

/* single-row blocks: tighter label */
.ws-label.compact .l-py { font-size: 4.4mm; }
.ws-label.compact .l-ur { font-size: 3mm; line-height: 1.5; }
.ws-label.compact .l-en { font-size: 2.4mm; margin-top: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* branded header on every sheet */
.ws-head { height: 15mm; box-sizing: content-box; gap: 4mm; align-items: center; border-bottom: .3mm solid var(--ws-grid); margin-bottom: 2mm; padding-bottom: 1mm; }
.ws-logo { width: 11mm; height: 11mm; object-fit: contain; flex: none; border-radius: 2mm; }
.ws-brand { flex: 1 1 auto; display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.ws-brand strong { font-family: 'Montserrat', 'Inter', sans-serif; font-size: 4.8mm; color: #1f2933; white-space: nowrap; }
.ws-brand span { font-size: 3.2mm; color: #5b6673; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-head .ws-fill { align-self: flex-end; }

/* centred watermark logo (15% opacity), sits behind the writing grid */
.ws-watermark { position: absolute; left: 50%; top: 50%; width: 62%; max-height: 62%; object-fit: contain; transform: translate(-50%, -50%); opacity: .055; pointer-events: none; user-select: none; z-index: 0; }
.ws-head, .ws-body, .ws-foot { position: relative; z-index: 1; }

/* wide logo artwork: drop its off-white box so only the artwork shows */
.ws-logo { width: auto; height: 12mm; border-radius: 0; mix-blend-mode: multiply; }
.ws-watermark { width: 80%; max-height: 70%; mix-blend-mode: multiply; }
.ws-logo, .ws-watermark { filter: brightness(1.05); } /* lifts the logo's off-white box to pure white so no edge shows */
