#masi-guide-coach[hidden],#masi-guide-highlight[hidden],#masi-guide-book[hidden]{display:none!important}
#masi-guide-coach{position:fixed;z-index:1250;box-sizing:border-box;width:min(330px,calc(100vw - 20px));padding:14px;color:#f6ebd3;background:linear-gradient(145deg,#273b39,#152625);border:1px solid #bd9d64;border-radius:12px;box-shadow:0 5px 24px #0006;font-family:inherit;font-size:13px;line-height:1.55;pointer-events:auto}
#masi-guide-coach h2{font-family:inherit;font-size:17px;font-weight:700;line-height:1.45;margin:3px 0 8px;color:#ffe3a3}#masi-guide-coach p{margin:5px 0}#masi-guide-coach small{color:#d4c095}#masi-guide-coach .mg-actions{display:flex;flex-wrap:wrap;gap:6px;margin-top:10px}
#masi-guide-coach button,#masi-guide-book button,.masi-guide-setting{font:inherit;min-height:44px;box-sizing:border-box;border:1px solid #9b875e;border-radius:6px;padding:8px 11px;color:#f9eecf;background:#29443e;cursor:pointer;touch-action:manipulation}
#masi-guide-coach button:disabled{opacity:.55;cursor:default}#masi-guide-coach button:focus-visible,#masi-guide-book button:focus-visible,.masi-guide-setting:focus-visible{outline:3px solid #fff2bd;outline-offset:2px}
#masi-guide-coach [data-mg-next]{background:#e0c58a;color:#263b34;font-weight:700}#masi-guide-coach .mg-message{color:#ffdaa5;min-height:1.5em;font-size:12px}
#masi-guide-highlight{position:fixed;z-index:1249;pointer-events:none;border:3px solid #f5d78e;border-radius:8px;box-sizing:border-box;box-shadow:0 0 0 3px #162b25aa,0 0 16px #f5d78e66}
#masi-guide-highlight:not([hidden]){animation:masi-guide-border-pulse 1.2s ease-in-out infinite;will-change:opacity}
@keyframes masi-guide-border-pulse{0%,100%{opacity:1}50%{opacity:.28}}
@media(prefers-reduced-motion:reduce){#masi-guide-highlight:not([hidden]){animation:none;opacity:1}}
#masi-guide-book{position:fixed;inset:12px;z-index:1300;display:flex;flex-direction:column;padding:0;box-sizing:border-box;background:#eee2c6;border:2px solid #a58a59;border-radius:10px;box-shadow:0 12px 40px #0009;color:#293e35;pointer-events:auto;overflow:hidden}
#masi-guide-book header{display:flex;align-items:center;justify-content:space-between;gap:8px;flex:none;padding:7px 12px;background:#213a33;color:#f9e8bc;font:inherit}#masi-guide-book header h2{margin:0;font-family:inherit;font-size:16px;font-weight:700;line-height:1.3}#masi-guide-book iframe{border:0;width:100%;flex:1;min-height:0;background:#eee2c6}
.masi-guide-setting{width:100%;display:block;margin:8px 0;text-align:left;font-weight:700}
@media(max-width:600px){#masi-guide-book{inset:5px}#masi-guide-coach{padding:10px;font-size:12px}#masi-guide-coach h2{font-size:15px}#masi-guide-coach .mg-message{margin:3px 0}#masi-guide-coach button{padding:7px 9px}}
@media(prefers-reduced-motion:reduce){#masi-guide-coach *,#masi-guide-book *{animation:none!important;transition:none!important}}
/* UI revision 2: journal-style HUD button and a book-only reader. */
#adventurer-guide-button{position:fixed;width:64px;height:64px;border:0;padding:0;background:transparent;cursor:pointer;z-index:105;touch-action:manipulation;pointer-events:auto}
#adventurer-guide-button[hidden]{display:none!important}
/* Keep the same HUD toggle usable above the book while the game UI is inert. */
#adventurer-guide-button.mg-book-toggle-active{position:absolute!important;z-index:3!important}
#adventurer-guide-button .guide-book-sprite{display:block;width:100%;height:100%;background:transparent;filter:drop-shadow(0 2px 3px #0008);transition:transform .15s,filter .15s}
#adventurer-guide-button:hover .guide-book-sprite,#adventurer-guide-button:focus-visible .guide-book-sprite{transform:scale(1.08);filter:drop-shadow(0 0 3px #ffe19a) drop-shadow(0 0 7px #c29137)}
#adventurer-guide-button:focus-visible{outline:1px solid #ffe19a;border-radius:8px}
#adventurer-guide-button::after{content:attr(data-tooltip);position:absolute;bottom:calc(100% + 9px);left:50%;padding:9px 13px;border:1px solid #b69b66;border-radius:7px;background:linear-gradient(145deg,#29313ef5,#111a27fa);color:#f0d8a7;box-shadow:0 5px 15px #0008;font:12px/1.6 'Malgun Gothic',sans-serif;white-space:nowrap;pointer-events:none;opacity:0;visibility:hidden;transform:translateX(-50%)}
#adventurer-guide-button:hover::after,#adventurer-guide-button:focus-visible::after{opacity:1;visibility:visible}
#masi-guide-book{inset:auto;left:50%;top:50%;transform:translate(-50%,-50%);width:min(1140px,calc(100vw - 20px));height:min(820px,calc(100vh - 20px));height:min(820px,calc(100dvh - 20px));border:0;border-radius:0;background:transparent;box-shadow:none;overflow:visible;z-index:1401}
#masi-guide-book iframe{background:transparent;border-radius:8px}
#masi-guide-book .mg-book-close{position:absolute;top:16px;right:96px;width:38px;min-height:38px;padding:0;border:1px solid #9e8456;border-radius:5px;background:#4b3b2b;color:#f7e8c6;font:24px/1 sans-serif;z-index:2}
@media(max-width:760px){#masi-guide-book{width:calc(100vw - 10px);height:calc(100vh - 10px);height:calc(100dvh - 10px)}#masi-guide-book .mg-book-close{right:68px;top:12px}}
@media(max-width:600px){#adventurer-guide-button,#adventurer-guide-button .guide-book-sprite{width:56px;height:56px}}
html[data-client=mobile] #adventurer-guide-button{z-index:109}
html[data-client=mobile] #adventurer-guide-button,html[data-client=mobile] #adventurer-guide-button .guide-book-sprite{width:56px;height:56px}
@media(hover:none){#adventurer-guide-button::after{display:none}}
@media(prefers-reduced-motion:reduce){#adventurer-guide-button .guide-book-sprite{transition:none}}

/* HUD guide revision 4: dimensions follow the adventure-journal button. */
#adventurer-guide-button .guide-book-sprite{width:100%!important;height:100%!important}
/* Stable first-adventure card: text can scroll without resizing its frame. */
#masi-guide-coach{display:grid;grid-template-rows:20px auto minmax(0,1fr) auto 38px;gap:6px;min-height:0;transition:none!important;animation:none!important;transform:none!important;scrollbar-gutter:stable}
#masi-guide-coach [data-mg-body]{min-height:0;margin:0;overflow:auto;overscroll-behavior:contain;scrollbar-width:thin}
#masi-guide-coach .mg-actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;margin-top:0}
#masi-guide-coach .mg-actions button{min-width:0}
#masi-guide-coach .mg-message{height:38px;min-height:0;margin:0;overflow:auto;font-size:12px}
