/* Tulevaisuus 2035 — käyttöliittymä
   Visuaalinen suunta: pohjoismainen solarpunk. Vaalea "painettu" paneeli,
   tumma metsänvihreä teksti, punamullan punainen korostus. */

:root{
  /* Merkkiarvo, jolla peli tunnistaa latautuiko tyylitiedosto lainkaan.
     Jos index.html avataan suoraan ZIPin sisältä, tämä puuttuu. */
  --check-loaded: ok;
  --birch:#f5f0e6;
  --birch-2:#ece5d6;
  --pine:#16332c;
  --pine-soft:#4a5f56;
  --falu:#b8452f;
  --aurora:#2f8f86;
  --aurora-light:#3fbfa8;
  --sun:#e9b44c;
  --line:#16332c;
  --shadow:4px 4px 0 rgba(22,51,44,.22);
  --shadow-lg:8px 8px 0 rgba(22,51,44,.18);
  --r:16px;
  --display:'Trebuchet MS','Aptos Display','Segoe UI Variable Display','Segoe UI',system-ui,sans-serif;
  --body:'Aptos','Segoe UI Variable Text','Segoe UI',-apple-system,BlinkMacSystemFont,system-ui,sans-serif;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;background:#0e1a18;color:var(--pine);
  font-family:var(--body);font-size:15px;line-height:1.5;
  overflow:hidden;-webkit-tap-highlight-color:transparent;
}
#scene{position:fixed;inset:0;width:100%;height:100%;display:block;z-index:0}
#storageWarning{position:fixed;z-index:50;top:calc(10px + env(safe-area-inset-top));left:50%;transform:translateX(-50%);width:min(760px,calc(100% - 24px));padding:10px 14px;border:2px solid #7b2e22;border-radius:12px;background:#fff0df;color:#5d2018;font:700 13px/1.4 var(--body);box-shadow:0 5px 18px rgba(20,20,20,.22);text-align:center}

.screen{position:fixed;inset:0;z-index:2;display:none}
.screen.active{display:block}
.hidden{display:none !important}
kbd{
  font-family:var(--display);font-size:.72em;font-weight:600;
  background:var(--pine);color:var(--birch);border-radius:5px;
  padding:2px 6px;margin:0 1px;letter-spacing:.02em;
}
.eyebrow,.kicker{
  font-family:var(--display);font-weight:600;text-transform:uppercase;
  letter-spacing:.16em;font-size:11px;color:var(--aurora);margin:0 0 6px
}
.fine{font-size:12.5px;color:var(--pine-soft);margin:8px 0 0}
.muted{color:var(--pine-soft)}
h1,h2,h3{font-family:var(--display);margin:0;letter-spacing:-.02em;line-height:1.05}

