/* Projektas „Dviese“ — style A2 (serif headlines). Tokens first, then components. */
:root {
  --bg: #FFF6E9; --card: #FFFFFF; --ink: #2B2118; --ink-2: #7A5C3A; --ink-3: #B08E68;
  --line: #E8D9C0; --line-2: #F1E4D0; --thumb-idle: #D9C9AE; --shadow: #F1E4D0; --btn-shadow: #C9A97C;
  --me: #E0A040; --me-text: #B86E12; --pt: #6B5CC7; --pt-text: #5A4BB5; --eq: #7A5C3A;
  --me-tint: #FBEBD1; --pt-tint: #E9E5F7; --sand: #F1E4D0;
  --r-card: 24px; --r-btn: 16px;
  --font: 'Nunito', system-ui, -apple-system, sans-serif; --disp: 'Fraunces', Georgia, serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-weight: 600; line-height: 1.4; }
a { color: var(--me-text); }
.wrap { max-width: 480px; margin: 0 auto; min-height: 100dvh; padding: 22px 18px 28px; display: flex; flex-direction: column; gap: 18px; }
@media (min-width: 720px) { .wrap { max-width: 560px; padding: 36px 24px; } }

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.eyebrow { font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2); }
.dots { display: flex; gap: 5px; }
.dot { width: 18px; height: 8px; border-radius: 4px; background: var(--line); }
.dot.on { background: var(--ink); }
@media (max-width: 380px) { .dot { width: 12px; } }

.h1 { font-family: var(--disp); font-weight: 600; font-size: 30px; line-height: 1.05; letter-spacing: -.01em; margin: 0; }
.h1.big { font-size: 38px; }
.h2 { font-family: var(--disp); font-weight: 700; font-size: 22px; margin: 6px 0 0; }
.h2.section { margin-top: 12px; color: var(--ink-2); font-size: 18px; }
.h3 { font-family: var(--disp); font-weight: 600; font-size: 22px; line-height: 1.1; margin: 0 0 8px; }
.lead { margin: 0; font-size: 15px; color: var(--ink-2); }
.hero { display: flex; flex-direction: column; gap: 12px; padding-top: 8px; }
.hint { font-size: 13px; line-height: 1.35; color: var(--ink-2); }
.muted { color: var(--ink-3); }
.foot { margin: 8px 0 0; font-size: 13px; text-align: center; color: var(--ink-2); }
.grow { flex-grow: 1; }

.card { background: var(--card); border-radius: var(--r-card); padding: 18px 16px 16px; box-shadow: 0 7px 0 var(--shadow); }
.card.intro { background: var(--sand); box-shadow: none; }
.card.missing { outline: 3px solid var(--me); outline-offset: 2px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.row3 { display: flex; gap: 8px; }
.row3 > * { flex: 1; min-width: 0; }
.nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 8px; }
.nav .btn.dark { flex: 1; }

.btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; text-align: center; font-family: var(--font); font-weight: 800; font-size: 17px; min-height: 56px; padding: 0 18px; border-radius: var(--r-btn); cursor: pointer; width: 100%; }
.btn.dark { border: 0; background: var(--ink); color: var(--bg); box-shadow: 0 5px 0 var(--btn-shadow); }
.btn.dark:hover { background: #3A2D20; }
.btn.dark:active { transform: translateY(2px); box-shadow: 0 3px 0 var(--btn-shadow); }
.btn.light { border: 2px solid var(--ink); background: var(--card); color: var(--ink); }
.btn.light:hover { background: #FFF0DC; }
.btn.small { width: auto; min-height: 48px; font-size: 15px; }
.btn[aria-disabled="true"] { opacity: .4; pointer-events: none; }

.q { display: block; font-family: var(--disp); font-weight: 600; font-size: 20px; line-height: 1.15; margin-bottom: 6px; }
.item .hint { margin-bottom: 10px; }
.check { display: flex; gap: 12px; align-items: flex-start; font-size: 15px; color: var(--ink-2); cursor: pointer; }
.check input { width: 24px; height: 24px; margin: 0; flex: none; accent-color: var(--ink); }

.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.pill { position: relative; }
.pill input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.pill span { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 16px; border-radius: 999px; border: 2px solid var(--line); background: var(--card); color: var(--ink-2); font-weight: 700; font-size: 14px; }
.pill input:checked + span { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.pill input:focus-visible + span { outline: 3px solid var(--me); outline-offset: 2px; }

.numrow { display: flex; gap: 10px; align-items: center; margin-top: 6px; }
.num, .txt { font: inherit; font-weight: 700; font-size: 18px; color: var(--ink); background: var(--bg); border: 2px solid var(--line); border-radius: 14px; padding: 12px 14px; min-height: 52px; width: 100%; min-width: 0; }
.num { max-width: 160px; }
.txt.area { min-height: 110px; resize: vertical; font-size: 16px; font-weight: 600; }
.num:focus, .txt:focus, .word-input:focus { outline: 3px solid var(--me); outline-offset: 1px; border-color: var(--ink); }
.num:disabled, .txt:disabled { opacity: .4; }
.word-input { font: inherit; font-family: var(--disp); font-weight: 700; font-size: 22px; letter-spacing: .04em; text-transform: uppercase; color: var(--ink); background: var(--bg); border: 2px solid var(--line); border-radius: 14px; padding: 12px 14px; min-height: 56px; width: 100%; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.chip { font-family: var(--font); font-weight: 700; font-size: 13px; padding: 10px 14px; border-radius: 999px; border: 2px solid var(--line); background: var(--card); color: var(--ink-2); cursor: pointer; min-height: 44px; }
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.chip.dk { flex: none; }

/* ---- slider */
.slider { display: flex; flex-direction: column; gap: 8px; padding-top: 10px; }
.task .slider + .slider { margin-top: 6px; border-top: 1px solid var(--line-2); padding-top: 14px; }
.slider-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.slider-title { font-family: var(--disp); font-weight: 700; font-size: 20px; }
.item > .slider .slider-title { font-size: 20px; line-height: 1.15; }
.readout { font-size: 14px; font-weight: 800; white-space: nowrap; color: var(--eq); }
.readout.me { color: var(--me-text); } .readout.pt { color: var(--pt-text); }
.rng { position: relative; height: 56px; }
.rng .track { position: absolute; left: 0; right: 0; top: 21px; height: 14px; border-radius: 999px; background: var(--line-2); }
.rng .tick { position: absolute; left: 50%; top: 15px; width: 3px; height: 26px; margin-left: -1.5px; border-radius: 2px; background: var(--thumb-idle); }
.rng .fill { position: absolute; top: 21px; height: 14px; border-radius: 999px; width: 0; left: 50%; background: var(--eq); }
.rng.me .fill { background: var(--me); } .rng.pt .fill { background: var(--pt); }
.rng input[type=range] { -webkit-appearance: none; appearance: none; position: absolute; left: 0; top: 0; width: 100%; height: 56px; margin: 0; background: transparent; cursor: pointer; z-index: 2; touch-action: pan-y; }
.rng input[type=range]:focus { outline: none; }
.rng input[type=range]::-webkit-slider-runnable-track { height: 56px; background: transparent; }
.rng input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 40px; height: 40px; margin-top: 8px; border-radius: 50%; background: #FFF; border: 4px solid var(--thumb-idle); box-shadow: 0 4px 0 rgba(120,80,30,.14); transition: transform .12s; }
.rng input[type=range]:active::-webkit-slider-thumb { transform: scale(1.08); }
.rng input[type=range]::-moz-range-track { height: 56px; background: transparent; }
.rng input[type=range]::-moz-range-thumb { width: 40px; height: 40px; border-radius: 50%; background: #FFF; border: 4px solid var(--thumb-idle); box-shadow: 0 4px 0 rgba(120,80,30,.14); }
.rng.touched input[type=range]::-webkit-slider-thumb, .rng.touched input[type=range]::-moz-range-thumb { border-color: var(--eq); background: var(--eq); }
.rng.touched.me input[type=range]::-webkit-slider-thumb, .rng.touched.me input[type=range]::-moz-range-thumb { border-color: var(--me); background: var(--me); }
.rng.touched.pt input[type=range]::-webkit-slider-thumb, .rng.touched.pt input[type=range]::-moz-range-thumb { border-color: var(--pt); background: var(--pt); }
.rng input[type=range]:focus-visible::-webkit-slider-thumb { outline: 3px solid var(--me); outline-offset: 2px; }
.rng.off { opacity: .35; pointer-events: none; }
.anchors { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }
.anchors span:nth-child(2) { text-align: center; } .anchors span:last-child { text-align: right; }
.slide-hint { font-size: 13px; color: var(--ink-3); font-weight: 700; text-align: center; }

/* ---- code tiles, notes, alerts */
.code-tiles { display: flex; flex-direction: column; gap: 10px; }
.tile { font-family: var(--disp); font-weight: 700; font-size: 28px; line-height: 1; letter-spacing: .04em; padding: 16px 18px; border-radius: 16px; text-align: center; overflow-wrap: anywhere; }
.tile.amber { background: var(--me-tint); color: #8F5409; } .tile.violet { background: var(--pt-tint); color: #4E41A3; } .tile.sand { background: var(--sand); color: #5C4329; }
.note { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: var(--sand); border-radius: 18px; font-size: 13px; color: var(--ink-2); font-weight: 700; }
.note svg { flex: none; }
.alert { margin: 0; padding: 12px 14px; border-radius: 14px; background: var(--me-tint); color: #8F5409; font-weight: 700; font-size: 14px; }
.alert.soft { background: var(--sand); color: var(--ink-2); }
.err { font-size: 11px; white-space: pre-wrap; overflow: auto; background: #FFF; padding: 12px; border-radius: 12px; }

/* ---- results */
.res { display: flex; flex-direction: column; gap: 4px; }
.res-label { font-size: 13px; color: var(--ink-2); }
.res-bar { display: flex; height: 30px; border-radius: 999px; overflow: hidden; font-size: 12px; font-weight: 800; color: #fff; }
.res-bar .m { background: var(--pt); display: flex; align-items: center; padding-left: 10px; min-width: 0; }
.res-bar .f { background: var(--me); display: flex; align-items: center; justify-content: flex-end; padding-right: 10px; min-width: 0; }
.legend { font-size: 12px; color: var(--ink-2); display: flex; gap: 8px; align-items: center; }
.sw { display: inline-block; width: 14px; height: 14px; border-radius: 4px; } .sw.m { background: var(--pt); } .sw.f { background: var(--me); }
.gap { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; padding: 8px 0; border-bottom: 1px solid var(--line-2); }
.gap:last-child { border-bottom: 0; }
.tbl { width: 100%; border-collapse: collapse; font-size: 12px; } .tbl th, .tbl td { text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line-2); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 999px; font-weight: 800; font-size: 14px; opacity: 0; transition: opacity .2s; pointer-events: none; }
.toast.show { opacity: 1; }
