/* Refuge / archive / manual saves. Original game assets remain unchanged. */
.in-menu { overflow: hidden; }
.in-menu #app { height: 100dvh; min-height: 0; }
.in-menu .top-nav { height: 64px; min-height: 64px; padding: 0 24px; gap: 15px; }
.in-menu .brand-name { font-size: 25px; }
.in-menu .brand-mark { width: 31px; height: 34px; font-size: 27px; }
.save-status.unsaved { color: #dfbb8c; }
.top-right > [data-action="save"] { min-width: 68px; }
.refuge-shell {
  height: calc(100dvh - 64px); display: grid;
  grid-template-columns: 290px minmax(0,1fr); max-width: 1920px; margin: auto;
}
.refuge-sidebar {
  display: flex; flex-direction: column; min-height: 0; padding: 32px 18px 22px;
  background: #202423; border-right: 1px solid #454c42; overflow-y: auto;
}
.refuge-label { padding: 0 13px 28px; }
.refuge-label > span { color: var(--accent); font-size: 9px; letter-spacing: .15em; }
.refuge-label h2 { font: 400 44px Impact,sans-serif; letter-spacing: .025em; color: var(--paper); margin: 12px 0; }
.refuge-label p { font-size: 12px; line-height: 1.6; color: #b2bba9; max-width: 210px; }
.refuge-nav { display: flex; flex-direction: column; gap: 10px; }
.refuge-nav button {
  display: flex; align-items: center; gap: 13px; width: 100%; text-align: left;
  padding: 17px 12px; border: 1px solid #495341; background: #292f26;
  color: #d9decd; border-radius: 4px;
}
.refuge-nav button > i { align-self: start; font: normal 11px monospace; color: #b6a47f; padding-top: 3px; }
.refuge-nav button > span:nth-child(2) { flex: 1; }
.refuge-nav b { display: block; font: 600 21px var(--heading-font); }
.refuge-nav small { display: block; font-size: 10px; color: #b4bea8; margin-top: 6px; line-height: 1.4; }
.refuge-nav button > span:last-child { color: var(--accent); }
.refuge-nav button:hover { background: #384231; border-color: #99a482; }
.refuge-nav button[aria-current="page"] { background: var(--paper); color: var(--ink); border-color: var(--paper); }
.refuge-nav button[aria-current="page"] small, .refuge-nav button[aria-current="page"] i { color: #656550; }
.refuge-nav button[aria-current="page"] > span:last-child { color: #9c603b; }
.refuge-sidebar-bottom { margin-top: auto; padding: 28px 12px 0; display: flex; flex-direction: column; align-items: start; gap: 13px; }
.refuge-sidebar-bottom > small { color: #aeb9a3; font-size: 11px; line-height: 1.7; }
.refuge-sidebar-bottom .btn { width: 100%; font-size: 12px; }
.refuge-sidebar-bottom .text-button { color: #c7b98e; font-size: 11px; }
.refuge-content { min-width: 0; overflow-y: auto; overscroll-behavior: contain; padding: clamp(22px,3vw,50px); scrollbar-gutter: stable; }
.refuge-heading { margin-bottom: 28px; }
.refuge-heading h1 { color: var(--paper); font-size: clamp(30px,3.5vw,48px); line-height: 1.08; margin: 12px 0; }
.refuge-heading p { color: #b9c2b0; font-size: 14px; max-width: 690px; line-height: 1.7; }
#screen-title:focus { outline: none; }
.refuge-welcome { position: relative; min-height: 100%; display: flex; flex-direction: column; align-items: start; overflow: hidden; }
.refuge-welcome h1 { position: relative; z-index: 1; font: 400 clamp(42px,5.2vw,84px)/1.08 Impact,sans-serif; color: var(--paper); letter-spacing: .01em; margin: 28px 0 25px; max-width: 950px; }
.refuge-welcome h1 span { color: var(--accent); }
.refuge-welcome > p { position: relative; z-index: 1; color: #c1c9b5; font-size: 16px; line-height: 1.8; }
.welcome-actions { display: flex; gap: 12px; flex-wrap: wrap; margin: 28px 0 18px; z-index: 1; }
.welcome-actions .btn { padding: 14px 18px; }
.refuge-bottom-line { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; border-top: 1px solid #48513f; padding-top: 18px; margin-top: auto; width: 100%; color: #8fa081; font-size: 10px; letter-spacing: .13em; }
.storage-notice { background: #33422e; border: 1px solid #75865c; border-left: 3px solid #c3bd88; padding: 12px 15px; font-size: 12px; color: #dce4c7; margin-bottom: 20px; line-height: 1.6; }
.storage-footnote { color: #b6c0a8; font-size: 12px; line-height: 1.6; margin-top: 20px; max-width: 800px; }
.storage-error { padding: 24px; background: #3c302a; border: 1px solid #986e52; border-radius: 5px; }
.storage-error h3 { color: #f4d7bb; font-size: 24px; }
.storage-error p { color: #d7c4aa; margin: 12px 0 18px; }

.save-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px; align-items: stretch; }
.save-slot { min-width: 0; display: flex; flex-direction: column; gap: 0; background: #2b3329; border: 1px solid #68745c; border-radius: 5px; padding: 18px; box-shadow: 0 4px 0 #10180f66; }
.save-slot > header { display: flex; align-items: center; justify-content: space-between; min-height: 34px; padding-bottom: 14px; margin-bottom: 18px; border-bottom: 1px solid #626b53; }
.save-slot > header > span { color: #bfc4ab; font-size: 11px; letter-spacing: .1em; }
.save-slot > header b { font: 500 27px var(--heading-font); color: var(--paper); margin-left: 7px; letter-spacing: 0; }
.save-slot > header > small { color: #96a987; font-size: 10px; }
.delete-slot { padding: 5px; display: grid; place-items: center; width: 32px; height: 32px; background: #4d302a; color: #f2a08e; border: 1px solid #9e6150; border-radius: 4px; }
.delete-slot svg { width: 20px; height: 20px; }
.delete-slot:hover { background: #793f32; border-color: #f5aa91; color: #ffe3d5; }
.slot-state { font-size: 10px; letter-spacing: .05em; color: #c9b17f; margin-bottom: 9px; }
.slot-state.won { color: #b9d6a2; }
.slot-state.lost { color: #dfaa8d; }
.save-slot h3 { font-size: 25px; line-height: 1.12; color: var(--paper); overflow-wrap: anywhere; }
.save-slot .slot-time { font-size: 11px; color: #aebca1; margin: 10px 0 18px; }
.slot-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; margin: 0 0 18px; }
.slot-facts dt { color: #a8b49a; font-size: 10px; margin-bottom: 4px; }
.slot-facts dd { margin: 0; color: #e1e5cc; font-size: 14px; }
.slot-team { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.slot-team > span { display: grid; place-items: center; position: relative; width: 36px; height: 46px; background: #dedbc3; border: 1px solid #a6aa88; border-radius: 3px; }
.slot-team img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.slot-team small { position: absolute; bottom: -4px; right: -3px; padding: 2px 3px; border-radius: 2px; background: #343e2a; color: #e3e6c8; font-size: 8px; }
.save-slot .slot-seed { font-size: 10px; color: #b6bea4; line-height: 1.5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 22px; }
.save-slot > .btn { width: 100%; margin-top: auto; white-space: normal; min-height: 42px; }
.save-slot.empty { background: #20291f; border-style: dashed; min-height: 340px; }
.slot-empty-art { display: grid; place-items: center; font: 300 62px var(--heading-font); color: #738363; height: 90px; }
.save-slot.empty h3 { font-size: 23px; text-align: center; color: #bdc9a8; }
.save-slot.empty p { font-size: 12px; color: #93a77c; text-align: center; margin: 12px 0 28px; }
.slot-empty-hint { margin-top: auto; text-align: center; font-size: 11px; color: #a5b494; padding: 10px 0; }
.save-slot.corrupt { background: #3b3329; border-color: #9c7953; }
.save-slot.corrupt > p { color: #d4c4a6; font-size: 12px; line-height: 1.7; margin: 15px 0 25px; }
.save-backdrop, .lore-reader-backdrop { z-index: 50; }
.save-modal { position: relative; max-width: 1120px; width: 100%; padding: 30px; max-height: calc(100dvh - 32px); }
.save-modal h2 { margin-right: 25px; }
.save-modal > p { max-width: 750px; }
.save-modal .save-grid { margin-top: 23px; }
.save-modal .save-slot h3 { font-size: 24px; }
.save-modal .save-error { color: #ffd6c0; background: #58382d; border: 1px solid #b67d5b; border-radius: 3px; padding: 12px; }
.confirm-backdrop { z-index: 60; }
.confirm-modal { max-width: 500px; border-color: #b38b61; padding: 30px; }
.confirm-modal h2 { font-size: 30px; line-height: 1.2; }
.confirm-modal p { font-size: 14px; line-height: 1.75; }
.confirm-modal .modal-actions { justify-content: end; margin-top: 25px; }
.btn-danger { background: #a34c3c; border-color: #df8b70; color: #fff1df; }
.btn-danger:hover:not(:disabled) { background: #bc5d47; border-color: #f8b18d; }
.toast { z-index: 80; }

.archive-count { display: inline-block; margin-top: 15px; border: 1px solid #657553; padding: 6px 9px; border-radius: 3px; font-size: 11px; color: #c5d1b3; }
.archive-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 22px; max-width: 900px; }
.lore-card { position: relative; display: block; overflow: hidden; aspect-ratio: 1; width: 100%; text-align: left; padding: 0; border: 1px solid #96977a; border-radius: 4px; color: var(--paper); background: #303b2b; box-shadow: 0 4px 0 #0004; }
.lore-card > img { display: block; width: 100%; height: 100%; object-fit: cover; }
.lore-card-number { position: absolute; left: 13px; top: 13px; background: #1d281fdd; border: 1px solid #8c9975; padding: 7px 9px; font: 11px monospace; color: #e0e0c3; border-radius: 3px; }
.lore-card-caption { position: absolute; bottom: 0; left: 0; right: 0; background: #e9e2d2f5; color: #2f3528; padding: 17px 19px; border-top: 1px solid #b3b090; }
.lore-card-caption small { display: block; text-transform: uppercase; letter-spacing: .1em; font-size: 9px; color: #796345; }
.lore-card-caption b { display: block; font: 600 clamp(18px,1.8vw,26px)/1.2 var(--heading-font); margin: 7px 0; }
.lore-card-caption > span { display: block; font-size: 11px; color: #67694f; }
.lore-card:hover:not(:disabled) { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent),0 7px 12px #0006; }
.lore-card:disabled { opacity: .6; }
.lore-reader { position: relative; max-width: 1000px; display: grid; grid-template-columns: 36% minmax(0,1fr); padding: 0; overflow-y: auto; max-height: calc(100dvh - 40px); }
.lore-reader > .inspector-close { z-index: 2; }
.lore-reader-image { display: flex; flex-direction: column; justify-content: center; background: #36402d; border-right: 1px solid #6e7958; padding: 25px; gap: 20px; }
.lore-reader-image img { width: 100%; border: 3px solid #b0af8a; box-shadow: 4px 5px 0 #0004; }
.lore-reader-image span { font: 11px monospace; color: #cfceb0; text-align: center; }
.lore-reader-copy { padding: 42px 35px 30px; background: var(--paper); color: #343e2c; }
.lore-reader-copy > .section-eyebrow { color: #8a5d39; }
.lore-reader-copy h2 { color: #30392a; font-size: clamp(26px,2.8vw,38px); margin: 13px 0; }
.lore-reader-copy p { color: #4b553f; font-size: 14px; line-height: 1.8; margin: 20px 0; }
.lore-reader-copy .lore-reader-source { color: #73765d; font-size: 11px; padding-bottom: 15px; border-bottom: 1px solid #b8b79a; margin-top: 0; }
.lore-reader-copy .text-button { color: #875533; font-size: 12px; }
.lore-reader-copy audio { width: 100%; margin: 10px 0; }

@media (min-width: 1300px) and (max-height: 850px) {
  .refuge-sidebar { padding-top: 24px; }
  .refuge-label { padding-bottom: 20px; }
  .refuge-content { padding: 28px; }
  .refuge-welcome h1 { font-size: 60px; margin: 20px 0; }
  .welcome-actions { margin-top: 20px; }
  .refuge-heading { margin-bottom: 22px; }
  .archive-grid { max-width: 660px; gap: 18px; }
  .lore-card-caption { padding: 13px 15px; }
  .lore-card-caption b { font-size: 21px; }
}
@media (max-width: 1200px) {
  .refuge-shell { grid-template-columns: 240px minmax(0,1fr); }
  .refuge-content { padding: 24px; }
  .refuge-sidebar { padding: 25px 12px; }
  .refuge-nav button { gap: 9px; padding: 16px 10px; }
  .refuge-nav b { font-size: 18px; }
  .refuge-nav small { font-size: 9px; }
  .refuge-label h2 { font-size: 39px; }
  .save-grid { gap: 10px; }
  .save-slot { padding: 13px; }
  .save-slot h3 { font-size: 22px; }
  .in-menu .top-right .fullscreen-hint, .in-menu .save-status { display: none; }
  .archive-grid { gap: 16px; }
}
@media (max-width: 1000px) {
  .refuge-content .save-grid { grid-template-columns: 1fr; }
  .refuge-content .save-slot.empty { min-height: 220px; }
  .refuge-content .slot-empty-art { height: 50px; }
  .save-modal .save-grid { grid-template-columns: 1fr; }
  .save-modal .save-slot.empty { min-height: 210px; }
  .save-modal .slot-empty-art { height: 50px; }
  .slot-facts { grid-template-columns: repeat(4,minmax(0,1fr)); }
  .refuge-welcome h1 { font-size: 47px; }
  .lore-reader { grid-template-columns: 30% minmax(0,1fr); }
  .lore-reader-image { padding: 16px; }
  .lore-reader-copy { padding: 40px 25px 25px; }
}
@media (max-width: 760px), (max-height: 530px) {
  .in-menu { overflow: auto; }
  .in-menu #app { height: auto; min-height: 100dvh; }
  .in-menu .top-nav { height: auto; min-height: 60px; padding: 12px; flex-wrap: wrap; gap: 12px; }
  .in-menu .top-right { margin-left: auto; gap: 6px; }
  .in-menu .top-right > .pill { display: none; }
  .refuge-shell { display: block; height: auto; }
  .refuge-sidebar { padding: 16px 12px; overflow: visible; border-right: 0; border-bottom: 1px solid #48543d; }
  .refuge-label { padding: 0 2px 15px; }
  .refuge-label h2 { font-size: 28px; margin: 8px 0 0; }
  .refuge-label p { display: none; }
  .refuge-nav { display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: 6px; }
  .refuge-nav button { padding: 12px 9px; gap: 5px; }
  .refuge-nav b { font-size: 15px; line-height: 1.3; }
  .refuge-nav small, .refuge-nav button > i, .refuge-nav button > span:last-child { display: none; }
  .refuge-sidebar-bottom { padding: 13px 0 0; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 12px; }
  .refuge-sidebar-bottom .btn { width: auto; }
  .refuge-sidebar-bottom > small { font-size: 10px; }
  .refuge-content { padding: 24px 14px; overflow: visible; }
  .refuge-welcome h1 { font-size: clamp(37px,8vw,58px); }
  .refuge-welcome > p { font-size: 14px; }
  .welcome-actions { margin: 20px 0 0; }
  .welcome-actions .btn { padding: 12px; }
  .refuge-heading h1 { font-size: 34px; }
  .refuge-heading p { font-size: 13px; }
  .archive-grid { gap: 12px; }
  .lore-card-caption { padding: 11px; }
  .lore-card-caption b { font-size: 17px; }
  .lore-card-caption small { font-size: 8px; }
  .lore-card-caption > span { display: none; }
  .lore-card-number { font-size: 9px; padding: 5px; left: 8px; top: 8px; }
  .save-modal { padding: 24px 16px; max-height: calc(100dvh - 20px); }
  .lore-reader { display: block; max-height: calc(100dvh - 20px); }
  .lore-reader-image { padding: 16px; flex-direction: row; align-items: center; border: 0; }
  .lore-reader-image img { width: 105px; }
  .lore-reader-copy { padding: 25px 20px; }
  .lore-reader-copy h2 { font-size: 29px; }
  .lore-reader-copy p { font-size: 14px; }
}
@media (max-width: 420px) {
  .archive-grid { grid-template-columns: 1fr; }
  .lore-card-caption { padding: 16px; }
  .lore-card-caption b { font-size: 23px; }
  .lore-card-caption small { font-size: 9px; }
  .slot-facts { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .confirm-modal { padding: 24px; }
}
