/* Fallout Shelter Save Editor (/tools/fallout-shelter/) */
.fos [hidden] { display: none !important; }
.fos { --fos-z: 1; }
.fos :where(button:not(.btn)) { padding: 0; background: none; border: 0; border-radius: 0; color: inherit; font: inherit; cursor: pointer; }
.fos .stabs button { padding: 5px 12px; background: var(--card2); border: 1px solid var(--line); border-radius: 999px; font-size: 13px; }
.fos .stabs button.on { background: var(--accent-soft); border-color: var(--btn-line); }
.fos .stabs button small { margin-left: 4px; color: var(--muted); font-size: 12px; }
.fos-small { font-size: 13px; }
.fos-after-drop { margin: 12px 0 0; overflow-wrap: anywhere; }
.fos-credit { margin: 28px 0 0; }
.fos #fosMsgs > *, .fos #fosStartMsgs > * { margin: 0 0 8px; }
.fos #fosMsgs:not(:empty), .fos #fosStartMsgs:not(:empty) { margin-bottom: 16px; }
.fos-msg-x { float: right; margin-left: 8px; font-size: 18px; line-height: 1; }
.fos-putback { margin: 0 0 16px; }
.fos-putback ol { margin: 6px 0 0; padding-left: 20px; }

/* hero tabs are links that switch a view */
.fos .page-hero-body { min-height: clamp(110px, 14vw, 160px); }

/* toolbar */
.fos-bar .stabs { margin: 0; flex: 1 1 100%; }
.fos-q { flex: 1 1 180px; }
.fos-bar #fosChangeN { font-weight: 600; }

/* section tools above a view */
.fos-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 12px; }
.fos-tools .stabs { margin: 0; }
.fos-tools .field { min-width: 0; }
.fos-grow { flex: 1 1 auto; min-width: 0; }

/* ---------- Vault Map ---------- */
.fos-map-scroll { overflow: auto; max-height: 78vh; background: var(--sunken); border: 1px solid var(--line); border-radius: var(--radius-lg); overscroll-behavior: contain; }
.fos-map {
    --fos-c: calc(40px * var(--fos-z)); --fos-r: calc(112px * var(--fos-z));
    display: grid; grid-template-columns: repeat(var(--fos-cols), var(--fos-c)); grid-auto-rows: var(--fos-r); width: max-content; padding: 4px; gap: 0;
    background-image: linear-gradient(rgb(255 255 255 / .04) 1px, transparent 1px), linear-gradient(90deg, rgb(255 255 255 / .04) 1px, transparent 1px);
    background-size: calc(var(--fos-c) * 3) var(--fos-r); background-position: 4px 4px;
}
.fos-room { position: relative; display: flex; flex-direction: column; gap: 4px; min-width: 0; margin: 1px; padding: 4px 6px; overflow: hidden; background: var(--card); border: 1px solid var(--line); border-radius: 4px; transition: border-color var(--fast), opacity var(--fast); }
.fos-room:hover { border-color: var(--accent); }
.fos-room.fos-elev { padding: 0; background: var(--card2); }
.fos-room.fos-dim { opacity: .3; }
.fos-room.fos-hit { border-color: var(--highlight); }
.fos-room.fos-ok { border-color: var(--accent); background: var(--accent-soft); }
.fos-room.fos-no { opacity: .35; }
.fos-room.fos-over { box-shadow: inset 0 0 0 2px var(--accent); }
.fos-room-btn { display: block; width: 100%; min-width: 0; text-align: left; }
.fos-room-btn::after { content: ""; position: absolute; inset: 0; }
.fos-room-btn b { display: block; overflow: hidden; font-size: 13px; font-weight: 600; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.fos-room-btn small { display: block; overflow: hidden; color: var(--muted); font-size: 12px; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.fos-elev .fos-room-btn { display: flex; align-items: center; justify-content: center; height: 100%; }
.fos-elev .fos-room-btn small { font-size: 12px; writing-mode: vertical-rl; }
.fos-room-tags { position: relative; display: flex; flex-wrap: wrap; gap: 4px; pointer-events: none; }
.fos-room-tags .badge { padding: 0 6px; font-size: 12px; }
.fos-chips { position: relative; display: flex; flex-wrap: wrap; gap: 4px; margin-top: auto; }
.fos-chip { display: inline-flex; flex: none; align-items: center; justify-content: center; width: calc(40px * var(--fos-z)); height: calc(40px * var(--fos-z)); background: var(--btn2); border: 1px solid var(--line-strong); border-radius: 50%; font-size: 12px; font-weight: 600; touch-action: none; user-select: none; transition: border-color var(--fast); }
.fos-chip:hover { border-color: var(--accent); }
.fos-chip.fos-legend { background: var(--gold-bg); border-color: var(--gold-line); }
.fos-chip.fos-hit { outline: 2px solid var(--highlight); outline-offset: 1px; }
.fos-chip.fos-dragging { opacity: .35; }
.fos-ghost { position: fixed; z-index: 1900; pointer-events: none; transform: translate(-50%, -50%); box-shadow: var(--lift); }
.fos-rock { display: flex; align-items: center; justify-content: center; margin: 1px; background: rgb(255 255 255 / .06); border: 1px dashed var(--line-strong); border-radius: 4px; color: var(--muted); font-size: 12px; }
.fos-zoomed-out .fos-room-btn small, .fos-zoomed-out .fos-room-tags { display: none; }
.fos-zoomed-out .fos-elev .fos-room-btn small { display: none; }
.fos-zoomed-out .fos-chip { font-size: 0; }
.fos-noroom { min-height: 48px; padding: 8px; background: var(--card); border: 1px dashed var(--line-strong); border-radius: var(--radius-lg); }
.fos-noroom.fos-over { border-color: var(--accent); }
.fos-noroom .fos-chip { width: 40px; height: 40px; }
.fos-note { margin: 12px 0 0; font-size: 13px; }

/* ---------- Dwellers ---------- */
.fos-dgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 8px; }
.fos-dw { display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 56px; padding: 8px 10px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); text-align: left; transition: border-color var(--fast), transform var(--fast); }
.fos-dw:hover { border-color: var(--accent); transform: translateY(-2px); }
.fos-dw .fos-chip { width: 40px; height: 40px; touch-action: auto; }
.fos-dw-text { flex: 1; min-width: 0; }
.fos-dw-text b { display: block; overflow: hidden; font-size: 14px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.fos-dw-text small { display: block; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.fos-more { margin-top: 12px; }

/* ---------- forms in tabs and the drawer ---------- */
.fos-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 16px; align-items: start; }
.fos-grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 130px), 1fr)); gap: 12px; }
.fos .form label.check { min-height: 40px; }
.fos input[type="color"].field { width: 100%; height: 40px; padding: 2px; }
.fos .field { min-height: 40px; }
.fos #fosDetail h2 { margin: 0 30px 2px 0; font-size: 20px; overflow-wrap: anywhere; }
.fos #fosDetail h3 { margin: 20px 0 8px; font-size: 15px; }
.fos #fosDetail .fos-sub { margin: 0 0 12px; color: var(--muted); font-size: 13px; }
.fos-special { display: grid; grid-template-columns: 96px repeat(3, minmax(0, 1fr)); align-items: center; gap: 6px; }
.fos-special .field { width: 100%; min-width: 0; padding: 8px 6px; }
.fos-special span { color: var(--muted); font-size: 13px; }
.fos-rowlist { display: grid; gap: 6px; }
.fos-rowlist .rowi { min-height: 40px; }
.fos-err-small { color: var(--text); }
.fos-details { margin: 6px 0 0; }
.fos-details > summary { min-height: 40px; padding: 8px 10px; background: var(--card2); border-radius: var(--radius); font-size: 14px; cursor: pointer; }
.fos-details > summary small { margin-left: 6px; color: var(--muted); font-size: 12px; }
.fos-details > .form { padding: 10px 2px; }

