:root { --ink:#18332b; --paper:#fffefb; --mint:#90e994; }
* { box-sizing:border-box; }
body { margin:0; min-width:880px; color:var(--ink); font-family:ui-rounded,"Arial Rounded MT Bold","Arial Rounded MT",system-ui,sans-serif; }
.app { display:grid; grid-template-columns:340px minmax(0,1fr); height:100vh; min-height:0; }
.guide { display:flex; flex-direction:column; justify-content:space-between; gap:22px; min-height:0; height:100vh; padding:34px 30px 28px; background:var(--paper); border-right:1px solid rgba(24,51,43,.12); }
.guide-header { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.logo { margin:0; padding:0; border:0; color:#080d0a; background:transparent; font:inherit; font-size:1.75rem; font-weight:900; letter-spacing:-.035em; white-space:nowrap; cursor:pointer; }.logo sup { font-size:.48em; vertical-align:top; margin-left:2px; }.logo:focus-visible { outline:2px solid #77bcdc; outline-offset:5px; border-radius:4px; }
.leave-confirmation { width:min(460px, calc(100vw - 32px)); padding:0; border:0; border-radius:18px; color:var(--ink); box-shadow:0 18px 44px rgba(24,51,43,.28); }.leave-confirmation::backdrop { background:rgba(18,43,38,.38); backdrop-filter:blur(2px); }.leave-confirmation-card { padding:28px; }.leave-confirmation h2 { margin:0 0 12px; font-size:25px; letter-spacing:-.04em; line-height:1.1; }.leave-confirmation p { margin:0; color:#61756d; font-size:15px; line-height:1.5; }.leave-confirmation-actions { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:10px; margin-top:24px; }.leave-confirmation-actions button { min-height:38px; padding:8px 14px; border-radius:9px; font:inherit; font-size:13px; font-weight:800; cursor:pointer; }.leave-confirmation-actions .secondary-action { border:1px solid #b8cfbe; background:#fffefb; color:var(--ink); }.leave-confirmation-actions #open-welcome-tab { flex:1 0 100%; }.leave-confirmation-actions #confirm-return-home { border:1px solid #70bc75; background:var(--mint); color:var(--ink); }
.language-switch { display:flex; align-items:center; gap:10px; }
.language-button { width:auto; min-width:0; padding:0; border:0; border-radius:0; background:transparent; color:#6b9a79; font-size:13px; font-weight:700; line-height:1; text-align:center; cursor:pointer; }
.language-button.is-active { background:transparent; color:#398b4e; font-weight:900; }.language-button:disabled { cursor:default; opacity:.72; }.language-button:focus-visible { outline:2px solid #77bcdc; outline-offset:4px; border-radius:3px; }
.guide-content { flex:1; min-height:0; overflow:auto; padding:clamp(18px, 3vh, 34px) 2px 12px; scrollbar-color:#bfd1c3 transparent; scrollbar-width:thin; }
.guide-content::-webkit-scrollbar { width:7px; }.guide-content::-webkit-scrollbar-thumb { background:#bfd1c3; border-radius:999px; }
.guide-kicker { margin:0 0 14px; color:#668178; font-size:11px; font-weight:900; letter-spacing:.16em; }
.guide-content h1 { margin:0 0 18px; color:var(--ink); font-size:31px; letter-spacing:-.06em; line-height:1.04; }
.guide-content[data-guide="root"], .guide-content[data-guide="valttely"], .guide-content[data-guide="yhteistyo"], .guide-content[data-guide="vastakkainasettelu"] { padding-top:clamp(14px, 2vh, 24px); }
.guide-content[data-guide="root"] .guide-kicker, .guide-content[data-guide="valttely"] .guide-kicker, .guide-content[data-guide="yhteistyo"] .guide-kicker, .guide-content[data-guide="vastakkainasettelu"] .guide-kicker { display:none; }
.guide-content[data-guide="root"] h1, .guide-content[data-guide="valttely"] h1, .guide-content[data-guide="yhteistyo"] h1, .guide-content[data-guide="vastakkainasettelu"] h1, .guide-content[data-guide="examples"] h1 { font-size:24px; }
.guide-content p { margin:0 0 16px; color:#61756d; font-size:14px; line-height:1.58; }
.guide-content strong { color:var(--ink); }.guide-content a { color:#27694f; font-weight:800; }
.guide-content .examples-box { margin-top:20px; padding:14px 15px; border-radius:13px; background:#eef8eb; }
.examples-box h2 { margin:0 0 9px; color:var(--ink); font-size:14px; line-height:1.3; }.examples-box ul { display:grid; gap:7px; margin:0; padding-left:18px; color:#4c675d; font-size:13px; line-height:1.43; }
.guide-actions { display:grid; gap:7px; }
.guide-actions button { width:74%; min-height:31px; justify-self:center; padding:5px 8px; border-color:#73b976; background:var(--mint); font-size:11px; line-height:1.1; text-align:center; }
.guide-actions .secondary-action { border-color:#73b976; background:var(--mint); }
.export-menu { display:grid; gap:4px; width:74%; justify-self:center; padding:5px; border:1px solid #bcd6c2; border-radius:9px; background:#fffefb; box-shadow:0 5px 16px rgba(35,72,58,.12); }
.export-menu[hidden] { display:none; }
.export-menu button { width:100%; min-height:28px; padding:5px 7px; border-color:#bcd6c2; background:#fffefb; font-size:10px; text-align:center; }
.export-menu button:hover { background:#eef8eb; }
.example-chooser { display:grid; gap:6px; }
.example-chooser h1 { margin-bottom:0; line-height:1.15; }
.example-chooser > p { margin-top:0; }
.example-choice { width:100%; min-height:30px; padding:5px 8px; border:1px solid #bcd6c2; border-radius:8px; background:#fffefb; color:var(--ink); font:inherit; font-size:11px; font-weight:800; line-height:1.1; text-align:center; cursor:pointer; }
.example-choice:hover { border-color:#78b995; }
.example-choice.is-selected { border-color:#78bdd4; background:#d8edf6; }
.example-choice:disabled { cursor:not-allowed; opacity:.55; }
button { width:100%; padding:12px 14px; border:1px solid #73b976; border-radius:9px; color:var(--ink); background:var(--mint); font:inherit; font-size:14px; font-weight:850; text-align:left; cursor:pointer; }
.secondary-action { border-color:#b9d3bf; background:transparent; }.secondary-action:disabled { color:#61756d; cursor:not-allowed; opacity:.68; }
.sky { position:relative; min-width:0; overflow:hidden; background:radial-gradient(circle at 51% 79%,#fff7c8 0 3%,#eaf8fa 17%,#d7f0f9 46%,#b8e4f4 100%); }
.tree-stage { position:absolute; inset:0; overflow:hidden; touch-action:none; cursor:grab; }.tree-stage.is-dragging { cursor:grabbing; }
.tree-frame { position:absolute; width:min(95%,1500px); aspect-ratio:4961 / 3508; transform-origin:0 0; }
.svg-host, .svg-host svg, .text-layer { position:absolute; inset:0; width:100%; height:100%; }
.svg-host svg { display:block; shape-rendering:geometricPrecision; text-rendering:geometricPrecision; }
.text-layer { pointer-events:none; }
.tree-text { position:absolute; z-index:2; display:grid; place-items:center; margin:0; padding:1px; resize:none; overflow:hidden; border:0; border-radius:0; outline:none; color:var(--ink); background:transparent; font:800 clamp(8px,1.1vw,16px)/1.18 ui-rounded,"Arial Rounded MT Bold","Arial Rounded MT",system-ui,sans-serif; text-align:center; hyphens:auto; overflow-wrap:break-word; pointer-events:auto; }
.tree-text:focus { background:rgba(255,255,255,.28); box-shadow:0 0 0 2px rgba(46,118,94,.32); }
.tree-text-counter { position:absolute; z-index:3; transform:translate(-50%, 2px); color:#426b5d; font-family:ui-rounded,"Arial Rounded MT Bold","Arial Rounded MT",system-ui,sans-serif; font-weight:700; line-height:1; pointer-events:none; white-space:nowrap; }
.root-title { position:absolute; display:grid; place-items:center; color:white; font-size:clamp(14px,2.2vw,31px); font-weight:900; letter-spacing:-.055em; line-height:1; text-align:center; pointer-events:none; text-shadow:0 1px 1px rgba(96,52,29,.28); white-space:nowrap; }
.root-title sup { font-size:.36em; align-self:start; margin-left:2px; }
.hidden { visibility:hidden; }
.tree-controls { position:absolute; right:28px; bottom:26px; display:flex; align-items:stretch; overflow:hidden; border:1px solid rgba(24,51,43,.12); border-radius:13px; background:rgba(255,255,255,.9); box-shadow:0 3px 12px rgba(47,86,73,.12); }
.tree-controls button { width:auto; min-width:48px; padding:10px 13px; border:0; border-right:1px solid rgba(24,51,43,.1); border-radius:0; background:transparent; text-align:center; }.tree-controls button:last-child { min-width:auto; border-right:0; text-align:left; }
.tree-copyright { position:absolute; left:28px; bottom:24px; display:grid; gap:3px; color:rgba(24,51,43,.58); font-size:10px; font-weight:650; letter-spacing:.01em; line-height:1.28; pointer-events:none; }

/* Kapeissa ikkunoissa paneeli saa vähemmän leveyttä, jotta puulle jää aina
   käyttökelpoinen tila. Puun oma kamera keskittää sisällön käytettävissä
   olevaan näkymään. */
@media (max-width: 980px) {
  body { min-width:0; }
  .app { grid-template-columns:minmax(250px, 31vw) minmax(0, 1fr); }
  .guide { padding:24px 20px 20px; gap:14px; }
  .logo { font-size:1.45rem; }
  .guide-content { padding-top:18px; }
  .guide-content h1 { font-size:27px; }
  .guide-content[data-guide="root"] h1,
  .guide-content[data-guide="valttely"] h1,
  .guide-content[data-guide="yhteistyo"] h1,
  .guide-content[data-guide="vastakkainasettelu"] h1,
  .guide-content[data-guide="examples"] h1 { font-size:21px; }
  .guide-content p { font-size:13px; }
  .tree-controls { right:16px; bottom:16px; }
  .tree-copyright { left:16px; bottom:16px; }
}

@media (max-width: 700px) {
  .app { grid-template-columns:1fr; grid-template-rows:minmax(238px, 39vh) minmax(0, 1fr); height:100dvh; }
  .guide { height:auto; padding:16px 18px 14px; border-right:0; border-bottom:1px solid rgba(24,51,43,.12); gap:10px; }
  .guide-header { align-items:center; }
  .logo { font-size:1.35rem; }
  .language-switch { gap:8px; }.language-button { font-size:12px; }
  .guide-content { padding:8px 2px 5px; }
  .guide-content h1 { margin-bottom:10px; font-size:23px; }
  .guide-content[data-guide="root"] h1,
  .guide-content[data-guide="valttely"] h1,
  .guide-content[data-guide="yhteistyo"] h1,
  .guide-content[data-guide="vastakkainasettelu"] h1,
  .guide-content[data-guide="examples"] h1 { font-size:19px; }
  .guide-content p { margin-bottom:10px; font-size:12px; line-height:1.45; }
  .guide-actions { grid-template-columns:repeat(3, minmax(0, 1fr)); gap:6px; }
  .guide-actions button, .export-menu { width:100%; }
  .guide-actions button { min-height:30px; padding:4px 5px; font-size:10px; }
  .export-menu { grid-column:1 / -1; }
  .tree-controls { right:10px; bottom:10px; border-radius:10px; }
  .tree-controls button { min-width:40px; padding:8px 10px; font-size:12px; }
  .tree-copyright { left:10px; bottom:10px; font-size:8px; }
}
