/* Necro Atelier — out-of-run screens */
.m-title { position: absolute; inset: 0; background: #07040b url("../assets/title-bg.webp") center / cover no-repeat; cursor: pointer; overflow: hidden; animation: fadeIn .5s ease both; }
.m-title.out { opacity: 0; transition: opacity .4s; pointer-events: none; }
.m-logo { position: absolute; left: 4vw; top: 3vh; width: min(46vw, 620px); max-height: 33vh; object-fit: contain; object-position: left top; pointer-events: none;
  animation: logoDrop .6s cubic-bezier(.2,1.5,.4,1) both, logoFloat 4s ease-in-out .6s infinite; filter: drop-shadow(0 6px 14px rgba(0,0,0,.7)); }
@keyframes logoDrop { 0% { transform: translateY(-60vh) scale(.9); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes logoFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
.m-hint { position: absolute; left: 15%; right: 15%; bottom: 9%; text-align: center; font-size: 19px; letter-spacing: .04em; animation: pulse 1.8s ease-in-out infinite; pointer-events: none; }
.m-trophy { position: absolute; top: 10px; right: 10px; z-index: 3; }
.m-keyhint { position: absolute; top: 18px; right: 66px; z-index: 3; font-size: 14px; padding: 1px 7px; border: 2px solid var(--ink-dim); border-radius: 5px; background: rgba(18,8,28,.7); pointer-events: none; }
.m-ember { position: absolute; bottom: -10px; width: 5px; height: 5px; border-radius: 50%; background: #ffb64a; box-shadow: 0 0 8px 2px rgba(255,170,60,.7); opacity: 0; pointer-events: none; animation: emberUp 8s linear infinite; }
@keyframes emberUp { 0% { transform: translate(0,0); opacity: 0; } 10% { opacity: .9; } 100% { transform: translate(30px,-80vh); opacity: 0; } }

/* sanctum */
.m-sanctum { position: absolute; inset: 0; pointer-events: none !important; }
.m-sanctum > * { pointer-events: auto; }
.m-col { position: absolute; left: 76px; top: 14px; width: min(34vw, 340px); display: flex; flex-direction: column; gap: 8px; max-height: calc(100% - 20px); }
.m-col > * { animation: slideRight .35s cubic-bezier(.2,1.2,.4,1) both; }
.m-col > *:nth-child(2) { animation-delay: .05s; } .m-col > *:nth-child(3) { animation-delay: .1s; } .m-col > *:nth-child(4) { animation-delay: .15s; }
.m-col > *:nth-child(5) { animation-delay: .2s; } .m-col > *:nth-child(6) { animation-delay: .25s; } .m-col > *:nth-child(7) { animation-delay: .3s; } .m-col > *:nth-child(8) { animation-delay: .35s; }
@keyframes slideRight { 0% { transform: translateX(-40px); opacity: 0; } 100% { transform: none; opacity: 1; } }
.m-slogo { height: clamp(34px, 9vh, 64px); max-width: 100%; object-fit: contain; object-position: left center; align-self: flex-start; filter: drop-shadow(0 3px 6px rgba(0,0,0,.7)); }
.m-bal { display: flex; align-items: center; gap: 8px; font-size: 20px; }
.m-bal img, .m-cost img { width: 26px; height: 26px; object-fit: contain; }
.m-best { font-size: 15px; color: var(--ink-dim); }
.m-depart { font-size: 24px; min-height: 58px; width: 100%; }
.m-menu { width: 100%; justify-content: flex-start; font-size: 17px; min-height: 46px; position: relative; }
.m-menu img { width: 28px; height: 28px; }
.m-dot { position: absolute; top: -2px; right: -2px; width: 14px; height: 14px; border-radius: 50%; background: var(--blood); border: 2px solid var(--outline); box-shadow: 0 0 8px var(--blood); animation: pulse 1.2s infinite; }
.m-sanctum .m-trophy { position: absolute; }
/* short screens (phones held sideways): menu buttons in pairs so the column fits */
@media (max-height: 460px) {
  .m-col { flex-direction: row; flex-wrap: wrap; align-content: flex-start; gap: 6px; width: min(48vw, 420px); top: 10px; }
  .m-col > * { width: 100%; }
  .m-col > .m-bal, .m-col > .m-best { width: auto; margin-right: 14px; align-self: center; font-size: 14px; }
  .m-col > .m-bal { font-size: 17px; }
  .m-col > .m-menu { width: calc(50% - 3px); font-size: 15px; min-height: 44px; padding-left: 8px; padding-right: 8px; }
  .m-depart { min-height: 50px; font-size: 21px; }
  .m-slogo { height: 32px; }
}

/* modal frame */
.m-modal { position: absolute; inset: 0; }
.m-modal .m-panel { position: absolute; left: 10px; right: 10px; top: 58px; bottom: 10px; display: flex; flex-direction: column;
  border-width: 18px; border-image: url("../assets/ui-panel.webp") 22% fill / 18px stretch; padding: 2px; animation: popIn .28s cubic-bezier(.2,1.4,.4,1) both; }
.m-back { position: absolute; left: 76px; top: 8px; z-index: 2; min-width: 84px; min-height: 44px; font-size: 16px; }
.m-head { position: absolute; left: 180px; right: 76px; top: 8px; height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.m-head h2 { margin: 0; font-size: 24px; white-space: nowrap; }
.m-body { flex: 1; overflow-y: auto; overflow-x: hidden; scrollbar-width: none; touch-action: pan-y; padding: 4px 6px; }
.m-body::-webkit-scrollbar { display: none; }
.m-foot { text-align: center; font-size: 14px; color: var(--ink-dim); padding-top: 4px; }

/* tree */
.m-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.m-branch { display: flex; flex-direction: column; gap: 12px; --acc: var(--jade); }
.m-branch.altar { --acc: #b47dff; } .m-branch.necro { --acc: #efe6d0; }
.m-bname { text-align: center; font-size: 17px; color: var(--acc); }
.m-node { position: relative; background: rgba(14,8,22,.75); border: 2px solid var(--acc); border-radius: 8px; padding: 5px 6px 5px 30px; min-height: 76px; display: flex; flex-direction: column; gap: 2px; animation: popIn .3s ease both; }
.m-node:not(:last-child)::after { content: ""; position: absolute; left: 50%; bottom: -13px; height: 12px; border-left: 3px dashed var(--acc); opacity: .7; }
.m-node.locked { opacity: .5; filter: grayscale(.6); }
.m-tier { position: absolute; left: 4px; top: 4px; width: 22px; height: 22px; border-radius: 50%; background: var(--acc); color: #120818; font-weight: 800; font-size: 14px; text-align: center; line-height: 22px; }
.m-nname { font-size: 15px; line-height: 1.15; }
.m-ndesc { font-size: 13px; line-height: 1.2; color: var(--ink-dim); }
.m-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 2px; }
.m-pips { display: flex; gap: 3px; flex-wrap: wrap; }
.m-pip { width: 9px; height: 9px; border-radius: 50%; border: 2px solid var(--acc); background: transparent; }
.m-pip.on { background: var(--acc); box-shadow: 0 0 6px var(--acc); }
.m-buy { min-height: 44px; min-width: 76px; font-size: 15px; padding: 0 4px; border-width: 12px 16px; border-image-width: 12px 16px; }
.m-buy img { width: 20px; height: 20px; }
.m-locktxt { font-size: 12px; color: var(--ink-dim); }
.m-burst { position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--jade)); box-shadow: 0 0 8px var(--c, var(--jade)); pointer-events: none; z-index: 5; animation: burst .7s ease-out forwards; }
@keyframes burst { 0% { transform: translate(0,0) scale(1); opacity: 1; } 100% { transform: translate(var(--dx), var(--dy)) scale(.2); opacity: 0; } }

/* codex */
.m-tabs { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 2px 6px 6px; }
.m-tab { min-width: 80px; font-size: 15px; min-height: 44px; border-width: 12px 14px; border-image-width: 12px 14px; }
.m-tab.on { color: var(--jade); filter: drop-shadow(0 0 8px rgba(93,255,168,.7)); }
.m-count { margin-left: auto; font-size: 16px; }
.m-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 10px; }
.m-card { --f: #8a5cc8; position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 4px; min-height: 140px; color: var(--ink); font-family: var(--font); cursor: pointer;
  background: radial-gradient(ellipse at 50% 30%, rgba(60,40,90,.6), rgba(14,8,22,.9)); border: 3px dashed var(--f); border-radius: 10px; outline: none; animation: popIn .25s ease both; transition: transform .12s, filter .12s; }
.m-card.chimera { --f: var(--jade); border-style: solid; } .m-card.enemy { --f: #9aa6b4; border-style: double; border-width: 5px; }
.m-card.holy { --f: var(--gold); border-style: solid; box-shadow: inset 0 0 14px rgba(255,211,106,.35), 0 0 8px rgba(255,211,106,.3); background: radial-gradient(ellipse at 50% 30%, rgba(120,90,30,.5), rgba(14,8,22,.9)); }
.m-card:hover, .m-card.focus { transform: scale(1.05); filter: brightness(1.25); }
.m-card.locked { cursor: default; }
.m-thumb { width: 72px; height: 72px; object-fit: contain; }
.m-card.locked .m-thumb { filter: brightness(0); opacity: .7; }
.m-glyph { font-size: 48px; line-height: 72px; height: 72px; }
.m-cname { font-size: 15px; text-align: center; line-height: 1.1; }
.m-cdesc { font-size: 12px; text-align: center; color: var(--ink-dim); line-height: 1.15; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.m-detail { position: absolute; inset: 0; z-index: 6; display: flex; align-items: center; justify-content: center; background: rgba(5,2,8,.7); animation: fadeIn .15s both; }
.m-dbox { width: min(92%, 440px); display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px; border-width: 18px; border-image: url("../assets/ui-panel.webp") 22% fill / 18px stretch; background: none; animation: popIn .28s cubic-bezier(.2,1.4,.4,1) both; }
.m-dbox .m-thumb { width: 104px; height: 104px; }
.m-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; width: 100%; text-align: center; }
.m-stats div { background: rgba(14,8,22,.7); border-radius: 6px; padding: 3px 2px; font-size: 14px; }
.m-stats b { display: block; font-size: 17px; color: var(--jade); }

/* quests */
.m-qlist { display: flex; flex-direction: column; gap: 10px; }
.m-q { display: flex; align-items: center; gap: 10px; background: rgba(14,8,22,.75); border: 2px solid var(--violet); border-radius: 10px; padding: 8px 10px; position: relative; animation: slideUp .3s ease both; }
.m-q.claimed { opacity: .65; }
.m-qmain { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.m-qname { font-size: 17px; }
.m-bar { position: relative; height: 18px; border-radius: 9px; background: #12081c; border: 2px solid var(--violet); overflow: hidden; }
.m-bar i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, #2fbf7a, var(--jade)); transition: width .4s; }
.m-bar span { position: absolute; inset: 0; text-align: center; font-size: 12px; line-height: 14px; }
.m-cost { display: flex; align-items: center; gap: 4px; font-size: 18px; }
.m-qact { width: 108px; display: flex; justify-content: center; }
.m-stamp { color: var(--jade); border: 3px solid var(--jade); border-radius: 6px; padding: 2px 10px; font-size: 18px; transform: rotate(-8deg); animation: popIn .3s both; }