/* ---------- kortit ja napit ---------- */
.card{
  background:var(--birch);border:2px solid var(--line);border-radius:var(--r);
  box-shadow:var(--shadow-lg);padding:22px;
}
.btn{
  font-family:var(--display);font-weight:600;font-size:15px;
  border:2px solid var(--line);border-radius:12px;background:var(--birch);
  color:var(--pine);padding:11px 16px;cursor:pointer;
  box-shadow:var(--shadow);transition:transform .08s ease,box-shadow .08s ease,background .15s;
}
.btn:hover{transform:translate(-1px,-1px);box-shadow:5px 5px 0 rgba(22,51,44,.24)}
.btn:active{transform:translate(3px,3px);box-shadow:1px 1px 0 rgba(22,51,44,.24)}
.btn:focus-visible{outline:3px solid var(--sun);outline-offset:2px}
.btn.primary{background:var(--falu);color:#fff6ef;border-color:var(--pine)}
.btn.ghost{background:transparent}
.btn.danger{background:transparent;color:var(--falu);border-style:dashed;box-shadow:none}
.btn.block{display:block;width:100%;margin-top:10px;text-align:left}
.btn.block em{display:block;font-style:normal;font-size:11.5px;font-weight:500;color:inherit;opacity:.7;margin-top:2px}
.btn.icon{padding:6px 12px;font-size:18px;line-height:1}

/* ---------- masthead + kompassimerkki ---------- */
.mast{display:flex;align-items:center;gap:12px}
.mark{
  width:38px;height:38px;border-radius:50%;flex:none;
  border:2px solid var(--pine);background:
    repeating-conic-gradient(from 0deg, var(--aurora-light) 0deg 3deg, transparent 3deg 51.4deg),
    radial-gradient(circle at 50% 50%, var(--sun) 0 22%, var(--birch) 22%);
}
.mast-txt strong{
  display:block;font-family:var(--display);font-weight:700;
  letter-spacing:.12em;font-size:14px
}
.mast-txt span{display:block;font-size:11.5px;color:var(--pine-soft);letter-spacing:.04em}
.mast.small .mark{width:30px;height:30px}

/* ---------- aloitusnäkymä ---------- */
.start-wrap{
  height:100%;display:grid;grid-template-rows:auto 1fr auto;
  padding:clamp(14px,2.5vw,30px);gap:16px;
  background:linear-gradient(105deg, rgba(245,240,230,.94) 0 30%, rgba(245,240,230,.55) 52%, rgba(245,240,230,0) 76%);
}
.mast .ver{
  margin-left:auto;font-family:var(--display);font-size:11px;font-weight:600;
  letter-spacing:.14em;border:2px solid var(--pine);border-radius:999px;padding:4px 12px;background:var(--birch)
}
.start-grid{
  display:grid;grid-template-columns:minmax(320px,1fr) 330px;gap:28px;
  align-items:center;align-content:center;max-width:1180px;width:100%;margin:0 auto
}
.pitch h1{font-size:clamp(34px,5.4vw,60px);font-weight:700;margin:6px 0 14px}
.pitch h1 span{color:var(--falu)}
.pitch .lead{max-width:44ch;font-size:16px;color:#26443c}
.bullets{list-style:none;padding:0;margin:18px 0 0;display:flex;flex-wrap:wrap;gap:8px}
.bullets li{
  font-size:12.5px;background:var(--birch);border:2px solid var(--pine);
  border-radius:999px;padding:5px 13px;box-shadow:2px 2px 0 rgba(22,51,44,.18)
}
.bullets b{font-family:var(--display)}
.start-card label{display:block;font-size:12px;font-weight:600;margin:10px 0 5px;color:var(--pine-soft)}
.start-card input{
  width:100%;font-family:var(--body);font-size:16px;padding:11px 13px;
  border:2px solid var(--pine);border-radius:11px;background:#fffdf7;color:var(--pine)
}
.start-card input:focus{outline:3px solid var(--sun);outline-offset:1px}
.ctrlbar{
  display:flex;flex-wrap:wrap;gap:8px 18px;justify-content:center;
  font-size:12px;color:#22403a
}

/* ---------- hahmonluonti ---------- */
.creator{
  height:100%;padding:clamp(12px,2vw,26px);display:grid;grid-template-rows:auto 1fr;gap:16px;
  background:linear-gradient(180deg,rgba(245,240,230,.92),rgba(233,228,214,.96))
}
.creator-head{display:flex;align-items:center;justify-content:space-between}
.creator-body{
  display:grid;grid-template-columns:minmax(280px,1fr) minmax(320px,460px);
  gap:18px;min-height:0;max-width:1180px;width:100%;margin:0 auto
}
.stage{display:flex;flex-direction:column;min-height:0}
.stage h2{font-size:26px;margin-bottom:8px}
#creatorCanvas{
  flex:1;width:100%;min-height:220px;border-radius:12px;border:2px solid var(--pine);
  background:
    radial-gradient(circle at 50% 62%, #ffffff 0%, #e8e2d2 46%, #d3d8cd 100%);
}
.closet{display:flex;flex-direction:column;min-height:0}
.closet-head{display:flex;justify-content:space-between;align-items:flex-start;gap:12px;margin-bottom:12px}
.closet-head h2{font-size:22px;max-width:16ch}
.wstatus{display:flex;flex-direction:column;gap:3px;font-size:11.5px;text-align:right;color:var(--pine-soft)}
.wstatus b{color:var(--pine)}
.wlist{overflow-y:auto;flex:1;padding-right:6px;margin-bottom:12px}
.wgroup{margin-bottom:14px}
.wlabel{display:flex;justify-content:space-between;align-items:baseline;margin-bottom:6px}
.wlabel strong{font-family:var(--display);font-size:13px;letter-spacing:.02em}
.wlabel span{font-size:11.5px;color:var(--aurora);font-weight:600}
.wrow{display:flex;flex-wrap:wrap;gap:6px}
.wbtn{
  font-family:var(--body);font-size:12.5px;font-weight:500;cursor:pointer;
  border:2px solid rgba(22,51,44,.35);background:#fffdf7;color:var(--pine);
  border-radius:9px;padding:7px 11px;display:flex;flex-direction:column;gap:1px;line-height:1.2
}
.wbtn small{font-size:10px;color:var(--pine-soft)}
.wbtn:hover{border-color:var(--pine)}
.wbtn.on{background:var(--pine);color:var(--birch);border-color:var(--pine)}
.wbtn.on small{color:rgba(245,240,230,.7)}
.wbtn.locked{opacity:.45;cursor:not-allowed}
.wbtn.buy{border-color:var(--sun);background:#fff8e8}
.wrow.swatches .wbtn{padding:0;border-radius:50%;width:34px;height:34px;overflow:hidden}
.wrow.swatches .wbtn i{display:block;width:100%;height:100%}
.wrow.swatches .wbtn.on{outline:3px solid var(--aurora);outline-offset:2px}

/* ---------- HUD ---------- */
.hud{pointer-events:none}
.hud .panel,.hud button{pointer-events:auto}
.panel{
  background:rgba(245,240,230,.94);border:2px solid var(--pine);border-radius:12px;
  box-shadow:var(--shadow);padding:8px 12px;font-size:12.5px;
  backdrop-filter:blur(2px);
}
.hud-tl{position:absolute;top:14px;left:14px;display:flex;flex-direction:column;gap:8px;max-width:min(420px,52vw)}
.day{font-family:var(--display);font-weight:600;letter-spacing:.1em;text-transform:uppercase;font-size:11.5px;align-self:flex-start}
.objective{display:flex;align-items:center;gap:10px}
.objective small{display:block;font-size:9.5px;letter-spacing:.16em;color:var(--aurora);font-weight:600}
.objective strong{font-family:var(--display);font-size:15px;display:block;line-height:1.15}
.objective strong em{font-style:normal;font-weight:500;color:var(--pine-soft);font-size:12px}
.obj-arrow{color:var(--falu);font-size:17px;transition:transform .15s linear;line-height:1}
.dist{margin-left:auto;font-family:var(--display);font-weight:600;font-size:12px;color:var(--pine-soft);white-space:nowrap}

.hud-tr{position:absolute;top:14px;right:14px;display:flex;gap:8px;align-items:flex-start}
.mp-presence{
  position:absolute;top:14px;left:50%;transform:translateX(-50%);z-index:3;
  max-width:min(540px,42vw);padding:7px 11px;text-align:center;line-height:1.2;
  pointer-events:auto;
}
.mp-presence strong{display:block;font-family:var(--display);font-size:11.5px;letter-spacing:.03em;color:var(--pine)}
.mp-presence span{display:block;margin-top:3px;font-size:10.5px;color:var(--pine-soft);white-space:nowrap;overflow-x:auto;scrollbar-width:thin}
.iconbtn{cursor:pointer;font-size:15px;line-height:1;padding:9px 11px}
.profile{display:flex;align-items:center;gap:10px;cursor:pointer;font-family:var(--body)}
.profile .ring{
  width:42px;height:42px;border-radius:50%;flex:none;display:grid;place-items:center;
  border:2px solid var(--pine);
  background:conic-gradient(var(--aurora-light) 0 var(--p,50%), var(--birch-2) 0);
}
.profile .ring b{font-family:var(--display);font-size:11px;background:var(--birch);border-radius:50%;width:30px;height:30px;display:grid;place-items:center}
.pmeta{text-align:left}
.pmeta strong{display:block;font-family:var(--display);font-size:13.5px}
.pmeta em{font-style:normal;font-size:11px;color:var(--pine-soft)}

.hud-bl{position:absolute;left:14px;bottom:14px;display:flex;flex-direction:column;gap:8px;align-items:flex-start}
#minimap{
  width:132px;height:132px;border-radius:50%;
  filter:drop-shadow(3px 3px 0 rgba(22,51,44,.22))
}
.area{font-family:var(--display);font-weight:600;font-size:12px;letter-spacing:.04em}

.hud-br{position:absolute;right:14px;bottom:14px;display:flex;flex-direction:column;gap:8px;align-items:flex-end}
.chips{font-family:var(--display);font-weight:600;letter-spacing:.04em}
.chips b{color:var(--aurora)}
.help{display:flex;gap:12px;flex-wrap:wrap;justify-content:flex-end;font-size:11.5px;color:var(--pine-soft)}

.prompt{
  position:absolute;left:50%;bottom:16%;transform:translateX(-50%);
  display:flex;align-items:center;gap:9px;
  background:var(--pine);color:var(--birch);border-radius:999px;
  padding:9px 18px 9px 12px;font-family:var(--display);font-weight:600;font-size:14px;
  box-shadow:var(--shadow);animation:pop .18s ease
}
.prompt kbd{background:var(--sun);color:var(--pine)}
@keyframes pop{from{transform:translateX(-50%) scale(.9);opacity:0}to{transform:translateX(-50%) scale(1);opacity:1}}

/* kosketusohjaus */
.stick,.touch-action{display:none}
body.touch .stick{
  display:block;position:absolute;left:22px;bottom:24px;width:112px;height:112px;border-radius:50%;
  border:2px solid rgba(22,51,44,.5);background:rgba(245,240,230,.4);pointer-events:auto;touch-action:none
}
body.touch .stick.on{background:rgba(245,240,230,.62)}
.knob{
  position:absolute;left:50%;top:50%;width:52px;height:52px;margin:-26px 0 0 -26px;border-radius:50%;
  background:var(--birch);border:2px solid var(--pine);box-shadow:var(--shadow)
}
body.touch .touch-action{
  display:grid;place-items:center;position:absolute;right:26px;bottom:34px;
  width:74px;height:74px;border-radius:50%;border:2px solid var(--pine);
  background:var(--sun);font-family:var(--display);font-weight:700;font-size:24px;
  box-shadow:var(--shadow);pointer-events:auto;cursor:pointer
}
body.touch .hud-bl{bottom:150px}
body.touch .help{display:none}

/* ---------- profiilipaneeli ---------- */
.drawer{position:fixed;inset:0;z-index:5}
.drawer-bg{position:absolute;inset:0;background:rgba(12,26,22,.45)}
.drawer-panel{
  position:absolute;top:0;right:0;height:100%;width:min(390px,92vw);
  border-radius:0;border-width:0 0 0 2px;box-shadow:none;overflow-y:auto;
  animation:slide .22s ease
}
@keyframes slide{from{transform:translateX(24px);opacity:.4}to{transform:none;opacity:1}}
.drawer-head{display:flex;justify-content:space-between;align-items:flex-start;gap:12px}
.drawer-head h2{font-size:24px}
#radar{width:100%;max-width:300px;height:auto;display:block;margin:6px auto 4px}
.tokenrow{
  display:flex;justify-content:space-between;align-items:center;
  border:2px dashed rgba(22,51,44,.4);border-radius:12px;padding:9px 13px;margin:8px 0 14px;font-size:13px
}
.tokenrow strong{font-family:var(--display);color:var(--aurora)}
.skill{margin-bottom:9px}
.skill-head{display:flex;justify-content:space-between;font-size:12.5px;margin-bottom:3px}
.skill-head b{font-family:var(--display)}
.bar{height:8px;background:var(--birch-2);border:1.5px solid var(--pine);border-radius:99px;overflow:hidden}
.bar i{display:block;height:100%;background:var(--aurora-light)}
.drawer-actions{margin-top:16px;padding-bottom:20px}

/* ---------- dialogi ---------- */
.overlay{
  position:fixed;inset:0;z-index:6;display:grid;place-items:center;padding:18px;
  background:rgba(12,26,22,.5);animation:fade .16s ease
}
@keyframes fade{from{opacity:0}to{opacity:1}}
.dialog{width:min(660px,100%);max-height:88vh;display:flex;flex-direction:column;animation:rise .2s ease}
@keyframes rise{from{transform:translateY(12px);opacity:0}to{transform:none;opacity:1}}
.dialog h2{font-size:25px;margin-bottom:12px;max-width:32ch}
.dialog-body{overflow-y:auto;font-size:15px}
.dialog-body p{margin:0 0 11px}
.dialog-actions{display:flex;flex-direction:column;gap:8px;margin-top:16px}
.opt{
  font-family:var(--body);font-size:14.5px;text-align:left;cursor:pointer;
  background:#fffdf7;border:2px solid rgba(22,51,44,.4);border-radius:12px;padding:12px 15px;color:var(--pine)
}
.opt:hover{border-color:var(--pine);background:#fff}
.opt.primary{background:var(--falu);color:#fff6ef;border-color:var(--pine);font-family:var(--display);font-weight:600}
.opt.dim{opacity:.5}
.opt:disabled{cursor:default}

.stepbar{display:flex;gap:5px;margin-bottom:14px}
.stepbar i{flex:1;height:5px;border-radius:99px;background:var(--birch-2);border:1.5px solid rgba(22,51,44,.3)}
.stepbar i.done{background:var(--aurora-light)}
.stepbar i.now{background:var(--sun)}

.viral-card{
  border:2px solid var(--pine);border-radius:12px;padding:13px;margin:12px 0;background:#fffdf7
}
.viral-card .viral{font-family:var(--display);font-size:10.5px;letter-spacing:.14em;color:var(--falu);margin-bottom:6px}
.viral-card strong{display:block;font-family:var(--display);font-size:17px;line-height:1.15;margin-bottom:6px}
.viral-card span{font-size:11.5px}
.source-list{display:flex;flex-direction:column;gap:6px;margin:12px 0}
.source{border-left:4px solid var(--aurora);background:#fffdf7;border-radius:0 9px 9px 0;padding:9px 12px;font-size:13.5px}
.chat-quote{
  background:var(--pine);color:var(--birch);border-radius:14px 14px 14px 4px;
  padding:11px 15px;margin:12px 0;font-size:14.5px;max-width:82%
}
.feedback{border-radius:12px;padding:12px 14px;margin-top:12px;border:2px solid}
.feedback p{margin:0;font-size:13.5px}
.fb-skill{font-family:var(--display);font-size:11px;letter-spacing:.1em;text-transform:uppercase;margin-bottom:5px}
.feedback.good{background:#e8f5ee;border-color:var(--aurora)}
.feedback.good .fb-skill{color:var(--aurora)}
.feedback.ok{background:#fdf4e2;border-color:var(--sun)}
.feedback.ok .fb-skill{color:#a97a17}
.feedback.bad{background:#fbeae5;border-color:var(--falu)}
.feedback.bad .fb-skill{color:var(--falu)}
.score{display:flex;align-items:baseline;gap:8px;margin:6px 0 12px}
.score b{font-family:var(--display);font-size:40px;line-height:1;color:var(--falu)}
.score span{font-size:13px;color:var(--pine-soft)}
.rewards{display:flex;flex-direction:column;gap:8px;margin-top:12px}
.rw{display:flex;gap:11px;align-items:center;border:2px dashed rgba(22,51,44,.35);border-radius:12px;padding:10px 13px}
.rw span{font-size:19px;color:var(--aurora)}
.rw strong{display:block;font-family:var(--display);font-size:14px}
.rw em{font-style:normal;font-size:12px;color:var(--pine-soft)}
.keys{list-style:none;padding:0;margin:10px 0;display:flex;flex-direction:column;gap:6px;font-size:13.5px}

/* ---------- pienet näytöt ---------- */
@media (max-width:900px){
  .start-grid{grid-template-columns:1fr;gap:16px;align-content:start;overflow-y:auto}
  .start-wrap{background:linear-gradient(180deg,rgba(245,240,230,.95) 0 70%,rgba(245,240,230,.7))}
  .pitch h1{font-size:32px}
  .pitch .lead{font-size:14.5px}
  .bullets{display:none}
  .creator-body{grid-template-columns:1fr;overflow-y:auto}
  #creatorCanvas{min-height:200px;max-height:34vh}
  .hud-br .help{display:none}
  .objective strong{font-size:13.5px}
  #minimap{width:100px;height:100px}
  .dialog{padding:18px}
  .dialog h2{font-size:21px}
}
@media (max-height:560px){
  .ctrlbar{display:none}
}
@media (prefers-reduced-motion:reduce){
  *{animation-duration:.01ms !important;transition-duration:.01ms !important}
}

/* ---------- IT-osaamiskartoitus ---------- */
.itblock{margin-top:18px;border-top:2px dashed rgba(22,51,44,.3);padding-top:14px}
.itscore{display:flex;align-items:baseline;gap:9px;margin-bottom:10px}
.itscore b{font-family:var(--display);font-size:28px;line-height:1;color:var(--aurora)}
.itscore span{font-size:12.5px;color:var(--pine-soft)}
.catbars{margin:14px 0 4px}
.catbars .bar i{background:var(--sun)}

.resulttext{
  width:100%;font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:13px;
  border:2px solid var(--pine);border-radius:11px;padding:11px;background:#fffdf7;color:var(--pine);resize:vertical
}

.vehicle{
  position:absolute;left:50%;bottom:calc(16% + 52px);transform:translateX(-50%);
  font-family:var(--display);font-weight:600;white-space:nowrap
}

/* ---------- oikean vastauksen näyttäminen ---------- */
.opt.right{
  border-color:var(--aurora);background:#e8f5ee;opacity:1;
  box-shadow:inset 3px 0 0 var(--aurora)
}
.opt.right::after{
  content:"✓ oikea vastaus";display:block;margin-top:4px;
  font-family:var(--display);font-size:10.5px;letter-spacing:.12em;
  text-transform:uppercase;color:var(--aurora)
}
.opt.wrong{border-color:var(--falu);background:#fbeae5;opacity:.85}
.answerbox{
  border:2px solid var(--aurora);border-radius:12px;padding:12px 14px;margin-top:10px;
  background:#f2faf5
}
.answerbox .fb-skill{color:var(--aurora);margin-bottom:6px}
.answerbox .ans{margin:0 0 4px;font-family:var(--display);font-size:14.5px;font-weight:600;line-height:1.25}
.answerbox .why{margin:0 0 10px;font-size:13.5px;color:#274a41}
.answerbox .why:last-child{margin-bottom:0}

/* ---------- vapaa keskustelu ---------- */
.chat{width:min(620px,100%);max-height:88vh;display:flex;flex-direction:column;gap:12px}
.chat-head{display:flex;justify-content:space-between;align-items:flex-start;gap:12px}
.chat-head h2{font-size:19px;color:var(--pine-soft);font-weight:500}
.chat-tools{display:flex;align-items:center;gap:8px}
.mode{
  font-family:var(--display);font-size:10px;letter-spacing:.12em;text-transform:uppercase;
  border:2px solid rgba(22,51,44,.35);border-radius:999px;padding:3px 9px;color:var(--pine-soft)
}
.mode.ai{border-color:var(--aurora);color:var(--aurora);background:#e8f5ee}
.chat-log{
  flex:1;min-height:180px;max-height:46vh;overflow-y:auto;display:flex;flex-direction:column;gap:9px;
  border:2px solid rgba(22,51,44,.25);border-radius:12px;padding:12px;background:#fffdf7
}
.bubble{max-width:86%;border-radius:14px 14px 14px 4px;padding:9px 13px;background:var(--birch-2);font-size:14.5px}
.bubble b{display:block;font-family:var(--display);font-size:10.5px;letter-spacing:.1em;text-transform:uppercase;color:var(--aurora);margin-bottom:3px}
.bubble.me{align-self:flex-end;border-radius:14px 14px 4px 14px;background:var(--pine);color:var(--birch)}
.bubble.me b{color:rgba(245,240,230,.62)}
.bubble .fallbacknote{display:block;margin-top:6px;font-style:normal;font-size:11.5px;color:var(--falu)}
.chat-chips{display:flex;flex-wrap:wrap;gap:6px}
.chip{
  font-family:var(--body);font-size:12.5px;cursor:pointer;background:transparent;color:var(--pine);
  border:2px dashed rgba(22,51,44,.35);border-radius:999px;padding:5px 12px
}
.chip:hover{border-style:solid;border-color:var(--aurora);background:#e8f5ee}
.chat-input{display:flex;gap:8px}
.chat-input input{
  flex:1;font-family:var(--body);font-size:15px;padding:11px 13px;
  border:2px solid var(--pine);border-radius:11px;background:#fffdf7;color:var(--pine)
}
.chat-input input:focus{outline:3px solid var(--sun);outline-offset:1px}
.chat-input .btn{white-space:nowrap}

/* tekoälyasetukset profiilissa */
.aisettings{
  margin-top:16px;border:2px dashed rgba(22,51,44,.3);border-radius:12px;padding:10px 13px
}
.aisettings summary{font-family:var(--display);font-size:13px;cursor:pointer}
.aisettings label{display:block;font-size:11.5px;font-weight:600;margin:9px 0 4px;color:var(--pine-soft)}
.aisettings input{
  width:100%;font-family:var(--body);font-size:13.5px;padding:8px 10px;
  border:2px solid rgba(22,51,44,.4);border-radius:9px;background:#fffdf7;color:var(--pine)
}
.airow{display:flex;gap:8px;margin-top:10px}
.airow .btn{flex:1;font-size:13px;padding:8px 10px}

@media (max-width:900px){
  .chat-log{max-height:40vh}
  .chat-head h2{font-size:15px}
}

/* ---------- oma taitoarvio ---------- */
.opt.scale{padding:10px 14px}
.bar{position:relative}
.bar u{position:absolute;top:-3px;width:2px;height:14px;background:var(--pine);border-radius:2px}
.skill-head em{font-style:normal;font-size:10.5px;letter-spacing:.06em;text-transform:uppercase;margin-left:6px}
.skill-head em.dhigh{color:var(--falu)}
.skill-head em.dlow{color:var(--aurora)}

/* ---------- osaamismerkit ---------- */
.badgegrid{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:8px;margin-top:10px}
.badge{
  display:flex;flex-direction:column;align-items:center;gap:3px;cursor:pointer;
  background:transparent;border:none;padding:2px;font-family:var(--body);min-width:0
}
.badgepic{position:relative;width:64px;height:64px;max-width:64px;aspect-ratio:1/1;flex:none}
.badgepic img{display:block;width:100%;height:100%;object-fit:contain;filter:drop-shadow(2px 2px 0 rgba(22,51,44,.18))}
.badgepic.locked img{filter:grayscale(1) opacity(.36) drop-shadow(2px 2px 0 rgba(22,51,44,.12))}
.badgelock{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);padding:3px 5px;border-radius:5px;background:rgba(22,51,44,.82);color:#fff!important;font-size:7px!important;font-weight:800!important;letter-spacing:.08em;white-space:nowrap}
.badge span{font-size:9.5px;line-height:1.15;text-align:center;color:var(--pine-soft)}
.badge.on span{color:var(--pine);font-weight:600}
.badgeaward{display:flex;gap:16px;align-items:flex-start;margin:4px 0 10px}
.badgeaward .badgepic.large{width:168px;max-width:168px}
.badgeaward .badgepic.large img{filter:drop-shadow(4px 4px 0 rgba(22,51,44,.2))}
.badgeaward .badgepic.large.locked img{filter:grayscale(1) opacity(.38) drop-shadow(4px 4px 0 rgba(22,51,44,.12))}
.badgeaward p{margin:0 0 7px;font-size:14px}
.badgecriteria{margin:5px 0 10px;padding-left:20px;font-size:13px;line-height:1.35}
.badgecriteria li{margin:0 0 5px}
.badgekeywords{font-size:12px!important;color:var(--pine-soft)}
@media (max-width:900px){
  .badgeaward{flex-direction:column;text-align:center}
  .badgegrid{grid-template-columns:repeat(3,1fr)}
}

/* Näppäinvihje dialogissa - piilotetaan kosketuslaitteella, jolla numero/Enter eivät ole käytössä */
.dialog-keyhint{text-align:center;opacity:.75}
body.touch .dialog-keyhint{display:none}

/* uusien pisteiden lomakekentät dialogissa */
#strengthOwn, .fbtext{
  width:100%;font-family:var(--body);font-size:14px;padding:9px 11px;
  border:2px solid rgba(22,51,44,.4);border-radius:9px;background:#fffdf7;color:var(--pine)
}
#strengthOwn:focus, .fbtext:focus{outline:3px solid var(--sun);outline-offset:1px}
.wbtn.strengthopt{font-size:12px}

/* ---------- yhteinen chat (moninpeli) ---------- */
.mp-panel{
  position:fixed;right:14px;bottom:14px;width:min(340px,92vw);z-index:7;
  background:var(--birch);border:2px solid var(--pine);border-radius:14px;
  box-shadow:var(--shadow-lg);padding:12px;display:flex;flex-direction:column;gap:8px
}
.mp-head{display:flex;align-items:center;gap:8px}
.mp-head strong{font-family:var(--display);font-size:14px;flex:1}
.mp-status{
  font-size:10.5px;letter-spacing:.08em;text-transform:uppercase;
  border:2px solid rgba(22,51,44,.3);border-radius:999px;padding:2px 8px;color:var(--pine-soft)
}
.mp-status.on{border-color:var(--aurora);color:var(--aurora);background:#e8f5ee}
.mp-log{
  height:170px;overflow-y:auto;display:flex;flex-direction:column;gap:5px;
  border:2px solid rgba(22,51,44,.25);border-radius:11px;padding:9px;background:#fffdf7;font-size:13.5px
}
.mp-msg b{color:var(--aurora);font-family:var(--display);font-size:11.5px}
.mp-msg.me{text-align:right;color:var(--pine)}
.mp-msg.me b{color:var(--pine-soft)}
.mp-msg.warn{color:var(--falu);font-size:12px}
.mp-quick{display:flex;flex-wrap:wrap;gap:5px;max-height:92px;overflow-y:auto}
.mp-quick .chip{font-size:11.5px;padding:4px 9px}
.mp-input{display:flex;gap:6px}
.mp-input input{
  flex:1;font-family:var(--body);font-size:14px;padding:8px 10px;
  border:2px solid var(--pine);border-radius:10px;background:#fffdf7;color:var(--pine)
}
.mp-input .btn{padding:8px 12px;font-size:13px}
.mp-note{font-size:11px;margin:0}
.iconbtn b{font-size:10px;margin-left:3px;color:var(--aurora)}
@media (max-width:900px){ .mp-panel{left:14px;right:14px;width:auto} .mp-log{height:130px} }

/* lue ääneen -nappi dialogissa */
.speakbtn{font-size:12.5px;padding:6px 12px;align-self:flex-start;margin-top:8px}
body.touch .speakbtn{align-self:stretch}

/* ---------- Palauteseinä ---------- */
.fbw-overlay{z-index:9;place-items:stretch;padding:clamp(8px,2vw,24px)}
.fbw-shell{
  width:min(1500px,100%);height:min(92vh,900px);margin:auto;padding:18px;
  display:flex;flex-direction:column;gap:14px;overflow:hidden;animation:rise .2s ease
}
.fbw-head{display:flex;align-items:flex-start;justify-content:space-between;gap:18px}
.fbw-head h2{font-size:clamp(25px,3vw,36px)}
.fbw-head .fine{margin-top:5px}
.fbw-headtools{display:flex;align-items:center;gap:10px;flex-wrap:wrap;justify-content:flex-end}
.fbw-access{
  font-family:var(--display);font-size:10.5px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;
  border:2px solid rgba(22,51,44,.35);border-radius:999px;padding:5px 10px;background:#fffdf7;color:var(--pine-soft)
}
.fbw-access.write{border-color:var(--falu);background:#fbeae5;color:var(--falu)}
.fbw-access.read{border-color:var(--aurora);background:#e8f5ee;color:#176b64}
.fbw-status{
  font-family:var(--display);font-size:10.5px;font-weight:600;letter-spacing:.06em;text-transform:uppercase;
  border:2px solid rgba(22,51,44,.28);border-radius:999px;padding:5px 10px;color:var(--pine-soft);background:#fffdf7
}
.fbw-status.shared{border-color:var(--aurora);color:#176b64;background:#e8f5ee}
.fbw-status.local{border-color:var(--sun);color:#8a6414;background:#fff5d9}
.fbw-toolbar{display:grid;grid-template-columns:1fr auto 1fr;align-items:center;gap:12px}
.fbw-weeknav{display:flex;gap:6px;align-items:center}
.fbw-weeknav .btn{padding:7px 11px;font-size:12.5px}
.fbw-weeklabel{font-family:var(--display);font-size:14px;text-align:center}
#fbWallNew{justify-self:end;padding:9px 14px;font-size:13.5px}
.fbw-form{
  border:2px solid var(--pine);border-radius:14px;background:#fffdf7;padding:14px;
  display:grid;grid-template-columns:minmax(220px,.75fr) minmax(220px,1fr) minmax(320px,1.5fr) auto;
  gap:9px 12px;align-items:end
}
.fbw-formintro{grid-column:1;grid-row:1 / span 3;align-self:start;padding-right:8px}
.fbw-formintro h3{font-size:18px;margin-bottom:5px}
.fbw-form label{font-size:11px;font-weight:700;color:var(--pine-soft);letter-spacing:.04em;text-transform:uppercase}
.fbw-form label[for="fbWallSession"]{grid-column:2;grid-row:1}
#fbWallSession{grid-column:2;grid-row:2}
.fbw-form label[for="fbWallText"]{grid-column:3;grid-row:1}
#fbWallText{grid-column:3;grid-row:2 / span 2}
.fbw-form input,.fbw-form select,.fbw-form textarea{
  width:100%;font-family:var(--body);font-size:14px;color:var(--pine);background:var(--birch);
  border:2px solid rgba(22,51,44,.45);border-radius:10px;padding:10px 11px;resize:vertical
}
.fbw-form input:focus,.fbw-form select:focus,.fbw-form textarea:focus{outline:3px solid var(--sun);outline-offset:1px;border-color:var(--pine)}
.fbw-form textarea{min-height:88px}
.fbw-formmsg{grid-column:2;grid-row:3;margin:0;color:var(--falu);min-height:18px}
.fbw-formactions{grid-column:4;grid-row:2 / 4;display:flex;flex-direction:column;gap:7px;align-self:end}
.fbw-formactions .btn{font-size:12.5px;padding:9px 12px;white-space:nowrap}
.fbw-columns{
  flex:1;min-height:0;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));
  gap:12px;overflow:hidden;padding:2px 2px 10px
}
.fbw-day{
  min-width:0;height:100%;display:flex;flex-direction:column;background:#e9e2d4;
  border:2px solid rgba(22,51,44,.45);border-radius:14px;overflow:hidden;scroll-snap-align:start
}
.fbw-day.today{border-color:var(--falu);box-shadow:inset 0 4px 0 var(--falu)}
.fbw-dayhead{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;padding:11px 12px;border-bottom:2px solid rgba(22,51,44,.22);background:#f6f0e5}
.fbw-dayhead h3{font-size:16px}.fbw-dayhead span{display:block;font-family:var(--display);font-size:12px;color:var(--pine-soft)}
.fbw-scheduled-topic{max-width:62%;font-family:var(--display);font-size:12px;line-height:1.25;text-align:right;color:var(--falu);overflow-wrap:anywhere}
.fbw-cardlist{flex:1;min-height:0;overflow-y:auto;padding:9px;display:flex;flex-direction:column;gap:9px}
.fbw-card{
  background:#fffdf7;border:2px solid rgba(22,51,44,.5);border-radius:11px;padding:11px 11px 9px;
  box-shadow:2px 2px 0 rgba(22,51,44,.12)
}
.fbw-card:nth-child(3n+1){transform:rotate(-.35deg)}
.fbw-card:nth-child(3n+2){transform:rotate(.25deg)}
.fbw-topic{
  display:inline-block;font-family:var(--display);font-size:10.5px;font-weight:700;letter-spacing:.055em;text-transform:uppercase;
  color:#fff7ee;background:var(--falu);border-radius:999px;padding:4px 8px;margin-bottom:8px;max-width:100%;overflow-wrap:anywhere
}
.fbw-text{margin:0;white-space:pre-wrap;overflow-wrap:anywhere;font-size:13.5px;line-height:1.45;color:var(--pine)}
.fbw-meta{margin-top:9px;padding-top:7px;border-top:1px dashed rgba(22,51,44,.25);font-size:10.5px;color:var(--pine-soft)}
.fbw-empty{margin:auto;text-align:center;color:var(--pine-soft);font-size:12.5px;padding:24px 10px}

@media (max-width:900px){
  .fbw-overlay{padding:0}.fbw-shell{height:100vh;border-radius:0;border-left:0;border-right:0;padding:12px;box-shadow:none}
  .fbw-headtools .fbw-status{display:none}
  .fbw-access{font-size:9.5px}
  .fbw-toolbar{grid-template-columns:1fr auto;grid-template-areas:"week new" "nav nav"}
  .fbw-weeklabel{grid-area:week;text-align:left}.fbw-weeknav{grid-area:nav}.fbw-weeknav .btn:nth-child(2){flex:1}
  #fbWallNew{grid-area:new}
  .fbw-form{display:flex;flex-direction:column;align-items:stretch;max-height:52vh;overflow:auto}
  .fbw-formintro{padding:0}.fbw-formactions{display:grid;grid-template-columns:1fr 1fr}.fbw-formmsg{min-height:0}
  .fbw-columns{grid-template-columns:repeat(2,minmax(82vw,1fr));overflow-x:auto;scroll-snap-type:x proximity}
  .fbw-day{scroll-snap-align:start}
  .fbw-scheduled-topic{max-width:55%;font-size:11px}
}

/* Torin verkkokartoitusten klikattava linkki */
.external-form-link{display:block;text-decoration:none;text-align:center;margin-top:12px}

/* Yhteiset pelisäännöt */
.rules-intro{background:#e8f2f6;border-left:5px solid #4f89a7;border-radius:0 10px 10px 0;padding:10px 12px;margin:0 0 12px;line-height:1.45}
.rules-list{counter-reset:rule;margin:0;padding:0;list-style:none;display:flex;flex-direction:column;gap:8px}
.rules-list li{counter-increment:rule;position:relative;background:#fffdf7;border:1.5px solid rgba(22,51,44,.24);border-radius:11px;padding:10px 11px 9px 48px;line-height:1.4}
.rules-list li::before{content:counter(rule);position:absolute;left:11px;top:10px;width:26px;height:26px;border-radius:50%;display:grid;place-items:center;background:var(--pine);color:var(--birch);font-family:var(--display);font-weight:700;font-size:12px}
.rules-list li strong{font-family:var(--display);font-size:14px;color:var(--pine)}
.rules-list li p{margin:4px 0 0!important;color:var(--pine-soft);font-size:13.5px}
.rules-highlight{margin-top:12px;padding:12px 14px;border:2px solid var(--sun);border-radius:12px;background:#fff7dc;line-height:1.45}

/* ========================================================================== 
   v2.56 WEB Hardened — puhelin-, tietosuoja- ja palvelinhionta
   ========================================================================== */
.install-btn{margin-top:12px}
.install-hint strong{font-family:var(--display)}
.rotate-hint{display:none}
.touch-camera,.touch-brake{display:none}

body.touch{
  overscroll-behavior:none;
  user-select:none;
  -webkit-user-select:none;
}
body.touch input,body.touch textarea,body.touch [contenteditable="true"]{
  user-select:text;-webkit-user-select:text
}
body.touch .prompt kbd{display:none}
body.touch .prompt{
  bottom:calc(102px + env(safe-area-inset-bottom));
  max-width:min(56vw,430px);padding:7px 12px;font-size:12.5px;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
body.touch .stick{
  left:calc(18px + env(safe-area-inset-left));
  bottom:calc(18px + env(safe-area-inset-bottom));
  width:132px;height:132px;
  border:2px solid rgba(22,51,44,.58);
  background:rgba(245,240,230,.48);
  box-shadow:0 6px 22px rgba(14,26,24,.16);
  z-index:6;
}
body.touch .knob{
  width:60px;height:60px;margin:-30px 0 0 -30px;
  background:rgba(245,240,230,.97);
}
body.touch .touch-action{
  right:calc(18px + env(safe-area-inset-right));
  bottom:calc(18px + env(safe-area-inset-bottom));
  width:86px;height:86px;
  padding:6px;border-radius:50%;font-size:13px;line-height:1.05;
  letter-spacing:.025em;text-transform:uppercase;z-index:8;
  touch-action:manipulation;
}
body.touch .touch-action.ready{background:var(--sun)}
body.touch .touch-action:not(.ready){opacity:.58;background:var(--birch-2)}
body.touch .touch-brake{
  position:absolute;display:grid;place-items:center;
  right:calc(116px + env(safe-area-inset-right));
  bottom:calc(28px + env(safe-area-inset-bottom));
  width:68px;height:68px;border-radius:50%;
  border:2px solid var(--pine);background:rgba(245,240,230,.92);color:var(--pine);
  box-shadow:var(--shadow);font-family:var(--display);font-weight:700;font-size:11px;
  letter-spacing:.04em;pointer-events:auto;touch-action:none;z-index:8;
}
body.touch .touch-brake.pressed{
  transform:translate(2px,2px);box-shadow:1px 1px 0 rgba(22,51,44,.24);
  background:var(--falu);color:#fff6ef;
}
body.touch .touch-camera{
  display:block;position:absolute;
  right:calc(8px + env(safe-area-inset-right));
  bottom:calc(112px + env(safe-area-inset-bottom));
  width:min(42vw,320px);height:min(38vh,230px);
  border-radius:24px;pointer-events:auto;touch-action:none;z-index:3;
  background:linear-gradient(135deg,rgba(245,240,230,.015),rgba(245,240,230,.08));
}
body.touch .touch-camera span{
  position:absolute;right:12px;bottom:8px;
  font-family:var(--display);font-size:9px;font-weight:700;letter-spacing:.12em;
  color:rgba(245,240,230,.74);text-shadow:0 1px 3px rgba(14,26,24,.7);
  pointer-events:none;
}
body.touch .hud-bl{bottom:calc(164px + env(safe-area-inset-bottom))}
body.touch .hud-br{right:calc(12px + env(safe-area-inset-right));bottom:auto;top:calc(76px + env(safe-area-inset-top))}
body.touch .hud-br .chips{font-size:10.5px;padding:6px 9px}
body.touch .vehicle{display:none !important;}
body.touch .hud-tl{top:calc(8px + env(safe-area-inset-top));left:calc(8px + env(safe-area-inset-left));gap:5px;max-width:48vw}
body.touch .hud-tr{top:calc(8px + env(safe-area-inset-top));right:calc(8px + env(safe-area-inset-right));gap:5px}
body.touch .mp-presence{top:calc(8px + env(safe-area-inset-top));max-width:36vw;padding:5px 7px}
body.touch .mp-presence strong{font-size:9px}
body.touch .mp-presence span{font-size:8px;margin-top:2px}
body.touch .panel{border-width:1.5px;border-radius:10px;box-shadow:2px 2px 0 rgba(22,51,44,.18)}
body.touch .day{font-size:9.5px;padding:5px 8px}
body.touch .objective{padding:6px 8px;gap:6px}
body.touch .objective small{font-size:7.5px}
body.touch .objective strong{font-size:11.5px;max-width:31vw;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
body.touch .objective strong em{font-size:9.5px}
body.touch .dist{font-size:9.5px}
body.touch .obj-arrow{font-size:14px}
body.touch .profile{padding:4px 6px;gap:5px}
body.touch .profile .ring{width:34px;height:34px}
body.touch .profile .ring b{width:25px;height:25px;font-size:9px}
body.touch .profile .pmeta{display:none}
body.touch .iconbtn{padding:7px 9px;font-size:13px}
body.touch #minimap{width:82px;height:82px}
body.touch .area{font-size:9.5px;padding:5px 7px;max-width:110px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

/* Puhelimen vaakataso: pelialueelle jätetään mahdollisimman paljon tilaa. */
@media (pointer:coarse) and (orientation:landscape) and (max-height:620px){
  .start-wrap{padding:12px 16px calc(10px + env(safe-area-inset-bottom));}
  .start-wrap .mast{margin-bottom:7px}
  .start-grid{grid-template-columns:minmax(0,1.25fr) minmax(260px,.75fr);gap:14px;align-items:center;overflow:auto}
  .pitch h1{font-size:clamp(25px,4.6vw,38px)}
  .pitch .lead{font-size:12.5px;line-height:1.35;margin-top:8px}
  .pitch .bullets{display:none}
  .start-card{padding:15px}
  .start-card .fine{font-size:10.5px}
  .ctrlbar{display:none}
  .creator{padding:8px 12px calc(8px + env(safe-area-inset-bottom))}
  .creator-head{margin-bottom:6px}
  .creator-body{grid-template-columns:minmax(230px,.8fr) minmax(340px,1.2fr);gap:10px;overflow:hidden;min-height:0}
  .creator-body .card{padding:12px}
  #creatorCanvas{min-height:0;max-height:none;height:calc(100vh - 150px)}
  .closet{overflow-y:auto;max-height:calc(100vh - 76px)}
  .wlist{gap:8px}
  .wrow{margin-bottom:8px}
  .wbtn{padding:7px 8px}
  body.touch .hud-bl{bottom:calc(150px + env(safe-area-inset-bottom))}
}

/* Pystyasento toimii, mutta pelin kannalta vaakatasoa suositellaan selvästi. */
@media (pointer:coarse) and (orientation:portrait){
  #gameUi.active .rotate-hint{display:flex}
  .rotate-hint{
    position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);
    width:min(84vw,360px);padding:13px 16px;border:2px solid var(--pine);border-radius:14px;
    background:rgba(245,240,230,.96);box-shadow:var(--shadow-lg);z-index:20;
    flex-direction:column;text-align:center;pointer-events:none;
  }
  .rotate-hint strong{font-family:var(--display);font-size:15px}
  .rotate-hint span{font-size:11px;color:var(--pine-soft)}
  body.touch .stick{width:118px;height:118px}
  body.touch .touch-camera{width:44vw;height:30vh}
}

@media (pointer:coarse) and (max-width:520px){
  body.touch .hud-br .chips{display:none}
  body.touch .objective strong{max-width:28vw}
}

@media (pointer:coarse) and (orientation:landscape) and (max-height:620px){
  .overlay{padding:7px calc(8px + env(safe-area-inset-right)) 7px calc(8px + env(safe-area-inset-left))}
  .dialog,.chat{max-height:96vh;width:min(760px,96vw);padding:12px}
  .dialog h2{font-size:19px;margin-bottom:7px}
  .dialog-body{font-size:12.5px;line-height:1.35}
  .dialog-body p{margin-bottom:7px}
  .dialog-actions{gap:5px;margin-top:8px}
  .opt{padding:8px 10px;font-size:12px}
  .keys{gap:3px;font-size:12px;margin:6px 0}
  .drawer-panel{width:min(430px,76vw)}
  .chat-log{max-height:36vh}
}


/* v2.69 — Rovaniemen reaaliaikainen sää */
.weather-hud{display:flex;align-items:baseline;gap:7px;padding:7px 10px;white-space:nowrap}
.weather-hud strong{font-family:var(--display);font-size:12px;letter-spacing:.02em}
.weather-hud span{font-size:10.5px;color:var(--pine-soft)}
body.touch .weather-hud{padding:5px 7px;gap:5px;max-width:46vw;overflow:hidden}
body.touch .weather-hud strong{font-size:9.5px}
body.touch .weather-hud span{font-size:8.5px;overflow:hidden;text-overflow:ellipsis}
