/* Kreska web: ten sam system „manga pop” co w aplikacji na iPada (Kreska/Theme/Theme.swift). */
:root {
  --bg: #EFEEF5; --surface: #fff; --paper: #FFFFFE;
  --ink: #15141A; --ink-soft: #4E4C5A; --ink-faint: #85838F;
  --blue: #2C86D1; --blue-light: #A9D2F2; --highlight: #FFD93D; --pop: #FF3E8A;
  --eraser: #E5566C; --success: #1FA774; --graphite: #2A2930; --line: #DAD8E3;
  --display: "Futura-CondensedExtraBold", "Futura Condensed ExtraBold", "Avenir Next Condensed", "Arial Narrow", "Roboto Condensed", sans-serif;
  --body: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --r-card: 14px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 18px/1.45 var(--body); -webkit-text-size-adjust: 100%; }
body { min-height: 100dvh; background:
  radial-gradient(circle, rgba(255,62,138,.22) 2.6px, transparent 3px) 0 0 / 14px 14px fixed, var(--bg);
  background-attachment: fixed; }
body::before { content: ""; position: fixed; inset: 0; background: linear-gradient(135deg, transparent 0 30%, var(--bg) 46%); pointer-events: none; z-index: -1; }
#app { max-width: 1180px; margin: 0 auto; padding: max(12px, env(safe-area-inset-top)) 24px calc(32px + env(safe-area-inset-bottom)); }
.boot { font-family: var(--display); font-size: 28px; padding: 40px 0; }
h1, h2, h3, .display { font-family: var(--display); font-weight: 800; font-stretch: condensed; letter-spacing: .2px; margin: 0; line-height: 1.02; }
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Kadr: biały panel, gruba ramka, twardy cień */
.panel { background: var(--surface); border: 3px solid var(--ink); border-radius: var(--r-card); box-shadow: 5px 5px 0 var(--ink); }
.btn { display: inline-flex; align-items: center; gap: 10px; min-height: 56px; padding: 0 24px; border: 3px solid var(--ink); border-radius: 14px;
  background: var(--highlight); font-family: var(--display); font-size: 24px; box-shadow: 4px 4px 0 var(--ink); transition: transform .14s cubic-bezier(.23,1,.32,1), box-shadow .14s cubic-bezier(.23,1,.32,1); }