/* ---------- Inventory ---------- */
.fos-igrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); gap: 8px; }
.fos-it { display: flex; flex-direction: column; gap: 4px; min-width: 0; min-height: 64px; padding: 8px 10px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); text-align: left; transition: border-color var(--fast), transform var(--fast); }
.fos-it:hover { border-color: var(--accent); transform: translateY(-2px); }
.fos-it b { font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.fos-it small { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }

/* ---------- raw tree ---------- */
.fos-tree .fos-val { padding: 0 4px; min-height: 22px; border-radius: 4px; font: inherit; text-align: left; white-space: pre-wrap; word-break: break-all; }
.fos-tree .fos-val:hover { background: var(--card2); }
.fos-tree .tl { white-space: normal; }
.fos-tree .field { min-width: 120px; max-width: 100%; min-height: 28px; padding: 2px 6px; font: inherit; }
.fos-lock { display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.fos-lock svg { width: 12px; height: 12px; }
.fos-reveal { margin-left: 4px; color: var(--link); text-decoration: underline; }
.fos-hitpath { color: var(--muted); }

/* ---------- changes ---------- */
dialog.fos-dlg { width: min(720px, 94vw); }
.fos-dlg h3 { margin: 14px 0 6px; font-size: 15px; overflow-wrap: anywhere; }
.fos-chg { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px 10px; padding: 6px 0; border-top: 1px solid var(--line); font-size: 13px; }
.fos-chg .mono { overflow-wrap: anywhere; }
.fos-chg small { color: var(--muted); font-size: 12px; }
.fos-chg .btn { grid-column: 2; grid-row: 1 / span 2; }
.fos-dlg ul { margin: 6px 0 0; padding-left: 20px; font-size: 14px; }
.fos-dlg .form { margin-top: 10px; }
.fos-linkish { color: var(--link); text-decoration: underline; text-align: left; }
