*{box-sizing:border-box} :root{font-family:"Malgun Gothic","Apple SD Gothic Neo",system-ui,sans-serif;color:#303b32;background:#f6f4ed;font-synthesis:none;--green:#526e51;--muted:#7c8178;--line:#e5e5da;--paper:#fffef9}body{margin:0}button,input{font:inherit}button{cursor:pointer;border:1px solid var(--line);border-radius:10px;background:var(--paper);color:inherit;padding:11px 16px;transition:background .15s,transform .15s}button:hover:not(:disabled){background:#eef1e7;transform:translateY(-1px)}button:disabled{cursor:wait;opacity:.45}button:focus-visible,a:focus-visible,input:focus-visible{outline:3px solid #b9cda2;outline-offset:3px}input{min-width:0;width:100%;padding:13px 15px;border:1px solid #d8ddce;border-radius:10px;background:#fffefb;color:inherit}h1,h2,p{margin:0}h1{font-size:30px;letter-spacing:-1.4px;font-weight:650;line-height:1.5}h2{font-size:20px;letter-spacing:-.6px;font-weight:650}p{line-height:1.85}.muted{color:var(--muted);font-size:13px}.small{font-size:12px}.eyebrow{font-family:Georgia,serif;font-size:10px;letter-spacing:2px;color:#859279;margin-bottom:6px}.masthead{padding:19px 5%;border-bottom:1px solid var(--line);display:flex;justify-content:space-between;align-items:center;background:#faf9f3}.brand{display:flex;align-items:center;gap:11px;text-decoration:none;color:#42593f}.brand img{width:40px;height:40px}.brand>span{font:600 23px Georgia,serif;letter-spacing:-.5px}.brand small{display:block;font:10px "Malgun Gothic",sans-serif;letter-spacing:1px;color:#8b907e;margin-top:3px}.badge{border-radius:20px;background:#edf1e6;color:#5c7557;font-size:11px;padding:7px 12px;white-space:nowrap}main{max-width:1230px;margin:auto;padding:32px 4% 15px}.intro{display:flex;justify-content:space-between;align-items:center;gap:10px;margin-bottom:28px}.intro .muted{margin-top:7px}.quiet{font-size:12px;background:transparent}.primary{background:var(--green);border-color:var(--green);color:#fffef9;font-size:13px}.primary:hover:not(:disabled){background:#3e5c40}.paper{border:1px solid var(--line);border-radius:19px;background:var(--paper);box-shadow:0 3px 6px #414f3210}.main-grid{display:grid;grid-template-columns:1fr 1fr;gap:20px}.pet-card{padding:23px 27px 20px}.card-top,.pet-heading,.section-heading{display:flex;justify-content:space-between;align-items:center;gap:12px}.portrait{position:relative;height:272px;display:flex;justify-content:center;align-items:center;margin:6px 0 4px;background:radial-gradient(ellipse,#eff2e560 0%,transparent 65%)}.portrait img{height:240px;max-width:90%;object-fit:contain;mix-blend-mode:multiply}.scribble{position:absolute;left:0;top:20px;font:italic 13px Georgia,serif;color:#99a58b;transform:rotate(-8deg);z-index:1}.image-caption{position:absolute;bottom:0;font-size:10px;color:#8d9585}.pet-heading h2{font-size:27px}.level{font:italic 27px Georgia,serif;color:#667b57}.xp-label{display:flex;justify-content:space-between;font-size:11px;color:var(--muted);margin-top:14px}progress{appearance:none;border:none;border-radius:9px;overflow:hidden;width:100%;height:6px;background:#eeeee5}progress::-webkit-progress-bar{background:#eeeee5}progress::-webkit-progress-value{background:#93a47a;border-radius:9px}.vitals{display:grid;grid-template-columns:1fr 1fr;gap:25px;margin-top:18px;font-size:12px}.vitals strong{float:right;font-weight:500}.vitals progress{display:block;height:4px;margin-top:8px}#intimacy-bar::-webkit-progress-value{background:#c9aa92}.stats{border-top:1px solid #efefe6;margin-top:20px;padding-top:13px;font-size:11px;color:#87907e;text-align:center;word-spacing:5px}.chat-card{display:flex;flex-direction:column;min-height:540px;max-height:590px}.chat-card>.card-top{padding:24px 25px 19px;border-bottom:1px solid #eeeee5}.messages{flex:1;min-height:100px;overflow:auto;display:flex;flex-direction:column;gap:14px;padding:22px}.message{max-width:91%;padding:13px 16px;background:#f0f2e9;border-radius:2px 15px 15px 15px;font-size:13px;white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.9}.message.user{align-self:flex-end;background:#e5ebdf;border-radius:15px 2px 15px 15px}.message-label{font-size:10px;color:#869078;margin-bottom:5px}.chat-bottom{border-top:1px solid #efefe6;padding:16px 22px 19px}.chat-bottom small{display:block;font-size:10px;margin-top:11px}.suggestions{display:flex;gap:6px;margin-bottom:12px;flex-wrap:wrap}.suggestions button{font-size:11px;padding:7px 10px;border-radius:20px;color:#7b876f}.inline{display:flex;gap:8px}.inline .primary{flex-shrink:0}.care-card{padding:23px 26px 15px;margin:20px 0}.section-heading{margin-bottom:20px}.actions{display:grid;grid-template-columns:repeat(7,1fr);gap:9px}.actions button{padding:13px 2px;font-size:12px}.actions span{display:block;font-family:Georgia,serif;color:#80916e;font-size:25px;height:38px}.actions small{display:block;font-size:9px;color:#969b8c;margin-top:7px}.result{font-size:12px;color:#68785e;margin-top:15px;padding:11px 13px;border-radius:8px;background:#f4f5ed;white-space:pre-line}.encounter{margin-top:15px;padding:16px;background:#fcf0dc;border-radius:9px}.encounter p{margin-bottom:10px;font-size:13px}.bottom-grid{display:grid;grid-template-columns:.8fr 1.2fr;gap:20px}.quest-card,.album-card{padding:24px}.quests{list-style:none;margin:0 0 18px;padding:0;display:flex;flex-direction:column;gap:13px;font-size:13px}.quests li{display:flex;justify-content:space-between}.quests .done{color:#809875}.quest-card>small{display:block;margin-top:12px;font-size:10px}.album{display:grid;grid-template-columns:repeat(4,1fr);gap:10px}.album-item{text-align:center;font-size:11px}.album-image{height:92px;background:#f2f3eb;border-radius:12px;display:flex;align-items:center;justify-content:center;color:#a9b09a;font-size:24px;margin-bottom:10px}.album-image img{max-width:100%;height:90px;object-fit:contain;mix-blend-mode:multiply}.album-item small{display:block;color:#959b8c;margin-top:5px;font-size:9px}.album-card>p{margin-top:17px;font-size:10px}footer{text-align:center;color:#a0a594;font:10px Georgia,serif;letter-spacing:1px;padding:28px 0 8px}footer span{padding:0 10px}.notice{padding:14px 18px;background:#fff0d9;border:1px solid #ecd7b8;border-radius:10px;font-size:13px;margin-bottom:18px;white-space:pre-wrap}.welcome{padding:45px;display:grid;grid-template-columns:1.3fr 1fr;align-items:center;gap:25px;min-height:440px}.welcome h2{font-size:25px;margin:10px 0 16px}.welcome p:not(.eyebrow){font-size:13px;color:#798271}.welcome>img{width:100%;max-height:300px;object-fit:contain;mix-blend-mode:multiply}.welcome form{margin:25px 0 13px}.welcome label{display:block;font-size:12px;margin-bottom:8px}.welcome small{font-size:10px}dialog{border:1px solid var(--line);border-radius:18px;padding:32px;max-width:480px;width:90%;color:inherit;box-shadow:0 20px 100px #29342230}dialog::backdrop{background:#33402b55}dialog h2{margin-bottom:18px}dialog p{font-size:13px;margin-bottom:18px}dialog .close{float:right;font-size:20px;border:0;padding:0 4px}.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0)}[hidden]{display:none!important}@media(max-width:760px){h1{font-size:23px}.main-grid,.bottom-grid{grid-template-columns:1fr}.intro .quiet{padding:9px;white-space:nowrap}.intro .muted{font-size:11px}.eyebrow{font-size:8px;letter-spacing:1.6px}.masthead{padding:15px 5%}main{padding-top:24px}.actions{grid-template-columns:repeat(4,1fr)}.care-card{padding:20px 17px}.section-heading{gap:8px}.section-heading h2{font-size:18px}.section-heading .quiet{padding:9px;font-size:11px}.section-heading>.muted{font-size:10px}.chat-card{height:460px;min-height:400px}.welcome{grid-template-columns:1fr;padding:28px}.welcome>img{height:190px;grid-row:1}.welcome h2{font-size:22px}.pet-card{padding:20px}.portrait{height:260px}.album-card,.quest-card{padding:20px}footer{font-size:9px}}@media(prefers-reduced-motion:reduce){button{transition:none}}

/* Locale controls and longer English labels. */
select{font:inherit;color:inherit;background:var(--paper);border:1px solid var(--line);border-radius:9px;padding:7px}select:focus-visible{outline:3px solid #b9cda2;outline-offset:3px}.header-controls{display:flex;gap:8px;align-items:center;flex-wrap:wrap;justify-content:flex-end}.actions b{font-weight:500}.actions small{padding:0 3px}.main-grid>*{min-width:0}h1{letter-spacing:-.8px}.pet-heading h2{overflow-wrap:anywhere}.section-heading{flex-wrap:wrap}.image-caption{text-align:center;max-width:100%}@media(max-width:480px){.masthead{gap:8px;align-items:flex-start}.header-controls{max-width:135px}.intro{align-items:flex-start}.welcome .inline{flex-wrap:wrap}.welcome .inline input{flex-basis:100%}.album{gap:6px}.brand small{letter-spacing:0}.brand>span{font-size:20px}}

#privacy-dialog{max-height:85vh;overflow:auto}#privacy-dialog h3{font-size:14px;margin:20px 0 6px}#privacy-dialog p{font-size:13px;margin-bottom:12px}#privacy-dialog a{color:var(--green);overflow-wrap:anywhere}footer #privacy{margin-left:12px}

.removed-card{padding:24px}.removed-card p{margin:12px 0}#erase-dialog{max-height:85vh;overflow:auto}#erase-dialog p{font-size:13px;margin:14px 0}.erase-checkbox{display:flex;gap:10px;align-items:flex-start;font-size:13px;margin:18px 0}.erase-checkbox input{width:auto;flex-shrink:0}#erase-phrase{margin:10px 0 16px}#erase-error{color:#913e32}.danger{border-color:#913e32;color:#913e32}

.growth-note{background:#f0f5e9;padding:12px;border-radius:12px;margin-bottom:12px}.growth-note p{font-size:13px;margin:0 0 8px}.encounter-art{display:flex;align-items:center;justify-content:center;gap:24px}.encounter-art img{width:100px;height:100px;object-fit:contain;border-radius:16px}.encounter-art span,.versus{font-weight:800;color:#728966}#battle-dialog{width:min(680px,92vw);max-width:92vw;padding:24px;box-sizing:border-box}.battle-scene{display:grid;grid-template-columns:minmax(0,1fr) 30px minmax(0,1fr);align-items:center;gap:12px;background:linear-gradient(#eaf4fa 0 63%,#d6e4c0 63% 68%,#eff3dd 68%);border-radius:18px;padding:20px 12px;overflow:hidden}.fighter{text-align:center;min-width:0}.fighter strong{display:block;min-height:38px;font-size:13px;overflow-wrap:anywhere}.fighter progress{width:90%;height:12px}.fighter img{display:block;width:100%;height:220px;object-fit:contain;mix-blend-mode:multiply;transition:transform .15s ease}.fighter img.strike{transform:translateX(14px) rotate(4deg)}.enemy img.strike{transform:translateX(-14px) rotate(-4deg)}#battle-status{font-weight:700}#battle-hp-text{font-size:12px}@media(max-width:500px){.fighter img{height:145px}.battle-scene{gap:4px;padding:14px 6px}}@media(prefers-reduced-motion:reduce){.fighter img{transition:none;transform:none!important}}

.message.reaction-pending{opacity:.72;font-style:italic}

.birth-choice{margin:1rem 0}.birth-choice select{display:block;max-width:100%;margin:.5rem 0}.art-source-preview{width:96px;height:96px;object-fit:contain;border:1px solid var(--line,#ddd);border-radius:12px;background:white;margin:.5rem 0}.birth-recovery{margin-bottom:20px;padding:24px}.birth-buttons,.art-tools{display:flex;gap:10px;align-items:center;flex-wrap:wrap}.birth-buttons form{margin:0}#art-dialog{width:min(560px,calc(100vw - 32px));max-height:90vh;overflow:auto}#art-canvas{display:block;width:100%;height:auto;background:white;border:1px solid #bbb;border-radius:12px;touch-action:none;margin:12px 0}.art-tools{margin-top:12px}.art-tools label{display:flex;align-items:center;gap:6px}#art-color{width:42px;height:36px;padding:2px}#art-editor-error,#birth-status,#birth-recovery-status{white-space:pre-line}
.art-tools label{white-space:nowrap;flex-shrink:0}.art-tools input[type="checkbox"]{width:auto;flex:0 0 auto}


/* Consistent card, form and dialog spacing. */
:root{--card-space:24px;--section-gap:24px}
button,input,select{line-height:1.45}
button{min-height:40px}
.inline{align-items:stretch;gap:12px}
.inline>input{flex:1}
main{padding-top:32px;padding-bottom:24px}
.intro{gap:24px;margin-bottom:24px}
.main-grid,.bottom-grid{gap:var(--section-gap)}
.pet-card,.care-card,.quest-card,.album-card{padding:var(--card-space)}
.care-card{margin:var(--section-gap) 0}
.section-heading{margin-bottom:20px;row-gap:12px}
.chat-card>.card-top{padding:24px}
.messages{padding:24px;gap:16px}
.chat-bottom{padding:20px 24px}
.suggestions{gap:8px;margin-bottom:12px}
.suggestions button{min-height:32px}
.chat-bottom small{line-height:1.65;margin-top:12px}
.actions{gap:12px}
.actions button{padding:14px 8px;display:flex;flex-direction:column;align-items:center}
.actions span{height:36px}
.actions b{line-height:1.5}
.actions small{margin-top:8px;line-height:1.5}
.result{margin-top:16px;padding:12px 16px;line-height:1.7}
.album{gap:12px}
.album-image{margin-bottom:12px}
#setup-birth{margin-bottom:16px;max-width:100%;text-align:left}
#clean-portraits{margin-top:20px}
.album-card>p{margin-top:12px;line-height:1.7}
.quests li{gap:16px;line-height:1.6}
.quest-card>small{line-height:1.7}
.welcome{padding:40px;gap:40px}
.welcome h2{margin:8px 0 16px}
.welcome p:not(.eyebrow){line-height:1.75}
.birth-choice{margin:24px 0 0}
.welcome label{margin-bottom:8px;line-height:1.5}
.birth-choice select{width:100%;min-height:46px;margin:0;padding:10px 12px}
#birth-art-choice{margin-top:16px}
.welcome form{margin:20px 0 12px}
.welcome .inline button{padding-inline:20px}
.welcome small{display:block;line-height:1.7}
.birth-recovery{padding:24px}
.birth-recovery>p{margin-top:12px;line-height:1.7}
.birth-recovery .birth-buttons{margin-top:20px;gap:12px}
.birth-recovery>small{display:block;margin-top:12px;line-height:1.7}
dialog{width:min(520px,calc(100vw - 32px));max-width:520px;padding:28px;max-height:calc(100dvh - 32px);overflow:auto}
dialog p{line-height:1.7}
#reset-dialog form,#erase-dialog form,#portraits-dialog form{display:grid;gap:16px}
#reset-dialog h2,#erase-dialog h2,#portraits-dialog h2{margin:0 0 4px}
#reset-dialog p,#erase-dialog p,#portraits-dialog p{margin:0}
dialog .erase-checkbox{display:flex;align-items:flex-start;gap:12px;margin:0;line-height:1.65}
dialog .erase-checkbox input{width:16px;height:16px;margin:3px 0 0;padding:0}
label[for="reset-phrase"],label[for="erase-phrase"]{font-size:13px;line-height:1.5;margin-bottom:-8px}
#reset-phrase,#erase-phrase{margin:0}
#reset-error:empty,#erase-error:empty,#portraits-error:empty{display:none}
dialog .inline{justify-content:flex-end;flex-wrap:wrap;margin-top:8px}
footer{display:flex;justify-content:center;align-items:center;flex-wrap:wrap;gap:12px;padding:28px 0 8px;line-height:1.7}
footer span{padding:0}footer #privacy{margin-left:0}
@media(max-width:900px) and (min-width:761px){.actions{grid-template-columns:repeat(4,minmax(0,1fr))}}
@media(max-width:760px){
 :root{--card-space:20px;--section-gap:20px}
 main{padding:24px 16px}.masthead{padding:16px}
 .intro{gap:16px;margin-bottom:20px}
 .welcome{padding:24px;gap:24px}.welcome>img{height:180px}
 .welcome form{margin-top:20px}.welcome .inline{gap:12px}
 .chat-card>.card-top,.messages{padding:20px}.chat-bottom{padding:16px 20px}
 .actions{grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
 .actions button{padding:12px 6px}.actions small{font-size:10px}
 .section-heading{align-items:flex-start}
 .album{gap:8px}.album-image{height:76px}.album-image img{height:72px}
 footer{gap:10px;padding-top:24px}
 dialog{padding:24px}
}
@media(max-width:480px){
 .welcome .inline button{width:100%}.welcome>img{height:160px}
 .intro>.quiet{flex-shrink:0}
 dialog .inline>button{flex:1;min-width:0;padding-inline:12px}
 .section-heading>.quiet{max-width:100%}
 footer>span:last-of-type{flex-basis:100%}
}

h1,h2,p,label,.actions b,.actions small{word-break:keep-all;overflow-wrap:break-word}
@media(max-width:480px){.intro{flex-wrap:wrap;gap:12px}.intro>div{flex-basis:100%}.intro>.quiet{margin-left:auto}.actions button:last-child{grid-column:1/-1;flex-direction:row;justify-content:center;gap:12px}.actions button:last-child span{height:auto}.actions button:last-child small{margin-top:0}}


/* First artwork stays unrevealed until generation and saving finish. */
.birth-recovery{max-width:720px;margin:0 auto 24px;text-align:center;padding:48px 32px}
.birth-recovery .birth-buttons{justify-content:center;margin-top:24px}
.birth-recovery .art-source-preview{margin:16px auto;display:block}
.birth-recovery>p{max-width:540px;margin:12px auto;line-height:1.7}
.birth-orbit{width:112px;height:112px;border:1px dashed #b9c6b2;border-radius:50%;display:grid;place-items:center;margin:0 auto 28px;background:#eef2e8;color:#687f5d}
.birth-orbit span{font-size:48px;line-height:1}
.birth-recovery[data-working="true"] .birth-orbit span{animation:birth-breathe 2.4s ease-in-out infinite}
@keyframes birth-breathe{50%{transform:scale(1.18);opacity:.45}}
@media(prefers-reduced-motion:reduce){.birth-recovery[data-working="true"] .birth-orbit span{animation:none}}
@media(max-width:480px){.birth-recovery{padding:32px 20px}.birth-recovery .birth-buttons{flex-direction:column;align-items:stretch}.birth-orbit{width:88px;height:88px}}

#art-dialog{max-height:90dvh;overflow:auto}
#art-input-mode{display:block;width:100%;margin:8px 0 20px}
#art-file{display:block;width:100%;min-width:0;margin-top:10px}
#art-file::file-selector-button{font:inherit;color:inherit;background:var(--paper);border:1px solid var(--line);border-radius:8px;padding:8px;margin-right:8px}
#art-file-preview{display:block;max-width:100%;max-height:260px;object-fit:contain;margin:16px auto;border:1px solid var(--line);border-radius:12px;background:#fff}
#art-file-help{line-height:1.7}
#art-file-status:empty,#art-editor-error:empty{display:none}

.story-ending{border-left:3px solid #a9bb9d;padding:12px 16px;background:#f3f5ef;border-radius:4px}
/* Small maps stay on an integer pixel grid; portraits retain their original style. */
.dungeon-section{margin-top:24px;padding:28px}
.dungeon-list{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px;margin:22px 0 12px}
.dungeon-card{padding:0 0 16px;overflow:hidden;text-align:left;border:1px solid #dcd4ce;background:#faf7f2;border-radius:16px;min-width:0}
.dungeon-card canvas{display:block;width:100%;height:auto;image-rendering:pixelated;aspect-ratio:16/9}
.dungeon-card strong,.dungeon-card>span{display:block;margin:12px 14px 0}
.dungeon-card>span{font-size:12px;color:#706b79;margin-top:5px}
.dungeon-card:hover:not(:disabled){transform:translateY(-2px);box-shadow:0 7px 22px #34243515}
.pixel-companion{display:flex;gap:18px;align-items:center;margin-top:18px;padding:14px;border-radius:14px;background:#efeae2}
.pixel-preview{width:80px;height:80px;flex-shrink:0;display:grid;place-items:center;background:#293b40;border:3px solid #c1b8a8;border-radius:8px;color:#ebdfbf;font-size:32px}
.pixel-preview img{width:72px;height:72px;object-fit:contain;image-rendering:pixelated}
.pixel-companion p{margin:6px 0}.pixel-companion button{font-size:12px}
#dungeon-dialog{width:96vw;max-width:none;height:94dvh;max-height:94dvh;padding:0;box-sizing:border-box;overflow:hidden;background:#10151b;color:#e6dccb;border:1px solid #9a80524d;border-radius:12px;box-shadow:0 25px 100px #0009}
#dungeon-dialog[open]{display:flex;flex-direction:column;gap:0}
#dungeon-dialog>.section-heading{margin:0;padding:14px 20px;flex-shrink:0;border-bottom:1px solid #c4a87830;gap:18px}
#dungeon-dialog h2{font-family:Georgia,serif;letter-spacing:.05em;color:#f0e6d4;font-size:22px}
#dungeon-dialog .eyebrow{font-size:8px;letter-spacing:.22em;color:#bca780;margin:0 0 3px}
#dungeon-dialog .quiet{background:#1b232b;color:#e4d4b7;border-color:#a78c5645;border-radius:5px}
#dungeon-dialog .primary{background:#b49968;color:#10151b;border-radius:5px;border-color:#d2b77f}
#dungeon-close{min-width:36px;padding:6px;font-size:20px;line-height:1}
.dungeon-experience{display:flex;flex-direction:column;flex:1;min-height:0}
.dungeon-scene-column{display:flex;flex-direction:column;flex:1;min-width:0;min-height:0}
.dungeon-map-area{position:relative;flex:1;min-height:160px;background:#080d13;overflow:hidden}
.dungeon-stage{position:absolute;inset:0;overflow:hidden}
.dungeon-sidebar{display:flex;align-items:center;gap:16px;flex-shrink:0;padding:12px 20px;border-top:1px solid #c4a87830;background:#11171f}
.dungeon-sidebar p,.dungeon-scene-column p{margin:0}
.dungeon-sidebar .birth-buttons{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:8px;margin:0 0 0 auto;flex-shrink:0}
.dungeon-sidebar button{font-size:12px}
.dungeon-countdown{font-variant-numeric:tabular-nums;font-weight:500;color:#c8b48f;font-size:12px;margin:0 0 0 auto}
.dungeon-card .dungeon-countdown{color:#645575}
#dungeon-map{display:block;width:100%;height:100%;image-rendering:pixelated}
#dungeon-explorer{position:absolute;width:62px;height:auto;image-rendering:pixelated;filter:drop-shadow(0 3px 2px #000c) drop-shadow(0 0 2px #f2d28b);pointer-events:none;will-change:transform,left,top}
#dungeon-explorer.dungeon-hit{filter:brightness(1.9) drop-shadow(0 0 5px #f77)}
#dungeon-explorer.dungeon-fallen{opacity:.45;filter:grayscale(.8) drop-shadow(0 2px 2px #000)}
.dungeon-scene-hud{position:absolute;left:22px;top:22px;max-width:calc(100% - 170px);pointer-events:none;text-shadow:0 2px 4px #000,0 0 14px #000}
.dungeon-scene-hud>span{font-size:9px;letter-spacing:.18em;color:#cfb98e}
#dungeon-phase{font-size:13px;line-height:1.5;margin-top:7px;color:#efe6d7}
#dungeon-hp{position:absolute;left:5%;right:5%;bottom:16px;padding:12px 18px;background:linear-gradient(90deg,#070b11b8,#0c1420de,#070b11b8);border:1px solid #c4a87835;pointer-events:none}
.dungeon-health{display:grid;grid-template-columns:1fr 2fr;gap:24px;font-size:11px;text-shadow:0 1px 2px #000}.dungeon-health progress{display:block;width:100%;height:7px;margin:7px 0 0;accent-color:#bb7259;border-radius:0}
#dungeon-your-hp{accent-color:#91aa7a}#dungeon-hp-text{font-size:10px;color:#bcb09c;margin-top:5px}
#dungeon-result{font-size:12px;color:#e2ca9c;max-width:40%}
#dungeon-result:empty{display:none}
.dungeon-briefing{position:relative;font-size:12px;max-width:50%}.dungeon-briefing summary{cursor:pointer;color:#c2b08d}
.dungeon-briefing[open]{position:absolute;bottom:68px;left:20px;z-index:5;padding:16px;width:min(360px,calc(100% - 40px));max-width:none;background:#101720f5;border:1px solid #8c79514d;box-shadow:0 6px 40px #0008;border-radius:6px}
.dungeon-briefing p{margin-top:10px;color:#c9c4b9;font-size:12px}
@media(max-width:760px){#dungeon-dialog>.section-heading{padding:10px 12px;gap:10px}#dungeon-dialog h2{font-size:18px}.dungeon-countdown{font-size:10px;max-width:40%}.dungeon-sidebar{padding:10px 12px;flex-wrap:wrap;gap:8px}.dungeon-sidebar .birth-buttons{gap:6px}.dungeon-sidebar button{padding:9px 12px;font-size:11px}.dungeon-scene-hud{left:13px;top:16px;max-width:calc(100% - 145px)}#dungeon-phase{font-size:11px}#dungeon-result{max-width:100%;font-size:11px}#dungeon-hp{left:3%;right:3%;bottom:10px;padding:8px 10px}.dungeon-health{gap:14px;font-size:10px}.dungeon-briefing{font-size:11px}}
@media(max-width:560px){.dungeon-section{padding:18px}.dungeon-list{grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:8px}.dungeon-card strong,.dungeon-card>span{margin-left:8px;margin-right:8px}.dungeon-card strong{font-size:13px}.dungeon-card>span{font-size:11px}.pixel-companion{gap:12px}}
@media(prefers-reduced-motion:reduce){.dungeon-card:hover:not(:disabled){transform:none}}

/* The room renderer owns the animated avatar; the source image is never overlaid. */
#dungeon-explorer[hidden]{display:none!important}
#dungeon-room{display:block;font-size:17px;color:#ffe1a0;margin:8px 0 4px;font-variant-numeric:tabular-nums}
@media(max-width:560px){#dungeon-room{font-size:14px}.dungeon-sidebar .birth-buttons{gap:4px}.dungeon-sidebar button{padding:8px}.dungeon-scene-hud{max-width:calc(100% - 145px)}}

.dungeon-choice{padding:16px;border:1px solid #c9ae73;border-radius:12px;background:#202e35;color:#fff1d2}.dungeon-choice h3{margin:0 0 8px}.dungeon-choice p{line-height:1.6}.dungeon-choice button{min-height:44px}.dungeon-choice[hidden]{display:none}

.dungeon-sidebar{flex-wrap:wrap;max-height:48%;overflow-y:auto}.dungeon-choice{flex:1 1 100%;order:-1}.dungeon-choice .birth-buttons{justify-content:flex-start;margin-top:12px}.dungeon-choice p{font-size:13px}@media(max-width:560px){.dungeon-choice{padding:10px}.dungeon-choice h3{font-size:15px}.dungeon-choice p{font-size:12px}}

#dungeon-dialog .dungeon-choice button{background:#31464d;color:#fff0d0;border-color:#ba9c64}#dungeon-dialog .dungeon-choice button:hover{background:#435e65}#dungeon-dialog .dungeon-choice button:disabled{opacity:.55}

/* Quiet home: care stays beside the companion; activities open in focused dialogs. */
.has-pet .intro>div{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
.has-pet .intro{justify-content:flex-end;margin-bottom:16px}
.main-grid{align-items:stretch;gap:20px}.main-grid .pet-card{grid-column:1;grid-row:1}
.main-grid .care-card{grid-column:1;grid-row:2;margin:0}.main-grid .chat-card{grid-column:2;grid-row:1 / span 2;height:100%;max-height:960px;min-height:540px}
.main-grid .actions{grid-template-columns:repeat(4,minmax(0,1fr));gap:8px}.main-grid .actions button{padding:10px 5px;min-height:92px}
.main-grid .actions small{font-size:10px}.care-card .section-heading{margin-bottom:16px}.care-card .result:empty{display:none}
.bottom-grid{margin-top:24px;align-items:start}.dungeon-section{margin-top:24px;padding:24px}.dungeon-list{grid-template-columns:repeat(auto-fit,minmax(180px,1fr));margin:0;gap:12px}
.dungeon-card{display:grid;grid-template-columns:92px 1fr;align-items:center;padding:12px;column-gap:14px;border-radius:12px;background:var(--paper)}
.dungeon-card canvas{grid-row:1 / span 3;width:92px;height:76px;object-fit:cover;border-radius:8px}.dungeon-card strong,.dungeon-card>span{margin:0}.dungeon-card strong{font-size:15px}.dungeon-card>span{font-size:11px}
#story-resume{margin-top:14px;width:100%;border-color:#91a480;color:#42563c;background:#eff4e9}
#walk-story{width:min(680px,calc(100vw - 32px));max-width:680px;padding:0;max-height:calc(100dvh - 32px);background:var(--paper);overflow:auto}
.story-top{display:flex;justify-content:space-between;align-items:center;padding:20px 24px;border-bottom:1px solid var(--line)}
#story-close{font-size:24px;line-height:1;min-width:40px;border:0;background:transparent;padding:8px}
.story-body{padding:28px 32px}.story-body h2{font-size:24px;line-height:1.4;margin:0 0 20px;outline:none}.story-body p{font-size:15px;line-height:1.85;white-space:pre-line}
#story-status:empty,#story-scene:empty{display:none}#story-choices{display:grid;gap:12px;margin-top:24px}.story-choice{text-align:left;padding:16px 20px;min-height:52px;background:#f4f6ef;border-color:#cbd5c1;font-size:14px;line-height:1.6}
.story-choice:hover:not(:disabled){background:#e8efdf;border-color:#91a480}.story-footer{display:flex;flex-wrap:wrap;gap:18px;padding:20px 32px;border-top:1px solid var(--line);align-items:center}.story-footer small{flex:1 1 240px;font-size:11px;line-height:1.7}.story-ending{margin:20px 0 0}
@media(max-width:760px){.main-grid{display:flex;flex-direction:column}.main-grid .pet-card{order:0}.main-grid .care-card{order:1}.main-grid .chat-card{order:2;height:460px;min-height:400px}.main-grid .actions{grid-template-columns:repeat(3,minmax(0,1fr))}.has-pet main{padding-top:16px}.dungeon-section{padding:20px}.dungeon-list{grid-template-columns:1fr}.story-body{padding:24px}.story-body h2{font-size:22px}.story-body p{font-size:14px}.story-top,.story-footer{padding:16px 24px}.story-footer .primary{width:100%}}

.has-pet .intro{display:none}#refresh{width:40px;min-width:40px;padding:0;font-size:0}#refresh::before{content:'↻';font-size:20px}
@media(min-width:761px){.main-grid .chat-card{grid-row:1;max-height:640px}.main-grid .care-card{grid-column:1 / -1;grid-row:2}.main-grid .actions{grid-template-columns:repeat(7,minmax(0,1fr))}}
@media(min-width:761px) and (max-width:1000px){.main-grid .actions{grid-template-columns:repeat(4,minmax(0,1fr))}}

/* Walk encounters and battle playback share the outing dialog. */
#walk-story #battle-dialog{width:100%;max-width:100%;padding:0 24px 20px}#walk-story #battle-heading{display:none}#walk-discovery small{display:block;margin-top:10px}#walk-story .encounter{margin:0 24px 24px}#walk-discovery{margin:0 24px 24px}#walk-retry{margin:0 24px 24px}

.personality-details { margin-top: 1rem; border-top: 1px solid var(--line, #e5e5da); padding-top: .85rem; }
.personality-details summary { cursor: pointer; font-weight: 600; }
.personality-details p { margin: .65rem 0; line-height: 1.65; overflow-wrap: anywhere; }
.personality-traits { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .7rem; }
.item-book-teaser{display:flex;align-items:center;justify-content:space-between;gap:24px;padding:28px;margin-top:24px}
.item-book-teaser h2{margin:8px 0}.item-book-teaser p{font-size:14px;line-height:1.7;margin:8px 0 18px}.item-book-samples{display:flex;flex-shrink:0;gap:10px}.item-book-samples img{width:88px;height:88px;object-fit:contain;background:#f1eee4;border-radius:16px;image-rendering:pixelated}
#item-catalog{width:min(1080px,calc(100vw - 32px));max-width:1080px;max-height:calc(100dvh - 32px);padding:0;background:var(--paper);overflow:auto}
#item-detail{width:min(520px,calc(100vw - 32px));max-width:520px;max-height:calc(100dvh - 32px);padding:0;background:var(--paper);overflow:auto}
.item-book-header{display:flex;justify-content:space-between;align-items:center;gap:18px;padding:22px 28px;border-bottom:1px solid var(--line);background:var(--paper)}.item-book-header h2{margin:7px 0 0;font-size:25px}.item-book-header button{flex-shrink:0;min-height:44px}
.item-book-body{padding:0 28px 28px}.item-book-notice{padding:15px 18px;margin:22px 0;background:#edf2e8;border-radius:12px;font-size:13px;line-height:1.7;color:#4f644b}
.item-filters{display:flex;align-items:end;gap:12px;flex-wrap:wrap}.item-filters label{display:grid;gap:7px;font-size:12px;color:var(--muted);flex:1 1 145px}.item-filters .item-search-label{flex:2 1 210px}.item-filters input,.item-filters select{width:100%;min-width:0;height:44px}.item-filters button{min-height:44px;font-size:12px}#item-count{margin:18px 0 12px;font-variant-numeric:tabular-nums}
.item-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px}.item-card{display:flex;flex-direction:column;align-items:stretch;text-align:left;padding:0 0 15px;background:#fffefa;border:1px solid var(--line);border-radius:15px;overflow:hidden;min-width:0;transition:border-color .15s,transform .15s}.item-card:hover:not(:disabled){border-color:#839774;transform:translateY(-2px)}.item-card:focus-visible{outline:3px solid #708763;outline-offset:3px}.item-card-art{display:flex;justify-content:center;align-items:center;height:164px;margin:9px;border-radius:10px;background:#f0eee4}.item-card-art[data-region=hellgate]{background:#f4e9e2}.item-card-art[data-region=icekingdom]{background:#e9f0f3}.item-card-art[data-region=dreamforest]{background:#eeeaf2}.item-card img{width:138px;height:138px;object-fit:contain;image-rendering:pixelated}.item-card strong{font-size:14px;margin:5px 14px 7px;line-height:1.4;overflow-wrap:anywhere}.item-card-meta{margin:0 14px;font-size:11px;color:var(--muted)}.item-card[data-rarity=rare] .item-card-meta{color:#927038}
.item-card-art[data-region=sunkenpalace]{background:#e3efec}.item-card-art[data-region=clockworkcity]{background:#f3eadb}
.item-card .item-ownership{align-self:flex-start;margin:10px 14px 0;font-size:11px;background:#f1eee6;color:var(--muted)}.item-card[data-owned=true]{border-color:#718864}.item-card[data-owned=true] .item-ownership{background:#e5eddb;color:#395435}
.item-fit-explanation{margin-top:24px;border-top:1px solid var(--line);padding-top:20px;font-size:13px;line-height:1.8}.item-fit-explanation summary{cursor:pointer;font-weight:600}.item-fit-explanation p{color:var(--muted)}
.item-detail-body{padding:22px 28px 30px}.item-detail-art{display:flex;justify-content:center;background:#f1eee6;border-radius:16px;margin-bottom:22px}.item-detail-art img{width:230px;height:230px;object-fit:contain;image-rendering:pixelated}.item-detail-body h2{font-size:26px;margin:10px 0}.item-detail-body h3{font-size:14px;margin:24px 0 8px}.item-detail-body p:not(.eyebrow){font-size:14px;line-height:1.8}.item-detail-body .badge{white-space:normal;font-size:11px}
@media(max-width:760px){.item-book-teaser{padding:20px;gap:15px}.item-book-samples{gap:5px}.item-book-samples img{width:56px;height:56px}.item-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}.item-card-art{height:135px}.item-card img{width:112px;height:112px}.item-book-body{padding:0 18px 20px}.item-book-header{padding:18px}.item-book-header h2{font-size:21px}}
@media(max-width:520px){.item-book-teaser{flex-direction:column;align-items:flex-start}.item-book-samples img{width:64px;height:64px}.item-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.item-card-art{height:120px;margin:6px}.item-card img{width:105px;height:105px}.item-card strong{font-size:12px;margin:5px 10px 7px}.item-card-meta{margin:0 10px;font-size:10px}.item-filters{gap:10px}.item-filters label{flex:1 1 100px}.item-filters .item-search-label{flex:1 1 150px}.item-book-header h2{font-size:19px}.item-detail-body{padding:18px 22px 24px}.item-detail-body h2{font-size:23px}}
@media(prefers-reduced-motion:reduce){.item-card{transition:none}.item-card:hover:not(:disabled){transform:none}}
.story-influence { padding: .8rem 1rem; margin: .8rem 0; background: #eef3e8; border-left: 3px solid #78956d; border-radius: .5rem; line-height: 1.7; }

.dungeon-health-help{flex:1 1 100%;font-size:12px;line-height:1.6}

.care-ai-options{display:flex;align-items:center;gap:8px;padding:10px 22px;border-bottom:1px solid var(--line);position:relative;z-index:2}.care-ai-options label{display:flex;align-items:center;gap:9px;font-size:13px;cursor:pointer}.care-ai-options input{width:18px;height:18px;padding:0;flex-shrink:0;accent-color:var(--green)}

.care-ai-help{display:inline-flex;flex-shrink:0}.care-ai-help-button{display:grid;place-items:center;width:30px;height:30px;min-width:30px;padding:0;border:0;border-radius:50%;background:transparent;color:var(--muted);font-size:18px;line-height:1}.care-ai-help-button:hover:not(:disabled){transform:none}.care-ai-tooltip{position:absolute;top:calc(100% - 2px);right:12px;width:max-content;max-width:min(320px,calc(100% - 24px));padding:12px 14px;border:1px solid var(--line);border-radius:10px;background:var(--paper);color:inherit;box-shadow:0 6px 18px #0002;font-size:12px;line-height:1.7;font-weight:400;white-space:normal;overflow-wrap:anywhere;z-index:10}

.explanation-help{display:inline-grid;place-items:center;width:28px;height:28px;min-width:28px;padding:0;margin:0 0 0 6px;border:0;border-radius:50%;background:transparent;color:var(--muted);font:18px/1 system-ui;vertical-align:middle;flex-shrink:0}.explanation-help:hover:not(:disabled){transform:none}.explanation-tooltip.explanation-tooltip{position:fixed;z-index:1000;width:max-content;max-width:320px;max-height:calc(100vh - 24px);overflow:auto;margin:0;padding:12px 14px;border:1px solid var(--line);border-radius:10px;background:var(--paper);color:var(--ink,#303b32);box-shadow:0 6px 18px #0002;font:400 12px/1.7 "Malgun Gothic",system-ui,sans-serif;letter-spacing:normal;white-space:normal;overflow-wrap:anywhere;text-align:left}

.hint-header.hint-header{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:nowrap}.hint-header>h2,.hint-header>h3,.hint-header>div:not(.hint-header-actions){min-width:0;flex:1}.hint-title-row{margin-bottom:12px}.hint-title-row h2,.hint-title-row h3{margin:0}.hint-header-actions{display:flex;align-items:center;justify-content:flex-end;gap:8px;flex-shrink:0;max-width:65%;margin-left:auto}.hint-header-actions>*{min-width:0}.hint-header-actions .explanation-help{margin:0}.hint-header-actions>.muted{font-size:12px;white-space:nowrap}.hint-standalone{float:right;margin-left:8px}.art-tools>.explanation-help{margin-left:auto}@media(max-width:480px){.hint-header.hint-header{gap:6px}.hint-header-actions{gap:5px}.hint-header-actions>.muted{font-size:10px}}
