/* Little Thread memory composition, themed for three story adapters. */
body.rrdd-adventure:has(#memoryScreen:not([hidden]) #memoryBoard[data-memory-theme]){background:#f9f1e4!important;background-image:none!important}
body.rrdd-adventure:has(#memoryScreen:not([hidden]) #memoryBoard[data-memory-theme]) .story-world-backdrop{display:none!important}
body.rrdd-adventure #memoryScreen.room-memory:has(#memoryBoard[data-memory-theme]){grid-template-rows:42px minmax(0,1fr) auto!important;gap:6px!important;padding:6px!important;overflow:hidden;background:transparent!important;border:0!important;box-shadow:none!important}
body.rrdd-adventure #memoryScreen .mini-heading{justify-content:center;align-items:center;gap:14px;padding:0!important;background:none!important;min-height:38px}
body.rrdd-adventure #memoryScreen .mini-heading h2{font-size:clamp(19px,2.6vw,30px)!important;line-height:1.1;margin:0;order:0}
body.rrdd-adventure #memoryScreen #memoryProgress{font:800 11px/1.2 'Trebuchet MS',sans-serif;letter-spacing:.12em;background:none;padding:0;border-radius:0;flex:none;color:#886956}
#memoryBoard[data-memory-theme='bag']{--memory-bg:#e7ece2;--memory-glow:#fff0cd;--memory-ink:#31576b;--memory-accent:#b69b5e;--memory-edge:#a7b7ac}
#memoryBoard[data-memory-theme='door']{--memory-bg:#dceee9;--memory-glow:#fce7c8;--memory-ink:#285f6b;--memory-accent:#4d9da7;--memory-edge:#97b8b8}
#memoryBoard[data-memory-theme='kindness']{--memory-bg:#f1dfd8;--memory-glow:#ffe9c8;--memory-ink:#76564c;--memory-accent:#c29776;--memory-edge:#bda092}
body.rrdd-adventure #memoryScreen #memoryBoard{height:100%;min-height:0;min-width:0;box-sizing:border-box;display:block;padding:8px;border-radius:26px;overflow:hidden;background:radial-gradient(ellipse at 20% 80%,var(--memory-glow),transparent 65%),var(--memory-bg)!important;color:var(--memory-ink)}
body.rrdd-adventure #memoryScreen #memoryBoard .unified-memory-layout{display:grid;grid-template-columns:minmax(0,1fr) minmax(220px,.7fr);grid-template-rows:minmax(0,1fr) 32px 24px;gap:8px 24px;width:100%;height:100%;min-height:0;padding:0}
body.rrdd-adventure #memoryScreen #memoryBoard .memory-frame-scene{grid-column:1;grid-row:1/4;display:flex;align-items:center;justify-content:center;min-height:0;min-width:0;position:relative;container-type:size}
body.rrdd-adventure #memoryScreen #memoryBoard .memory-frame{position:relative;flex:none;aspect-ratio:4/3;height:auto;max-width:100%;max-height:100%;min-height:0;margin:0;padding:0;border:0!important;border-radius:0;background:none!important;box-shadow:none!important;isolation:isolate;overflow:visible}
body.rrdd-adventure #memoryScreen #memoryBoard .memory-frame::before,body.rrdd-adventure #memoryScreen #memoryBoard .memory-frame::after{display:none}
body.rrdd-adventure #memoryScreen #memoryBoard .memory-slot{position:absolute!important;inset:20% 10%!important;width:80%!important;height:60%!important;aspect-ratio:16/9;min-height:0;min-width:0;padding:0!important;margin:0;border:0!important;border-radius:0!important;background:#fffaf0!important;box-shadow:none!important;display:block;overflow:hidden;opacity:1;z-index:1;touch-action:none}
body.rrdd-adventure #memoryScreen #memoryBoard .memory-slot img.framed-answer{position:absolute;inset:0;width:100%!important;height:100%!important;max-width:none!important;max-height:none!important;object-fit:contain!important;object-position:center!important;padding:0!important;border:0!important;border-radius:0!important;display:block;background:#fffaf0}
body.rrdd-adventure #memoryScreen #memoryBoard .memory-frame-rim{position:absolute;inset:0;width:100%;height:100%;max-width:none;object-fit:contain;pointer-events:none;z-index:2;filter:drop-shadow(0 5px 4px #79624e24);mask-image:linear-gradient(#000 0 0),linear-gradient(#000 0 0);mask-size:100% 100%,80% 60%;mask-position:center;mask-repeat:no-repeat;mask-composite:exclude}
body.rrdd-adventure #memoryScreen #memoryBoard .memory-frame-question{position:absolute;left:15%!important;top:21%!important;width:70%!important;height:58%!important;z-index:3;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:12px;pointer-events:none;box-sizing:border-box;padding:8px}
body.rrdd-adventure #memoryScreen #memoryBoard .clue{font:800 clamp(16px,2vw,25px)/1.3 'Trebuchet MS',sans-serif;text-align:center;color:var(--memory-ink);max-width:100%;overflow-wrap:break-word;margin:0!important}
body.rrdd-adventure #memoryScreen #memoryBoard #memoryHear{position:static;display:grid;place-items:center;flex:none;width:44px;height:44px;min-height:44px;min-width:44px;padding:0;border:0;border-radius:50%;color:var(--memory-ink);background:#fff9e3;box-shadow:0 3px 0 #c5b49355;font-size:24px;pointer-events:auto}
body.rrdd-adventure #memoryScreen #memoryBoard .memory-answer .clue{display:none}
body.rrdd-adventure #memoryScreen #memoryBoard .memory-answer .memory-frame-question{justify-content:flex-end;align-items:flex-end;padding:6px}
body.rrdd-adventure #memoryScreen #memoryBoard .memory-slot:focus-visible,body.rrdd-adventure #memoryScreen #memoryBoard #memoryHear:focus-visible{outline:4px solid var(--memory-accent);outline-offset:3px}
body.rrdd-adventure #memoryScreen #memoryBoard .memory-slot.drop-near{outline:5px solid #e8b74e!important;outline-offset:-5px;background:#fff0c8!important}
body.rrdd-adventure #memoryScreen #memoryBoard .memory-tray{grid-column:2;grid-row:1;display:flex;flex-direction:column;justify-content:center;align-items:stretch;gap:12px;min-height:0;min-width:0;padding:4px}
body.rrdd-adventure #memoryScreen #memoryBoard .memory-photo{display:flex;flex-direction:row;align-items:center;justify-content:center;gap:10px;flex:1;width:100%;height:100%;min-width:0;min-height:44px;max-width:none;max-height:210px;margin:0;padding:8px;box-sizing:border-box;background:#fffdf7;border:3px solid #fff;border-radius:16px;box-shadow:0 4px 0 var(--memory-edge);color:var(--memory-ink);transform:none;overflow:hidden;touch-action:none;user-select:none;-webkit-user-select:none}
body.rrdd-adventure #memoryScreen #memoryBoard .memory-photo img{display:block;width:55%;height:100%;min-height:0;max-height:none;object-fit:contain;object-position:center;background:#fffdf7;border-radius:9px;pointer-events:none}
body.rrdd-adventure #memoryScreen #memoryBoard .memory-photo span{font:800 clamp(12px,1.6vw,20px)/1.15 'Trebuchet MS',sans-serif;flex:1;text-align:center;padding:0;pointer-events:none}
body.rrdd-adventure #memoryScreen #memoryBoard .memory-photo[aria-pressed='true']{outline:4px solid var(--memory-accent);outline-offset:-3px;background:#fff4cf}
body.rrdd-adventure #memoryScreen #memoryBoard .memory-photo:focus-visible{outline:4px solid var(--memory-accent);outline-offset:2px}
body.rrdd-adventure #memoryScreen #memoryBoard .memory-keepsakes{grid-column:2;grid-row:2;display:flex;align-items:center;justify-content:center;gap:14px;min-height:0}
body.rrdd-adventure #memoryScreen #memoryBoard .memory-keepsake{display:grid;place-items:center;position:relative;flex:none;width:28px;height:28px;aspect-ratio:1;border:2px dashed var(--memory-accent);border-radius:50%;background:#fffaf0;font:800 16px/1 'Trebuchet MS',sans-serif;color:var(--memory-ink);box-sizing:border-box}
body.rrdd-adventure #memoryScreen #memoryBoard .memory-keepsake.saved{border-style:solid;background:#ffdc82}
body.rrdd-adventure #memoryScreen #memoryBoard .memory-frame-note{grid-column:2;grid-row:3;font:12px/1.25 'Trebuchet MS',sans-serif;text-align:center;align-self:center;margin:0;color:var(--memory-ink)}
body.rrdd-adventure #memoryScreen #memoryFeedback:empty{display:none}
.unified-memory-layout .frame-filled .memory-frame-rim{animation:story-frame-cheer .7s ease-out}
@keyframes story-frame-cheer{50%{filter:drop-shadow(0 0 12px #ffdc86)}}
@media(max-aspect-ratio:6/5){
 body.rrdd-adventure #memoryScreen #memoryBoard .unified-memory-layout{grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr) clamp(120px,19dvh,240px) 30px 24px;gap:8px}
 body.rrdd-adventure #memoryScreen #memoryBoard .memory-frame-scene{grid-column:1;grid-row:1}
 body.rrdd-adventure #memoryScreen #memoryBoard .memory-tray{grid-column:1;grid-row:2;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));grid-template-rows:minmax(0,1fr);gap:10px;align-items:stretch;padding:3px}
 body.rrdd-adventure #memoryScreen #memoryBoard .memory-photo{height:100%;max-height:none;flex-direction:column;gap:4px;padding:6px}
 body.rrdd-adventure #memoryScreen #memoryBoard .memory-photo img{width:100%;height:calc(100% - 30px);flex:1;min-height:0;aspect-ratio:16/9}
 body.rrdd-adventure #memoryScreen #memoryBoard .memory-photo span{flex:none;width:100%;font-size:clamp(12px,2vw,20px);min-height:22px;display:grid;place-items:center}
 body.rrdd-adventure #memoryScreen #memoryBoard .memory-keepsakes{grid-column:1;grid-row:3}
 body.rrdd-adventure #memoryScreen #memoryBoard .memory-frame-note{grid-column:1;grid-row:4}
}
@media(max-width:700px) and (orientation:portrait){
 body.rrdd-adventure #memoryScreen.room-memory:has(#memoryBoard[data-memory-theme]){grid-template-rows:36px minmax(0,1fr) auto!important;padding:3px!important;gap:4px!important}
 body.rrdd-adventure #memoryScreen .mini-heading{gap:8px;min-height:34px}body.rrdd-adventure #memoryScreen .mini-heading h2{font-size:clamp(17px,4.5vw,24px)!important}
 body.rrdd-adventure #memoryScreen #memoryProgress{font-size:10px;letter-spacing:.05em}
 body.rrdd-adventure #memoryScreen #memoryBoard{padding:6px;border-radius:22px}
 body.rrdd-adventure #memoryScreen #memoryBoard .unified-memory-layout{grid-template-rows:minmax(0,1fr) clamp(112px,18dvh,170px) 26px 26px;gap:6px}
 body.rrdd-adventure #memoryScreen #memoryBoard .memory-tray{gap:7px;padding:2px}
 body.rrdd-adventure #memoryScreen #memoryBoard .memory-photo{padding:4px;border-width:2px;border-radius:12px}
 body.rrdd-adventure #memoryScreen #memoryBoard .memory-photo span{font-size:12px;line-height:1.1;min-height:24px}
 body.rrdd-adventure #memoryScreen #memoryBoard .memory-frame-question{gap:6px;padding:2px}
 body.rrdd-adventure #memoryScreen #memoryBoard .clue{font-size:clamp(13px,3.7vw,18px);line-height:1.2}
 body.rrdd-adventure #memoryScreen #memoryBoard #memoryHear{width:40px;height:40px;min-width:40px;min-height:40px;font-size:22px}
 body.rrdd-adventure #memoryScreen #memoryBoard .memory-keepsake{width:24px;height:24px;font-size:13px}
 body.rrdd-adventure #memoryScreen #memoryBoard .memory-frame-note{font-size:10px}
}
@media(orientation:landscape) and (max-height:500px){
 body.rrdd-adventure #memoryScreen.room-memory:has(#memoryBoard[data-memory-theme]){grid-template-rows:30px minmax(0,1fr) auto!important;padding:3px!important;gap:2px!important}
 body.rrdd-adventure #memoryScreen .mini-heading h2{font-size:19px!important}
 body.rrdd-adventure #memoryScreen #memoryBoard .unified-memory-layout{grid-template-columns:minmax(0,1fr) minmax(175px,.6fr);grid-template-rows:minmax(0,1fr) 24px 22px;gap:4px 12px}
 body.rrdd-adventure #memoryScreen #memoryBoard .memory-tray{gap:5px;padding:0 2px 3px}
 body.rrdd-adventure #memoryScreen #memoryBoard .memory-photo{padding:3px;gap:5px;border-width:2px;border-radius:9px}
 body.rrdd-adventure #memoryScreen #memoryBoard .memory-photo span{font-size:12px}
 body.rrdd-adventure #memoryScreen #memoryBoard .clue{font-size:14px;line-height:1.15}
 body.rrdd-adventure #memoryScreen #memoryBoard .memory-frame-question{gap:4px;padding:0}
 body.rrdd-adventure #memoryScreen #memoryBoard #memoryHear{width:38px;height:38px;min-width:38px;min-height:38px;font-size:20px}
 body.rrdd-adventure #memoryScreen #memoryBoard .memory-keepsake{width:22px;height:22px;font-size:12px}
 body.rrdd-adventure #memoryScreen #memoryBoard .memory-frame-note{font-size:9px}
}
body.bag-adventure #playScreen .magic-controls:not(:has(button:not([hidden]))){display:none!important}
@media(prefers-reduced-motion:reduce){.unified-memory-layout *{animation:none!important;transition:none!important}}
/* Seat photographs under the measured alpha opening of each generated rim. */
#memoryBoard[data-memory-theme='bag']{--memory-slot-left:18%;--memory-slot-top:24.1%;--memory-slot-width:64.2%;--memory-slot-height:50.3%}
#memoryBoard[data-memory-theme='door']{--memory-slot-left:15%;--memory-slot-top:23.3%;--memory-slot-width:69.3%;--memory-slot-height:53.2%}
#memoryBoard[data-memory-theme='kindness']{--memory-slot-left:17.1%;--memory-slot-top:25.5%;--memory-slot-width:66.1%;--memory-slot-height:49%}
body.rrdd-adventure #memoryScreen #memoryBoard .memory-frame-rim{mask:none}
body.rrdd-adventure #memoryScreen #memoryBoard .memory-slot{inset:auto!important;left:var(--memory-slot-left)!important;top:var(--memory-slot-top)!important;width:var(--memory-slot-width)!important;height:var(--memory-slot-height)!important}
body.rrdd-adventure #memoryScreen #memoryBoard .memory-frame-question{left:calc(var(--memory-slot-left) + 2%)!important;top:calc(var(--memory-slot-top) + 2%)!important;width:calc(var(--memory-slot-width) - 4%)!important;height:calc(var(--memory-slot-height) - 4%)!important}
/* Keep the central photo drop/tap target clear of the replay control. */
body.rrdd-adventure #memoryScreen #memoryBoard #memoryHear{position:absolute;top:4px;right:4px}
body.rrdd-adventure #memoryScreen #memoryBoard .memory-answer #memoryHear{top:auto;bottom:4px}
