/* Poké Mart uses the shared modal, with all sizing scoped to this view. */
body.gameShell #panel.martOpen{padding:22px;background:#061f2fc4;backdrop-filter:blur(5px)}
body.gameShell #panel.martOpen .panelCard{position:relative;width:min(1100px,100%);max-width:1100px;padding:0;overflow:hidden;border:1px solid #7da1ad;border-radius:20px;background:#eff4f6;color:#253f4d;box-shadow:0 24px 90px #06121a80}
body.gameShell #panel.martOpen #closePanel{position:absolute;right:20px;top:18px;z-index:3;min-height:44px;padding:8px 14px;margin:0;border:1px solid #729ba9;border-radius:10px;background:#e6f0f3;color:#294d5d;font-size:13px;font-weight:700}
.martView{display:flex;flex-direction:column;min-height:480px;max-height:min(92dvh,900px);padding:22px 24px 0;background:linear-gradient(145deg,#f8fafa,#e5eff3);color:#253f4d}
.martView *{box-sizing:border-box}.martView h2,.martView h3,.martView p{margin:0}.martView button,.martView input{font:inherit}.martView button{cursor:pointer}.martView button:disabled{cursor:default;opacity:.5}.martView button:focus-visible,.martView input:focus-visible{outline:3px solid #d5a74c;outline-offset:2px}
.martView .martHeader{position:static;display:flex;align-items:center;gap:14px;margin:0;padding:0 110px 18px 0;min-height:80px;border:0;background:none;color:inherit}.martHeader small{font-size:10px;letter-spacing:2px;color:#648797}.martHeader h2{font-size:30px;line-height:1.3;letter-spacing:-.5px}.martHeader p{font-size:13px;color:#537383}.martHeader p span{margin:0 7px}.martHeader b{color:#1e626e}
.martMark{position:relative;width:58px;height:58px;flex:0 0 58px;border:4px solid #24495a;border-radius:50%;background:linear-gradient(#df705e 0 44%,#24495a 44% 55%,#fffdf1 55%)}.martMark:after{content:'';position:absolute;width:20px;height:20px;left:15px;top:15px;border:4px solid #24495a;border-radius:50%;background:#fffdf1}
.martSearch{display:flex;align-items:center;gap:8px;min-height:46px;margin-bottom:12px;padding:0 14px;background:#fff;border:1px solid #b1c9d2;border-radius:10px}.martSearch>span{font-size:27px;color:#7094a4}.martView .martSearch input{width:100%;min-width:0;margin:0;padding:10px 0;border:0;background:none;box-shadow:none;color:#253f4d;font-size:15px}
.martView .martCategories{display:flex;position:static;flex-wrap:nowrap;gap:6px;margin:0 -4px;padding:4px 4px 12px;overflow-x:auto;scrollbar-width:thin;scrollbar-color:#8cabb7 transparent}.martView .martCategories button{display:flex;flex:0 0 auto;align-items:center;gap:7px;min-height:44px;padding:9px 12px;border:1px solid #b2c9d1;border-radius:9px;background:#e2edf1;color:#4b6978;font-size:12px;white-space:nowrap}.martCategories button small{font-size:10px;opacity:.7;letter-spacing:0}.martView .martCategories .isActive{background:#286579;border-color:#286579;color:#fff}
.martWorkspace{display:grid;grid-template-columns:minmax(0,1.65fr) minmax(260px,1fr);gap:18px;flex:1;min-height:0;overflow:hidden}.martShelves{display:flex;flex-direction:column;min-height:0;min-width:0}.martShelfHeading{display:flex;justify-content:space-between;align-items:center;gap:8px;margin-bottom:8px}.martShelfHeading h3{font-size:14px}.martShelfHeading span{font-size:12px;color:#6c8793}
.martGrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(98px,1fr));align-content:start;gap:8px;min-height:140px;overflow:auto;padding:3px 5px 8px 3px;scrollbar-width:thin;scrollbar-color:#9ab6c0 transparent}.martView .martProduct{display:flex;flex-direction:column;align-items:center;gap:5px;min-height:126px;min-width:0;padding:9px 7px;border:1px solid #c4d6dc;border-radius:10px;background:#fcfdfb;color:#3d5a69;font-size:12px;text-align:center;line-height:1.3}.martView .martProduct.isSelected{border:2px solid #358295;padding:8px 6px;background:#e8f4f2;box-shadow:0 0 0 2px #b5dad2}.martProduct b{margin-top:auto;color:#27786f;font-size:12px}.martProductArt{display:grid;place-items:center;height:48px}.martProduct img{width:42px;height:42px;object-fit:contain;image-rendering:pixelated}.martProductArt>span{font-size:32px;color:#8aa6b0}
.martPagination{display:flex;justify-content:center;align-items:center;gap:14px;padding:7px 0 0;flex:none}.martView .martPagination button{width:44px;min-height:40px;padding:6px;border:1px solid #b7cbd3;border-radius:8px;background:#e1ecf0;color:#365b6c}.martPagination span{font-size:11px;color:#6d8894}
.martDetails{min-width:0;min-height:0;overflow:auto;padding:18px;background:#fffdf8;border:1px solid #c0d1d7;border-radius:14px;scrollbar-width:thin;scrollbar-color:#b5c9cf transparent}.martDetailHeading{display:flex;align-items:center;gap:12px;padding-bottom:14px;border-bottom:1px solid #dce5e7}.martDetailArt{display:grid;place-items:center;flex:0 0 70px;width:70px;height:70px;background:#e7f0f0;border:1px solid #d0e0e1;border-radius:12px}.martDetailArt img{width:56px;height:56px;object-fit:contain;image-rendering:pixelated}.martDetailHeading small{font-size:10px;letter-spacing:1px;color:#678694}.martDetails h3{margin:3px 0 6px;font-size:21px;line-height:1.3;color:#244e60}.martDetailHeading p{font-size:11px;color:#6c8691}.martDetailHeading p span{margin:0 4px}.martDescription{margin-top:15px!important;font-size:13px;line-height:1.7;color:#516e79}.martUsage{padding:11px;margin-top:14px!important;background:#eef5f5;border-radius:9px;color:#426f76;font-size:12px;line-height:1.5}
.martPurchase{margin-top:20px;padding-top:15px;border-top:1px solid #dce5e7}.martPurchase>label{display:block;margin-bottom:7px;color:#5a7783;font-size:12px;font-weight:700}.martQuantity{display:flex;gap:5px}.martView .martQuantity button{flex:0 0 42px;min-height:44px;padding:7px;border:1px solid #b0c8d1;border-radius:8px;background:#e4eff1;color:#355d6d;font-size:15px}.martView .martQuantity #martMax{flex-basis:48px;font-size:12px}.martView #martQuantity{width:100%;min-width:0;max-width:90px;height:44px;margin:0;padding:8px;border:1px solid #b0c8d1;border-radius:8px;background:white;text-align:center;color:#264e5e;font-size:16px}.martTotal{display:flex;justify-content:space-between;align-items:center;margin:15px 0!important;font-size:13px;color:#66808b}.martTotal b{font-size:22px;color:#275b6c}.martView #martBuy{display:block;width:100%;min-height:46px;border:1px solid #286273;border-radius:10px;background:#286e79;color:#fff;padding:10px 12px;font-size:14px;font-weight:700}.martAffordable{display:block;margin-top:10px;color:#83979e;font-size:11px;line-height:1.5;letter-spacing:0}
.martEmpty{grid-column:1/-1;display:grid;place-content:center;min-height:180px;padding:20px;text-align:center;color:#8399a0}.martEmpty h3{font-size:16px;margin-bottom:10px}.martEmpty p{font-size:12px;line-height:1.6}.martStatus{flex:none;min-height:40px;padding:12px 2px;font-size:12px;line-height:1.4;color:#477a6a}.martStatus.isError{color:#ad5949}.martView .martFooter{position:static;display:flex;justify-content:space-between;gap:10px;margin:0 -24px;padding:10px 24px;background:#dfeaf0;border-top:1px solid #c5d8df;color:#5f7c8a;font-size:11px}.martFooter kbd{color:inherit;border-color:#a8c1cc}
@media(max-width:700px){body.gameShell #panel.martOpen{padding:10px}.martView{padding:16px 14px 0;max-height:calc(100dvh - 24px);min-height:0}.martHeader h2{font-size:25px}.martHeader small{font-size:8px;letter-spacing:1px}.martMark{width:46px;height:46px;flex-basis:46px}.martMark:after{left:10px;top:10px}.martView .martHeader{min-height:70px;padding-right:85px}.martHeader p{font-size:11px}body.gameShell #panel.martOpen #closePanel{right:14px;top:14px;font-size:12px;padding:7px 10px}.martWorkspace{grid-template-columns:minmax(0,1.2fr) minmax(220px,1fr);gap:10px}.martGrid{grid-template-columns:repeat(auto-fill,minmax(88px,1fr));gap:6px}.martDetails{padding:13px}.martDetailHeading{gap:8px;flex-direction:column;align-items:flex-start}.martDetails h3{font-size:18px}.martDescription{font-size:12px}.martView .martFooter{margin:0 -14px;padding:9px 14px}.martFooter>span:last-child{display:none}}
@media(max-width:480px){body.gameShell #panel.martOpen{padding:6px}.martView{padding:14px 10px 0;max-height:calc(100dvh - 16px)}.martWorkspace{grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1.1fr) minmax(0,1fr);gap:10px}.martGrid{min-height:0;grid-template-columns:repeat(auto-fill,minmax(88px,1fr))}.martView .martProduct{min-height:110px;font-size:12px}.martProductArt{height:36px}.martProduct img{width:36px;height:36px}.martDetails{padding:12px}.martDetailHeading{flex-direction:row;align-items:center}.martDetailArt{flex-basis:50px;width:50px;height:50px}.martDetailArt img{width:44px;height:44px}.martPurchase{margin-top:12px;padding-top:12px}.martDescription{font-size:12px}.martSearch input{font-size:16px!important}.martView .martCategories button{min-height:44px;padding:8px 10px}.martPagination{padding-top:4px}.martView .martPagination button{min-height:44px}.martView .martFooter{margin:0 -10px;padding:9px 10px}.martStatus{font-size:11px;min-height:36px;padding:9px 2px}}
@media(max-height:530px) and (orientation:landscape){body.gameShell #panel.martOpen{padding:6px}.martView{max-height:calc(100dvh - 14px);min-height:0;padding:10px 14px 0}.martView .martHeader{min-height:0;padding-bottom:8px}.martHeader small,.martMark{display:none}.martHeader h2{font-size:21px}.martHeader p{position:absolute;right:115px;top:18px}.martSearch{min-height:40px;margin-bottom:5px}.martView .martCategories{padding-bottom:6px}.martView .martCategories button{min-height:36px;padding:6px 9px}.martWorkspace{grid-template-columns:minmax(0,1.5fr) minmax(250px,1fr);grid-template-rows:minmax(0,1fr)}.martGrid{min-height:0}.martDetails{padding:10px}.martDetailHeading{flex-direction:row;padding-bottom:8px}.martDetailArt{flex-basis:40px;width:40px;height:40px}.martDetailArt img{width:36px;height:36px}.martDetails h3{font-size:17px}.martStatus{min-height:28px;padding:7px 2px}.martView .martFooter{display:none}body.gameShell #panel.martOpen #closePanel{top:8px}}

/* Reserve full control heights before allocating the scrolling shelves. */
body.gameShell #panel.martOpen .martView{box-sizing:border-box;height:min(900px,calc(100dvh - 46px));min-height:0;max-height:none}
.martView .martHeader{justify-content:flex-start;flex:none}
.martView .martSearch,.martView .martCategories,.martView .martFooter,.martShelfHeading{flex:none}
.martView .martCategories{min-height:64px;overflow-y:hidden}
.martView .martGrid{min-height:0;flex:1}
.martView .martWorkspace{min-height:100px}
@media(max-width:700px){body.gameShell #panel.martOpen .martView{height:calc(100dvh - 24px)}}
@media(max-width:480px){body.gameShell #panel.martOpen .martView{height:auto;min-height:calc(100dvh - 16px)}.martView .martWorkspace{overflow:visible;grid-template-rows:260px auto}.martView .martDetails{overflow:visible}}
@media(max-height:530px) and (orientation:landscape){body.gameShell #panel.martOpen .martView{height:calc(100dvh - 14px);min-height:360px}.martView .martCategories{min-height:52px}}
