/* Star Gate has its own palette and layout; all rules are scoped to the dungeon. */
.dg-view,.dg-dialog-layer,#dgBattle{--dg-bg:#101321;--dg-ink:#0b0c17;--dg-gold:#ebd19b;--dg-text:#f5efdF;--dg-muted:#b8b2c9;--dg-border:#5f526f;color:var(--dg-text);font-family:var(--f-body);color-scheme:dark}
#v-dungeon{padding:0!important;overflow:auto!important;background:radial-gradient(ellipse at 60% 0,#3b2c59 0,transparent 60%),linear-gradient(145deg,#151b2b,#11121f 60%,#202039);height:var(--app-height,100dvh);z-index:80;isolation:isolate}
#v-dungeon::before{content:"";position:fixed;inset:0;pointer-events:none;opacity:.07;z-index:-1;background:url('/assets/dungeon/v1/environment-zh.webp') center/cover}
.dg-view button,.dg-dialog-layer button,#dgBattle button{cursor:pointer;font:700 14px/1.4 var(--f-body);min-height:44px;touch-action:manipulation}
.dg-view button:disabled,.dg-dialog-layer button:disabled,#dgBattle button:disabled{opacity:.5;cursor:default}
.dg-view a{color:inherit;text-decoration:none}
.dg-button,.dg-primary{display:inline-flex;align-items:center;justify-content:center;gap:9px;border:2px solid var(--dg-border);border-radius:11px;padding:10px 16px;background:#222438;color:#e8e1f4;box-shadow:0 4px 0 #090c18}
.dg-button:hover:not(:disabled){background:#373049;border-color:#b7a1d2}
.dg-primary{border-color:#bda06c;background:linear-gradient(180deg,#f0d99d,#cba563);color:#231c24;box-shadow:0 4px 0 #503c2f}
.dg-primary:hover:not(:disabled){filter:brightness(1.1)}
.dg-button:active:not(:disabled),.dg-primary:active:not(:disabled){transform:translateY(2px)}
.dg-header{height:86px;padding:18px 30px;display:flex;align-items:center;gap:26px;border-bottom:1px solid #a08bb52b;background:#10142180;position:relative;z-index:3}
.dg-brand{display:flex;align-items:center;gap:10px;font-size:28px;color:#edd2a0!important;font-family:var(--f-display)}
.dg-brand span{font-size:24px;letter-spacing:2px}.dg-brand small{display:block;font:700 10px/1.3 var(--f-body);letter-spacing:5px;color:#b5a7c7}
.dg-header-right{display:flex;align-items:center;gap:20px;margin-left:auto}.dg-wallet{color:#efdaa5;font-weight:700}
.dg-lobby{max-width:1440px;margin:auto;padding:27px 40px 24px}
.dg-heading{display:flex;align-items:center;justify-content:space-between;gap:20px;margin-bottom:26px}.dg-kicker{font:700 11px/1.5 var(--f-body);letter-spacing:3px;color:#d9bf89;text-transform:uppercase;margin:0 0 8px}
.dg-heading h1{font:400 clamp(26px,3.2vw,42px)/1.3 var(--f-display);color:#fff5df;margin-bottom:10px}.dg-heading p:not(.dg-kicker){font-size:13px;color:var(--dg-muted);margin:0}
.dg-duration{font-weight:700;color:#e6ce9d;font-size:18px;white-space:nowrap;text-align:right}.dg-duration small{display:block;color:#b8aec9;font-size:10px;font-weight:500;margin-top:6px}
.dg-lobby-grid{display:grid;grid-template-columns:240px minmax(0,1fr);gap:28px}
.dg-hero{position:relative;isolation:isolate;padding:21px 20px;background:linear-gradient(155deg,#34334a,#161e2c);border:2px solid #78668b;border-radius:18px;box-shadow:0 8px 0 #090d1b;overflow:hidden;align-self:start}
.dg-hero-rune{position:absolute;z-index:-1;inset:36px -50px auto;height:280px;border-radius:50%;background:repeating-conic-gradient(from 10deg,#b89aee18 0 1deg,transparent 1deg 30deg);border:1px solid #caa4ff33;box-shadow:0 0 80px #ac6cff1f,inset 0 0 40px #9879e333}
.dg-portrait{height:190px;display:flex;align-items:end;justify-content:center;position:relative}.dg-portrait::after{position:absolute;content:"";bottom:6px;width:140px;height:22px;border-radius:50%;background:#060c1a80;z-index:-1;box-shadow:0 0 25px #7c73e459}
.dg-portrait img{height:100%;width:190px;object-fit:contain;filter:drop-shadow(0 4px 10px #080a18)}
.dg-hero-title{display:flex;align-items:center;justify-content:space-between;margin-top:13px;gap:5px}.dg-hero-title h2{font-size:23px}.dg-hero-title>b{font:800 17px var(--f-num);color:#efce88;background:#111829;border-radius:8px;padding:3px 9px}
.dg-hero p{font-size:11px;color:var(--dg-muted);line-height:1.7;margin:11px 0 16px}.dg-hero-stats{display:grid;grid-template-columns:repeat(3,1fr);gap:5px;border-block:1px solid #9982ac33;padding:12px 0}.dg-hero-stats span{font-size:10px;color:#bbb3c8}.dg-hero-stats b{display:block;font:800 23px/1.2 var(--f-num);color:#ffe4ad}
.dg-xp{height:5px;background:#0a1222;border-radius:3px;margin-top:15px;overflow:hidden}.dg-xp i{display:block;height:100%;background:#9ad4d9}.dg-hero>small{display:block;font-size:9px;color:#b3bed0;margin:9px 0 18px;line-height:1.7}.dg-hero>.dg-button{width:100%;font-size:11px;padding:8px}
.dg-catalog{min-width:0}.dg-realms{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:12px}
.dg-realm{position:relative;overflow:hidden;height:165px;border:2px solid #635871;border-radius:14px;padding:0;background:#15172c;box-shadow:0 6px 0 #080e1b;isolation:isolate}
.dg-realm img{width:100%;height:100%;object-fit:cover;object-position:50% 45%;opacity:.66;transition:transform .4s,opacity .4s}
.dg-realm::after{content:"";position:absolute;inset:0;background:linear-gradient(0deg,#101329 0,transparent 80%);z-index:0}
.dg-realm span{position:absolute;z-index:1;bottom:14px;left:12px;right:4px;text-align:left}.dg-realm small{color:var(--realm);font-size:11px;display:block;letter-spacing:2px}.dg-realm b{font:400 17px/1.6 var(--f-display);color:#f8f0e3;white-space:nowrap}
.dg-realm.selected{border-color:var(--realm);box-shadow:0 0 0 2px #0b0c17,0 0 0 3px var(--realm),0 0 35px #ac6cff2e}
.dg-realm.selected img,.dg-realm:hover img{transform:scale(1.06);opacity:1}
.dg-paper-heading{display:flex;justify-content:space-between;align-items:center;gap:15px;margin:25px 0 13px}.dg-paper-heading h2{font-size:20px}.dg-paper-heading label{font-size:11px;color:var(--dg-muted);display:flex;align-items:center;gap:10px}.dg-paper-heading select{background:#24273c;border:1px solid #79688e;border-radius:8px;min-height:44px;color:#eadcc7;padding:6px;max-width:180px;font:700 12px var(--f-body)}
.dg-papers{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:11px;max-height:236px;overflow:auto;padding:3px 5px 9px 0;scrollbar-color:#6c5e87 transparent}
.dg-paper{display:flex;align-items:center;gap:12px;width:100%;text-align:left;min-height:88px!important;padding:13px;background:linear-gradient(120deg,#2c2b41,#212435);border:1px solid #71617b;border-radius:11px;color:#eee5db;box-shadow:0 4px 0 #0a101b;transition:border-color .2s,background .2s}
.dg-paper:hover:not(:disabled){border-color:#d1b789;background:#36314a}.dg-paper-number{font:400 26px var(--f-display);color:#897b99;border-right:1px solid #78638555;padding-right:11px}.dg-paper-copy{min-width:0;flex:1}.dg-paper b{display:block;line-height:1.5;font-size:14px;overflow-wrap:anywhere}.dg-paper small{display:block;color:#bcb0c7;font-size:10px;line-height:1.8;margin-top:4px}.dg-paper-go{font-size:11px;color:#e9cd97;white-space:nowrap}.dg-paper-go i{font-style:normal;font-size:21px;display:block;text-align:right;line-height:1.2}
.dg-notice{color:#b9b2c9;font-size:11px;line-height:1.7;min-height:20px}.dg-empty{color:#bcb0c7;padding:40px;text-align:center;grid-column:1/-1}
.dg-rules{display:flex;gap:30px;align-items:center;justify-content:center;font-size:11px;color:#c7bfce;margin-top:25px;padding-top:18px;border-top:1px solid #77618033}.dg-rules b{color:#d2af7c;margin-right:6px}.dg-rules .dg-button{font-size:11px;min-height:44px;padding:7px 14px}
.dg-resume{display:flex;gap:12px;align-items:center;padding:12px;margin-bottom:12px;background:#40556355;border:1px solid #75bbba;border-radius:12px}.dg-resume>div{flex:1;font-size:12px}.dg-resume span{display:block;font-size:10px;color:#bbd3d8;margin-top:4px}.dg-resume button{font-size:11px;padding:8px 10px}.dg-loading{padding:70px 20px;text-align:center}.dg-loading p{color:#bbb0c7}
/* Portal is anchored to the right tree hollow, with a mobile dock below the books. */
#v-workbooks .dg-portal-entry{position:absolute;right:max(6px,1vw);top:26%;z-index:6;width:clamp(110px,12vw,190px);height:clamp(220px,38vh,360px);padding:0;border:0;background:transparent;display:flex;flex-direction:column;align-items:center;cursor:pointer;color:#fff5e3;filter:drop-shadow(0 5px 4px #281c3d80)}
.dg-portal-entry>img{width:100%;height:78%;object-fit:contain;position:relative;filter:drop-shadow(0 0 12px #ba74ff);animation:dg-portal-glow 3s ease-in-out infinite}.dg-portal-aura{position:absolute;top:7%;left:15%;right:15%;height:62%;border-radius:50%;background:radial-gradient(ellipse,#e5baff77,#9b4eff55 40%,transparent 70%);animation:dg-aura 5s linear infinite}.dg-portal-caption{background:linear-gradient(#332245,#171929);border:2px solid #e4c8fc;border-radius:15px;padding:9px 12px;box-shadow:0 4px 0 #231032;width:max-content;text-align:center;max-width:220px;position:relative}.dg-portal-caption b{display:block;font:400 24px var(--f-display);color:#f6e2bb}.dg-portal-caption small{display:block;font:700 10px/1.8 var(--f-body);color:#d5c6ed}.dg-portal-caption strong{display:block;font-size:12px;color:#fff0bf;margin-top:4px}
@keyframes dg-portal-glow{50%{filter:drop-shadow(0 0 25px #d17bff) brightness(1.17)}}@keyframes dg-aura{to{transform:rotate(360deg)}}
/* PC: the spinning portal sat beside the two books and looked like the books were shaking. */
@media (hover:hover) and (pointer:fine){
  #v-workbooks .dg-portal-entry{filter:drop-shadow(0 4px 3px #281c3d66)}
  #v-workbooks .dg-portal-entry img,
  #v-workbooks .dg-portal-entry>img{animation:none!important;filter:drop-shadow(0 0 10px #ba74ff)}
  #v-workbooks .dg-portal-aura{animation:none!important;transform:none!important}
}
/* Exploration fills the viewport. */
.dg-exp{position:relative;height:100%;min-height:430px;background:#101321;overflow:hidden}.dg-run-hud{height:78px;display:flex;align-items:center;gap:24px;padding:12px 24px;border-bottom:1px solid #c7a8df44;background:#101625f2;z-index:5;position:relative;box-shadow:0 3px 20px #080c17}
.dg-health{width:190px;flex-shrink:0}.dg-health>b{font-size:13px;color:#f6e6c9}.dg-health b small{margin-left:7px;color:#edce8b}.dg-health>span,.dg-monster>span{height:8px;display:block;background:#090f1d;border:1px solid #997e8977;border-radius:8px;overflow:hidden;margin:5px 0}.dg-health i,.dg-monster i{display:block;height:100%;background:linear-gradient(90deg,#4ab7a3,#9fdfbc);transition:width .3s}.dg-health>small{display:block;font-size:10px;color:#c9c4d2}.dg-run-progress{min-width:0;flex:1;display:grid;grid-template-columns:1fr auto;gap:2px 12px}.dg-run-progress>b{font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.dg-run-progress>span{font-size:11px;color:#c2bbd0;grid-column:1}.dg-run-progress>small{font:700 15px var(--f-num);color:#e2c58d;grid-row:1/3;grid-column:2;align-self:center}
#dgWorld{width:100%;height:calc(100% - 78px);display:block;touch-action:none;background:#101321;outline-offset:-4px}
.dg-map-label{position:absolute;top:100px;left:28px;max-width:420px;pointer-events:none;text-shadow:0 2px 4px #000;background:#101323b0;padding:13px 18px;border-radius:12px;border-left:2px solid #c1a4db}.dg-map-label h2{font-size:24px}.dg-map-label p:not(.dg-kicker){font-size:11px;color:#d5c9df;margin:5px 0 0}
.dg-map-bottom{position:absolute;left:24px;bottom:55px;right:190px;display:flex;justify-content:space-between;align-items:end;gap:12px;pointer-events:none}.dg-map-bottom button{pointer-events:auto}.dg-directions{display:grid;grid-template-columns:repeat(3,48px);grid-template-rows:48px 48px;gap:4px;touch-action:none}.dg-directions .dg-button{padding:3px;font-size:23px;background:#131b2ce8;border-color:#ac98bb}.dg-directions button:first-child{grid-column:2}.dg-directions button:nth-child(2){grid-row:2;grid-column:1}.dg-directions button:nth-child(3){grid-row:2;grid-column:2}.dg-directions button:nth-child(4){grid-row:2;grid-column:3}.dg-map-actions{display:flex;gap:10px;flex-wrap:wrap;justify-content:end;max-width:360px}.dg-map-notice{position:absolute;bottom:7px;left:24px;right:180px;background:#111827d9;border:1px solid #a68bb455;color:#e1d8e6;border-radius:8px;font-size:12px;padding:9px 13px;margin:0;pointer-events:none}
/* The native question board remains interactive beneath the animated battle. */
body.dungeon-battle{--dg-battle-height:310px;background:#141928!important}
body.dungeon-battle>.hud,body.dungeon-battle #bg,body.dungeon-battle #backMap,body.dungeon-battle .gbar,body.dungeon-battle #stage>.coach{display:none!important}
body.dungeon-battle #board{border:2px solid #8f7d9e!important;border-radius:16px!important;box-shadow:0 5px 0 #090d18!important;background:#fffaf0!important;min-height:0!important;max-height:100%!important;height:100%!important;overflow:auto!important;padding:18px!important;color:#2b1d14!important;container-type:inline-size}
body.dungeon-battle #qtitle{font-size:clamp(18px,2vw,26px)!important}body.dungeon-battle #qno{width:35px;height:35px;font-size:20px}body.dungeon-battle #qarea{height:auto!important;max-height:none!important;overflow:visible!important;min-height:160px!important;padding:10px 0!important}
body.dungeon-battle #qtitle .src{font-size:10px!important}.dungeon-battle .qhead{margin-bottom:10px!important}
body.dungeon-battle #sheet .pbtns{flex-wrap:wrap}body.dungeon-battle #sheet .pbtns .primary{flex:1 1 100%}
body.dungeon-battle #reward,body.dungeon-battle #questionTasks,body.dungeon-battle .question-task-nav,body.dungeon-battle #readingPages,body.dungeon-battle .question-toolbar,body.dungeon-battle .question-record-controls,body.dungeon-battle .question-index{display:none!important}
/* Equipment, confirmation, report */
.dg-dialog-layer{position:fixed;z-index:250;inset:0;display:grid;place-items:center;padding:20px;background:#070c18c9;backdrop-filter:blur(8px)}.dg-dialog{position:relative;width:min(660px,100%);max-height:90dvh;overflow:auto;padding:30px;border:2px solid #9c829e;border-radius:22px;background:linear-gradient(145deg,#303046,#171f2d);box-shadow:0 12px 0 #080c18}.dg-dialog>h2{font-size:30px;color:#f3d69e;padding-right:30px}.dg-dialog>p{font-size:13px;color:#c9bfd2;line-height:1.8}.dg-close{position:absolute;top:15px;right:15px;font-size:23px!important;padding:4px 12px}.dg-equipment{display:grid;gap:14px;margin:20px 0}.dg-equipment article{display:grid;grid-template-columns:55px 1fr auto auto;gap:12px;align-items:center;padding:13px;border-radius:12px;background:#121a2bc9;border:1px solid #81708d}.dg-equipment img{width:55px;height:55px;object-fit:contain}.dg-equipment h3{font-size:18px}.dg-equipment p{font-size:10px;color:#b9abc8;margin:5px 0 0}.dg-equipment button{font-size:11px;padding:8px}.dg-report-list{display:grid;gap:12px;margin-top:20px}
.dg-report{max-width:1000px;padding:40px 32px;margin:auto}.dg-report>h1{font-size:36px;margin:15px 0}.dg-report>p{font-size:13px;color:#bfb1cd}.dg-report-score{display:flex;align-items:center;gap:32px;padding:25px 0}.dg-report-score>strong{font:800 90px/1 var(--f-num);color:#f4d493}.dg-report-score strong small{font-size:24px}.dg-report-score>div{display:grid;gap:10px}.dg-report-score b{font-size:22px}.dg-report-score span{font-size:13px;color:#b8adcc}.dg-report-score img{margin-left:auto;width:160px;height:160px;object-fit:contain}.dg-rewards{display:flex;justify-content:space-around;gap:15px;padding:20px 10px;background:#222d3e;border:1px solid #947d96;border-radius:12px;color:#f1d39a}.dg-growth{padding:24px;background:#1e2436;border:1px solid #786181;border-radius:14px;margin:24px 0}.dg-growth h2{font-size:24px;margin-bottom:18px}.dg-growth>div{display:grid;grid-template-columns:1fr 160px 55px;gap:20px;align-items:center;padding:10px 0;font-size:13px}.dg-growth progress{width:100%;accent-color:#a4cfc8;height:8px}.dg-report-actions{display:flex;gap:12px;flex-wrap:wrap}
@media(min-width:1450px){.dg-lobby{padding-top:40px}.dg-portrait{height:240px}.dg-realm{height:205px}.dg-papers{max-height:340px}.dg-hero{padding:28px}.dg-lobby-grid{grid-template-columns:280px 1fr}}
@media(max-width:1050px){.dg-header{padding:14px 20px;gap:15px}.dg-lobby{padding:22px}.dg-lobby-grid{grid-template-columns:200px minmax(0,1fr);gap:20px}.dg-hero{padding:15px}.dg-portrait{height:160px}.dg-realm{height:150px}.dg-realms{gap:9px}.dg-realm span{left:8px}.dg-realm b{font-size:15px}.dg-paper-go{display:none}.dg-papers{max-height:255px}.dg-portal-caption{padding:7px 9px}.dg-portal-caption b{font-size:22px}}
@media(max-width:750px){
 .dg-header{height:70px;gap:12px;padding:10px 12px}.dg-header .dg-back{font-size:11px;padding:7px 10px}.dg-brand span{font-size:19px}.dg-brand small{font-size:8px;letter-spacing:3px}.dg-header-right .dg-wallet{display:none}.dg-header-right .dg-button{font-size:11px;padding:8px 10px}.dg-brand{gap:6px;font-size:22px}
 .dg-lobby{padding:22px 14px}.dg-heading{display:block;margin-bottom:19px}.dg-heading h1{font-size:30px}.dg-heading p:not(.dg-kicker){font-size:11px}.dg-kicker{font-size:10px;letter-spacing:2px}.dg-duration{display:block;font-size:14px;text-align:left;margin-top:12px}.dg-duration small{display:inline;font-size:9px;margin-left:7px}.dg-lobby-grid{display:flex;flex-direction:column;gap:19px}.dg-hero{display:none}.dg-realm{height:130px}.dg-realms{gap:7px}.dg-realm span{left:4px;bottom:9px}.dg-realm b{font-size:12px;writing-mode:vertical-rl;letter-spacing:2px}.dg-realm small{font-size:9px;margin-bottom:5px}.dg-realm.selected b{color:#ffe9bc}
 .dg-paper-heading{margin:19px 0 10px;gap:8px}.dg-paper-heading h2{font-size:18px}.dg-paper-heading label{font-size:0;gap:0}.dg-paper-heading select{font-size:10px;max-width:140px;min-height:44px}.dg-papers{grid-template-columns:1fr;max-height:350px;gap:10px}.dg-paper{min-height:82px!important;padding:12px}.dg-paper-go{display:block}.dg-paper b{font-size:14px}.dg-paper small{font-size:10px}.dg-paper-number{font-size:26px}.dg-rules{gap:10px;flex-wrap:wrap;justify-content:space-between;margin-top:16px;font-size:9px}.dg-rules .dg-button{width:100%;font-size:12px}.dg-resume{gap:7px;padding:10px}.dg-resume .dg-button{font-size:10px}.dg-resume .dg-primary{font-size:10px;min-width:88px}.dg-resume b{font-size:11px}
 #v-workbooks .dg-portal-entry{position:relative;inset:auto;width:100%;height:105px;flex-direction:row;justify-content:center;gap:6px;margin:8px auto 20px;filter:none}.dg-portal-entry>img{width:90px;height:110px;object-fit:contain}.dg-portal-aura{width:100px;left:calc(50% - 145px);top:0;height:95px}.dg-portal-caption{width:230px;max-width:230px;text-align:left;padding:10px 16px}.dg-portal-caption b{font-size:24px}.dg-portal-caption small{font-size:11px}.dg-portal-caption strong{font-size:12px;position:absolute;right:12px;top:15px;writing-mode:vertical-rl;letter-spacing:1px}
 #v-workbooks.on:has(.dg-portal-entry){display:flex!important;flex-direction:column}.dg-run-hud{height:92px;padding:10px 12px;gap:12px;flex-wrap:wrap}.dg-health{width:138px}.dg-run-progress{grid-template-columns:1fr}.dg-run-progress>b{font-size:11px}.dg-run-progress>span{font-size:10px}.dg-run-progress>small{grid-column:1;grid-row:auto;font-size:11px}.dg-run-hud>.dg-button{position:absolute;right:10px;top:55px;font-size:9px;padding:4px 8px;min-height:30px}.dg-health>b{font-size:11px}.dg-health>small{font-size:9px}
 #dgWorld{height:calc(100% - 92px)}.dg-map-label{top:105px;left:12px;padding:9px 12px;max-width:250px}.dg-map-label h2{font-size:20px}.dg-map-label p:not(.dg-kicker){font-size:10px}.dg-map-bottom{left:12px;right:12px;bottom:88px;gap:7px;align-items:end}.dg-directions{grid-template-columns:repeat(3,44px);grid-template-rows:44px 44px;gap:3px}.dg-map-actions{max-width:180px;gap:8px}.dg-map-actions button{font-size:11px;padding:10px 12px;min-height:44px}.dg-map-notice{left:12px;right:12px;bottom:14px;font-size:11px;padding:8px;max-width:65%;min-height:48px}
 body.dungeon-battle #board{padding:12px!important;border-radius:12px!important}body.dungeon-battle #qtitle{font-size:18px!important}body.dungeon-battle #qtitle .src{font-size:9px!important}
 .dg-dialog-layer{padding:10px}.dg-dialog{padding:22px 16px}.dg-dialog>h2{font-size:25px}.dg-equipment article{grid-template-columns:42px 1fr 1fr;gap:8px;padding:10px}.dg-equipment img{width:42px;height:42px;grid-row:1/3}.dg-equipment article>div{grid-column:2/4}.dg-equipment h3{font-size:19px}.dg-equipment button{min-height:44px}.dg-report{padding:25px 16px}.dg-report>h1{font-size:28px}.dg-report-score{gap:15px;padding:20px 0}.dg-report-score>strong{font-size:72px}.dg-report-score b{font-size:16px}.dg-report-score span{font-size:11px}.dg-report-score img{display:none}.dg-rewards{gap:10px;padding:14px 8px;font-size:11px;flex-wrap:wrap}.dg-growth{padding:17px}.dg-growth>div{grid-template-columns:1fr 85px 35px;gap:10px;font-size:11px}.dg-report-actions button{width:100%}
}
@media(max-height:600px) and (min-width:751px){.dg-lobby{padding-top:18px}.dg-heading{margin-bottom:15px}.dg-portrait{height:115px}.dg-realm{height:115px}.dg-papers{max-height:160px}.dg-hero>p,.dg-hero>small{display:none}.dg-rules{margin-top:13px;padding-top:10px}}
@media(prefers-reduced-motion:reduce){.dg-view *,.dg-portal-entry *{animation:none!important;transition:none!important}}

/* The generated portal rests on a small trunk-side stone ledge. */
.dg-portal-pedestal{display:block;position:relative;width:100%;aspect-ratio:1;margin-top:30px;isolation:isolate}
.dg-portal-pedestal::after{content:"";position:absolute;bottom:3%;left:5%;width:90%;height:14%;border-radius:50%;border:3px solid #483a43;background:linear-gradient(#91a35f,#4d6250 50%,#332b3a);box-shadow:0 8px 0 #382c3e;z-index:-1}
.dg-portal-pedestal img{width:100%;height:100%;object-fit:contain;filter:drop-shadow(0 0 12px #ba74ff);animation:dg-portal-glow 3s ease-in-out infinite}
.dg-portal-aura::after{content:"";position:absolute;inset:15%;border:3px dashed #efd1ff99;border-radius:50%;filter:drop-shadow(0 0 10px #d684ff)}
.dg-dialog{border-image:url('/assets/dungeon/v1/panel.webp') 100 / 28px / 5px stretch}
@media(max-width:750px){.dg-portal-pedestal{flex:none;width:90px;height:100px;margin-top:0}.dg-portal-pedestal img{width:90px;height:100px}}
/* Learning Layout moves the explanation into #stage; anchor it to the viewport. */

/* ---------- v2: bigger FF-style battle stage, dungeon names, portal warp ---------- */
.dg-paper-copy em{display:block;font-style:normal;font-size:11px;color:#e9c98f;letter-spacing:1px;margin:1px 0 2px}
.dg-equipment .dg-slot{font:400 16px var(--f-display);color:#e8cf9d;margin:6px 0 -6px}.dg-equipment article.used{border-color:#e7c98f;box-shadow:inset 0 0 0 1px #e7c98f55}
/* Portal warp: a spinning vortex while the dark lobby opens. */
.dg-warp{position:fixed;inset:0;z-index:300;pointer-events:none;display:grid;place-items:center;background:radial-gradient(circle,#0000 0,#0b0716 70%);animation:dg-warp-in .7s ease-out forwards}
.dg-warp i{position:absolute;width:160vmax;height:160vmax;border-radius:50%;background:conic-gradient(from 0deg,#2b0f4a,#b06cff,#1a0b33,#7d3df0,#e7c2ff,#2b0f4a);animation:dg-warp-spin 1.2s linear infinite;opacity:.85;mask:radial-gradient(circle,#000 0 18%,#0000 19% 22%,#000 23% 40%,#0000 41% 44%,#000 45%);-webkit-mask:radial-gradient(circle,#000 0 18%,#0000 19% 22%,#000 23% 40%,#0000 41% 44%,#000 45%)}
.dg-warp i+i{animation-direction:reverse;animation-duration:1.8s;opacity:.45;transform:scale(.7)}
.dg-warp b{position:absolute;width:30vmin;height:30vmin;border-radius:50%;background:radial-gradient(circle,#fff,#e3c4ff 40%,#0000 70%);animation:dg-warp-core .7s cubic-bezier(.8,0,1,1) forwards}
.dg-warp.out{animation:dg-warp-out .45s ease-out forwards}
@keyframes dg-warp-in{0%{opacity:0;transform:scale(.3) rotate(-60deg)}30%{opacity:1}100%{opacity:1;transform:none}}
@keyframes dg-warp-spin{to{rotate:360deg}}
@keyframes dg-warp-core{to{width:220vmax;height:220vmax}}
@keyframes dg-warp-out{to{opacity:0;transform:scale(1.4)}}
@media(prefers-reduced-motion:reduce){.dg-warp{display:none}}

/* ---------- v3 battle: one screen. The question window sits inside the battle scene. ---------- */
body.dungeon-battle{--dg-hud:64px;--dg-board-top:clamp(300px,42dvh,470px)}
#dgBattle{position:fixed;inset:0;z-index:1;background:#0b0d1c}
#dgFight{position:absolute;inset:0;width:100%;height:100%;display:block}
#dgBattle .dg-run-hud{position:absolute;top:0;left:0;right:0;height:var(--dg-hud);padding:8px 18px;background:linear-gradient(#0b0d1cf0,#0b0d1c80);border:0;box-shadow:none}
body.dungeon-battle #v-game{position:fixed!important;inset:0!important;height:auto!important;padding:0!important;background:#0b0d1c!important;overflow:hidden!important;z-index:45}
body.dungeon-battle #stage{position:fixed!important;inset:var(--dg-board-top) 12px 12px!important;width:auto!important;height:auto!important;max-width:none!important;margin:0!important;z-index:3!important;display:block!important;padding:6px!important;background:linear-gradient(180deg,#34428c,#151c4a 70%,#0d1236)!important;border:3px solid #cfd8ff!important;border-radius:14px!important;box-shadow:0 0 0 2px #0a0d24,0 12px 30px #000a!important;transition:none!important}
body.dungeon-battle #stage .play,body.dungeon-battle #stage.with-sheet .play{width:100%!important;height:100%!important;max-width:none!important;display:block!important;flex:none!important;margin:0!important;padding:0!important}
body.dungeon-battle #board{border:0!important;border-radius:9px!important;box-shadow:inset 0 0 0 2px #e9d9b4!important}
body.dungeon-battle #sheet{position:fixed!important;display:flex!important;inset:var(--dg-board-top) 12px 12px!important;width:auto!important;height:auto!important;max-height:none!important;z-index:6!important;border:3px solid #cfd8ff!important;border-radius:14px!important;background:#fff8ed!important;box-shadow:0 0 0 2px #0a0d24,0 12px 30px #000a!important;opacity:0!important;transform:translateY(24px)!important;pointer-events:none!important;transition:opacity .2s,transform .2s!important}
body.dungeon-battle #sheet.in{opacity:1!important;transform:none!important;pointer-events:auto!important}
body.dungeon-battle #sheet .pbtns{flex-wrap:wrap}
/* Command row: energy, then every skill and spell, just above the question window. */
#dgSkillBar{position:absolute;left:12px;right:12px;top:calc(var(--dg-board-top) - 58px);height:52px;z-index:2}
#dgBattle .dg-skills{display:flex;gap:6px;height:100%;align-items:stretch;overflow-x:auto;overflow-y:hidden;scrollbar-width:none;position:static}
#dgBattle .dg-skills::-webkit-scrollbar{display:none}
#dgBattle .dg-skill,#dgBattle .dg-energy,#dgBattle .dg-monster,#dgBattle .dg-battle-status{background:linear-gradient(180deg,#34428cee,#151c4aee 60%,#0d1236ee);border:2px solid #cfd8ffb0;box-shadow:0 0 0 1px #0a0d24,0 4px 10px #0007;color:#f4f6ff;text-shadow:0 1px 0 #0a0d24;border-radius:9px}
#dgBattle .dg-skill{display:flex;align-items:center;gap:6px;flex:0 0 auto;min-height:44px;padding:3px 10px 3px 5px;font:700 13px var(--f-body);cursor:pointer}
#dgBattle .dg-skill i{width:34px;height:34px;display:grid;place-items:center;flex:none}#dgBattle .dg-skill i img,#dgBattle .dg-skill i svg{width:32px;height:32px;object-fit:contain}
#dgBattle .dg-skill span{text-align:left;line-height:1.15}#dgBattle .dg-skill small{display:block;font-size:10px;color:#c8d1fb;font-weight:600}
#dgBattle .dg-skill:not(:disabled):hover{border-color:#fff3c4;transform:translateY(-1px)}#dgBattle .dg-skill:disabled{opacity:.45;cursor:default}#dgBattle .dg-skill.locked{filter:grayscale(.8)}
#dgBattle .dg-energy{flex:0 0 auto;display:flex;flex-direction:column;justify-content:center;gap:4px;padding:4px 10px;font-size:11px}#dgBattle .dg-energy b{display:flex;gap:3px}
.dg-energy i{width:10px;height:10px;border-radius:50%;background:#1b2250;border:1px solid #8d9ad8;display:inline-block}.dg-energy i.on{background:radial-gradient(circle at 35% 35%,#fff7cf,#ffcf55);border-color:#fff1b0;box-shadow:0 0 6px #ffd56a}
#dgBattle .dg-monster{position:absolute;top:calc(var(--dg-hud) + 8px);right:14px;left:auto;width:250px;padding:6px 12px;text-align:left;pointer-events:none;z-index:2}
#dgBattle .dg-monster>b{display:block;font:400 16px var(--f-display);color:#fff}#dgBattle .dg-monster b em{font:700 10px var(--f-body);font-style:normal;background:#ffcf6e;color:#2a1a08;border-radius:5px;padding:1px 6px;margin-right:6px;vertical-align:2px;text-shadow:none}#dgBattle .dg-monster.boss b em{background:#ff8fa6}
#dgBattle .dg-monster>span{display:block;height:9px;margin:4px 0;background:#05081c;border:1px solid #8d9ad8;border-radius:8px;overflow:hidden}#dgBattle .dg-monster i{display:block;height:100%;background:linear-gradient(90deg,#ff6f86,#ffc073);transition:width .3s}#dgBattle .dg-monster small{font-size:10px;color:#d7defc}
#dgBattle .dg-battle-status{position:absolute;left:50%;transform:translateX(-50%);top:calc(var(--dg-board-top) - 96px);max-width:min(460px,70%);padding:5px 14px;margin:0;font-size:12px;border-radius:20px;text-align:center;z-index:2;pointer-events:none}
body.dungeon-battle #qarea{min-height:120px!important}
@media(min-width:751px) and (max-aspect-ratio:1/1){body.dungeon-battle{--dg-board-top:clamp(340px,40dvh,520px)}}
@media(max-height:600px) and (min-width:751px){body.dungeon-battle{--dg-hud:56px;--dg-board-top:52dvh}#dgBattle .dg-run-hud .dg-health small{display:none}}
@media(max-width:750px){
 body.dungeon-battle{--dg-hud:84px;--dg-board-top:max(330px,42dvh)}
 #dgBattle .dg-run-hud{padding:8px 10px;height:var(--dg-hud)}
 #dgBattle .dg-monster{top:calc(var(--dg-hud) + 4px);left:8px;right:8px;width:auto;display:grid;grid-template-columns:auto 1fr;align-items:center;gap:0 10px;padding:3px 10px}#dgBattle .dg-monster>b{font-size:13px}#dgBattle .dg-monster small{display:none}
 #dgSkillBar{left:6px;right:6px;top:calc(var(--dg-board-top) - 52px);height:46px}#dgBattle .dg-skill{padding:2px 8px 2px 3px;font-size:11px}#dgBattle .dg-skill i{width:28px;height:28px}#dgBattle .dg-skill i img,#dgBattle .dg-skill i svg{width:26px;height:26px}#dgBattle .dg-skill small{font-size:9px}
 body.dungeon-battle #stage,body.dungeon-battle #sheet{inset:var(--dg-board-top) 6px 6px!important}body.dungeon-battle #stage{padding:4px!important}
 #dgBattle .dg-battle-status{top:calc(var(--dg-board-top) - 84px);font-size:11px;max-width:92%}
}
/* Character screen: equipment and talents. */
.dg-dialog.dg-wide{width:min(1040px,100%);max-height:92dvh}
.dg-hero-sheet{display:grid;grid-template-columns:230px 1fr;gap:22px;margin-top:8px}
.dg-hero-side{display:flex;flex-direction:column;gap:10px;align-items:stretch;text-align:center}
.dg-hero-side canvas{width:100%;height:220px;border-radius:14px;background:radial-gradient(circle at 50% 70%,#3b2c5e,#121528 70%);border:1px solid #81708d}
.dg-stat-grid{display:grid;grid-template-columns:1fr 1fr;gap:6px;font-size:12px;text-align:left}.dg-stat-grid span{background:#121a2bc9;border:1px solid #81708d55;border-radius:8px;padding:6px 8px;color:#c9c0d6}.dg-stat-grid b{display:block;font:700 16px var(--f-num);color:#f6e2bb}
.dg-points{background:linear-gradient(180deg,#34428c,#151c4a);border:2px solid #cfd8ffa0;border-radius:10px;padding:8px 10px;font-size:12px;color:#e8ecff}.dg-points b{font:700 20px var(--f-num);color:#ffe08a}.dg-points progress{width:100%;height:8px;accent-color:#ffcf55}
.dg-tabs{display:flex;gap:8px;margin-bottom:12px}.dg-tabs button{flex:1}.dg-tabs button[aria-selected=true]{background:#e9d3a2;color:#2b1d14;border-color:#fff3c4}
.dg-talents{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}
.dg-talent-group h3{font:400 17px var(--f-display);color:#e8cf9d;margin:0 0 8px}
.dg-talent{display:grid;grid-template-columns:40px 1fr;gap:4px 10px;align-items:center;padding:10px;margin-bottom:8px;border-radius:12px;background:#121a2bc9;border:1px solid #81708d}
.dg-talent.learned{border-color:#cfd8ffa0}.dg-talent i{width:40px;height:40px;grid-row:1/3;display:grid;place-items:center}.dg-talent i img,.dg-talent i svg{width:36px;height:36px;object-fit:contain}
.dg-talent h4{margin:0;font-size:14px;color:#fff;display:flex;justify-content:space-between;gap:6px}.dg-talent h4 em{font-style:normal;font-size:11px;color:#ffe08a}
.dg-talent p{margin:0;font-size:11px;color:#c9c0d6;line-height:1.45;grid-column:2}.dg-talent p b{color:#9dffb0;font-weight:700}
.dg-talent button{grid-column:1/-1;min-height:40px;font-size:12px}
.dg-pips{display:inline-flex;gap:3px}.dg-pips i{width:8px;height:8px;border-radius:2px;background:#2a3060;display:inline-block}.dg-pips i.on{background:#ffd56a}
.dg-hud-hero{position:relative}.dg-hud-hero[data-points]::after{content:attr(data-points);position:absolute;top:-6px;right:-6px;min-width:18px;height:18px;border-radius:9px;background:#ff6f86;color:#fff;font:700 11px/18px var(--f-num);text-align:center;padding:0 4px}
@media(max-width:750px){.dg-hero-sheet{grid-template-columns:1fr}.dg-hero-side canvas{height:150px}.dg-talents{grid-template-columns:1fr}}
body.dungeon-battle .rv-ribbon,body.dungeon-battle .review-notice{display:none!important}

/* A hole in the central sky. Only its interior rotates; the target stays fixed. */
#v-workbooks .dg-sky-portal{--vortex-size:clamp(150px,20dvh,225px);position:absolute;left:50%;right:auto;top:118px;transform:translateX(-50%);width:var(--vortex-size);height:auto;min-height:44px;margin:0;gap:0;filter:none;flex-direction:column;z-index:5;isolation:isolate}
.dg-sky-eye{position:relative;display:block;flex:none;width:var(--vortex-size);height:var(--vortex-size);border-radius:50%;isolation:isolate;pointer-events:none}
.dg-sky-halo{position:absolute;inset:-12%;border-radius:50%;background:radial-gradient(circle,#39206255 30%,#a6b5ff77 48%,#edfaff66 56%,transparent 70%);animation:dg-sky-breathe 4s ease-in-out infinite}
.dg-sky-spin{position:absolute;inset:0;display:block;animation:dg-sky-rotate 13s linear infinite;will-change:transform}
#v-workbooks .dg-sky-spin img{display:block;width:100%;height:100%;object-fit:contain;filter:none;animation:none!important}
.dg-sky-depth{position:absolute;inset:40%;border-radius:50%;background:radial-gradient(circle,#100d36bb,#28205c66 45%,transparent 72%);box-shadow:0 0 12px #583eaa55}
.dg-sky-mote{--angle:calc(var(--i)*37deg);position:absolute;left:50%;top:50%;width:4px;height:4px;border-radius:50%;background:#fff8c6;box-shadow:0 0 6px #fff,0 0 11px #a9f2ff;opacity:0;animation:dg-sky-infall calc(3s + var(--i)*.09s) linear infinite;animation-delay:calc(var(--i)*-.31s)}
@keyframes dg-sky-rotate{to{transform:rotate(360deg)}}
@keyframes dg-sky-breathe{50%{transform:scale(1.09);opacity:.7}}
@keyframes dg-sky-infall{
 0%{opacity:0;transform:rotate(var(--angle)) translateX(calc(var(--vortex-size)*.67)) scale(1)}
 15%{opacity:.9}
 50%{opacity:.85;transform:rotate(calc(var(--angle) + 180deg)) translateX(calc(var(--vortex-size)*.31)) scale(.8)}
 90%{opacity:.5}
 100%{opacity:0;transform:rotate(calc(var(--angle) + 420deg)) translateX(0) scale(.1)}
}
#v-workbooks .dg-sky-portal .dg-portal-caption{margin-top:-4px;padding:6px 12px;border-radius:16px;background:linear-gradient(135deg,#3b2860ef,#22233cef);width:max-content;max-width:210px;text-align:center;box-shadow:0 3px 0 #38204b,0 0 12px #d8ccff66}
#v-workbooks .dg-sky-portal .dg-portal-caption b{font-size:22px}
#v-workbooks .dg-sky-portal .dg-portal-caption small{font-size:10px;line-height:1.5}
#v-workbooks .dg-sky-portal .dg-portal-caption strong{position:static;writing-mode:horizontal-tb;font-size:12px;margin-top:2px;letter-spacing:0}
.dg-sky-portal:hover .dg-sky-halo,.dg-sky-portal:focus-visible .dg-sky-halo{background:radial-gradient(circle,#39206277 30%,#a6b5ff99 48%,#edfaff99 56%,transparent 70%)}
.dg-sky-portal:focus-visible{outline:3px solid #4e3b80;outline-offset:10px;border-radius:48% 48% 20px 20px}
#v-workbooks:not(.on) .dg-sky-portal *{animation-play-state:paused!important}
.dg-sky-paused *{animation-play-state:paused!important}
/* The travel effect starts at the aperture, rather than at the viewport centre. */
.dg-sky-warp{display:block;background:transparent;animation:dg-sky-veil .8s ease-in forwards;overflow:hidden;opacity:1;transform:none;isolation:isolate}
.dg-sky-warp>img{position:absolute;left:var(--warp-x);top:var(--warp-y);width:var(--warp-size);height:var(--warp-size);max-width:none;animation:dg-sky-enter .8s cubic-bezier(.5,0,.75,.6) forwards}
.dg-sky-warp>span{position:absolute;inset:0;background:#1a1234;opacity:0;animation:dg-sky-cover .8s ease-in forwards}
.dg-sky-warp.covered{background:#17152a;animation:none}.dg-sky-warp.covered>span{opacity:1;animation:none}.dg-sky-warp.covered>img{visibility:hidden}
.dg-sky-warp.out{animation:none;opacity:0;transform:none;transition:opacity .36s ease-out}
@keyframes dg-sky-veil{to{background:#16102bdd}}
@keyframes dg-sky-enter{from{transform:translate(-50%,-50%) rotate(var(--warp-angle,0deg)) scale(1)}to{transform:translate(-50%,-50%) rotate(calc(var(--warp-angle,0deg) + 155deg)) scale(26)}}
@keyframes dg-sky-cover{0%,72%{opacity:0}100%{opacity:1}}
@media(min-width:701px){#v-workbooks:has(.dg-sky-portal) .mw-book-choices{column-gap:clamp(190px,20vw,270px)}}
@media(min-width:701px) and (max-height:760px){#v-workbooks .dg-sky-portal{--vortex-size:130px;top:94px}.dg-sky-portal .dg-portal-caption small{display:none}}
@media(max-width:700px){
 #v-workbooks .dg-sky-portal{position:relative;inset:auto;transform:none;--vortex-size:145px;align-self:center;width:var(--vortex-size);margin:-2px 0 3px;flex-direction:column;height:auto}
 #v-workbooks:has(.dg-sky-portal) .mw-picker-content{gap:10px;padding-top:15px}
 #v-workbooks:has(.dg-sky-portal) .mw-picker-title{text-align:center}
 #v-workbooks:has(.dg-sky-portal) .mw-picker-title h1{font-size:26px}
 #v-workbooks .dg-sky-portal .dg-portal-caption{max-width:190px;padding:5px 12px}
 #v-workbooks .dg-sky-portal .dg-portal-caption b{font-size:20px}
}
@media(prefers-reduced-motion:reduce){.dg-sky-portal *{animation:none!important;transition:none!important}.dg-sky-mote{display:none}.dg-sky-warp{display:none}}

/* Different currents and a breathing rim give the aperture changing depth. */
.dg-sky-eye{animation:dg-sky-living 7s ease-in-out infinite;transform-origin:center}
.dg-sky-spin::after{content:'';position:absolute;inset:9%;border-radius:50%;background:url('../assets/sky-vortex/v1/vortex.webp') center/contain no-repeat;opacity:.22;mask-image:radial-gradient(circle,transparent 12%,#000 24% 54%,transparent 68%);animation:dg-sky-undertow 19s linear infinite}
.dg-sky-depth{animation:dg-sky-depth 5.3s ease-in-out infinite}
@keyframes dg-sky-living{0%,100%{transform:scale(.98) rotate(-2deg)}50%{transform:scale(1.035) rotate(2deg)}}
@keyframes dg-sky-undertow{to{transform:rotate(-360deg) scale(.92)}}
@keyframes dg-sky-depth{50%{transform:scale(1.16);opacity:.65}}
body.dungeon-travel .view{animation:none!important}
@media(prefers-reduced-motion:reduce){.dg-sky-eye,.dg-sky-spin::after,.dg-sky-depth{animation:none!important}}
.dg-sky-paused .dg-sky-spin::after,#v-workbooks:not(.on) .dg-sky-spin::after{animation-play-state:paused!important}

/* ---------- 2026-10-21: loot toasts, villagers and quests ---------- */
.dg-loot{position:fixed;left:50%;top:max(84px,12dvh);transform:translateX(-50%);z-index:400;display:flex;flex-direction:column;align-items:center;gap:6px;padding:12px 18px 14px;min-width:220px;max-width:min(92vw,420px);border-radius:16px;background:linear-gradient(180deg,#3a2a62f2,#1b1638f2);border:2px solid #f0d58f;box-shadow:0 0 0 2px #120c24,0 10px 30px #000a,0 0 30px #ffd56a55;color:#fff6dc;font:700 14px/1.4 var(--f-body);pointer-events:none;animation:dg-loot-in .35s cubic-bezier(.2,1.6,.4,1) both}
.dg-loot>b{font:400 20px var(--f-display);color:#ffe08a;letter-spacing:2px;text-shadow:0 2px 0 #120c24}
.dg-loot-item{display:flex;align-items:center;gap:8px;background:#ffffff14;border-radius:10px;padding:4px 10px 4px 4px;width:100%}
.dg-loot-item i{width:34px;height:34px;flex:none;display:grid;place-items:center;filter:drop-shadow(0 0 6px #ffe08a88)}.dg-loot-item i img,.dg-loot-item i svg{width:32px;height:32px;object-fit:contain}
.dg-loot.out{animation:dg-loot-out .5s ease-in forwards}
@keyframes dg-loot-in{from{opacity:0;transform:translate(-50%,-18px) scale(.8)}}
@keyframes dg-loot-out{to{opacity:0;transform:translate(-50%,-24px)}}
@media(prefers-reduced-motion:reduce){.dg-loot,.dg-loot.out{animation:none}}
.dg-npc-dialog{display:grid;grid-template-columns:110px 1fr;gap:14px;align-items:center}
.dg-npc-face{flex-shrink:0;width:100px;height:122px;border-radius:14px;background:radial-gradient(circle at 50% 70%,#3b2c5e,#121528 75%);border:1px solid #81708d}
.dg-quest-list{display:grid;gap:8px;margin:12px 0}
.dg-quest{padding:8px 12px;border-radius:10px;background:#121a2bc9;border:1px solid #81708d;display:flex;flex-direction:column;gap:2px}
.dg-quest b{font-size:14px;color:#fff}.dg-quest small{font-size:12px;color:#c9c0d6}
.dg-quest.done{border-color:#ffe08a;box-shadow:inset 0 0 0 1px #ffe08a55}.dg-quest.claimed{opacity:.6}.dg-quest.active{border-color:#9fd8ff88}
@media(max-width:600px){.dg-npc-dialog{grid-template-columns:72px 1fr}.dg-npc-face{width:70px;height:86px}}

/* ---------- 2026-10-21: the entry is a tree-hollow cave with a living portal inside ---------- */
/* --cw/--ch come from the painted tree hollow at the current cover scale (set in dungeon-game.js). */
#v-workbooks .dg-sky-portal.dg-hollow{--cw:115px;--ch:205px;width:calc(var(--cw)*1.42);top:104px}
.dg-hollow-frame{position:relative;display:block;width:calc(var(--cw)*1.42);height:calc(var(--ch) + var(--cw)*.42);margin:0 auto;isolation:isolate}
/* Carved trunk around the hole: warm wood like the garden tree, with grain, a knot, roots and moss. */
.dg-hollow-bark{position:absolute;inset:0;width:100%;height:100%;overflow:visible;filter:drop-shadow(0 8px 10px #1a0f2a55)}
/* The hole itself: an arch the shape of the garden's tree hollow. */
.dg-hollow .dg-sky-eye{position:absolute;left:calc(var(--cw)*.21);top:calc(var(--cw)*.16);width:var(--cw);height:var(--ch);border-radius:50% 50% 12% 12%/30% 30% 6% 6%;overflow:hidden;background:radial-gradient(ellipse at 50% 45%,#2b1b5c,#0d0820 70%);box-shadow:inset 0 0 22px 8px #07041299,inset 0 -8px 16px #000a;animation:dg-hollow-breathe 6s ease-in-out infinite}
.dg-hollow .dg-sky-halo{inset:-10%;border-radius:40%}
.dg-hollow .dg-sky-spin{inset:auto;left:calc(50% - var(--ch)*.75);top:calc(50% - var(--ch)*.75);width:calc(var(--ch)*1.5);height:calc(var(--ch)*1.5)}
.dg-hollow .dg-sky-depth{inset:auto;left:calc(50% - var(--cw)*.2);top:calc(50% - var(--cw)*.2);width:calc(var(--cw)*.4);height:calc(var(--cw)*.4)}
/* Rune rings turn in opposite directions inside the hole. */
.dg-hollow-ring{position:absolute;left:calc(50% - var(--cw)*.42);top:calc(50% - var(--cw)*.42);width:calc(var(--cw)*.84);height:calc(var(--cw)*.84);border-radius:50%;border:2px dashed #f2e6ffaa;box-shadow:0 0 10px #c9a6ff88,inset 0 0 10px #c9a6ff55;animation:dg-sky-rotate 11s linear infinite reverse;pointer-events:none}
.dg-hollow-ring2{left:calc(50% - var(--cw)*.27);top:calc(50% - var(--cw)*.27);width:calc(var(--cw)*.54);height:calc(var(--cw)*.54);border:2px dotted #ffe9a8cc;box-shadow:0 0 8px #ffe08a88;animation:dg-sky-rotate 6s linear infinite}
/* Lit inner lip of the hole and the purple light that leaks onto the bark. */
.dg-hollow-lip{position:absolute;left:calc(var(--cw)*.21 - 4px);top:calc(var(--cw)*.16 - 4px);width:calc(var(--cw) + 8px);height:calc(var(--ch) + 8px);border-radius:50% 50% 12% 12%/30% 30% 6% 6%;border:5px solid #d29a5c;box-shadow:inset 0 0 0 2px #5a341a,inset 0 0 14px 4px #1a0d2a99,0 0 0 2px #3b2412,0 3px 0 2px #6a3d2088;pointer-events:none}
.dg-hollow-glow{position:absolute;left:calc(var(--cw)*.21);top:calc(var(--cw)*.16);width:var(--cw);height:var(--ch);border-radius:50% 50% 12% 12%/30% 30% 6% 6%;box-shadow:0 0 16px 4px #c9a6ffaa,inset 0 0 26px 6px #b388ff88;animation:dg-hollow-pulse 3.2s ease-in-out infinite;pointer-events:none}
.dg-hollow-spill{position:absolute;left:5%;right:5%;bottom:-14px;height:26px;border-radius:50%;background:radial-gradient(ellipse,#c9a6ffaa,#8f6bff44 45%,transparent 72%);z-index:-1;animation:dg-hollow-pulse 3.2s ease-in-out infinite}
.dg-hollow-rune{--a:calc(var(--i)*30deg - 90deg);position:absolute;left:50%;top:calc(var(--cw)*.16 + var(--cw)*.5);width:14px;height:14px;margin:-7px;font-style:normal;font-size:12px;line-height:14px;text-align:center;color:#ffe9a8;text-shadow:0 0 6px #ffd56a,0 0 12px #b388ff;transform:rotate(var(--a)) translateY(calc(var(--cw)*-.66)) rotate(calc(var(--a)*-1));animation:dg-hollow-twinkle 2.4s ease-in-out infinite;animation-delay:calc(var(--i)*-.35s);pointer-events:none}
.dg-hollow-vine{position:absolute;left:-8%;top:6%;width:34%;height:88%;overflow:visible;pointer-events:none;filter:drop-shadow(0 2px 0 #1d3a1488)}
.dg-sky-portal.dg-hollow:hover .dg-hollow-glow,.dg-sky-portal.dg-hollow:focus-visible .dg-hollow-glow{box-shadow:0 0 26px 8px #e0c8ffcc,inset 0 0 30px 8px #c9a6ffaa}
.dg-sky-portal.dg-hollow:focus-visible{border-radius:46% 46% 16px 16px}
@keyframes dg-hollow-breathe{0%,100%{filter:brightness(.95) saturate(1)}50%{filter:brightness(1.15) saturate(1.25)}}
@keyframes dg-hollow-pulse{0%,100%{opacity:.7}50%{opacity:1}}
@keyframes dg-hollow-twinkle{0%,100%{opacity:.35}50%{opacity:1}}
#v-workbooks .dg-sky-portal.dg-hollow .dg-portal-caption{margin-top:6px}
@media(min-width:701px) and (max-height:760px){#v-workbooks .dg-sky-portal.dg-hollow{top:98px}}
@media(max-width:700px){#v-workbooks .dg-sky-portal.dg-hollow{top:auto;flex-direction:row;align-items:center;gap:10px;width:auto;margin:0 0 4px}#v-workbooks .dg-sky-portal.dg-hollow .dg-portal-caption{margin-top:0}}
@media(prefers-reduced-motion:reduce){.dg-hollow .dg-sky-eye,.dg-hollow-ring,.dg-hollow-glow,.dg-hollow-spill,.dg-hollow-rune{animation:none!important}}
.dg-sky-paused .dg-hollow-frame *,#v-workbooks:not(.on) .dg-hollow-frame *{animation-play-state:paused!important}

/* v30: learning occupies the upper window; the supported arena stays below. */
body.dungeon-battle{--dg-question-height:clamp(230px,38dvh,380px);--dg-arena-top:calc(var(--dg-hud) + var(--dg-question-height) + 18px)}
body.dungeon-battle #stage,body.dungeon-battle #sheet{inset:calc(var(--dg-hud) + 6px) 12px auto!important;height:var(--dg-question-height)!important;border-color:#b9c7b5!important;background:#173d43!important;box-shadow:0 3px 0 #071b24,0 7px 20px #0006!important}
body.dungeon-battle #board{box-shadow:inset 0 0 0 2px #d4bc86!important;background:linear-gradient(125deg,#fffaf0,#f5eedc)!important}
#dgFight{top:var(--dg-arena-top);bottom:0;height:calc(100% - var(--dg-arena-top));border-top:1px solid #819c8b66}
#dgBattle .dg-monster{top:calc(var(--dg-arena-top) + 8px);right:14px;max-width:42%;padding:6px 12px;background:linear-gradient(135deg,#163b43e8,#0c202de8);border-color:#bca671}
#dgBattle .dg-monster .dg-intent-detail{display:none}
#dgSkillBar{top:auto;bottom:max(8px,env(safe-area-inset-bottom));height:52px}
#dgBattle .dg-battle-status{top:auto;bottom:70px;max-width:min(620px,90%);background:#102a31d9;border-color:#8d9f8f;font-size:11px}
body.dungeon-battle.dungeon-command #qarea,body.dungeon-battle.dungeon-command #qhead,body.dungeon-battle.dungeon-command #whyBtn,body.dungeon-battle.dungeon-command #hintBtn{visibility:visible}
#dgBattle #dgTactics{position:absolute;inset:calc(var(--dg-arena-top) + 10px) auto 68px 50%;transform:translateX(-50%);width:min(350px,96vw);z-index:15;overflow:visible;padding:0;border:0;border-radius:0;background:none;color:#fff4d5;pointer-events:none;display:flex;flex-direction:column;justify-content:center;align-items:center;gap:0;text-shadow:0 2px 4px #071318}
#dgBattle #dgTactics>header{display:block;text-align:center;margin:0 0 4px;padding:2px 14px;background:#0e2630b8;border:1px solid #a8b19c66;border-radius:20px}
#dgBattle #dgTactics h2{font-family:var(--f-display);font-size:17px;margin:0}#dgBattle #dgTactics small{color:#e6d9ae;font-size:10px}
#dgBattle #dgTactics .dg-command-wheel{--wheel-scale:1;position:relative;display:block;flex:0 0 224px;width:310px;height:224px;margin:0;isolation:isolate;animation:dg-wheel-arrive .5s cubic-bezier(.15,.7,.25,1) both}
#dgBattle #dgTactics .dg-command-wheel:before{content:"";position:absolute;left:50%;top:50%;width:202px;height:202px;margin:-101px 0 0 -101px;border:1px solid #efd29388;border-radius:50%;background:conic-gradient(from 0deg,#f4da8100,#e5cc6740 16%,#7fd5d322 36%,#c1e6dc00 55%,#f6db7c38 80%,#f4da8100);box-shadow:0 0 24px #bde8d421,inset 0 0 24px #e5cf7e16;animation:dg-wheel-orbit 24s linear infinite;pointer-events:none;z-index:-1}
#dgBattle #dgTactics .dg-command-card{position:absolute;left:50%;top:50%;transform:translate(calc(-50% + var(--wheel-x)*var(--wheel-scale)),calc(-50% + var(--wheel-y)*var(--wheel-scale)));width:100px;min-height:58px;padding:6px 4px;gap:2px;align-items:center;text-align:center;border:1px solid #d6c18f;background:linear-gradient(145deg,#275a5cef,#102c39f5);box-shadow:0 3px 0 #071923,0 4px 15px #07192388;border-radius:12px;pointer-events:auto;transition:background .18s,box-shadow .18s,border-color .18s;cursor:pointer}
#dgBattle #dgTactics .dg-command-card b{font-size:13px;line-height:1.2;white-space:nowrap}#dgBattle #dgTactics .dg-command-card span{font-size:9px;color:#e0e8d5;line-height:1.3}#dgBattle #dgTactics .dg-command-card i{font-size:15px;line-height:1;font-style:normal;color:#f1d787}
#dgBattle #dgTactics .dg-command-card:focus-visible,#dgBattle #dgTactics .dg-command-card:hover{background:linear-gradient(145deg,#71643e,#24494b);border-color:#fff0ba;box-shadow:0 0 0 3px #f7db7b55,0 0 24px #f6d99177;outline:0}
.dg-wheel-center{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:58px;height:58px;border:1px solid #d6c18f99;border-radius:50%;background:#102d39e3;display:grid;place-content:center;text-align:center;font:700 21px var(--f-body);box-shadow:0 0 20px #e3cc7733;pointer-events:none}.dg-wheel-center small{display:block;font-size:9px}
#dgBattle #dgTactics .dg-command-keys{font-size:10px;margin:0;color:#dfdfc7;padding:3px 10px;border-radius:20px;background:#102b35cc}
#dgBattle #dgTactics:not([data-phase=command]){inset:auto 16px 80px;width:auto;max-width:640px;min-height:0;margin:auto;transform:none;padding:10px 14px;background:#102e37eb;border:1px solid #c9ba8999;border-radius:14px;pointer-events:auto;align-items:stretch}
#dgBattle #dgTactics:not([data-phase=command]) header,#dgBattle #dgTactics:not([data-phase=command]) .dg-battle-log{display:none}#dgBattle #dgTactics .dg-turn-wait{padding:0;margin:0;background:none;font-size:12px;color:#e9e6d4}
.dg-summary-stats{display:grid;grid-template-columns:repeat(4,1fr);gap:10px;margin:18px 0}.dg-summary-stats span{padding:12px 6px;border:1px solid #7f9b8e;border-radius:12px;text-align:center;background:#163a40;color:#d7e7d5;font-size:12px}.dg-summary-stats b{display:block;color:#ffe09c;font-size:22px;margin-top:5px}.dg-encounter-summary p{line-height:1.7}.dg-encounter-summary>.dg-primary{width:100%;min-height:48px}
@keyframes dg-wheel-orbit{to{rotate:360deg}}@keyframes dg-wheel-arrive{from{opacity:0;rotate:-16deg;scale:.88}to{opacity:1;rotate:0deg;scale:1}}
@media(max-width:750px){body.dungeon-battle{--dg-question-height:clamp(245px,35dvh,340px)}body.dungeon-battle #stage,body.dungeon-battle #sheet{left:6px!important;right:6px!important}#dgBattle .dg-monster{left:8px;right:8px;max-width:none;top:calc(var(--dg-arena-top) + 4px);padding:3px 9px}#dgBattle .dg-monster .dg-intent{font-size:9px}#dgBattle .dg-monster>small{display:none}#dgSkillBar{height:46px}#dgBattle .dg-battle-status{bottom:64px}#dgBattle #dgTactics{bottom:64px;top:calc(var(--dg-arena-top) + 25px)}.dg-summary-stats{grid-template-columns:repeat(2,1fr)}}
@media(max-height:650px){body.dungeon-battle{--dg-question-height:clamp(138px,34dvh,220px);--dg-hud:54px}#dgBattle #dgTactics>header,#dgBattle #dgTactics .dg-command-keys{display:none}#dgBattle #dgTactics .dg-command-wheel{--wheel-scale:.62;flex-basis:140px;width:230px;height:140px}#dgBattle #dgTactics .dg-command-wheel:before{width:124px;height:124px;margin:-62px 0 0 -62px}#dgBattle #dgTactics .dg-command-card{width:78px;min-height:44px;padding:5px 2px}#dgBattle #dgTactics .dg-command-card i,#dgBattle #dgTactics .dg-command-card span{display:none}#dgBattle #dgTactics .dg-command-card b{font-size:11px}.dg-wheel-center{width:35px;height:35px;font-size:15px}.dg-wheel-center small{display:none}#dgBattle .dg-monster{padding:3px 8px}#dgBattle .dg-monster .dg-attack-estimate,#dgBattle .dg-monster .dg-intent{display:none}#dgSkillBar{height:44px}#dgBattle .dg-battle-status{bottom:60px;padding:3px 10px}#dgBattle #dgTactics{bottom:56px;top:calc(var(--dg-arena-top) + 18px)}}
@media(prefers-reduced-motion:reduce){#dgBattle #dgTactics .dg-command-wheel,#dgBattle #dgTactics .dg-command-wheel:before{animation:none!important}#dgBattle #dgTactics .dg-command-card{transition:none!important}}
/* Later bestiary/vital styles must not put the enemy panel behind the wheel. */
body.dungeon-battle #dgBattle .dg-monster{left:auto;right:14px;transform:none;width:278px;max-width:40%;display:block}
body.dungeon-battle #dgBattle .dg-monster .dg-intent-detail{display:none}
#dgBattle #dgTactics .dg-command-wheel{pointer-events:auto}
@media(max-width:750px){body.dungeon-battle #dgBattle .dg-monster{left:8px;right:8px;width:auto;max-width:none;display:grid;grid-template-columns:auto minmax(0,1fr);gap:0 8px}body.dungeon-battle #dgBattle .dg-monster>.dg-vital-widget{grid-column:2;grid-row:1/3}body.dungeon-battle #dgBattle .dg-monster .dg-intent{grid-column:1;font-size:9px;margin:0}body.dungeon-battle #dgBattle .dg-monster>b{font-size:11px;max-width:44vw}body.dungeon-battle #dgBattle .dg-monster .dg-attack-estimate{display:none}}
@media(max-height:650px){body.dungeon-battle #dgBattle .dg-monster{left:auto;right:8px;transform:none;width:240px;max-width:34%;padding:3px 8px}body.dungeon-battle #dgBattle .dg-monster .dg-attack-estimate,body.dungeon-battle #dgBattle .dg-monster .dg-intent{display:none}}
body.dungeon-battle.dungeon-command #dgBattleStatus{visibility:hidden}
@media(max-width:750px) and (min-height:651px){#dgBattle #dgTactics{top:calc(var(--dg-arena-top) + 70px);bottom:56px}#dgBattle #dgTactics>header,#dgBattle #dgTactics .dg-command-keys{display:none}}
@media(max-height:650px){#dgBattle #dgTactics{top:var(--dg-arena-top);bottom:58px}#dgBattle #dgTactics .dg-command-wheel{--wheel-scale:.45;flex-basis:120px;height:120px}#dgBattle #dgTactics .dg-command-wheel:before{width:100px;height:100px;margin:-50px 0 0 -50px}}
@media(max-height:650px){#dgBattle #dgTactics{top:calc(var(--dg-arena-top) + 8px);bottom:52px}#dgBattle #dgTactics .dg-command-wheel{--wheel-scale-x:.8;--wheel-scale-y:.5}#dgBattle #dgTactics .dg-command-card{width:74px;transform:translate(calc(-50% + var(--wheel-x)*var(--wheel-scale-x)),calc(-50% + var(--wheel-y)*var(--wheel-scale-y)))}}
