/* Pelin fontit paketissa (SIL OFL 1.1, ks. OFL-*.txt) – toimii offline, ei ulkoisia pyyntöjä (QA F-03, T-015). */
@font-face { font-family: 'Bagel Fat One'; font-weight: 400; font-style: normal; font-display: swap; src: url(fonts/bagel-fat-one-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2190-2199,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Baloo 2'; font-weight: 500; font-style: normal; font-display: swap; src: url(fonts/baloo-2-latin-500-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2190-2199,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Baloo 2'; font-weight: 700; font-style: normal; font-display: swap; src: url(fonts/baloo-2-latin-700-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2190-2199,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Baloo 2'; font-weight: 800; font-style: normal; font-display: swap; src: url(fonts/baloo-2-latin-800-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2190-2199,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Bagel Fat One'; font-weight: 400; font-style: normal; font-display: swap; src: url(fonts/bagel-fat-one-latin-ext-400-normal.woff2) format('woff2'); unicode-range: U+0100-02AF,U+0304,U+0308,U+0329,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Baloo 2'; font-weight: 500; font-style: normal; font-display: swap; src: url(fonts/baloo-2-latin-ext-500-normal.woff2) format('woff2'); unicode-range: U+0100-02AF,U+0304,U+0308,U+0329,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Baloo 2'; font-weight: 700; font-style: normal; font-display: swap; src: url(fonts/baloo-2-latin-ext-700-normal.woff2) format('woff2'); unicode-range: U+0100-02AF,U+0304,U+0308,U+0329,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Baloo 2'; font-weight: 800; font-style: normal; font-display: swap; src: url(fonts/baloo-2-latin-ext-800-normal.woff2) format('woff2'); unicode-range: U+0100-02AF,U+0304,U+0308,U+0329,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }

/* Layout: one tall portrait game column, HUD floating over the canvas, menus as night-sky panels. Single dusk-to-space world, so one theme by choice. */
:root {
  --night: #0d1330;
  --night-2: #1b2452;
  --ink: #fdf3e4;
  --muted: #b8c0e0;
  --fox: #e8742f;
  --star: #ffd75e;
  --panel: rgba(13, 19, 48, 0.84);
  --line: rgba(253, 243, 228, 0.16);
  --display: "Bagel Fat One", "Baloo 2", "Trebuchet MS", system-ui, sans-serif;
  --body: "Baloo 2", "Trebuchet MS", system-ui, sans-serif;
  color-scheme: dark;
}
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  background: radial-gradient(120% 80% at 50% 0%, var(--night-2), var(--night) 70%);
  background-color: var(--night);
  color: var(--ink);
  font-family: var(--body);
  overflow: hidden;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 12px;
  box-sizing: border-box;
  display: flex;
  justify-content: center;
}
#stage {
  position: relative;
  width: 100%;
  max-width: 480px;
  height: 100%;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 0 0 1px var(--line), 0 20px 60px rgba(0, 0, 0, 0.45);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  background: var(--night);
}
canvas { display: block; width: 100%; height: 100%; cursor: crosshair; }

#hud {
  position: absolute; inset: 0 0 auto 0;
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 12px 14px; gap: 12px;
  pointer-events: none;
}
.score {
  font-family: var(--display);
  font-size: 34px; line-height: 1;
  color: var(--ink);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.25), 0 0 18px rgba(255, 215, 94, 0.35);
  font-variant-numeric: tabular-nums;
}
.alt {
  font-size: 13px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink); opacity: 0.85; margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.hud-right { display: flex; gap: 8px; pointer-events: auto; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(13, 19, 48, 0.45);
  color: var(--ink);
  display: grid; place-items: center;
  cursor: pointer; padding: 0;
  backdrop-filter: blur(4px);
}
.icon-btn:focus-visible, .btn:focus-visible { outline: 2px solid var(--star); outline-offset: 3px; }
/* Selkävarusteen nappi (T-111): rengas näyttää raketin latauksen tai sateenvarjon valmiuden */
.jet-btn { position: absolute; right: 14px; bottom: max(18px, calc(env(safe-area-inset-bottom) + 10px)); width: 70px; height: 70px; border-radius: 50%; border: 0; padding: 5px;
  background: rgba(255,255,255,0.16); cursor: pointer; touch-action: none; }
