/* Portrait preparation: independent icons, labels and stretchable CSS panels. */
body:has(#setup:not(.hidden)){background:#261e17;overflow:hidden}
body:has(#setup:not(.hidden))>.wrap{padding:0;max-width:none}
body:has(#setup:not(.hidden)) .mast{display:none}
#setup{--paper:#f3ecdb;--brown:#443320;--gold:#b19964;container-type:inline-size;width:min(100%,560px);max-width:560px;height:100dvh;margin:0 auto;padding:0;display:flex;flex-direction:column;border:3px double #aa8a51;border-radius:0;background:radial-gradient(ellipse at 45% 30%,#fffcf1,#e5d9bd);color:#25252b;box-shadow:0 0 60px #0006}
#setup button,#prepDialog button{color:inherit;touch-action:manipulation}
#setup button:focus-visible,#prepDialog button:focus-visible,#setup select:focus-visible{outline:3px solid #5389c4;outline-offset:1px}
.prep-header{display:grid;grid-template-columns:1fr 1fr 1fr;align-items:center;min-height:58px;padding:max(8px,env(safe-area-inset-top)) 8px 8px;background:repeating-linear-gradient(3deg,#ffffff04 0 1px,transparent 1px 7px),linear-gradient(100deg,#38291f,#5b4633,#34271d);border-bottom:3px double #cab47f;color:#fff4db}
.prep-header h2{text-align:center;line-height:1}
.prep-label{height:24px;max-width:100%;object-fit:contain;vertical-align:middle}
.prep-header .prep-label{height:33px;filter:brightness(0) invert(.94) sepia(.2)}
#setup #homeBack{margin:0;padding:4px;border:0;font-size:13px;color:#fff1d4;white-space:nowrap;min-height:44px}
.prep-tabs{display:flex;gap:5px;padding:4px 5px 0;border-bottom:3px double #ab915a;flex:none}
#setup .prep-tabs button{width:50%;min-height:49px;border:3px double #baa986;border-radius:8px 8px 0 0;background:#eee7d6}
#setup .prep-tabs button[aria-selected=true]{background:linear-gradient(110deg,#26364a,#35496a);border-color:#c3b589;box-shadow:inset 0 0 15px #ffffff12}
.prep-tabs [aria-selected=true] .prep-label{filter:brightness(0) invert(.96) sepia(.2)}
.prep-scroll{min-height:0;flex:1;overflow-y:auto;overscroll-behavior:contain;padding:7px 9px 12px;scrollbar-width:thin;scrollbar-color:#bca776 #eee5d0}
.prep-stats{display:flex;align-items:center;gap:4px;padding:10px 5px;border:3px double #bdac88;background:#ffffff38;border-radius:6px;margin-bottom:9px}
#setup #prepLevel{min-width:56px;color:#272b3a;padding:3px;font-size:13px;text-align:center}
#setupStats{display:flex;flex:1;justify-content:space-around;gap:0}
#setupStats span{background:transparent;border:0;border-left:1px solid #c6b99f;border-radius:0;padding:0 6px;font-size:12px;color:#303444;white-space:nowrap}
#setupStats b{font-size:16px;margin-left:3px}
.prep-group h3{display:flex;align-items:center;gap:10px;margin:11px 0 7px}
.prep-group h3::before{content:'✦';color:#9c814a;font-size:17px}
.prep-group h3::after{content:'';height:1px;background:#b4a487;flex:1}
.prep-group h3 .prep-label{height:20px}
.prep-grid{display:grid;grid-template-columns:1fr 1fr;gap:6px}
#setup .prep-gear{position:relative;display:flex;align-items:center;gap:5px;min-width:0;min-height:86px;padding:7px 13px 7px 3px;border:3px double #c6baa0;background:linear-gradient(115deg,#fffcf07a,#e9e1d144);border-radius:8px;text-align:left;box-shadow:inset 0 0 8px #b8a58020}
#setup .prep-gear.selected{border-color:#ac812e;background:linear-gradient(110deg,#ffedb0a0,#fff9e4);box-shadow:inset 0 0 0 1px #d9b95a}
.prep-icon{width:55px;height:65px;object-fit:contain;flex:none;filter:drop-shadow(0 2px 1px #41240e22)}
.prep-gear>span{min-width:0;display:grid;gap:3px;flex:1}
.prep-gear b{font-size:12px;line-height:1.5;overflow-wrap:anywhere}
#setup small{color:#665845}
.prep-gear small{font-size:10px;line-height:1.5}
.prep-gear i{position:absolute;right:4px;top:42%;font-style:normal;color:#9e895d}
.prep-effect{display:flex;align-items:center;gap:8px;margin-top:10px;padding:9px;border:3px double #b6a17a;border-radius:7px;background:#fff9ec66}
.prep-effect>span{flex:1;min-width:0;display:grid;gap:4px}
.prep-effect b{font-size:12px;line-height:1.6}
.prep-effect small{font-size:10px}
#setup .prep-effect button,#prepDialog .prep-confirm{background:linear-gradient(#344766,#253348);color:#fff4d8;border:3px double #ccb989;border-radius:7px;min-height:44px}
.prep-bag{display:grid;grid-template-columns:54px 1fr;gap:5px 8px;align-items:center;border:3px double #bda778;padding:9px 7px;border-radius:7px;margin-bottom:9px;background:#fffcf066}
.prep-bag>img{width:54px;height:65px;object-fit:contain}
.prep-bag label{font-size:10px;color:#756448}
#setup #bagChoice{width:100%;min-width:0;color:#302d29;background:transparent;border:0;border-bottom:1px solid #b8a984;border-radius:0;font-size:13px;padding:6px 0;min-height:40px}
#setup #bagDescription{font-size:11px;margin:4px 0}
#prepCapacityMount{grid-column:1/-1}
#capacityText{display:flex;align-items:center;gap:7px;font-size:11px}
#capacityText strong{font-size:18px;white-space:nowrap}
.prep-capacity{display:flex;gap:3px;margin-left:auto;max-width:50%;flex:1}
.prep-capacity i{flex:1;height:15px;background:#c9c3b3;border-radius:3px;border:1px solid #a39c89}
.prep-capacity .filled{background:#4f7d48;border-color:#42683a}
#setup #carryChoices{display:grid;grid-template-columns:1fr;gap:7px}
.prep-item{display:grid;grid-template-columns:53px 1fr;align-items:center;gap:4px 7px;padding:8px 7px;border:3px double #c4b28f;border-radius:7px;background:linear-gradient(100deg,#fffaf088,#f8f0dd44)}
.prep-item>.prep-icon{grid-row:1/3;width:53px;height:70px}
.prep-item>div:nth-child(2){display:grid;gap:4px;min-width:0}
.prep-item b{font-size:14px}
.prep-item small{font-size:11px;line-height:1.5}
.prep-item .qty-controls{grid-column:2;justify-content:flex-end;gap:4px}
#setup .qty-controls button{width:44px;height:44px;padding:0;min-height:44px;background:#2f425b;border:3px double #b7a77f;border-radius:6px;color:#fff6df;font-size:22px}
#setup .qty-controls button:disabled{opacity:1;color:#eee5d6;background:#b6afa0;border-color:#c9bfad;cursor:default}
.qty-controls output{width:36px;text-align:center;font-size:22px;color:#242735}
#setup #capacityNotice{font-size:12px;font-weight:600;color:#443320;text-align:center;line-height:1.8;margin:9px 0 0;padding:9px 7px;background:#fff5dd;border:1px solid #c4b28f;border-radius:6px}
#setup #capacityNotice.over-capacity{color:#9b291f}
#setup #prepBagChange{display:flex;align-items:center;justify-content:space-between;gap:8px;width:100%;min-height:44px;padding:6px 0;text-align:left;background:transparent;border:0;border-bottom:1px solid #b8a984;border-radius:0;color:#302d29}
#prepBagChange b{font-size:13px}#prepBagChange span{font-size:11px;white-space:nowrap}
#prepComparison:has(.prep-bag-warning){flex-wrap:wrap}
#prepComparison .prep-bag-warning{width:100%;margin:3px 0 0;font-size:12px;line-height:1.7;color:#67472e}
#setup .over-capacity{color:#9b291f}
.prep-footer{display:flex;align-items:stretch;gap:7px;flex:none;padding:8px 8px max(8px,env(safe-area-inset-bottom));border-top:3px double #bca06a;background:linear-gradient(110deg,#493824,#30271f);color:#fff2d5;box-shadow:0 -4px 10px #422e1722}
#setup #prepDifficulty{display:grid;grid-template-columns:auto auto;align-items:center;gap:1px 7px;flex:1;padding:5px;border:1px solid #938061;border-radius:6px;background:#211c1744}
#prepDifficulty small{grid-column:1/-1;color:#dbc9a7;font-size:10px}
#prepDifficulty b{font-size:12px}#prepDifficulty span{font-size:10px}
#prepStartMount{flex:1.45;display:flex}
#setup #startButton{width:100%;min-width:0;min-height:52px;background:linear-gradient(130deg,#3f6434,#203f2d);border:4px double #dac388;border-radius:11px;box-shadow:inset 0 0 0 2px #1d3021;color:#fff3d6;padding:4px 6px;display:flex;align-items:center;justify-content:center}
#startButton .prep-label{height:auto;width:90%;max-height:28px;filter:brightness(0) invert(.94) sepia(.2)}
#prepDialog{width:min(520px,calc(100% - 20px));max-height:88dvh;padding:0;background:#f4ecd9;color:#302e2a;border:4px double #baa06a;border-radius:12px}
#prepDialog::backdrop{background:#19130ec9;backdrop-filter:blur(3px)}
#prepDialog>header{position:sticky;top:0;z-index:2;display:flex;align-items:center;justify-content:space-between;gap:10px;padding:10px 14px;background:#3e3025;color:#fff0d0;border-bottom:3px double #ad976b}
#prepDialog h2{font-size:19px}#prepClose{width:44px;height:44px;background:transparent;border:1px solid #a4916e;font-size:22px;padding:0}
#prepDialogBody{padding:13px}.prep-picker-help{font-size:13px;margin-bottom:9px}
.prep-sort{display:flex;justify-content:flex-end;gap:8px;font-size:12px;margin-bottom:10px;align-items:center}
.prep-sort select{background:#fff8e7;color:#302d27;border:1px solid #b7a98c;border-radius:4px;padding:8px}
#prepCandidates{display:grid;gap:8px;max-height:40dvh;overflow:auto;padding:3px}
#prepDialog .prep-candidate{display:flex;align-items:center;gap:8px;position:relative;text-align:left;background:#fff9ed;border:2px solid #c3b496;padding:9px;border-radius:7px;min-width:0}
#prepDialog .prep-candidate[aria-pressed=true]{border-color:#a8863c;background:#f8eabc;box-shadow:inset 0 0 0 1px #c0a04e}
.prep-candidate>span{display:grid;gap:5px;flex:1;min-width:0}.prep-candidate b{font-size:14px}.prep-candidate small{font-size:11px;color:#625440;line-height:1.6}.prep-candidate em{position:absolute;right:7px;top:4px;font-size:9px;color:#5c712f;font-style:normal}
.prep-empty{display:grid;place-items:center;width:45px;flex:none!important;color:#a99a79}
#prepComparison{display:flex;justify-content:space-around;gap:8px;margin:14px 0;padding:10px 0;border-block:1px solid #b8a789}
#prepComparison span{display:grid;text-align:center;gap:4px;font-size:12px}#prepComparison b{font-size:15px}.gain{color:#346535}.loss{color:#a03727}
.prep-confirm{width:100%}#prepDialog .difficulty-grid{display:grid;gap:8px}#prepDialog [data-difficulty]{background:#fff9ed;border:2px solid #b8a780;padding:12px}#prepDialog [data-difficulty] small{display:block;color:#67553d}#prepDialog [data-difficulty][aria-pressed=true]{background:#ecd79e;border-color:#9a7b39}
@media(min-width:420px){.prep-gear b{font-size:14px}.prep-gear small{font-size:11px}.prep-icon{width:65px;height:72px}.prep-item{grid-template-columns:65px minmax(0,1fr) auto;min-height:111px}.prep-item>.prep-icon{width:65px;height:85px;grid-row:auto}.prep-item .qty-controls{grid-column:3}.prep-item b{font-size:15px}.prep-item small{font-size:12px}.prep-bag{grid-template-columns:60px 1fr}.prep-tabs .prep-label{height:28px}}
@media(max-width:359px){.prep-scroll{padding-inline:5px}.prep-gear .prep-icon{width:40px;height:55px}#setup .prep-gear{padding-left:0;gap:2px}.prep-gear b{font-size:11px}#setupStats span{padding:0 3px;font-size:10px}#setupStats b{font-size:14px}.prep-header{grid-template-columns:1fr 1fr .6fr}.prep-footer{padding-inline:5px}}
#prepDialog b{color:#302e2a}
#setup #bagDescription{color:#665845}
#setup .prep-gear{min-height:70px;padding-top:4px;padding-bottom:4px}
.prep-gear .prep-icon{height:55px}
.prep-group h3{margin:8px 0 5px}
.prep-stats{padding-block:6px;margin-bottom:5px}
@media(min-width:380px){.prep-item{grid-template-columns:48px minmax(0,1fr) auto;min-height:97px;padding-inline:5px;gap:5px}.prep-item>.prep-icon{grid-row:auto;width:48px;height:64px}.prep-item .qty-controls{grid-column:3;gap:2px}.prep-item b{font-size:13px}.prep-item small{font-size:11px}.prep-item .qty-controls output{width:24px}.prep-bag{padding-block:6px}}
