/* Fontit omalta palvelimelta (SIL Open Font License 1.1, ks. lisenssit/). Ei pyyntöjä Googlelle. */
@font-face { font-family: "Bricolage Grotesque"; font-style: normal; font-weight: 500 700; font-display: swap;
  src: url(fontit/bricolage-grotesque.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Atkinson Hyperlegible"; font-style: normal; font-weight: 400; font-display: swap;
  src: url(fontit/atkinson-hyperlegible-400.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Atkinson Hyperlegible"; font-style: normal; font-weight: 700; font-display: swap;
  src: url(fontit/atkinson-hyperlegible-700.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url(fontit/jetbrains-mono.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* Perustyylit, jotka Claude-artefaktin kehys muuten antaa */
:root { padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; }
[hidden] { display: none !important; }
img { max-width: 100%; }
/* Layout: yksi kapea työpöytä; vasemmalla "kerrospino" näyttää edistymisen kuin tuloste kasvaa tasolta ylöspäin. */
:root {
  --bg: #eef0ee;          /* tulostusalusta, viileä harmaa */
  --surface: #fbfcfb;
  --ink: #1d2422;
  --muted: #5b6662;
  --line: #d3d9d6;
  --pei: #b06d1f;         /* PEI-levyn meripihka, aksentti */
  --pei-soft: #f3e3cc;
  --fil: #1f6f68;         /* filamentin petrooli */
  --fil-soft: #d6ebe8;
  --warn: #9c3b1c;
  --warn-soft: #f7e0d6;
  --f-display: "Bricolage Grotesque", "Avenir Next", system-ui, sans-serif;
  --f-body: "Atkinson Hyperlegible", system-ui, -apple-system, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #151a19; --surface: #1d2423; --ink: #e7ecea; --muted: #9aa6a2; --line: #33403d;
  --pei: #e0a050; --pei-soft: #3a2c1a; --fil: #5fc1b6; --fil-soft: #18332f;
  --warn: #f0906c; --warn-soft: #3b2219; color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #151a19; --surface: #1d2423; --ink: #e7ecea; --muted: #9aa6a2; --line: #33403d;
  --pei: #e0a050; --pei-soft: #3a2c1a; --fil: #5fc1b6; --fil-soft: #18332f;
  --warn: #f0906c; --warn-soft: #3b2219; color-scheme: dark; }

* { box-sizing: border-box; }
body {
  background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 1rem; line-height: 1.55;
  background-image: repeating-linear-gradient(0deg, transparent 0 5px, color-mix(in srgb, var(--line) 35%, transparent) 5px 6px);
}
.wrap {
  max-width: 60rem; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 2.5rem 4rem;
}
header { display: grid; gap: .5rem; margin-bottom: 2rem; max-width: 40rem; }
.eyebrow { font-family: var(--f-mono); font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--pei); }
h1 { font-family: var(--f-display); font-weight: 700; font-size: clamp(2rem, 6vw, 3.1rem); line-height: 1.05; margin: 0; text-wrap: balance; letter-spacing: -.01em; }
header p { margin: 0; color: var(--muted); }

.layout { display: grid; grid-template-columns: 11rem minmax(0, 1fr); gap: 2rem; align-items: start; }
@media (max-width: 720px) { .layout { grid-template-columns: minmax(0, 1fr); gap: 1.25rem; } }

/* Kerrospino: alin kerros = ensimmäinen vaihe */
.stack { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 1rem); display: flex; flex-direction: column-reverse; gap: 4px; }
.stack button {
  all: unset; cursor: pointer; display: grid; grid-template-columns: 2.2rem 1fr; align-items: center;
  font-size: .85rem; padding: .45rem .6rem; border-radius: 3px; color: var(--muted);
  background: var(--surface); border: 1px dashed var(--line);
}
.stack button .z { font-family: var(--f-mono); font-size: .7rem; }
.stack button.done { background: var(--fil-soft); color: var(--ink); border: 1px solid transparent; }
.stack button.current { background: var(--pei); color: #fff; border: 1px solid transparent; font-weight: 700; }
.stack button:disabled { cursor: default; opacity: .55; }
.stack button:focus-visible { outline: 2px solid var(--fil); outline-offset: 2px; }
.stack-label { font-family: var(--f-mono); font-size: .7rem; color: var(--muted); order: -1; padding-top: .3rem; }
@media (max-width: 720px) {
  .stack { position: static; flex-direction: row; overflow-x: auto; }
  .stack button { grid-template-columns: auto; text-align: center; flex: 1 0 auto; }
  .stack button .z { display: none; }
  .stack-label { display: none; }
}

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: clamp(1.25rem, 3vw, 2rem); display: grid; gap: 1.25rem; min-width: 0; }
h2 { font-family: var(--f-display); font-weight: 700; font-size: 1.6rem; line-height: 1.15; margin: 0; text-wrap: balance; }
h3 { font-family: var(--f-display); font-weight: 500; font-size: 1.15rem; margin: 0; }
.lead { margin: 0; color: var(--muted); max-width: 38rem; }

label.big { display: grid; gap: .4rem; font-weight: 700; }
textarea, input[type=text] {
  font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 4px;
  padding: .75rem .85rem; width: 100%; resize: vertical;
}
textarea:focus-visible, input:focus-visible { outline: 2px solid var(--fil); outline-offset: 1px; }
.counter { font-family: var(--f-mono); font-size: .72rem; color: var(--muted); justify-self: end; }

.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip { all: unset; cursor: pointer; font-size: .88rem; padding: .35rem .7rem; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); }
.chip:hover { border-color: var(--fil); }
.chip:focus-visible { outline: 2px solid var(--fil); outline-offset: 2px; }

.options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.options.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 760px) { .options.three { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .options, .options.three { grid-template-columns: minmax(0, 1fr); } }
.opt { all: unset; cursor: pointer; display: grid; align-content: start; gap: .3rem; padding: 1rem; border: 1px solid var(--line); border-radius: 5px; background: var(--bg); }
.opt strong { font-family: var(--f-display); font-weight: 700; font-size: 1.05rem; }
.opt span { color: var(--muted); font-size: .9rem; }
.opt .tag { font-family: var(--f-mono); font-size: .7rem; color: var(--pei); letter-spacing: .04em; text-transform: uppercase; }
.opt:hover { border-color: var(--fil); }
.opt[aria-pressed="true"] { border: 2px solid var(--pei); padding: calc(1rem - 1px); background: var(--pei-soft); }
.opt:focus-visible { outline: 2px solid var(--fil); outline-offset: 2px; }
.sub { display: grid; gap: .75rem; padding-top: 1rem; border-top: 1px dashed var(--line); }

.toggles { display: grid; gap: .5rem; }
.toggle { display: grid; grid-template-columns: auto 1fr; gap: .75rem; align-items: start; padding: .75rem .9rem; border: 1px solid var(--line); border-radius: 5px; background: var(--bg); cursor: pointer; }
.toggle input { width: 1.15rem; height: 1.15rem; margin-top: .2rem; accent-color: var(--pei); }
.toggle b { display: block; }
.toggle small { color: var(--muted); font-size: .88rem; }

.nav { display: flex; justify-content: space-between; gap: .75rem; flex-wrap: wrap; padding-top: .25rem; }
.btn { font: inherit; font-weight: 700; cursor: pointer; border-radius: 4px; padding: .7rem 1.2rem; border: 1px solid var(--line); background: transparent; color: var(--ink); }
.btn.primary { background: var(--fil); border-color: var(--fil); color: var(--surface); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:focus-visible { outline: 2px solid var(--pei); outline-offset: 2px; }

/* Suunnitelma */
.idea-quote { font-family: var(--f-display); font-size: 1.3rem; font-weight: 500; margin: 0; padding-left: 1rem; border-left: 3px solid var(--pei); overflow-wrap: anywhere; }
.mat { display: grid; grid-template-columns: auto 1fr; gap: 1rem; align-items: center; padding: 1rem; background: var(--fil-soft); border-radius: 5px; }
.spool { width: 3.2rem; height: 3.2rem; border-radius: 50%; border: 6px solid var(--fil); background: radial-gradient(circle, var(--surface) 0 28%, var(--fil) 29% 100%); }
.mat strong { font-family: var(--f-display); font-size: 1.35rem; display: block; }
.mat p { margin: .2rem 0 0; font-size: .92rem; }
.alts { display: grid; gap: .4rem; margin: 0; padding: 0; list-style: none; }
.alts li { display: grid; grid-template-columns: minmax(8rem, auto) 1fr; gap: .75rem; padding: .5rem 0; border-bottom: 1px solid var(--line); font-size: .92rem; }
.alts li b { font-family: var(--f-mono); font-size: .85rem; font-weight: 600; }
@media (max-width: 480px) { .alts li { grid-template-columns: minmax(0, 1fr); gap: .1rem; } }

.flow { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; margin: 0; padding: 0; list-style: none; counter-reset: f; }
.flow li { counter-increment: f; position: relative; padding: .7rem .75rem .7rem 2.2rem; background: var(--bg); border: 1px solid var(--line); font-size: .88rem; line-height: 1.35; }
.flow li:first-child { border-radius: 5px 0 0 5px; }
.flow li:last-child { border-radius: 0 5px 5px 0; background: var(--pei-soft); }
.flow li::before { content: counter(f); position: absolute; left: .7rem; top: .7rem; font-family: var(--f-mono); font-weight: 600; color: var(--pei); }
@media (max-width: 640px) { .flow { grid-auto-flow: row; } .flow li, .flow li:first-child, .flow li:last-child { border-radius: 4px; } }

.settings { width: 100%; border-collapse: collapse; font-size: .92rem; }
.settings th, .settings td { text-align: left; padding: .5rem .4rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.settings th { font-weight: 400; color: var(--muted); width: 38%; }
.settings td .v { font-family: var(--f-mono); font-weight: 600; font-variant-numeric: tabular-nums; }
.settings td .why { display: block; color: var(--muted); font-size: .85rem; }

details.ref { border: 1px solid var(--line); border-radius: 5px; background: var(--bg); }
details.ref summary { cursor: pointer; padding: .8rem 1rem; font-family: var(--f-display); font-weight: 500; font-size: 1.05rem; }
details.ref summary:focus-visible { outline: 2px solid var(--fil); outline-offset: 2px; }
details.ref .inner { padding: 0 1rem 1rem; display: grid; gap: .6rem; }
.scroll { overflow-x: auto; }
.mtable { border-collapse: collapse; font-size: .85rem; min-width: 40rem; width: 100%; }
.mtable th, .mtable td { text-align: left; padding: .45rem .5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.mtable thead th { font-family: var(--f-mono); font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 400; }
.mtable td.n { font-family: var(--f-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.mtable tr.hl { background: var(--pei-soft); }
.mtable tr.hl th { color: var(--pei); }
.diff { font-family: var(--f-mono); font-size: .75rem; white-space: nowrap; }

.slicers { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.slicers > span { font-size: .88rem; color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--fil); border-color: var(--fil); color: var(--surface); }
.gbtns { display: flex; flex-wrap: wrap; gap: .5rem; }
.gbtn { all: unset; cursor: pointer; display: grid; gap: .1rem; padding: .6rem .9rem; border: 1px solid var(--line); border-radius: 5px; background: var(--bg); min-width: 7.5rem; }
.gbtn .tag { font-family: var(--f-mono); font-size: .68rem; letter-spacing: .05em; text-transform: uppercase; color: var(--pei); }
.gbtn strong { font-family: var(--f-display); font-weight: 700; }
.gbtn small { color: var(--muted); font-size: .8rem; }
.gbtn:hover { border-color: var(--fil); }
.gbtn[aria-pressed="true"] { border: 2px solid var(--pei); padding: calc(.6rem - 1px) calc(.9rem - 1px); background: var(--pei-soft); }
.gbtn:focus-visible { outline: 2px solid var(--fil); outline-offset: 2px; }
.walk { border: 1px solid var(--line); border-top: 4px solid var(--pei); border-radius: 5px; padding: 1rem 1.1rem; display: grid; gap: .7rem; background: var(--surface); min-width: 0; }
.walk-head { display: flex; justify-content: space-between; align-items: center; gap: .75rem; }
.walk h4 { font-family: var(--f-display); font-weight: 700; font-size: 1.25rem; margin: 0; }
.walk .val { font-family: var(--f-mono); font-weight: 600; font-size: 1.02rem; color: var(--fil); font-variant-numeric: tabular-nums; }
.walk .path { font-family: var(--f-mono); font-size: .8rem; background: var(--bg); border-radius: 4px; padding: .55rem .7rem; overflow-wrap: anywhere; }
.walk .path b { display: block; font-family: var(--f-body); font-size: .75rem; color: var(--muted); font-weight: 400; margin-bottom: .15rem; }
.walk .why { margin: 0; max-width: 40rem; }
.dots { display: flex; flex-wrap: wrap; gap: 4px; }
.dot { all: unset; cursor: pointer; width: 1.6rem; height: .5rem; border-radius: 2px; background: var(--line); }
.dot.seen { background: var(--fil); opacity: .55; }
.dot[aria-current="step"] { background: var(--pei); opacity: 1; }
.dot:focus-visible { outline: 2px solid var(--fil); outline-offset: 2px; }
.btn.small { padding: .4rem .8rem; font-size: .88rem; }
.btnrow { display: flex; gap: .75rem; flex-wrap: wrap; }
.mat p b { font-weight: 700; }
.foot { margin-top: 2.5rem; padding-top: 1.25rem; border-top: 1px solid var(--line); display: grid; gap: .5rem; max-width: 46rem; font-size: .82rem; color: var(--muted); }
.foot p { margin: 0; }
.foot .meta { font-family: var(--f-mono); font-size: .75rem; }
.linkbtn { all: unset; cursor: pointer; color: var(--fil); text-decoration: underline; text-underline-offset: 2px; }
.linkbtn:focus-visible { outline: 2px solid var(--fil); outline-offset: 2px; }
.pc { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem 1.25rem; font-size: .9rem; }
@media (max-width: 520px) { .pc { grid-template-columns: minmax(0, 1fr); } }
.pc ul { margin: .25rem 0 0; padding: 0; list-style: none; display: grid; gap: .25rem; }
.pc li { padding-left: 1.1rem; position: relative; }
.pc li::before { position: absolute; left: 0; font-family: var(--f-mono); font-weight: 600; }
.pc li.plus::before { content: "+"; color: var(--fil); }
.pc li.minus::before { content: "−"; color: var(--warn); }
.pc-h { font-family: var(--f-mono); font-size: .7rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.opt .pc { font-size: .82rem; margin-top: .35rem; grid-template-columns: minmax(0, 1fr); gap: .35rem; }
.opt .pc li { color: var(--ink); }
.choose { padding-top: 1.25rem; border-top: 1px solid var(--line); }
.instr { padding: 1.25rem; border-radius: 6px; background: color-mix(in srgb, var(--fil-soft) 45%, var(--surface)); gap: 1rem; }
.instr:focus { outline: none; }
.instr .settings th { width: 45%; }
.term { all: unset; cursor: pointer; display: grid; gap: .1rem; border-radius: 3px; }
.term .fi { color: var(--ink); text-decoration: underline dotted var(--muted); text-underline-offset: 3px; }
.term .fi::after { content: "?"; display: inline-grid; place-items: center; width: 1.05rem; height: 1.05rem; margin-left: .35rem; border-radius: 50%; border: 1px solid var(--line); font-family: var(--f-mono); font-size: .65rem; color: var(--muted); vertical-align: 1px; }
.term .en { font-size: .78rem; color: var(--muted); font-style: italic; }
.term:hover .fi, .term[aria-expanded="true"] .fi { color: var(--fil); text-decoration-color: var(--fil); }
.term[aria-expanded="true"] .fi::after { content: "×"; border-color: var(--fil); color: var(--fil); }
.term:focus-visible { outline: 2px solid var(--fil); outline-offset: 2px; }
.settings tr.gloss-row td { padding-top: 0; }
.gloss { display: grid; gap: .5rem; padding: .8rem .9rem; border-radius: 5px; background: var(--bg); border-left: 3px solid var(--fil); font-size: .9rem; }
.gloss strong { font-family: var(--f-display); font-weight: 700; }
.gloss p { margin: 0; max-width: 40rem; }
.gloss .path { font-family: var(--f-mono); font-size: .78rem; overflow-wrap: anywhere; }
.gloss .path b { display: block; font-family: var(--f-body); font-weight: 400; font-size: .74rem; color: var(--muted); }
.walk h4 .en { font-family: var(--f-body); font-weight: 400; font-size: .85rem; font-style: italic; color: var(--muted); }
.note { padding: .85rem 1rem; border-radius: 5px; background: var(--pei-soft); font-size: .92rem; }
.note.warn { background: var(--warn-soft); }
.note.warn b { color: var(--warn); }
ul.tips, ol.steps { margin: 0; padding-left: 1.2rem; display: grid; gap: .45rem; }
ol.steps li::marker { font-family: var(--f-mono); color: var(--pei); }
.section { display: grid; gap: .6rem; }
a { color: var(--fil); }
.footnote { font-size: .82rem; color: var(--muted); margin: 0; }
/* Sanasto: oma osio vaiheiden alla, pysyy auki vaiheesta toiseen */
.sanasto { grid-column: 2; min-width: 0; }
@media (max-width: 720px) { .sanasto { grid-column: 1; } }
.sanasto details.ref { background: var(--surface); }
.san-ryhma { display: grid; gap: .1rem; }
.san-ryhma[hidden] { display: none; }
.san-ryhma h3 { margin: .9rem 0 .3rem; font-family: var(--f-mono); font-size: .75rem; font-weight: 400; letter-spacing: .08em; text-transform: uppercase; color: var(--pei); }
.san-rivi { padding: .55rem 0; border-top: 1px solid var(--line); }
.san-rivi dt { display: flex; flex-wrap: wrap; gap: .1rem .5rem; align-items: baseline; }
.san-rivi .en { font-family: var(--f-mono); font-size: .85rem; overflow-wrap: anywhere; }
.san-rivi .fi { font-family: var(--f-display); font-weight: 700; }
.san-rivi dd { margin: .15rem 0 0; font-size: .92rem; color: var(--muted); max-width: 40rem; }
.san-ryhma dl { margin: 0; }
@media (prefers-reduced-motion: no-preference) { .panel { animation: rise .25s ease-out; } @keyframes rise { from { transform: translateY(6px); opacity: .6; } } }

/* Lisenssiportti */
a.btn { text-decoration: none; display: inline-block; }
.portti { max-width: 38rem; }
.portti-lomake { display: grid; gap: .75rem; }
#lk-avain { font-family: var(--f-mono); letter-spacing: .06em; text-transform: uppercase; }
#lk-email { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 4px;
  padding: .75rem .85rem; width: 100%; }
/* Opastajan prototyyppi: keskustelu oppaan alla, oppaan omilla väreillä */
.avustaja { grid-column: 2; min-width: 0; }
@media (max-width: 720px) { .avustaja { grid-column: 1; } }
.av { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: clamp(1rem, 3vw, 1.5rem); display: grid; gap: .9rem; }
.av-head { display: grid; gap: .25rem; }
.av-head h2 { margin: 0; font-family: var(--f-display); font-size: 1.3rem; }
.av-tila { font-size: .82rem; color: var(--muted); margin: 0; }
.av-loki { display: grid; gap: .7rem; max-height: 32rem; overflow-y: auto; }
.av-viesti { padding: .7rem .9rem; border-radius: 6px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; }
.av-viesti.kayttaja { background: var(--fil-soft); justify-self: end; max-width: 85%; }
.av-viesti.opastaja { background: var(--bg); border: 1px solid var(--line); }
.av-viesti.virhe { background: var(--warn-soft); }
.av-viesti small { display: block; color: var(--muted); font-size: .75rem; margin-top: .35rem; }
.av-ehdotukset { display: flex; flex-wrap: wrap; gap: .4rem; }
.av-lomake { display: grid; gap: .5rem; }
.av-lomake textarea { min-height: 4.5rem; }
.av-rivi { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.av-rivi input[type=text] { flex: 1 1 12rem; min-width: 0; }
.av-kuva { font-size: .85rem; color: var(--muted); }
.av-laskuri { font-family: var(--f-mono); font-size: .72rem; color: var(--muted); margin-left: auto; }
