/* Paper Land app. Same calm colours as the website. */
:root {
  --bg: #FFF8F0; --card: #FFFFFF; --ink: #4A3428; --soft: #6E5242; --line: #F1DFCB;
  --brand: #B8561F; --brand-dark: #8E3F12; --peach: #F6B27A; --peach-soft: #FCEBDC;
  --green-soft: #E4EFDD; --green: #2F5A23; --lilac-soft: #EFE6F8; --lilac: #4B3470;
  --tabs-h: 64px; --top-h: 60px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); }
body { font-family: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif; color: var(--ink); -webkit-tap-highlight-color: transparent; }
h1, h2, h3 { font-family: 'Fredoka', system-ui, sans-serif; font-weight: 600; margin: 0; }
p { margin: 0; }
a { color: var(--brand); }
button { font: inherit; color: inherit; }
img { -webkit-user-drag: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; pointer-events: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }

.app { max-width: 560px; margin: 0 auto; min-height: 100%; position: relative; }

/* top bar */
.top { position: sticky; top: 0; z-index: 10; height: calc(var(--top-h) + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 12px 0;
  display: flex; align-items: center; gap: 8px; background: rgba(255, 248, 240, .94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 20px; margin-inline-start: 4px; }
.brand img { width: 38px; height: 38px; border-radius: 50%; border: 2px solid var(--peach); object-fit: cover; }
.brand b { color: var(--brand); font-weight: 600; }
.top-title { font-size: 19px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 0; background: transparent; display: grid; place-items: center; cursor: pointer; flex: none; }
.lang-btn { margin-inline-start: auto; color: var(--soft); }
.pill-btn { border: 0; background: var(--brand); color: #fff; font-weight: 700; padding: 9px 16px; border-radius: 999px; cursor: pointer; }

/* main view */
.view { padding: 16px 16px calc(var(--tabs-h) + 28px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 22px; outline: none; }
.section { display: flex; flex-direction: column; gap: 12px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.section-head h2 { font-size: 22px; }
.section-head a { font-weight: 700; font-size: 15px; text-decoration: none; }
.muted { color: var(--soft); }

/* bottom tabs */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; height: calc(var(--tabs-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  display: flex; justify-content: center; background: rgba(255, 255, 255, .97); border-top: 1px solid var(--line); }
.tabs a { flex: 1; max-width: 112px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none; color: var(--soft); font-size: 12px; font-weight: 700; }
.tabs svg { width: 25px; height: 25px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linejoin: round; stroke-linecap: round; }
.tabs svg .fill { fill: currentColor; stroke: none; }
.tabs a[aria-current="page"] { color: var(--brand); }
.tabs a[aria-current="page"] svg { fill: var(--peach-soft); }

/* hello card */
.hello { background: var(--peach); border-radius: 28px; padding: 20px; display: flex; gap: 14px; align-items: center; position: relative; overflow: hidden; }
.hello h2 { font-size: 24px; line-height: 1.15; }
.hello p { font-size: 15px; margin-top: 6px; }
.hello img { width: 86px; height: 86px; border-radius: 50%; border: 4px solid var(--bg); object-fit: cover; flex: none; }
.season { background: #5A1219; color: #FFF8F0; border-radius: 24px; padding: 16px 18px; display: flex; align-items: center; gap: 12px; text-decoration: none; }
.season b { font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 18px; display: block; }
.season span { font-size: 14px; color: #F3DCD4; }
.season .chev { margin-left: auto; font-size: 22px; }

/* continue */
.continue { display: flex; gap: 12px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 10px; text-decoration: none; color: var(--ink); }
.continue img { width: 92px; height: 70px; border-radius: 14px; object-fit: cover; flex: none; }
.continue b { display: block; font-size: 16px; }
.continue span { font-size: 14px; color: var(--soft); }
.bar { height: 6px; border-radius: 99px; background: var(--peach-soft); margin-top: 8px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--brand); border-radius: 99px; }

/* chips */
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line); background: var(--card); color: var(--ink); font-weight: 700; font-size: 14px; padding: 9px 14px; border-radius: 999px; cursor: pointer; text-decoration: none; }
.chip[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: #fff; }

/* model cards */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.mcard { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 22px; overflow: hidden; text-decoration: none; color: var(--ink); display: flex; flex-direction: column; }
.mcard .pic { aspect-ratio: 4 / 3; background: var(--peach-soft); }
.mcard .pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mcard .body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 6px; }
.mcard h3 { font-size: 16px; line-height: 1.2; }
.tags { display: flex; flex-wrap: wrap; gap: 5px; }
.tag { font-size: 11.5px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--green-soft); color: var(--green); }
.tag.short { background: var(--peach-soft); color: var(--brand-dark); }
.tag.steps { background: var(--lilac-soft); color: var(--lilac); }

/* heart */
.heart { width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .92); display: grid; place-items: center; cursor: pointer; box-shadow: 0 1px 4px rgba(74, 52, 40, .18); }
.heart svg { width: 22px; height: 22px; fill: none; stroke: var(--brand); stroke-width: 2; }
.heart[aria-pressed="true"] svg { fill: var(--brand); }
.mcard .heart { position: absolute; top: 8px; inset-inline-end: 8px; }

/* video rows */
.vlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.vrow { display: flex; gap: 12px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 8px; }
.vrow a.v { display: flex; gap: 12px; align-items: center; flex: 1; min-width: 0; text-decoration: none; color: var(--ink); }
.vrow .thumb { width: 116px; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: var(--peach-soft); flex: none; }
.vrow .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vrow b { font-size: 14.5px; line-height: 1.3; display: block; }
.vrow .heart { width: 36px; height: 36px; box-shadow: none; background: transparent; flex: none; }

.search { width: 100%; font: inherit; font-size: 17px; padding: 13px 18px; border-radius: 999px; border: 2px solid var(--line); background: var(--card); color: var(--ink); }
.search:focus { border-color: var(--peach); outline: none; }

/* step viewer */
.model-head { display: flex; flex-direction: column; gap: 8px; }
.model-head h2 { font-size: 26px; line-height: 1.15; }
.stepper { background: var(--card); border: 1px solid var(--line); border-radius: 26px; padding: 12px; display: flex; flex-direction: column; gap: 12px; }
.progress { display: flex; gap: 4px; }
.progress i { flex: 1; height: 5px; border-radius: 99px; background: var(--peach-soft); }
.progress i.on { background: var(--brand); }
.frame { position: relative; border-radius: 18px; overflow: hidden; background: var(--bg); touch-action: pan-y; }
.frame img { width: 100%; height: 100%; object-fit: cover; display: block; transition: opacity .18s; }
.frame .num { position: absolute; top: 10px; inset-inline-start: 10px; background: var(--brand); color: #fff; font-weight: 700; font-size: 14px; padding: 5px 11px; border-radius: 999px; }
.frame .heart { position: absolute; top: 8px; inset-inline-end: 8px; }
.step-text { font-size: 18.5px; line-height: 1.45; font-weight: 600; min-height: 80px; padding: 0 4px; }
.step-nav { display: flex; gap: 10px; }
.btn { border: 0; border-radius: 999px; padding: 15px 18px; font-weight: 700; font-size: 16.5px; cursor: pointer; text-decoration: none; text-align: center; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn.primary { background: var(--brand); color: #fff; }
.btn.ghost { background: var(--card); color: var(--ink); border: 2px solid var(--line); }
.btn.soft { background: var(--peach-soft); color: var(--ink); }
.btn:disabled { opacity: .4; cursor: default; }
.step-nav .btn.ghost { flex: 1; } .step-nav .btn.primary { flex: 2; }
.hint { font-size: 13.5px; text-align: center; color: var(--soft); }
.done { text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: center; padding: 8px 4px 4px; }
.done h3 { font-size: 22px; }

/* printables */
.pcard { display: flex; gap: 14px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 14px; }
.pcard img { width: 96px; height: 96px; border-radius: 12px; object-fit: cover; border: 1px solid var(--line); flex: none; background: #fff; }
.pcard h3 { font-size: 17px; }
.pcard p { font-size: 14px; color: var(--soft); margin: 4px 0 10px; }
.pcard .row { display: flex; gap: 8px; flex-wrap: wrap; }
.pcard .btn { padding: 10px 14px; font-size: 14.5px; }

.empty { text-align: center; padding: 30px 10px; display: flex; flex-direction: column; gap: 10px; align-items: center; color: var(--soft); }
.empty img { width: 110px; height: 110px; border-radius: 50%; border: 4px solid var(--peach); object-fit: cover; }
.links { display: flex; flex-wrap: wrap; gap: 8px; }
.foot { font-size: 13px; color: var(--soft); text-align: center; line-height: 1.6; }

.toast { position: fixed; left: 50%; bottom: calc(var(--tabs-h) + 18px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 20;
  background: var(--ink); color: #FFF8F0; font-weight: 700; padding: 11px 18px; border-radius: 999px; font-size: 14.5px; box-shadow: 0 4px 16px rgba(0, 0, 0, .2); max-width: 90vw; text-align: center; }

@media (min-width: 600px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (prefers-reduced-motion: reduce) { .frame img { transition: none; } }

/* language picker */
.lang-sheet { position: fixed; inset: 0; z-index: 30; background: rgba(74, 52, 40, .45); display: flex; align-items: center; justify-content: center; padding: 20px; }
.lang-card { background: var(--bg); border-radius: 30px; padding: 26px 22px 22px; width: 100%; max-width: 400px; max-height: 92vh; overflow: auto; display: flex; flex-direction: column; gap: 14px; text-align: center; align-items: center; box-shadow: 0 10px 40px rgba(0, 0, 0, .25); }
.lang-card img { width: 96px; height: 96px; border-radius: 50%; border: 4px solid var(--peach); object-fit: cover; }
.lang-card h2 { font-size: 20px; line-height: 1.35; }
.lang-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; }
.lang-opt { border: 2px solid var(--line); background: var(--card); border-radius: 18px; padding: 15px 10px; font-weight: 700; font-size: 17px; cursor: pointer; }
.lang-opt[aria-current="true"] { border-color: var(--brand); background: var(--peach-soft); }
.lang-card [data-close] { padding: 8px 18px; font-size: 20px; }
html[lang="fa"] body, html[lang="hi"] body { font-family: system-ui, -apple-system, 'Segoe UI', 'Noto Sans', sans-serif; }
html[lang="fa"] h1, html[lang="fa"] h2, html[lang="fa"] h3, html[lang="hi"] h1, html[lang="hi"] h2, html[lang="hi"] h3 { font-family: system-ui, -apple-system, 'Segoe UI', 'Noto Sans', sans-serif; font-weight: 700; }

.kinds { display: flex; gap: 6px; background: var(--peach-soft); padding: 4px; border-radius: 14px; }
.kind { flex: 1; border: 0; background: transparent; border-radius: 11px; padding: 9px 6px; font-weight: 700; font-size: 14px; cursor: pointer; color: var(--soft); }
.kind[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 4px rgba(74, 52, 40, .15); }
