/* Aukuro medis (/medis/): game-GUI tree. Dark-only page on the site design system (site.css tokens, pixel fonts). */
:root {
  --mt-bg: #0b0a14;
  --mt-prof: #ffc83d;
  --mt-kunas: #4fd6c8;
  --mt-kova: #ff5555;
  --mt-tip-bg: rgba(16, 0, 16, .96);
  --mt-tip-rim: #2d0b66;
  --mt-panel-w: 380px;
  --mt-bar-h: 56px;
}
html, body.medis { height: 100%; }
body.medis { overflow: hidden; background: radial-gradient(ellipse at 50% 40%, #1b1630 0%, #0f0d1c 45%, var(--mt-bg) 80%) fixed; }
body.medis .topbar { position: relative; }
main.mt-app { width: 100%; max-width: none; margin: 0; padding: 0; display: flex; flex-direction: column;
  height: calc(100dvh - 56px); min-height: 0; }

/* UI chrome is not text (site rule): no selection, no I-beam/help cursors, pointer only on clickables */
.mt-bar, .mt-stage, .mt-zoom, .mt-chips, .mt-handle, .mt-card .mt-head, .mt-card .mt-pill, .mt-card .mt-ring, .mt-tip,
.mt-card .mt-goal, .mt-card .mt-skills, .mt-card button {
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
.mt-card p, .mt-card li, .mt-card .mt-text { -webkit-user-select: text; user-select: text; cursor: auto; }
.mt-stage img, .mt-stage image, .mt-card img { -webkit-user-drag: none; }

/* ------------------------------------------------------------------ bar */
.mt-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 8px max(var(--gutter), env(safe-area-inset-left));
  background: rgba(8, 8, 14, .6); border-bottom: 2px solid #000; position: relative; z-index: 5; }
.mt-title { margin: 0; font: 400 26px/1 var(--font-head); color: #ffe9a8; text-shadow: 2px 2px 0 #3a2400; white-space: nowrap; cursor: default; }
.mt-who { display: flex; gap: 6px; }
.mt-who input { width: 180px; min-height: 40px; padding: 6px 10px; font: 400 18px var(--font-pixel); color: #fff; background: #000;
  border: 2px solid #a0a0a0; box-shadow: inset 2px 2px 0 #333; outline: none; }
.mt-who input:focus { border-color: #fff; }
.mt-who .mc-btn, .mt-chips .mc-btn, .mt-zoom .mc-btn { padding: 6px 12px; min-height: 40px; font-size: 16px; }
.mt-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.mt-chips .mc-btn[aria-pressed="true"] { background: linear-gradient(#8d9fe0, #6d7fc4); box-shadow: inset 2px 2px 0 #c3ceff, inset -2px -3px 0 #3e4d8f; }
.mt-chips .mc-btn i { display: inline-block; width: 10px; height: 10px; margin-right: 6px; border: 2px solid #000; vertical-align: 0; }
.mt-chips .mt-mine[hidden] { display: none; }

/* ------------------------------------------------------------------ stage */
.mt-body { position: relative; flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) var(--mt-panel-w); }
.mt-stage { position: relative; overflow: hidden; touch-action: none; cursor: grab; overscroll-behavior: contain; min-height: 0; }
.mt-stage.drag { cursor: grabbing; }
#mt-svg { display: block; width: 100%; height: 100%; }
#mt-svg text { font-family: var(--font-head); pointer-events: none; }
#mt-svg.lod-far .lbs { visibility: hidden; } /* not display:none – the layout measures these */
#mt-svg image { image-rendering: pixelated; }

/* edges */
.e { fill: none; stroke: #2a2538; stroke-width: 6; stroke-linecap: square; }
.e.lit { stroke: var(--c); stroke-width: 6; }
.lit-edges { filter: url(#mt-glow); }
.e.fresh { stroke-dasharray: 10 10; animation: mt-dash 1.2s linear infinite; }
@keyframes mt-dash { to { stroke-dashoffset: -20; } }

/* nodes = inventory slots */
.n { cursor: pointer; outline: none; }
.n .sl { fill: #8b8b8b; }
.n .bd { fill: #373737; }
.n .bl { fill: #ffffff; }
.n .rim { fill: none; stroke: var(--rc, #000); stroke-width: 4; }
.n:hover .sl, .n.sel .sl, .n:focus-visible .sl { fill: #a7a7a7; }
.n:focus-visible .focus { stroke: #fff; stroke-width: 3; fill: none; stroke-dasharray: 6 4; }
.n .focus { fill: none; }
.n .halo { fill: var(--c); opacity: 0; }
.n.got .halo { opacity: .28; filter: url(#mt-glow); }
.n.next .rim { animation: mt-pulse 1.4s ease-in-out infinite; }
.n.next .halo { opacity: .18; animation: mt-pulse 1.4s ease-in-out infinite; }
@keyframes mt-pulse { 50% { opacity: .35; stroke-width: 6; } }
.n.age image, .n.path image, .n.soon image, .n.empty image { filter: grayscale(1) brightness(.55); }
.n.age .sl, .n.path .sl, .n.soon .sl { fill: #5d5d5d; }
.n.path .rim { stroke-dasharray: 4 4; }
.n.empty .sl { fill: #4a4a4a; }
.n.none .rim { opacity: .85; }
.n .lock { display: none; }
.n.age .lock { display: inline; }
/* labels: own layer above nodes, on a dark plate; placed by the collision pass in medis.js */
.lbs, .lb { pointer-events: none; }
.lb .plate { fill: rgba(9, 7, 16, .86); stroke: #000; stroke-width: 2; shape-rendering: crispEdges; }
.lb.hub .plate, .lb.root .plate { stroke: color-mix(in srgb, var(--c) 55%, #000); }
.lb text { paint-order: stroke; stroke: #07060c; stroke-width: 3px; stroke-linejoin: round; }
.lb .lbl { font-size: 20px; fill: #f2eee4; }
.lb.hub .lbl { font-size: 26px; fill: var(--c); }
.lb.root .lbl { font-size: 28px; fill: #ffe9a8; }
.lb .lvtag { font-size: 17px; fill: var(--c); }
.lb.path .lbl, .lb.soon .lbl { fill: #b9b3c9; }
/* milestone level = caption tab under the slot, rim in the rarity colour */
.n .badge { fill: #0c0a12; stroke: var(--rc, #fff); stroke-width: 2; shape-rendering: crispEdges; }
.n .cnt { font: 400 20px var(--font-mono); fill: #fff; }
.n.path .cnt, .n.empty .cnt, .n.age .cnt { fill: #b9b3c9; }
.n .ring-bg { fill: none; stroke: #1a1626; stroke-width: 7; }
.n .ring { fill: none; stroke: var(--c); stroke-width: 7; stroke-linecap: butt; }
.n .xmark { font-size: 18px; fill: #ff7777; }
@media (prefers-reduced-motion: reduce) { .n.next .rim, .n.next .halo, .e.fresh { animation: none; } }

.mt-note { position: absolute; left: 12px; top: 12px; max-width: min(460px, calc(100% - 90px)); padding: 8px 12px;
  font: 400 17px/1.25 var(--font-pixel); color: #fff; background: rgba(0,0,0,.72); border: 2px solid #000;
  box-shadow: inset 0 0 0 2px #3a3350; pointer-events: auto; }
.mt-note a { color: #ffff55; }
.mt-zoom { position: absolute; right: 12px; bottom: 12px; display: flex; flex-direction: column; gap: 6px; }
.mt-zoom .mc-btn { width: 44px; height: 44px; padding: 0; font-size: 22px; line-height: 1; }

/* ------------------------------------------------------------------ card panel (desktop: right; phone: bottom sheet) */
.mt-panel { position: relative; overflow: auto; background: #0e0c18; border-left: 2px solid #000;
  box-shadow: inset 2px 0 0 rgba(255,255,255,.06); overscroll-behavior: contain; }
.mt-handle { display: none; }
.mt-card { padding: 14px 16px 28px; font-size: 16px; }
.mt-card.framed { margin: 12px; padding: 12px 14px 16px; background: var(--mt-tip-bg); border: 2px solid #100010;
  box-shadow: inset 0 0 0 2px var(--rc, var(--mt-tip-rim)), 0 0 0 2px #000, 4px 4px 0 2px rgba(0,0,0,.5); }
.mt-card .mt-kick { font: 400 15px var(--font-head); color: #a9a3bd; letter-spacing: .5px; }
.mt-card .mt-head { display: flex; align-items: center; gap: 12px; margin: 4px 0 8px; }
.mt-card .mt-head h2 { margin: 0; font: 400 30px/1 var(--font-head); color: var(--rc, #fff); text-shadow: 2px 2px 0 #000; }
.mt-card .mt-slot { flex: none; width: 52px; height: 52px; display: grid; place-items: center; background: #8b8b8b;
  box-shadow: inset 2px 2px 0 #373737, inset -2px -2px 0 #fff, 0 0 0 2px var(--rc, #000); }
.mt-card .mt-slot img { width: 36px; height: 36px; image-rendering: pixelated; }
.mt-card h3 { margin: 14px 0 6px; font: 400 19px var(--font-head); color: #ffe9a8; text-shadow: 1px 1px 0 #000; }
.mt-card p { margin: 6px 0; line-height: 1.45; color: #ddd8ea; }
.mt-card .muted { color: #a9a3bd; }
.mt-card .mt-pill { display: inline-block; margin: 2px 6px 2px 0; padding: 1px 7px; font: 400 15px var(--font-head); color: #140c00;
  background: var(--pc, #d6d0e6); border: 2px solid #000; }
.mt-card .mt-pill.got { --pc: #55ff55; } .mt-card .mt-pill.next { --pc: #ffff55; } .mt-card .mt-pill.age { --pc: #ff9b55; }
.mt-card .mt-pill.path { --pc: #9a94ad; } .mt-card .mt-pill.soon { --pc: #9a94ad; }
.mt-card .mt-need { margin: 8px 0; padding: 6px 10px; font: 400 17px/1.3 var(--font-pixel); color: #fff; background: rgba(0,0,0,.45);
  border-left: 4px solid var(--pc, #ffff55); }
.mt-card ul.mt-ms { list-style: none; margin: 6px 0; padding: 0; display: grid; gap: 4px; }
.mt-card ul.mt-ms li { display: grid; grid-template-columns: 38px 1fr; gap: 8px; align-items: start; padding: 5px 6px;
  background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.06); }
.mt-card ul.mt-ms li b.lv { font: 400 18px var(--font-mono); color: var(--lc, #fff); text-align: center; }
.mt-card ul.mt-ms li.got { background: rgba(85,255,85,.08); }
.mt-card ul.mt-ms li.lock { opacity: .62; }
.mt-card ul.mt-ms li .it .nm { display: none; }
.mt-card ul.mt-ms li img.ico { width: 18px; height: 18px; vertical-align: -3px; image-rendering: pixelated; }
.mt-card .mt-bar2 { height: 10px; margin: 6px 0; background: #1a1626; border: 2px solid #000; }
.mt-card .mt-bar2 b { display: block; height: 100%; background: var(--c, #55ff55); }
.mt-card button.mt-goal, .mt-card button.mt-row { display: grid; grid-template-columns: 32px 1fr auto; gap: 8px; align-items: center; width: 100%;
  margin: 4px 0; padding: 6px 8px; text-align: left; font: 400 17px var(--font-pixel); color: #fff; cursor: pointer;
  background: rgba(255,255,255,.05); border: 2px solid #000; box-shadow: inset 1px 1px 0 rgba(255,255,255,.12); }
.mt-card button.mt-goal:hover, .mt-card button.mt-row:hover { background: rgba(141,159,224,.25); }
.mt-card button img { width: 28px; height: 28px; image-rendering: pixelated; }
.mt-card button .r { color: #ffff55; white-space: nowrap; }
.mt-card .mt-skills { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 8px 0; }
.mt-card .mt-skills button { display: grid; justify-items: center; gap: 2px; padding: 6px 2px; cursor: pointer; font: 400 15px var(--font-head);
  color: #e8e4f4; background: rgba(255,255,255,.04); border: 2px solid #000; }
.mt-card .mt-skills svg { width: 52px; height: 52px; }
.mt-card .mt-who-head { display: flex; gap: 12px; align-items: center; }
.mt-card .mt-face { width: 56px; height: 56px; image-rendering: pixelated; border: 2px solid #000; background: #222; }
.mt-card .mt-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.mt-card .mt-actions .mc-btn { padding: 6px 12px; font-size: 15px; text-decoration: none; }
.mt-card a { color: #9fd3ff; }

/* tooltip (desktop hover): reuses site .title-tip */
.mt-tip { max-width: min(320px, calc(100vw - 16px)); }
.mt-tip .tt-need { margin-top: 4px; color: #ffff55; }
.mt-tip .tt-lock { color: #ff9b55; }

/* ------------------------------------------------------------------ phones: bottom sheet */
@media (max-width: 860px) {
  :root { --mt-peek: 128px; }
  main.mt-app { height: calc(100dvh - 52px); }
  .mt-bar { gap: 6px; padding: 6px max(10px, env(safe-area-inset-left)) 6px max(10px, env(safe-area-inset-right)); }
  .mt-title { font-size: 21px; }
  .mt-who { flex: 1 1 0; min-width: 0; }
  .mt-who input { flex: 1 1 0; width: 0; min-width: 0; min-height: 44px; }
  .mt-who .mc-btn { min-height: 44px; }
  .mt-chips { order: 3; width: 100%; margin: 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .mt-chips::-webkit-scrollbar { display: none; }
  .mt-chips .mc-btn { flex: none; min-height: 44px; }
  .mt-body { grid-template-columns: 1fr; }
  .mt-panel { position: absolute; left: 0; right: 0; bottom: 0; z-index: 8; height: 88%; border-left: 0; border-top: 2px solid #000;
    box-shadow: 0 -6px 0 rgba(0,0,0,.35), inset 0 2px 0 rgba(255,255,255,.08);
    transform: translateY(calc(100% - var(--mt-peek) - env(safe-area-inset-bottom))); transition: transform .22s ease-out;
    overflow: hidden; display: flex; flex-direction: column; }
  .mt-panel.half { transform: translateY(45%); }
  .mt-panel.full { transform: translateY(0); }
  .mt-panel.closed { transform: translateY(100%); }
  .mt-panel.dragging { transition: none; }
  .mt-handle { display: grid; place-items: center; flex: none; height: 30px; cursor: grab; touch-action: none; }
  .mt-handle span { width: 48px; height: 6px; background: #8b8b8b; border: 2px solid #000; }
  .mt-card { flex: 1 1 auto; overflow: auto; padding: 2px 16px calc(24px + env(safe-area-inset-bottom)); overscroll-behavior: contain; }
  .mt-card.framed { margin: 4px 10px 10px; }
  .mt-zoom { bottom: calc(var(--mt-peek) + 12px + env(safe-area-inset-bottom)); right: max(10px, env(safe-area-inset-right)); }
  .mt-note { font-size: 15px; }
}
@media (max-width: 400px) {
  .mt-title { display: none; }
  .mt-card .mt-head h2 { font-size: 26px; }
  .mt-card .mt-skills svg { width: 44px; height: 44px; }
}

/* ------------------------------------------------------------------ v2: tabs, frames, secrets (shared tree model) */
.n .qm { font: 400 30px var(--font-head); fill: #e0d4ff; pointer-events: none; }
.n.secret .sl { fill: #4a3f66; }
.n.secret .rim { stroke-dasharray: 4 4; }
.lb.secret .lbl { fill: #b9a8e8; }
.n.f-challenge .rim { stroke-width: 5; }
.n.f-goal .rim { stroke-width: 4; }
.n.todo image { filter: brightness(.85); }
.lb.got .lvtag { fill: #55ff55; }
.mt-chips .mc-btn img { width: 18px; height: 18px; image-rendering: pixelated; vertical-align: -3px; margin-right: 6px; }
.mt-card .mt-pill.secret { --pc: #b266ff; }
.mt-card .mt-pill.todo { --pc: #d6d0e6; }
.mt-card .q { display: grid; place-items: center; width: 28px; height: 28px; font: 400 22px var(--font-head); color: #e0d4ff; background: #4a3f66; }
.mt-card .mt-slot .q { width: 36px; height: 36px; font-size: 28px; }
.mt-card button.mt-row.got > span:nth-child(2) { color: #b6ffb6; }
.mt-card button.mt-row.path, .mt-card button.mt-row.age { opacity: .7; }
.mt-tip .tt-how { color: #e8c66a; }

/* ------------------------------------------------------------------ progress toward nodes (/api/player "treeReq") */
/* the edge into a node not reached yet: a bar along the part of the line only it uses (pathLength 1 → dash = share) */
.e.track { stroke: #3a3350; }
.e.prog { stroke: var(--c); stroke-linecap: butt; stroke-dasharray: 0 1; transition: stroke-dasharray .7s cubic-bezier(.2, .7, .2, 1); }
.e.prog.age { stroke: #ff9b55; }
.e.prog.secret { stroke: #b266ff; opacity: .75; }
.lb .lvtag.chip { fill: #ffe9a8; }
.lb.got .lvtag.chip { fill: #b6ffb6; }
.mt-card .mt-pill.lv { --pc: #ffe9a8; }
.mt-card ul.mt-req { list-style: none; margin: 6px 0; padding: 0; display: grid; gap: 6px; }
.mt-card ul.mt-req li { display: grid; gap: 2px; font: 400 17px/1.3 var(--font-pixel); color: #fff; }
.mt-card ul.mt-req li.ok { color: #b6ffb6; }
.mt-card ul.mt-req .mt-bar2 { display: block; margin: 0; }
.mt-card ul.mt-lvls { list-style: none; margin: 6px 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 4px; }
.mt-card ul.mt-lvls li { display: flex; justify-content: space-between; gap: 8px; min-width: 0; padding: 3px 8px; font: 400 17px var(--font-pixel);
  color: #ddd8ea; background: rgba(255,255,255,.05); border: 2px solid #000; }
.mt-card ul.mt-lvls li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-card ul.mt-lvls li b { font-weight: 400; color: #ffe9a8; white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { .e.prog { transition: none; } }

/* work icon (subclass badge / profession icon) in the Mano kelias header */
.mt-work { image-rendering: pixelated; vertical-align: -3px; margin-right: 5px; }