.jet-btn canvas { display: block; width: 100%; height: 100%; border-radius: 50%; background: #18204a; cursor: inherit; }
.jet-btn.ready { box-shadow: 0 0 0 3px rgba(255,215,94,0.45), 0 0 20px rgba(255,215,94,0.6); }
.jet-btn:disabled { cursor: default; }
.jet-btn:disabled canvas { background: #1d2550; }
.jet-btn.used canvas { opacity: 0.45; }
.icon-btn svg { width: 18px; height: 18px; }

.overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: linear-gradient(to bottom, rgba(13, 19, 48, 0.1), rgba(13, 19, 48, 0.55));
}
.panel {
  width: 100%; max-width: 340px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 26px 24px 22px;
  text-align: center;
  display: flex; flex-direction: column; gap: 14px;
  backdrop-filter: blur(6px);
}
.title {
  font-family: var(--display);
  font-size: clamp(44px, 13vw, 58px);
  line-height: 0.9;
  margin: 0;
  color: var(--fox);
  text-shadow: 0 3px 0 #8c3b12, 0 0 30px rgba(232, 116, 47, 0.45);
  text-wrap: balance;
}
.title span { display: block; color: var(--star); text-shadow: 0 3px 0 #9c6f12, 0 0 30px rgba(255, 215, 94, 0.45); }
.lead { margin: 0; font-size: 16px; line-height: 1.4; color: var(--muted); text-wrap: pretty; }
.how { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; text-align: left; font-size: 14px; line-height: 1.35; }
.how li { display: grid; grid-template-columns: 22px 1fr; gap: 8px; align-items: start; }
.how .dot { width: 14px; height: 14px; border-radius: 50%; margin-top: 3px; }
.btn {
  font-family: var(--display);
  font-size: 22px;
  border: 0; border-radius: 999px;
  padding: 12px 22px 10px;
  background: var(--star);
  color: #3a2605;
  cursor: pointer;
  box-shadow: 0 4px 0 #b88a1c;
}
.btn:active { transform: translateY(2px); box-shadow: 0 2px 0 #b88a1c; }
.btn.secondary { background: transparent; color: var(--ink); box-shadow: none; border: 1px solid var(--line); font-size: 18px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { border: 1px solid var(--line); border-radius: 14px; padding: 10px 8px 8px; }
.stat .k { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.stat .v { font-family: var(--display); font-size: 28px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat.wide { grid-column: 1 / -1; }
.badge {
  align-self: center;
  font-size: 13px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
  background: var(--fox); color: #fff6ea;
  border-radius: 999px; padding: 4px 12px 2px;
}
.small { font-size: 13px; color: var(--muted); margin: 0; }
/* Kentät (T-111): planeettakortit vierivässä ruudukossa */
.lvl-grid { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; align-content: start; padding: 2px; }
.lvl { position: relative; border: 1px solid var(--line); border-radius: 16px; padding: 6px 6px 8px; background: rgba(255,255,255,0.06); color: var(--ink); font-family: var(--body);
  cursor: pointer; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 1px; min-width: 0; }
.lvl canvas { width: 66px; height: 66px; }
.lvl b { font-family: var(--display); font-weight: 400; font-size: 18px; display: block; line-height: 1.1; }
.lvl span { font-size: 12px; color: var(--muted); line-height: 1.25; }
.lvl.sel { border-color: var(--star); box-shadow: inset 0 0 0 2px var(--star); background: rgba(255,215,94,0.1); }
.lvl.locked canvas { filter: grayscale(0.8) brightness(0.72); }
.lvl .lock { position: absolute; top: 6px; right: 7px; font-size: 13px; }
.lvl .chs { color: var(--star); letter-spacing: 2px; font-size: 13px; }
.chl { display: grid; gap: 3px; font-size: 12.5px; text-align: left; margin: 0 12px 6px; flex: 0 0 auto; }
.chl:empty { display: none; }
.chl .ch { display: grid; grid-template-columns: 1fr auto; gap: 6px; border: 1px solid var(--line); border-radius: 10px; padding: 3px 8px 2px; color: var(--ink); }
.chl .ch b { color: var(--star); font-variant-numeric: tabular-nums; }
.chl .ch.ok { border-color: rgba(255,215,94,.55); background: rgba(255,215,94,.08); }
.chl .ch.look { grid-template-columns: 1fr; color: #9fe8ff; }
.lvl-msg { min-height: 2.6em; flex: 0 0 auto; line-height: 1.3; padding: 0 10px; }
@media (max-height: 700px) { .chl { font-size: 11.5px; gap: 2px; } .chl .ch { padding: 2px 7px 1px; } .lvl-msg { min-height: 0; } }
#tuner .panel { max-height: 100%; overflow-y: auto; }
#tuner .panel { max-width: 380px; text-align: left; gap: 8px; }
.tune-h { font-family: var(--display); color: var(--star); font-size: 17px; margin-top: 6px; }
.tune-row { display: grid; grid-template-columns: 1fr 64px; gap: 2px 8px; align-items: center; font-size: 13px; }
.tune-row input { grid-column: 1 / -1; width: 100%; accent-color: var(--star); }
.tune-row output { text-align: right; font-variant-numeric: tabular-nums; color: var(--star); font-weight: 700; }
.tune-row.changed span::after { content: " •"; color: var(--star); }
#tuneOut { width: 100%; min-height: 110px; font: 11px ui-monospace, monospace; background: rgba(0,0,0,0.35); color: var(--ink); border: 1px solid var(--line); border-radius: 10px; padding: 6px; box-sizing: border-box; }
.tune-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.tune-btns .btn { font-size: 15px; padding: 8px 12px 6px; flex: 1 1 auto; }
/* Pesä (T-111, D-035): koko näytön pystynäkymä HCR2:n autotallin tapaan – kehityskortit ylhäällä, hahmo keskellä */
.overlay.nest { padding: 0; align-items: stretch; background: radial-gradient(120% 75% at 50% 42%, #2c3478 0%, #161b47 58%, #0b0f2e 100%); }
.nest-wrap { width: 100%; height: 100%; display: flex; flex-direction: column; gap: 8px; box-sizing: border-box;
  padding: max(10px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom)); }
.nest-top { display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 10px; }
.nest-title { font-family: var(--display); font-weight: 400; font-size: 28px; line-height: 1; margin: 0; color: var(--fox); text-shadow: 0 2px 0 #8c3b12; text-align: left; }
.nest-top .dust { font-size: 18px; }
.back-btn svg { width: 20px; height: 20px; }
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.card { position: relative; border-radius: 14px; padding: 4px 3px 5px; background: linear-gradient(#f6a54d, #db7c28); box-shadow: inset 0 0 0 2px rgba(255,255,255,0.35), 0 3px 0 #8c4a14;
  text-align: center; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; }
.card canvas { width: 44px; height: 44px; }
.card b { font-family: var(--display); font-weight: 400; font-size: 13px; line-height: 1; color: #fff; text-shadow: 0 1px 0 #8c4a14; white-space: nowrap; }
.card .lv { font-family: var(--display); font-size: 15px; line-height: 1; color: #3a1d05; }
.card .buy { font-family: var(--display); font-size: 14px; border: 0; border-radius: 9px; padding: 5px 2px 3px; width: 100%; cursor: pointer;
  background: linear-gradient(#86e47f, #3fae3a); color: #fff; text-shadow: 0 1px 0 #1d6a19; box-shadow: 0 2px 0 #1d6a19; white-space: nowrap; }
.card .buy:disabled { background: #8b8fa3; box-shadow: 0 2px 0 #50546a; text-shadow: none; color: #eceef5; cursor: default; }
.card .buy.max { background: linear-gradient(#ffe08a, #f2b632); color: #5a3a05; text-shadow: none; box-shadow: 0 2px 0 #9c6f12; }
.cards.locked .card { filter: grayscale(0.85) brightness(0.7); }
/* Mestaruus (T-121, D-038 / E7) */
.mastery { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; font-size: 12.5px; color: var(--muted); margin: -2px 2px 0; min-height: 0; }
.mastery:empty { display: none; }
.mastery b { font-family: var(--display); font-weight: 400; color: var(--star); font-size: 15px; white-space: nowrap; }
.mastery .bar { height: 8px; border-radius: 6px; background: rgba(255,255,255,0.12); overflow: hidden; position: relative; }
.mastery .bar i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #ffd75e, #ff9f1c); border-radius: 6px; }
.mastery .btn { font-size: 13px; padding: 5px 10px 3px; }
.mastery.hint { grid-template-columns: 1fr; text-align: center; font-size: 12px; }
.hero { position: relative; flex: 1 1 auto; min-height: 190px; border-radius: 22px; overflow: hidden; background: #2a3170;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.16), inset 0 -60px 60px rgba(10,14,40,0.32), 0 10px 26px rgba(0,0,0,0.35); }
.hero canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: pan-y; }
.hero-nav { position: absolute; top: 42%; left: 6px; width: 40px; height: 40px; margin-top: -20px; border-radius: 50%; border: 0; padding: 0 0 3px;
  background: rgba(13,19,48,0.32); color: #fff; font: 30px/1 var(--display); cursor: pointer; display: grid; place-items: center; }
.hero-nav.next { left: auto; right: 6px; }
.hero-nav:active { background: rgba(13,19,48,0.55); }
.hero-tag { position: absolute; left: 10px; top: 10px; font: 800 11.5px/1 var(--body); letter-spacing: 0.06em; text-transform: uppercase;
  padding: 5px 11px 4px; border-radius: 999px; background: rgba(13,19,48,0.5); color: var(--ink); white-space: nowrap; pointer-events: none; }
.hero-tag.own { background: rgba(120,230,150,0.92); color: #0c3a1c; }
.hero-tag.gold { background: var(--star); color: #3a2605; }
.hero-info { position: absolute; left: 0; right: 0; bottom: 10px; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; padding: 0 8px; }
.hero-name { font-family: var(--display); font-weight: 400; font-size: 30px; line-height: 1; color: var(--ink); text-shadow: 0 2px 0 rgba(0,0,0,0.3); }
.traits { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; }
.trait { font: 700 12px/1 var(--body); padding: 5px 9px 4px; border-radius: 999px; background: rgba(13,19,48,0.45); color: var(--ink); }
.trait.up { background: rgba(40,110,70,0.55); color: #b9f7cc; }
.trait.down { background: rgba(120,40,40,0.5); color: #ffc4bc; }
.trait.gold { background: rgba(120,90,10,0.55); color: var(--star); }
.nest-desc { margin: -2px 0 0; min-height: 1.3em; text-align: center; }
.nest-btns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.nb { display: flex; flex-direction: column; align-items: center; gap: 2px; border: 1px solid var(--line); border-radius: 16px; padding: 6px 4px 5px;
  background: rgba(255,255,255,0.07); color: var(--ink); font-family: var(--display); font-size: 15px; cursor: pointer; }
.nb canvas { width: 40px; height: 40px; }
.nb:disabled { opacity: 0.35; cursor: default; }
.nest-bottom { display: flex; flex-direction: column; gap: 4px; }
.nest-bottom .btn { font-size: 24px; padding: 13px 22px 11px; }
.nest-bottom .small { margin: 0; text-align: center; }
.btn.go { background: linear-gradient(#86e47f, #3fae3a); color: #fff; text-shadow: 0 2px 0 #1d6a19; box-shadow: 0 4px 0 #1d6a19; }
.btn.go:active { box-shadow: 0 2px 0 #1d6a19; }
.btn:disabled { opacity: 0.55; cursor: default; }
.sheet { position: absolute; inset: 0; background: rgba(5,8,25,0.62); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 6; }
.sheet-card { width: 100%; max-width: 360px; max-height: 100%; overflow-y: auto; background: #1b2152; border: 1px solid var(--line); border-radius: 22px; padding: 16px;
  display: flex; flex-direction: column; gap: 10px; text-align: center; box-shadow: 0 20px 50px rgba(0,0,0,0.5); }
.sheet-title { font-family: var(--display); font-weight: 400; font-size: 26px; margin: 0; color: var(--ink); }
.sheet-card canvas.big { width: 96px; height: 96px; margin: 0 auto; }
.sheet-card .fx { font-family: var(--display); font-size: 18px; color: var(--star); margin: 0; }
/* Pukuhuone: asut ja varusteet */
.dress-stage { position: relative; flex: 0 0 auto; height: 38%; min-height: 160px; border-radius: 22px; overflow: hidden; background: #2a3170;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.16), inset 0 -40px 50px rgba(10,14,40,0.3); }
.dress-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.tabs { display: flex; gap: 6px; }
.tab { flex: 1; display: flex; align-items: center; justify-content: center; gap: 4px; border: 1px solid var(--line); border-radius: 12px; padding: 4px 4px 3px;
  background: rgba(255,255,255,0.05); color: var(--muted); font-family: var(--display); font-size: 15px; cursor: pointer; min-width: 0; }
.tab canvas { width: 26px; height: 26px; flex: none; }
.tab.on { background: var(--star); color: #3a2605; border-color: transparent; }
.item-grid { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; align-content: start; padding: 2px; }
.item { position: relative; border: 1px solid var(--line); border-radius: 12px; padding: 3px 2px 4px; background: rgba(255,255,255,0.05); color: var(--ink);
  cursor: pointer; font-family: var(--body); display: flex; flex-direction: column; align-items: center; min-width: 0; }
.item canvas { width: 50px; height: 50px; }
.item b { font-weight: 700; font-size: 11.5px; line-height: 1.1; }
.item span { font-size: 11px; line-height: 1.2; color: var(--muted); }
.item.sel { box-shadow: inset 0 0 0 2px var(--star); }
.item.on { background: rgba(120,230,150,0.12); }
.item.on span { color: #a9f5c0; font-weight: 700; }
.item.locked canvas { opacity: 0.6; }
.item.afford span { color: var(--star); }
.dress-info { margin: 0; min-height: 2.6em; text-align: center; }
.char-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.char { position: relative; border: 1px solid var(--line); border-radius: 14px; padding: 3px 3px 6px; background: rgba(255,255,255,0.03); color: var(--ink); font-family: var(--body); cursor: pointer; text-align: center; overflow: hidden; }
.char canvas { width: 100%; height: 66px; display: block; object-fit: contain; }
.char b { font-family: var(--display); font-weight: 400; font-size: 15px; line-height: 1.1; display: block; }
.char span { font-size: 11px; color: var(--muted); line-height: 1.25; display: block; }
.char.sel { border-color: var(--star); box-shadow: inset 0 0 0 2px var(--star); }
.char.legend b { color: var(--star); }
.char.cur span { color: #a9f5c0; font-weight: 700; }
.dust { font-family: var(--display); color: var(--star); font-size: 22px; margin: 0; line-height: 1.1; font-variant-numeric: tabular-nums; }
.hud-dust { font-family: var(--display); color: var(--star); font-size: 18px; margin-top: 4px; text-shadow: 0 2px 0 rgba(0,0,0,.25); font-variant-numeric: tabular-nums; }
.lvl.locked { background: rgba(0,0,0,0.18); }
.lvl.locked b { color: var(--muted); }
.lvl .price, .char .price { color: var(--star); font-weight: 800; }
.lvl .dm { display: block; }
.lvl.afford, .char.afford { border-color: rgba(255,215,94,.55); }
.char.locked canvas { opacity: .82; filter: saturate(.7); }
.sheet .char-grid { max-height: 60vh; overflow-y: auto; }
.parts { display: grid; gap: 8px; text-align: left; }
.part { display: grid; grid-template-columns: 1fr auto; gap: 3px 10px; align-items: center; border: 1px solid var(--line); border-radius: 14px; padding: 8px 10px; }
.part b { font-family: var(--display); font-weight: 400; font-size: 16px; }
.part span { font-size: 12px; color: var(--muted); }
.part .bar { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(10, 1fr); gap: 3px; }
.part .bar i { height: 6px; border-radius: 3px; background: rgba(255,255,255,0.12); }
.part .bar i.on { background: var(--star); }
.part .btn { font-size: 15px; padding: 7px 12px 5px; }
.btn[disabled] { opacity: .45; cursor: default; }
.btn.glow { animation: glow 1.1s ease-in-out infinite alternate; }
@keyframes glow { to { box-shadow: 0 0 0 3px rgba(255,215,94,.5), 0 0 22px rgba(255,215,94,.55); } }
.dust-list { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; text-align: left; font-size: 14px; color: var(--muted); }
.dust-list b { color: var(--ink); text-align: right; font-variant-numeric: tabular-nums; }
.dust-list .tot { color: var(--star); font-family: var(--display); font-weight: 400; font-size: 18px; border-top: 1px solid var(--line); padding-top: 4px; }
.missions { display: grid; gap: 4px; text-align: left; font-size: 13.5px; }
.missions:empty { display: none; }
.missions .mh { font-family: var(--display); color: var(--star); font-size: 15px; }
.missions .m { display: grid; grid-template-columns: 1fr auto; gap: 8px; border: 1px solid var(--line); border-radius: 10px; padding: 4px 8px 3px; color: var(--ink); }
.missions .m b { color: var(--star); font-variant-numeric: tabular-nums; }
.missions .m.ok { border-color: rgba(255,215,94,.6); background: rgba(255,215,94,.08); }
.dev-toggle { display: flex; gap: 8px; align-items: center; justify-content: center; }
/* Koti (T-111): läpinäkyvä keskiosa – hahmo seisoo pelin maisemassa; napautus keskelle = ilohyppy */
.overlay.home { padding: 0; align-items: stretch; pointer-events: none;
  background: linear-gradient(to bottom, rgba(9,13,38,0.72) 0%, rgba(9,13,38,0.2) 36%, rgba(9,13,38,0) 52%, rgba(9,13,38,0.12) 66%, rgba(9,13,38,0.78) 100%); }
.home-wrap { width: 100%; height: 100%; max-width: 480px; margin: 0 auto; display: flex; flex-direction: column; gap: 8px; box-sizing: border-box;
  padding: max(10px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom)); }
.home-top, .home-bottom { pointer-events: auto; display: flex; flex-direction: column; gap: 8px; }
.home-bar { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
/* Seikkailijataso (T-122, D-038 / E11) */
.advlv { display: flex; align-items: center; gap: 6px; flex: 1 1 auto; max-width: 150px; }
.advlv b { font-family: var(--display); font-weight: 400; color: #0b0f2e; background: var(--star); border-radius: 999px; min-width: 26px; height: 26px; display: grid; place-items: center; font-size: 15px; }
.advlv .bar { flex: 1 1 auto; height: 7px; border-radius: 6px; background: rgba(255,255,255,0.15); position: relative; overflow: hidden; }
.advlv .bar i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #9fe8ff, #ffd75e); border-radius: 6px; }
.home-bar .icon-btn svg { width: 22px; height: 22px; }
.home-title { font-size: clamp(40px, 12vw, 54px); text-align: center; }
.home-card { width: 100%; max-width: 380px; margin: 0 auto; box-sizing: border-box; background: rgba(13,19,48,0.6); border: 1px solid var(--line); border-radius: 16px; padding: 8px 10px; }
.home-card .lead { font-size: 14px; margin-bottom: 6px; text-align: center; }
.home-card .how { font-size: 13px; gap: 5px; }
.home-space { flex: 1 1 auto; min-height: 40px; }
.home-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.home-tiles.three { grid-template-columns: repeat(3, 1fr); }
.tile { position: relative; display: flex; align-items: center; gap: 8px; border: 1px solid rgba(255,255,255,0.22); border-radius: 16px; padding: 6px 10px 6px 6px;
  background: rgba(27,33,82,0.82); color: var(--ink); cursor: pointer; text-align: left; min-width: 0; font-family: var(--body); }
.tile canvas { width: 46px; height: 46px; flex: none; }
.tile b { display: block; font-family: var(--display); font-weight: 400; font-size: 19px; line-height: 1.05; }
.tile small { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile span { min-width: 0; }
.tile.sm { flex-direction: column; gap: 0; padding: 5px 4px 6px; text-align: center; }
.tile.sm canvas { width: 38px; height: 38px; }
.tile.sm b { font-size: 16px; }
.tile .dot { position: absolute; top: 6px; right: 7px; width: 12px; height: 12px; border-radius: 50%; background: #ff5a4e; box-shadow: 0 0 0 2px #1b2152; animation: pulse 1.2s ease-in-out infinite alternate; }
@keyframes pulse { to { transform: scale(1.25); } }
.btn.big { font-size: 30px; padding: 13px 22px 11px; }
.home-foot { text-align: center; }
.link { background: none; border: 0; padding: 0; color: var(--star); font: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
/* Asetukset */
.set-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; width: 100%; max-width: 440px; margin: 0 auto; padding-bottom: 8px; }
.set-list > * { flex: none; }   /* overflow: hidden -ryhmät eivät saa kutistua vierityslistassa */
.set-h { font: 800 12px/1 var(--body); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin: 10px 6px 0; }
.set-group { background: rgba(255,255,255,0.06); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.set-group.pad { padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 12px 14px; background: none; border: 0; border-top: 1px solid var(--line);
  color: var(--ink); font: 700 16px/1.2 var(--body); text-align: left; cursor: pointer; }
.set-row:first-child { border-top: 0; }
.set-row small { display: block; font-weight: 500; font-size: 12px; color: var(--muted); margin-top: 2px; }
.set-row:active { background: rgba(255,255,255,0.06); }
.set-row.danger { color: #ff9a8f; }
.set-row .chev { font: 400 24px/1 var(--display); color: var(--muted); font-style: normal; }
.sw { position: relative; flex: none; width: 46px; height: 28px; border-radius: 999px; background: rgba(255,255,255,0.2); transition: background 0.2s; }
.sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.35); transition: transform 0.2s; }
.set-row.on .sw { background: #3fae3a; }
.set-row.on .sw::after { transform: translateX(18px); }
.set-ver { text-align: center; margin-top: 10px; }
.sheet-card .how { text-align: left; }
.sheet-card .txt { text-align: left; font-size: 14px; line-height: 1.45; color: var(--ink); margin: 0; }
.btn.danger { background: linear-gradient(#ff8a7a, #e0483a); color: #fff; text-shadow: 0 2px 0 #8c2016; box-shadow: 0 4px 0 #8c2016; }
/* Loppuruutu */
.overlay.result { padding: 0; align-items: stretch; background: linear-gradient(to bottom, rgba(9,13,38,0.5), rgba(9,13,38,0.8)); }
.res-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 400px; margin: 0 auto; text-align: center;
  box-sizing: border-box; padding: 16px 14px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 22px; }
.res-title { font-size: 40px; }
.res-actions { width: 100%; max-width: 400px; margin: 0 auto; gap: 8px; }
/* QA F-04: puhelimessa koko näyttö (ei artifaktikehystä) */
@media (max-width: 520px) { body { padding: 0; } #stage { border-radius: 0; box-shadow: none; max-width: none; } }
@media (prefers-reduced-motion: reduce) { .btn:active { transform: none; } .btn.glow, .tile.glow, .tile .dot { animation: none; } .sw, .sw::after { transition: none; } }
.tile.glow { animation: glow 1.1s ease-in-out infinite alternate; }
@media (max-height: 700px) { .home-card #homeHowBox .lead { display: none; } .home-title { font-size: 40px; } .home-card .how { font-size: 12.5px; gap: 3px; } }