.btn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.btn.secondary { background: var(--surface); }
.btn.success { background: var(--success); color: #fff; }
.btn[disabled] { background: var(--line); opacity: .7; cursor: default; }
.icon-btn { width: 56px; height: 56px; border-radius: 50%; border: 2.5px solid var(--ink); background: var(--surface); display: grid; place-items: center; font-size: 22px; flex: none; }
.icon-btn[aria-pressed="true"] { background: var(--ink); color: #fff; }
.icon-btn svg { width: 24px; height: 24px; }

/* Nagłówek */
.top { display: flex; align-items: center; gap: 16px; padding: 8px 0 20px; }
.logo { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.logo img { width: 44px; height: 44px; border-radius: 11px; }
.logo span { font-family: var(--display); font-size: 36px; background: linear-gradient(var(--pop), var(--pop)) 0 100% / 100% 5px no-repeat; padding-bottom: 2px; }
.tabs { margin: 0 auto; display: flex; padding: 4px; border: 2.5px solid var(--ink); border-radius: 999px; background: var(--surface); }
.tabs button { border: 0; background: none; font-family: var(--display); font-size: 22px; padding: 8px 22px; border-radius: 999px; }
.tabs button[aria-selected="true"] { background: var(--ink); color: #fff; }

/* Kadr powitalny */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 24px; align-items: center; padding: 32px; position: relative; overflow: hidden; border-radius: 18px; box-shadow: 7px 7px 0 var(--ink); }
.hero::after { content: ""; position: absolute; right: 0; bottom: 0; width: 420px; height: 300px; pointer-events: none;
  background: radial-gradient(circle, var(--accent-35) 3.2px, transparent 3.6px) 0 0 / 12px 12px;
  mask: linear-gradient(315deg, #000 10%, transparent 70%); -webkit-mask: linear-gradient(315deg, #000 10%, transparent 70%); }
.hero h1 { font-size: clamp(44px, 7vw, 72px); }
.tag { display: inline-flex; gap: 8px; align-items: center; background: var(--ink); color: #fff; font-weight: 700; font-size: 15px; padding: 7px 12px; transform: rotate(-1.5deg); margin: 14px 0 10px; }
.tag i { width: 10px; height: 10px; background: var(--accent); transform: rotate(45deg); }
.hero h2 { font-size: 40px; }
.hero p { color: var(--ink-soft); margin: 8px 0 18px; }
.stat { margin-top: 18px; display: flex; gap: 8px; align-items: baseline; color: var(--ink-soft); font-size: 15px; }
.stat b { font-family: var(--display); font-size: 26px; color: var(--ink); background: linear-gradient(var(--highlight), var(--highlight)) 0 80% / 100% 11px no-repeat; padding: 0 6px; }
.stage { position: relative; aspect-ratio: 4 / 3; display: grid; place-items: center; cursor: pointer; }
.speed { position: absolute; inset: -20px; color: var(--accent-55); }
.sheet { position: relative; width: 84%; aspect-ratio: 4/3; background: var(--paper); border-radius: 4px; box-shadow: 4px 5px 0 var(--ink); transform: rotate(-2deg); padding: 4%; }
.sheet svg { width: 100%; height: 100%; display: block; }
.tape { position: absolute; top: -13px; left: 50%; width: 110px; height: 26px; margin-left: -55px; background: rgba(237,227,200,.88); transform: rotate(-3deg); box-shadow: 0 1px 1px rgba(0,0,0,.06); }

/* Animowany szkic */
.an-c, .an-l { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw .7s cubic-bezier(.77,0,.175,1) forwards; }
.an-c { animation-delay: calc(.2s + var(--i) * (1s / var(--n))); }
.an-l { animation-delay: calc(1.1s + var(--i) * (1.7s / var(--n))); }
.an-shade, .an-dot { opacity: 0; animation: fade .6s ease-out 2.8s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fade { to { opacity: 1; } }

/* Okładki kursów */
.covers { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin: 40px 0 8px; padding-top: 8px; }
.cover { padding: 0; border: 2.5px solid var(--ink); border-radius: 12px; background: var(--surface); box-shadow: 3px 3px 0 var(--ink); overflow: hidden; text-align: left; transition: transform .22s cubic-bezier(.23,1,.32,1), box-shadow .22s cubic-bezier(.23,1,.32,1); }
.cover[aria-pressed="true"] { transform: translateY(-8px); border-width: 3.5px; box-shadow: 7px 7px 0 var(--ink); }
.cover .art { height: 130px; padding: 12px; display: block; overflow: hidden; background:
  radial-gradient(circle, rgba(255,255,255,.35) 2.5px, transparent 3px) 0 0 / 9px 9px, var(--c); }
.cover .art div { width: 100%; height: 100%; background: var(--paper); border: 2px solid var(--ink); padding: 8px; transition: transform .22s; }
.cover[aria-pressed="true"] .art div { transform: rotate(-3deg); }
.cover .art div { overflow: hidden; }
.cover .art svg { display: block; width: 100%; height: 100%; }
.cover .name { position: relative; z-index: 1; padding: 8px 12px; border-top: 2.5px solid var(--ink); }
.cover[aria-pressed="true"] .name { background: var(--highlight); }
.cover .name b { font-family: var(--display); font-size: 24px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cover .name small { color: var(--ink-soft); font-size: 14px; }

/* Kurs i poziomy */
.course-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin: 40px 0 8px; }
.course-head h2 { font-size: 52px; background: linear-gradient(var(--accent-45), var(--accent-45)) 0 82% / 100% 16px no-repeat; padding: 0 6px; display: inline-block; }
.course-head p { color: var(--ink-soft); margin: 6px 0 0; }
.course-head .count { font-family: var(--display); font-size: 28px; }
.level { margin-top: 32px; }
.level-head { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.grade { width: 58px; height: 42px; display: grid; place-items: center; color: #fff; font-family: var(--display); font-size: 22px; flex: none;
  background: var(--tone); clip-path: polygon(20% 0, 80% 0, 100% 50%, 80% 100%, 20% 100%, 0 50%); filter: drop-shadow(3px 3px 0 var(--ink)); }
.level-head h3 { font-size: 27px; }
.level-head p { margin: 0; font-size: 15px; color: var(--ink-soft); }
.level-head.locked h3 { color: var(--ink-faint); }
.meter { margin-left: auto; display: flex; gap: 5px; }
.meter i { width: 22px; height: 14px; border: 2px solid var(--ink); border-radius: 3px; background: var(--surface); }
.meter i.on { background: var(--accent); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 24px; }
.card { padding: 0; border: 2.5px solid var(--ink); border-radius: 12px; background: var(--surface); box-shadow: 4px 4px 0 var(--ink); overflow: hidden; text-align: left; display: flex; flex-direction: column; transition: transform .14s cubic-bezier(.23,1,.32,1); }
.card:active { transform: scale(.97); }
.card .art { position: relative; aspect-ratio: 4/3; padding: 16px; background: var(--paper); border-bottom: 2.5px solid var(--ink); }
.card .art svg { width: 100%; height: 100%; }
.card .num { position: absolute; top: 0; left: 0; min-width: 38px; height: 34px; display: grid; place-items: center; background: var(--ink); color: #fff; font-family: var(--display); font-size: 22px; }
.card .lock { position: absolute; top: 8px; right: 8px; width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--ink); background: var(--surface); display: grid; place-items: center; font-size: 15px; }
.card .done { position: absolute; top: 8px; right: 8px; background: var(--highlight); border: 2px solid var(--ink); border-radius: 999px; padding: 3px 10px; font-weight: 800; font-size: 13px; }
.card .txt { padding: 10px 12px 12px; }
.card .txt b { font-family: var(--display); font-size: 22px; display: block; line-height: 1.05; }
.card .txt small { color: var(--ink-soft); font-size: 14px; }
.card.locked { box-shadow: 2px 2px 0 var(--ink); }
.card.locked .art { background: radial-gradient(circle, rgba(21,20,26,.12) 1.6px, transparent 2px) 0 0 / 8px 8px, var(--paper); }
.card.locked .num { background: var(--ink-faint); }
.card.locked .txt b { color: var(--ink-faint); }
.card.isdone .txt { background: var(--accent-18); }
.card.nudge { animation: nudge .26s cubic-bezier(.23,1,.32,1); }
@keyframes nudge { 40% { transform: translateX(6px); } }

/* Lekcja */
.lesson { min-height: 100dvh; display: flex; flex-direction: column; gap: 16px; }
.lesson-top { display: flex; align-items: center; gap: 16px; }
.lesson-top .t { flex: 1; min-width: 0; }
.lesson-top h2 { font-size: 30px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lesson-top small { color: var(--ink-soft); }
.steps { display: flex; gap: 4px; margin-top: 6px; }
.steps i { flex: 1; height: 7px; border-radius: 3px; background: var(--line); }
.steps i.on { background: var(--ink); }
.steps i.now { background: var(--pop); }
.work { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.board { position: relative; width: 100%; aspect-ratio: 4/3; background: var(--paper); border: 3px solid var(--ink); border-radius: 6px; box-shadow: 5px 5px 0 var(--ink); touch-action: none; overflow: hidden; }
.board svg, .board canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.guide-line { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.1s cubic-bezier(.77,0,.175,1) .15s forwards; }
.guide-start { animation: pulse 1.2s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: center; }
@keyframes pulse { to { transform: scale(1.5); opacity: .5; } }
.side { display: flex; flex-direction: column; gap: 14px; }
.stepcard { padding: 18px; }
.stepcard .kind { display: inline-block; font-size: 13px; font-weight: 800; padding: 3px 9px; border-radius: 999px; border: 2px solid var(--ink); margin-bottom: 8px; }
.stepcard .kind.c { background: var(--blue-light); }
.stepcard .kind.s { background: var(--highlight); }
.stepcard h3 { font-size: 27px; margin-bottom: 8px; }
.stepcard p { margin: 0; color: var(--ink-soft); font-size: 16px; }
.verdict { min-height: 44px; display: flex; align-items: center; gap: 8px; font-weight: 800; padding: 8px 14px; border-radius: 12px; border: 2.5px solid var(--ink); background: var(--surface); }
.verdict.great { background: var(--success); color: #fff; }
.verdict.offTrack { background: var(--eraser); color: #fff; }
.tools { display: flex; flex-wrap: wrap; gap: 8px; }
.tools { flex-wrap: nowrap; gap: 6px; }
.tools .icon-btn { width: 44px; height: 44px; font-size: 19px; }
.tools .icon-btn svg { width: 21px; height: 21px; }
.sizes { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.size { width: 44px; height: 44px; border-radius: 12px; border: 2.5px solid var(--ink); background: var(--surface); display: grid; place-items: center; }
.size i { width: var(--d); height: var(--d); border-radius: 50%; background: var(--ink); }
.size[aria-pressed="true"] { background: var(--highlight); box-shadow: 3px 3px 0 var(--ink); }
.thick { flex: 1 1 100%; display: flex; align-items: center; gap: 12px; }
.thick input { flex: 1; height: 36px; accent-color: var(--ink); }
.thick .dot { width: 40px; height: 36px; flex: none; display: grid; place-items: center; }
.thick .dot::after { content: ""; width: var(--d); height: var(--d); border-radius: 50%; background: var(--ink); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.peek { position: relative; display: block; width: 100%; padding: 6px; text-align: left; background: var(--paper); aspect-ratio: 4/3; max-height: 112px; transition: max-height .22s cubic-bezier(.23,1,.32,1); }
.peek.big { max-height: 300px; }
.peek small { position: absolute; left: 10px; top: 6px; font-size: 12px; font-weight: 800; color: var(--ink-soft); }
.peek svg { width: 100%; height: 100%; }
.palette { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; justify-items: center; }
.swatch { width: 34px; height: 34px; border-radius: 50%; border: 2.5px solid var(--ink); background: var(--c); }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--surface), 0 0 0 6px var(--ink); }
.sizes .hint { flex: 1 1 140px; font-size: 13px; color: var(--ink-soft); line-height: 1.3; }
/* Na czas rysowania: dłoń na ekranie nie zaznacza tekstu, nie przewija i nie powiększa strony. */
html.drawing, html.drawing body { overscroll-behavior: none; }
html.drawing body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
html.drawing .work, html.drawing .lesson-top { touch-action: none; }
html.drawing .scrollable { touch-action: pan-y; overflow-y: auto; max-height: 24vh; }
#cvp { pointer-events: none; } /* warstwa przewidywań tylko rysuje, dotyk idzie do płótna pod spodem */
.board canvas { touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.nav { display: flex; gap: 10px; }
.nav .btn { flex: 1; justify-content: center; }

/* Wybór trybu, wynik, szkicownik, ustawienia */
.center { max-width: 920px; margin: 0 auto; }
.intro { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: center; margin: 24px 0; }
.intro h1 { font-size: 64px; }
.intro p { color: var(--ink-soft); }
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.mode { text-align: left; padding: 22px; display: flex; flex-direction: column; gap: 6px; }
.mode b { font-family: var(--display); font-size: 30px; }
.mode span { color: var(--ink-soft); }
.result { display: grid; grid-template-columns: 1.1fr 1fr; gap: 28px; align-items: center; margin-top: 24px; }
.result img { width: 100%; border: 3px solid var(--ink); background: var(--paper); box-shadow: 5px 5px 0 var(--ink); transform: rotate(-2deg); animation: land .55s cubic-bezier(.34,1.4,.64,1); }
@keyframes land { from { transform: translateY(-40px) rotate(6deg); opacity: 0; } }
.result h1 { font-size: 56px; }
.moods { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.moods button { border: 2.5px solid var(--ink); background: var(--surface); border-radius: 999px; padding: 8px 14px; font-weight: 700; }
.moods button[aria-pressed="true"] { background: var(--highlight); }
.album { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 24px; }
.album figure { margin: 0; padding: 10px; background: var(--paper); border: 2.5px solid var(--ink); box-shadow: 4px 4px 0 var(--ink); }
.album img { width: 100%; aspect-ratio: 4/3; object-fit: contain; display: block; }
.album figcaption { font-family: var(--display); font-size: 20px; margin-top: 6px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.album figcaption button { border: 0; background: none; color: var(--eraser); font-size: 14px; font-family: var(--body); font-weight: 700; }
.empty { text-align: center; padding: 48px 24px; }
.empty h2 { font-size: 40px; margin-bottom: 8px; }
.empty p { color: var(--ink-soft); }
.settings { padding: 28px; display: flex; flex-direction: column; gap: 18px; max-width: 640px; margin: 0 auto; }
.settings label { display: flex; flex-direction: column; gap: 6px; font-weight: 700; }
.settings input[type=text] { font: inherit; padding: 12px 14px; border: 2.5px solid var(--ink); border-radius: 12px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.capture input { display: none; }
.photo { width: 100%; border: 3px solid var(--ink); box-shadow: 5px 5px 0 var(--ink); }
.onboard { min-height: 90dvh; display: grid; place-items: center; text-align: center; }
.onboard h1 { font-size: clamp(52px, 9vw, 96px); margin: 18px 0 10px; }
.onboard input { font: inherit; font-size: 22px; padding: 14px 16px; border: 3px solid var(--ink); border-radius: 14px; width: min(360px, 90vw); text-align: center; margin: 18px 0; }

@media (max-width: 900px) {
  .hero, .intro, .result { grid-template-columns: 1fr; }
  .work { grid-template-columns: 1fr; }
  .covers { grid-template-columns: repeat(5, 150px); overflow-x: auto; padding-bottom: 12px; }
  .modes { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  #app { padding-left: 16px; padding-right: 16px; }
  .tabs button { padding: 8px 12px; font-size: 18px; }
  .logo span { display: none; }
  .course-head h2 { font-size: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition: none !important; }
  .an-c, .an-l, .guide-line { stroke-dashoffset: 0; }
}

.onboard .stage { overflow: hidden; border-radius: 18px; }

/* Wesprzyj Projekt (jak w Funny Bunny) */
.donate-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 18px; border: 2.5px solid var(--ink); border-radius: 999px;
  background: var(--surface); font-weight: 800; font-size: 16px; box-shadow: 3px 3px 0 var(--ink); white-space: nowrap; }
.donate-btn span { color: var(--pop); font-size: 18px; }
.donate-btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.dialog-bg { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(21,20,26,.42); animation: fade .18s ease-out both; }
.dialog { position: relative; width: min(400px, 100%); padding: 26px; animation: pop .22s cubic-bezier(.23,1,.32,1) both; }
@keyframes pop { from { transform: scale(.95); opacity: 0; } }
.dialog h2 { font-size: 32px; margin: 10px 0 8px; }
.dialog p { color: var(--ink-soft); font-size: 16px; margin: 0 0 16px; }
.dialog small { display: block; text-align: center; color: var(--ink-soft); margin-top: 10px; }
.dialog .heart { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 14px; border: 2.5px solid var(--ink); background: var(--pop); color: #fff; font-size: 24px; }
.dialog-x { position: absolute; top: 12px; right: 12px; width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--ink); background: var(--surface); }
.donate-go { width: 100%; justify-content: center; text-decoration: none; color: #fff; background: var(--pop); }
@media (max-width: 760px) { .donate-btn { font-size: 0; gap: 0; width: 48px; padding: 0; justify-content: center; } .donate-btn span { font-size: 20px; } }

/* Strona prywatności */
.legal { max-width: 760px; }
.legal h1 { font-size: clamp(40px, 7vw, 60px); margin: 16px 0 6px; }
.legal h2 { font-size: 36px; margin: 36px 0 8px; }
.legal h3 { font-size: 24px; margin: 22px 0 6px; }
.legal p { margin: 0 0 12px; }
.legal .meta { color: var(--ink-soft); font-size: 15px; }
.legal .summary { padding: 18px 20px; margin: 18px 0; }
.legal a:not(.btn) { color: var(--ink); text-decoration-color: var(--pop); text-decoration-thickness: 2px; }
.legal .btn { text-decoration: none; color: var(--ink); min-height: 44px; font-size: 20px; }

/* Stopka */
.foot { margin-top: 48px; display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; font-size: 14px; color: var(--ink-soft); }
.foot a { color: var(--ink-soft); }

/* Telefon: nagłówek w dwóch rzędach */
@media (max-width: 600px) {
  .top { flex-wrap: wrap; gap: 10px; }
  .top .tabs { order: 3; width: 100%; margin: 0; }
  .top .tabs button { flex: 1; }
  .top .donate-btn { margin-left: auto; }
}
@media (max-width: 900px) {
  .nav { position: sticky; bottom: calc(8px + env(safe-area-inset-bottom)); z-index: 5; padding: 8px; margin: 0 -8px; background: color-mix(in srgb, var(--bg) 88%, transparent); border-radius: 18px; }
}
/* Tryb rysowania na tablecie: wszystko w kolumnie obok arkusza mieści się na ekranie iPada. */
html.drawing .side { gap: 10px; }
html.drawing .lesson { min-height: 0; }
html.drawing #app { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
/* arkusz nigdy nie jest wyższy niż ekran (tablety z Androidem w poziomie mają ~800 px wysokości) */
html.drawing .board { width: min(100%, calc((100dvh - 130px) * 4 / 3)); }
html.drawing .stepcard { padding: 12px 14px; }
html.drawing .stepcard h3 { font-size: 22px; margin-bottom: 4px; }
html.drawing .stepcard p { font-size: 15px; }
html.drawing .verdict { min-height: 40px; padding: 6px 12px; }

/* Podpowiedź instalacji (ekran główny) */
.install { display: flex; align-items: center; gap: 16px; padding: 14px 18px; margin-bottom: 18px; background: var(--highlight); }
.install > div:first-child { flex: 1; }
.install p { margin: 4px 0 0; font-size: 15px; }
.install .ico { width: 18px; height: 18px; vertical-align: -3px; }
.install-btns { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 700px) { .install { flex-direction: column; align-items: stretch; } }

/* Tablet w pionie (iPad pionowo, tablety z Androidem): arkusz i wszystkie narzędzia na jednym ekranie, bez przewijania.
   Arkusz zmniejsza się tak, żeby pod nim zmieściły się: miniatura z opisem kroku, ocena, narzędzia, grubość, kolory i nawigacja. */
@media (max-width: 900px) {
  html.drawing .lesson { min-height: 0; gap: 10px; }
  html.drawing .board { width: min(100%, calc((100dvh - 520px) * 4 / 3)); margin: 0 auto; }
  html.drawing .work { gap: 12px; }
  html.drawing .side { display: grid; grid-template-columns: 128px minmax(0, 1fr); gap: 8px 10px; align-items: stretch; }
  html.drawing .side > :not(.peek):not(.stepcard) { grid-column: 1 / -1; }
  html.drawing .peek { max-height: none; height: 100%; min-height: 96px; aspect-ratio: auto; }
  html.drawing .peek.big { grid-column: 1 / -1; height: 260px; }
  html.drawing .stepcard { max-height: none; }
  html.drawing .stepcard p { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  html.drawing .tools { justify-content: space-between; }
  html.drawing .palette { grid-template-columns: repeat(10, 1fr); }
  html.drawing .swatch { width: 32px; height: 32px; }
  html.drawing .nav { position: static; padding: 0; margin: 0; background: none; }
}
.peek small { background: var(--paper); padding: 0 3px; border-radius: 4px; z-index: 1; }
@media (max-width: 900px) { html.drawing .peek { padding-top: 22px; } }

/* ===== Studio: rysowanie na tablecie, arkusz jak największy ===== */
.studio { position: fixed; inset: 0; z-index: 2; display: flex; flex-direction: column; gap: 8px; background: var(--bg);
  padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); }
.sbar { display: flex; align-items: center; gap: 8px; min-height: 52px; }
.icon-btn.sm { width: 44px; height: 44px; font-size: 18px; }
.peek-mini { flex: none; width: 66px; height: 50px; padding: 2px; background: var(--paper); border: 2px solid var(--ink); border-radius: 8px; }
.peek-mini svg { width: 100%; height: 100%; }
.sinfo { flex: 1; min-width: 0; display: grid; gap: 2px; text-align: left; background: none; border: 0; padding: 0; }
.sinfo small { font-size: 12px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sinfo small b.k { color: var(--ink); background: var(--highlight); padding: 0 5px; border-radius: 4px; }
.sinfo small b.k.c { background: var(--blue-light); }
.sinfo .t { font-family: var(--display); font-size: 21px; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sinfo .steps { display: flex; gap: 3px; margin: 0; }
.sinfo .steps i { height: 4px; }
.studio .verdict { flex: none; max-width: 230px; min-height: 44px; font-size: 14px; line-height: 1.15; padding: 4px 10px; border-radius: 10px; }
.snav { display: flex; gap: 6px; flex: none; }
.snav .btn { padding: 9px 16px; font-size: 18px; }
.sbody { flex: 1; min-height: 0; display: flex; gap: 8px; }
.rail { flex: none; align-self: center; max-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 6px; border-radius: 30px;
  background: var(--surface); border: 2.5px solid var(--ink); overflow: auto; }
.rail .icon-btn { width: 46px; height: 46px; font-size: 19px; border-width: 2px; }
.rail .icon-btn svg { width: 21px; height: 21px; }
.rail .sep { width: 28px; height: 2px; background: var(--line); flex: none; }
.rail .cur { width: 24px; height: 24px; border-radius: 50%; background: var(--c); border: 2px solid var(--ink); }
.rail .dot { width: var(--d); height: var(--d); border-radius: 50%; background: var(--ink); }
.bwrap { flex: 1; min-width: 0; min-height: 0; container-type: size; display: grid; place-items: center; }
html.drawing .studio .board { margin: 0; width: min(100cqw - 6px, (100cqh - 6px) * 4 / 3); aspect-ratio: 4 / 3; box-shadow: 4px 4px 0 var(--ink); }
.under { display: none; }
.pop { position: fixed; z-index: 10; padding: 12px; background: var(--surface); border: 2.5px solid var(--ink); border-radius: 16px; box-shadow: 4px 4px 0 var(--ink); }
.pop[hidden] { display: none; }
.pop .palette { display: grid; grid-template-columns: repeat(5, 40px); gap: 10px; }
.pop .swatch { width: 40px; height: 40px; }
#pop-sz { width: 300px; }
#pop-sz .thick input { height: 44px; }
#pop-sz .hint { margin: 6px 0 0; font-size: 13px; color: var(--ink-soft); }
#pop-info { width: min(420px, calc(100vw - 16px)); }
#pop-info h3 { font-size: 24px; margin: 6px 0; }
#pop-info p { margin: 0; color: var(--ink-soft); }
.pop .kind { display: inline-block; font-size: 13px; font-weight: 800; padding: 3px 9px; border-radius: 999px; border: 2px solid var(--ink); background: var(--highlight); }
.pop .kind.c, .under .kind.c { background: var(--blue-light); }
.pop-peek { width: min(520px, calc(100vw - 16px)); aspect-ratio: 4 / 3; background: var(--paper); }
.pop-peek svg { width: 100%; height: 100%; }
.pop-peek small { position: absolute; left: 12px; top: 8px; font-size: 12px; font-weight: 800; color: var(--ink-soft); }

/* Pionowo: arkusz na całą szerokość u góry, pod nim szyna narzędzi, a w wolnym miejscu miniatura i pełny opis kroku. */
@media (orientation: portrait) {
  .sbar { flex-wrap: wrap; row-gap: 6px; }
  .sinfo { order: 5; flex-basis: 100%; }
  .sbar .verdict { margin-left: auto; }
  .sbody { flex-direction: column; }
  .bwrap { flex: none; width: 100%; container-type: inline-size; order: 1; }
  .rail { order: 2; }
  .under { order: 3; }
  html.drawing .studio .board { width: calc(100cqw - 6px); }
  .rail { flex-direction: row; border-radius: 30px; align-self: center; max-width: 100%; }
  .rail .sep { width: 2px; height: 28px; }
  .under { display: flex; gap: 14px; flex: 1; min-height: 0; overflow: auto; padding: 12px; background: var(--surface); border: 2.5px solid var(--ink); border-radius: 16px; }
  .under .peek-big { flex: none; width: 38%; aspect-ratio: 4 / 3; align-self: flex-start; background: var(--paper); border: 2px solid var(--ink); border-radius: 8px; padding: 4px; }
  .under .peek-big svg { width: 100%; height: 100%; }
  .under h3 { font-size: 22px; margin: 6px 0; }
  .under p { margin: 0; color: var(--ink-soft); font-size: 16px; }
  .under .kind { display: inline-block; font-size: 13px; font-weight: 800; padding: 3px 9px; border-radius: 999px; border: 2px solid var(--ink); background: var(--highlight); }
  .peek-mini { display: none; }
}
/* Mały tablet w pionie: miniatura nad opisem, żeby tekst się mieścił. */
@media (orientation: portrait) and (max-width: 640px) {
  .under { flex-direction: column; }
  .under .peek-big { width: 50%; }
  .snav .btn { padding: 8px 12px; }
}

.foot .brand { display: inline-flex; align-items: center; gap: 6px; }
.foot .brand img { height: 24px; width: auto; }

/* ===== Licznik sesji (20 min, jak w Funny Bunny) ===== */
.sclock { display: flex; align-items: center; gap: 6px; padding: 3px 12px 3px 3px; background: var(--surface); border: 2.5px solid var(--ink); border-radius: 999px; flex: none; }
.sclock svg { width: 38px; height: 38px; transform: rotate(-90deg); }
.sclock circle { fill: none; stroke-width: 6; }
.sclock .bg { stroke: var(--line); }
.sclock .fg { stroke: var(--pop); stroke-linecap: round; transition: stroke-dasharray 1s linear; }
.sclock.low .fg { stroke: #FF8A1C; }
.sclock.pause .fg { stroke: var(--success); }
.sclock span { display: grid; line-height: 1; }
.sclock b { font-family: var(--display); font-size: 20px; font-variant-numeric: tabular-nums; }
.sclock small { font-size: 11px; color: var(--ink-soft); }
.sbar .sclock svg { width: 32px; height: 32px; }
.sbar .sclock b { font-size: 17px; }
@media (max-width: 760px) { .top .sclock small { display: none; } }
.sover { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(21, 20, 26, .5); }
.sover-box { max-width: 440px; padding: 26px; text-align: center; display: grid; gap: 12px; justify-items: center; }
.sover-ico { font-size: 56px; }
.sover-box h2 { font-size: 38px; }
.sover-box p { margin: 0; color: var(--ink-soft); }
.sover-left { padding: 10px 22px; border-radius: 14px; background: var(--highlight); display: grid; }
.sover-left b { font-family: var(--display); font-size: 40px; }

/* ===== Efekt WOW ===== */
.wow { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; overflow: hidden; background: var(--scene);
  background-image: radial-gradient(circle, rgba(255,255,255,.22) 2.5px, transparent 3px); background-size: 16px 16px; }
.wow-rays { position: absolute; inset: -50%; background: repeating-conic-gradient(rgba(255,255,255,.18) 0 6deg, transparent 6deg 18deg); animation: wow-spin 30s linear infinite; }
.wow .deco { position: absolute; left: var(--x); top: var(--y); font-size: 34px; color: #fff; opacity: .7; animation: wow-deco .6s var(--d) cubic-bezier(.23,1,.32,1) backwards; }
.wow-card { position: relative; display: grid; justify-items: center; gap: 12px; }
.wow-sticker { padding: 10px; background: #fff; border: 4px solid var(--ink); border-radius: 22px; box-shadow: 8px 8px 0 var(--ink);
  transform: rotate(-4deg); animation: wow-pop .55s cubic-bezier(.34,1.56,.64,1), wow-float 3s 1s ease-in-out infinite; }
.wow-sticker img { display: block; max-width: min(70vw, 560px); max-height: 52vh; border-radius: 12px; }
.wow-stars { display: flex; gap: 10px; }
.wow-stars span { font-size: 64px; color: rgba(255,255,255,.35); -webkit-text-stroke: 3px var(--ink);
  animation: wow-star .4s calc(.7s + var(--i) * .25s) cubic-bezier(.34,1.56,.64,1) backwards; }
.wow-stars span.on { color: var(--highlight); }
.wow-title { margin: 0; font-family: var(--display); font-size: 56px; color: #fff; -webkit-text-stroke: 2px var(--ink); text-shadow: 4px 4px 0 var(--ink); }
.wow-tap { margin: 0; color: #fff; font-weight: 700; opacity: .9; }
.wow.out { opacity: 0; transition: opacity .2s; }
/* stan końcowy jest domyślny – gdy animacja się nie odtworzy, naklejka i gwiazdki i tak są widoczne */
@keyframes wow-pop { from { transform: rotate(-4deg) scale(.6); opacity: 0; } }
@keyframes wow-float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -10px; } }
@keyframes wow-star { from { transform: scale(.4); opacity: 0; } }
@keyframes wow-deco { from { opacity: 0; transform: scale(.5); } }
@keyframes wow-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .wow-rays, .wow-sticker, .wow-stars span, .wow .deco { animation: none !important; opacity: 1 !important; transform: none !important; }
  .wow .deco { opacity: .7 !important; }
}

/* ===== Wynik lekcji ===== */
.rstars { display: flex; align-items: center; gap: 4px; margin-bottom: 4px; }
.rstars span { font-size: 40px; line-height: 1; color: var(--line); -webkit-text-stroke: 2px var(--ink); }
.rstars span.on { color: var(--highlight); }
.rstars small { margin-left: 10px; color: var(--ink-soft); font-weight: 700; }
.result .tip { padding: 10px 14px; background: var(--highlight); border: 2.5px solid var(--ink); border-radius: 12px; font-weight: 600; }
.row-btns { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.cmp-img { position: relative; }
.cmp-img > img, .cmp-img > .sheet { display: block; width: 100%; }
.cmp-tpl { position: absolute; inset: 0; display: none; background: var(--paper); border-radius: 4px; }
.cmp-tpl svg { width: 100%; height: 100%; }
.cmp[data-view="tpl"] .cmp-tpl { display: block; }
.cmp[data-view="both"] .cmp-tpl { display: block; background: transparent; opacity: .45; mix-blend-mode: multiply; }
.cmp[data-view="both"] .cmp-tpl svg { --graphite: var(--pop); } /* wzór na różowo, rysunek ucznia na szaro */
.cmp-img { transform: rotate(-2deg); }
.cmp-img > img { transform: none; border-width: 3px; }
.cmp-tpl { border: 3px solid transparent; }
.seg { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.seg button { padding: 7px 12px; border: 2.5px solid var(--ink); border-radius: 999px; background: var(--surface); font-weight: 700; }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.newbadges { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0; }
.badge { display: grid; justify-items: center; gap: 4px; padding: 12px; text-align: center; border: 2.5px solid var(--ink); border-radius: 16px; background: var(--surface); opacity: .55; }
.badge.on { opacity: 1; background: var(--highlight); box-shadow: 3px 3px 0 var(--ink); }
.badge i { font-style: normal; font-size: 30px; filter: grayscale(1); }
.badge.on i { filter: none; }
.badge small { font-size: 12px; color: var(--ink-soft); }
.newbadges .badge { display: inline-flex; flex-direction: row; padding: 6px 12px; gap: 6px; }
.newbadges .badge i { font-size: 20px; }
.thennow { margin: 12px 0; }
.thennow > div, .pair > div { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 6px; }
.thennow img { width: 100%; border: 2px solid var(--ink); border-radius: 8px; background: var(--paper); }
.thennow figcaption { font-size: 13px; color: var(--ink-soft); text-align: center; }

/* ===== Szkicownik ===== */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.chips button { padding: 8px 14px; border: 2.5px solid var(--ink); border-radius: 999px; background: var(--surface); font-weight: 700; }
.chips button[aria-selected="true"] { background: var(--ink); color: #fff; }
.album .zoom { position: relative; display: block; width: 100%; padding: 0; border: 0; background: none; }
.album .zoom img { width: 100%; display: block; }
.cstars { position: absolute; right: 6px; bottom: 6px; padding: 1px 6px; font-size: 14px; letter-spacing: 1px; color: var(--ink); background: var(--highlight); border: 2px solid var(--ink); border-radius: 999px; }
.card .art .cstars { top: 8px; right: 8px; bottom: auto; }
.album figcaption small { display: block; font-size: 12px; color: var(--ink-soft); font-weight: 400; }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.lead { color: var(--ink-soft); margin: 0 0 14px; }
.pairs { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.pair { padding: 12px; }
.pair figure { margin: 0; }
.pair img { width: 100%; border: 2px solid var(--ink); border-radius: 8px; background: var(--paper); }
.pair .cstars { position: static; display: inline-block; margin-top: 4px; }
.pair .zoom { position: relative; display: block; padding: 0; border: 0; background: none; width: 100%; }
.zoombox { max-width: min(900px, 96vw); }
.zoombox img { width: 100%; max-height: 70vh; object-fit: contain; background: var(--paper); border: 2px solid var(--ink); border-radius: 10px; }
