.melf-shade{position:fixed;inset:0;z-index:100020;background:rgba(6,11,9,.84);display:flex;align-items:center;justify-content:center;padding:18px;backdrop-filter:blur(7px);font-family:WaveVar2,system-ui,sans-serif;color:#e8dec1}
.melf-panel{display:flex;flex-direction:column;max-width:1040px;width:min(100%,1040px);max-height:min(95vh,850px);overflow:hidden;border-radius:22px;border:2px solid #aa9366;background:linear-gradient(125deg,#1b2f26,#111b19 60%,#2c2a21);box-shadow:0 28px 85px #000a,inset 0 0 0 4px #304437}
.melf-head{display:flex;gap:16px;align-items:center;justify-content:space-between;padding:21px 27px;background:linear-gradient(90deg,#334a35,#193128);border-bottom:2px solid #947f5d}
.melf-head h2{margin:0;font-size:clamp(22px,4vw,34px);letter-spacing:.03em;color:#ffe6a6}
.melf-head p{margin:5px 0 0;color:#c2d1ad;font-size:13px}
.melf-head button,.melf-toolbar button,.melf-card button{appearance:none;border:1px solid #c6a56e;background:#40583b;color:#fff1bc;border-radius:10px;font:inherit;cursor:pointer;padding:10px 13px}
.melf-head button:focus-visible,.melf-toolbar button:focus-visible,.melf-node:focus-visible,.melf-roster select:focus-visible{outline:3px solid #f0d176;outline-offset:3px}
.melf-main{display:grid;grid-template-columns:minmax(0,1.65fr) minmax(235px,.85fr);gap:0;overflow:auto;min-height:0}
.melf-canvas{position:relative;min-width:540px;height:490px;background:radial-gradient(ellipse at 50% 90%,#3b5e46 0%,transparent 66%),repeating-linear-gradient(90deg,transparent 0 68px,#e5d19f09 69px 70px)}
.melf-canvas svg{position:absolute;inset:0;width:100%;height:100%;overflow:visible}
.melf-node{position:absolute;transform:translate(-50%,-50%);width:158px;min-height:82px;border-radius:13px;border:2px solid #92835c;box-shadow:0 5px 17px #0008;background:linear-gradient(145deg,#384536,#1c2621);color:#e5dcbf;cursor:pointer;text-align:center;padding:9px 7px;font:inherit}
.melf-node strong{display:block;font-size:14px;color:#e9d1a0}
.melf-node small{display:block;font-size:11px;margin-top:5px;opacity:.9}
.melf-node[data-active="true"]{border-color:#c4df80;background:linear-gradient(140deg,#507150,#294c3e)}
.melf-node[data-selected="true"]{box-shadow:0 0 0 4px #dbbd6e88,0 5px 17px #000a}
.melf-node[data-locked="true"]{opacity:.60;filter:saturate(.65)}
.melf-aside{padding:18px;border-left:1px solid #8b7859;background:#172620}
.melf-aside h3{margin:0 0 10px;color:#f8d993;font-size:22px}
.melf-aside p{font-size:14px;line-height:1.55;color:#d5d4ba}
.melf-aside .melf-cost{color:#e7b989;font-size:13px;margin:14px 0}
.melf-toolbar{padding:15px 22px;border-top:1px solid #797457;background:#26392f}
.melf-toolbar h3{margin:0 0 11px;color:#ffe6b2}
.melf-roster{display:flex;gap:10px;flex-wrap:wrap;overflow:auto;max-height:185px}
.melf-roster label{display:flex;align-items:center;gap:8px;border-radius:10px;padding:8px;background:#182923;border:1px solid #546b52;font-size:12px}
.melf-roster select{background:#36503e;color:#f9ebbf;border:1px solid #997a50;border-radius:7px;padding:8px;font:inherit;max-width:145px}
.melf-foot{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:11px 23px;border-top:1px solid #75805f;background:#17231f;font-size:12px;color:#d8d2b9}
@media(max-width:740px){.melf-shade{padding:4px}
.melf-panel{max-height:99vh;border-radius:11px}
.melf-main{display:block}
.melf-canvas{height:420px;transform-origin:top left}
.melf-aside{border-left:none;border-top:1px solid #8b7859}
.melf-head{padding:12px 16px}
.melf-roster{max-height:110px}
.melf-toolbar{padding:12px}
}

/* Stable authored positions; no inline styles under style-src 'self'. */
.melf-node[data-skill="west:logging"]{left:21.22449%;top:13.19149%}
.melf-node[data-skill="west:prospecting"]{left:78.57143%;top:13.19149%}
.melf-node[data-skill="west:hauling"]{left:21.22449%;top:47.65957%}
.melf-node[data-skill="west:surveying"]{left:78.57143%;top:47.65957%}
.melf-node[data-skill="west:deepcraft"]{left:50.00000%;top:79.57447%}
.melf-node[data-skill="east:hearthkeeping"]{left:21.22449%;top:13.19149%}
.melf-node[data-skill="east:hunting"]{left:78.57143%;top:13.19149%}
.melf-node[data-skill="east:rest"]{left:21.22449%;top:47.65957%}
.melf-node[data-skill="east:tracking"]{left:78.57143%;top:47.65957%}
.melf-node[data-skill="east:masterwork"]{left:50.00000%;top:79.57447%}

/* Melf guild: same icon and card language as the main house-station UI.
   Preserve the guild's woodland color identity. */
.melf-panel{--melf-accent:#98c99b;--melf-border:rgba(152,201,155,.38);
  border-color:var(--melf-border);background:linear-gradient(155deg,#1b3026,#101b17 72%);
  box-shadow:0 22px 65px #000b,inset 0 1px rgba(255,255,255,.06)}
.melf-head{background:linear-gradient(120deg,#263e30,#172b23);border-bottom-color:var(--melf-border)}
.melf-head h2{color:#eef5e8;letter-spacing:.02em}
.melf-head p{color:#a7baab}
.melf-canvas{background:radial-gradient(ellipse at 50% 87%,#2b4937 0%,transparent 64%),
  repeating-linear-gradient(90deg,transparent 0 68px,#d2e5c507 69px 70px)}
.melf-node{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;
  border:1px solid var(--melf-border);border-radius:11px;
  background:linear-gradient(160deg,#2a4031,#141e19 75%);padding:6px 7px;
  box-shadow:inset 0 1px rgba(255,255,255,.05),0 5px 17px #0006}
.melf-node strong{font-size:12px;color:#eef1df;line-height:1.15}
.melf-node small{margin:0;color:#a1b6a0;font-size:9px}
.melf-node[data-selected="true"]{border-color:#d5c27d;box-shadow:0 0 0 2px #d5c27d88,0 5px 17px #0008}
.melf-node[data-active="true"]{border-color:#b2da96;background:linear-gradient(145deg,#365e42,#1c382b)}
.melf-node[data-locked="true"]{opacity:.68;filter:none}
.melf-icon,.melf-talent-icon{display:inline-flex;align-items:center;justify-content:center;flex:none;
  font-family:var(--icon-font,inherit);letter-spacing:0;line-height:1}
.melf-icon{width:20px;height:20px;font-size:17px}
.melf-talent-icon{width:30px;height:30px;font-size:24px}
.melf-icon svg,.melf-talent-icon svg{width:100%;height:100%;display:block}
.melf-action,.melf-head .melf-action,.melf-aside .melf-action,.melf-foot .melf-action{
  display:inline-flex;align-items:center;justify-content:center;gap:7px;min-height:38px;
  appearance:none;background:#294334;color:#eff5e7;border:1px solid #80a38a;
  border-radius:9px;padding:7px 12px;font:inherit;font-size:12px;line-height:1.2;
  cursor:pointer;white-space:normal;text-align:center;letter-spacing:.025em;
  box-shadow:inset 0 1px rgba(255,255,255,.08)}
.melf-action:hover:not(:disabled){background:#365740;border-color:#bed69e}
.melf-action:disabled{opacity:.48;cursor:not-allowed}
.melf-action.melf-primary{background:#416246;border-color:#b4d18c}
.melf-aside{background:#14231c;border-left-color:var(--melf-border)}
.melf-aside h3{color:#e5ebd9;font-size:19px}
.melf-aside p{color:#bdcabd}
.melf-aside .melf-cost{display:flex;flex-wrap:wrap;gap:6px;margin:12px 0}
.melf-resource{display:inline-flex;align-items:center;gap:5px;padding:5px 7px;
  border:1px solid var(--melf-border);border-radius:8px;background:#203329;color:#e7e7cd}
.melf-resource small{text-transform:uppercase;font-size:9px;color:#aabcaa}
.melf-wallet{display:flex;align-items:center;gap:6px;flex-wrap:wrap}
.melf-toolbar{background:#21382b;border-top-color:var(--melf-border)}
.melf-toolbar h3{display:flex;align-items:center;gap:8px;color:#e7efda}
.melf-foot{background:#14251d;border-top-color:var(--melf-border)}
.melf-roster label{border-color:var(--melf-border);background:#172c20}
.melf-roster select{background:#294735;color:#eff6df;border-color:#75987a}
@media(max-width:740px){
 .melf-node{width:142px;min-height:78px;padding:5px}
 .melf-talent-icon{width:24px;height:24px;font-size:20px}
 .melf-foot{flex-wrap:wrap}
}

/* Keep atlas glyphs within the talent tile, even when global menu SVG rules apply. */
.melf-node .melf-talent-icon{display:grid;place-items:center;flex:0 0 24px;
  width:24px;height:24px;min-width:0;min-height:0;font-size:21px;line-height:1;overflow:hidden}
.melf-node .melf-talent-icon svg,
.melf-panel .melf-icon svg{position:static!important;display:block!important;
  width:100%!important;height:100%!important;max-width:100%!important;
  max-height:100%!important;min-width:0!important;min-height:0!important;
  transform:none!important;margin:0!important}
.melf-node strong,.melf-node small{position:relative;z-index:1;flex:none;
  max-width:100%;overflow-wrap:break-word}


/* Small screens: the skill graph becomes a real two-column progression grid.
   No min-width canvas, clipped cards, or nested horizontal scrolling. */
@media (max-width:740px){
  .melf-shade{
    box-sizing:border-box;
    align-items:stretch;justify-content:center;
    padding:0;
    padding-top:env(safe-area-inset-top,0px);
    padding-bottom:env(safe-area-inset-bottom,0px);
  }
  .melf-panel{
    box-sizing:border-box;
    width:100%;max-width:100%;
    height:100%;max-height:100%;
    min-width:0;min-height:0;
    border-radius:0;border-width:0;
    overflow-x:hidden;overflow-y:auto;
    overscroll-behavior:contain;
    -webkit-overflow-scrolling:touch;
  }
  .melf-head{
    position:sticky;top:0;z-index:5;
    flex:0 0 auto;align-items:center;
    gap:8px;padding:10px 12px;
  }
  .melf-head>div{min-width:0;flex:1 1 auto}
  .melf-head h2{
    font-size:clamp(17px,5vw,25px);
    line-height:1.2;overflow-wrap:anywhere;
  }
  .melf-head p{font-size:10px;line-height:1.35;overflow-wrap:anywhere}
  .melf-head .melf-action{
    flex:0 0 auto;min-width:44px;min-height:44px;padding:8px;
  }
  .melf-main{display:flex;flex-direction:column;flex:0 0 auto;overflow:visible;min-height:0;min-width:0}
  .melf-canvas{
    display:grid;grid-template-columns:repeat(2,minmax(0,1fr));
    gap:12px 10px;align-content:start;
    box-sizing:border-box;
    width:100%;min-width:0;height:auto;
    padding:18px 12px;
  }
  .melf-canvas>svg{display:none}
  .melf-node,.melf-node[data-skill]{
    position:relative;inset:auto;left:auto;top:auto;
    transform:none;box-sizing:border-box;
    width:100%;min-width:0;min-height:102px;height:auto;
    padding:9px 6px;overflow:hidden;
  }
  .melf-node:last-child{grid-column:1/-1;justify-self:center;width:min(100%,230px)}
  .melf-node strong{font-size:clamp(10px,2.9vw,13px);line-height:1.25;overflow-wrap:anywhere}
  .melf-node small{font-size:10px}
  .melf-aside{
    min-width:0;padding:14px 12px;
    border-left:0;border-top:1px solid var(--melf-border);
  }
  .melf-aside h3{font-size:18px}
  .melf-aside p{font-size:12px;overflow-wrap:anywhere}
  .melf-aside .melf-primary{width:100%;min-height:44px}
  .melf-toolbar{padding:14px 12px}
  .melf-toolbar h3{font-size:14px;line-height:1.4;overflow-wrap:anywhere}
  .melf-roster{max-height:none;overflow:visible;gap:8px}
  .melf-roster label{box-sizing:border-box;flex:1 1 200px;min-width:0;flex-wrap:wrap}
  .melf-roster label strong{overflow-wrap:anywhere}
  .melf-roster select{min-width:0;max-width:100%;min-height:44px;flex:1 1 125px}
  .melf-foot{
    box-sizing:border-box;flex:0 0 auto;
    flex-wrap:wrap;justify-content:flex-start;
    gap:8px;padding:10px 12px;font-size:11px;
    overflow-wrap:anywhere;
  }
  .melf-foot>.melf-action{width:100%;min-height:44px}
  .melf-wallet{min-width:0}
  .melf-status{min-width:0;overflow-wrap:anywhere}
  .melf-resource{font-size:11px}
}
@media(max-width:360px){
  .melf-canvas{gap:8px;padding:12px 8px}
  .melf-node,.melf-node[data-skill]{min-height:100px;padding:7px 4px}
  .melf-node strong{font-size:10px}
  .melf-head .melf-action{font-size:0;gap:0}
  .melf-head .melf-action .melf-icon{font-size:19px}
}
@media(min-width:741px) and (max-height:560px){
  .melf-panel{max-height:calc(100dvh - 16px)}
  .melf-head{padding:9px 16px}
  .melf-canvas{height:420px}
}

/* Guild wallet follows the consistent top-of-menu resource placement. */
.melf-wallet-bar{display:flex;align-items:center;justify-content:flex-start;
  flex:0 0 auto;padding:9px 18px;background:#1a3025;
  border-bottom:1px solid var(--melf-border)}
.melf-wallet-bar .melf-wallet{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));
  width:100%;gap:8px}
.melf-wallet-bar .melf-resource{justify-content:center;min-width:0;box-sizing:border-box;
  font-variant-numeric:tabular-nums}
.melf-foot:empty{display:none}
@media(max-width:740px){
  .melf-head{position:relative}
  .melf-wallet-bar{position:sticky;top:0;z-index:6;padding:8px 10px}
  .melf-wallet-bar .melf-wallet{gap:5px}
  .melf-wallet-bar .melf-resource{gap:3px;padding:7px 3px;font-size:11px}
  .melf-wallet-bar .melf-resource small{font-size:8px}
  .melf-canvas{padding:12px 10px;gap:9px}
  .melf-node,.melf-node[data-skill]{min-height:85px}
  .melf-aside{padding:12px}
  .melf-foot.melf-status-foot{padding:7px 12px}
}
