/* Shared phone layout. Loaded after each screen's desktop styles. */
@media(max-width:760px){
 html{min-width:0!important;text-size-adjust:100%;-webkit-text-size-adjust:100%}
 body.pirate-theme:not(.pirate-login){min-width:0!important;box-sizing:border-box;font-size:16px;line-height:1.6;padding:10px 8px 24px}
 body.pirate-theme #page_body{min-width:0!important;max-width:100%;box-sizing:border-box;margin:0!important;padding:8px!important}
 body.pirate-theme p,body.pirate-theme li,body.pirate-theme td,body.pirate-theme th{font-size:14px!important;line-height:1.6}
 body.pirate-theme small{font-size:12px}
 body.pirate-theme h1{font-size:25px!important}body.pirate-theme h2{font-size:22px!important}body.pirate-theme h3{font-size:19px!important}
 body.pirate-theme input:not([type=checkbox]):not([type=radio]):not([type=hidden]),body.pirate-theme select,body.pirate-theme textarea{box-sizing:border-box;max-width:100%;min-height:44px;font-size:16px!important}
 body.pirate-theme button:not(.island-cell):not(.sector-island):not(.ocean-sector-hit):not(.ocean-island-hit):not(.ocean-fleet-ship),body.pirate-theme input[type=submit],body.pirate-theme input[type=button]{min-height:44px;touch-action:manipulation}
 body.pirate-theme #sn_menu{float:none!important;width:100%!important;min-width:0!important;margin:0 0 12px!important}
 body.pirate-theme #sn_menu table{width:100%!important}body.pirate-theme #sn_menu td a{display:block;padding:10px 12px;font-size:15px!important}
 body.pirate-theme .pirate-hero{min-width:0!important;max-width:100%;box-sizing:border-box}
 .mobile-table-scroll{width:100%;max-width:100%;overflow-x:auto;overscroll-behavior-x:contain;-webkit-overflow-scrolling:touch;margin:8px 0;scrollbar-width:thin;scrollbar-color:#987448 #ead6ad}
 .mobile-table-scroll>table{margin:0!important;min-width:100%}.mobile-table-scroll:focus-visible{outline:2px solid #805422}
 /* A single swipeable resource strip preserves the view of the island. */
 body.pirate-theme.island-command{padding:0;overflow:hidden}
 body.pirate-theme .command-top{padding:8px;display:block}
 body.pirate-theme .command-identity{display:flex;min-width:0;gap:8px;margin:0 0 7px}
 body.pirate-theme .command-identity strong{font-size:15px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
 body.pirate-theme .command-identity select{min-height:36px;max-width:48%;font-size:13px!important;margin-left:auto}
 body.pirate-theme .command-crest{width:30px;height:34px;font-size:23px;flex-shrink:0}
 body.pirate-theme .command-stores{display:flex!important;flex-wrap:nowrap;gap:6px;overflow-x:auto;overscroll-behavior-x:contain;padding-bottom:5px;scrollbar-width:thin;scrollbar-color:#b99a62 #252a23}
 body.pirate-theme .command-resource{flex:0 0 106px;min-width:106px;padding:8px;gap:0;min-height:76px}
 body.pirate-theme .command-resource small{font-size:12px;letter-spacing:0}
 body.pirate-theme .command-resource [id],body.pirate-theme .command-resource strong,body.pirate-theme .command-resource [data-population-reserve],body.pirate-theme .command-resource [data-population-people]{font-size:18px}
 body.pirate-theme .command-resource [data-resource-rate],body.pirate-theme .command-resource [data-population-free]{font-size:11px!important}
 body.pirate-theme .command-left{top:158px;left:8px}
 body.pirate-theme .command-tavern{width:52px}
 body.pirate-theme .island-quest-widget{top:150px;right:8px;width:136px;padding:30px 8px 8px}
 body.pirate-theme .island-quest-widget .island-quest-open>strong{font-size:12px;line-height:1.4}
 body.pirate-theme .fleet-compass-button{width:68px;height:68px;right:12px;bottom:110px}
 body.pirate-theme .command-bottom{box-sizing:border-box;width:calc(100vw - 12px);bottom:max(6px,env(safe-area-inset-bottom));gap:3px}
 body.pirate-theme .command-bottom .command-action{flex:1;min-width:0;min-height:76px;padding:10px 4px!important}
 body.pirate-theme .command-bottom .command-action>small{font-size:12px;line-height:1.25;overflow-wrap:anywhere}
 body.pirate-theme .command-bottom .command-action>span{font-size:23px}
 body.island-command .island-map-tools{bottom:100px;right:88px;gap:4px}
 body.island-command .island-map-tools button{min-width:44px;padding:4px!important;font-size:14px}
 /* Slim scroll edges leave room for readable content. */
 body.pirate-theme .command-dialog,body.pirate-theme .island-menu-window{width:calc(100vw - 12px)!important;max-width:calc(100vw - 12px)!important;max-height:94dvh!important}
 body.pirate-theme .command-menu,body.pirate-theme .command-building,body.pirate-theme .command-people,body.pirate-theme .command-journal-page.resource-window,body.pirate-theme dialog.island-building-window,body.pirate-theme .island-menu-window.shipyard-window{border-width:42px 12px 40px!important;padding-left:7px!important;padding-right:7px!important}
 body.pirate-theme .command-journal-page{height:94dvh!important;padding:14px 4px 4px}
 body.pirate-theme .command-menu #sn_menu td>a{font-size:16px!important;padding:13px 9px}
 body.pirate-theme .command-dialog .command-close,body.pirate-theme .island-building-window #island-close-window{min-width:44px;min-height:44px}
 body.pirate-theme .island-building-window #island-selection{max-height:calc(94dvh - 130px)!important}
 body.pirate-theme .island-building-window p,body.pirate-theme .island-building-window small{font-size:14px!important;line-height:1.6}
 body.pirate-theme .population-jobs{grid-template-columns:minmax(0,1fr)!important}
 body.pirate-theme .population-actions{gap:10px}body.pirate-theme .population-actions button{width:100%}
 body.pirate-theme .mail-tabs a{font-size:14px!important;min-height:44px;box-sizing:border-box}
 body.pirate-theme .mail-sheet,body.pirate-theme .island-population,body.pirate-theme .nautical-scroll,html.captain-window body.pirate-ocean .nautical-scroll{border-width:42px 12px 40px!important;padding-left:6px!important;padding-right:6px!important}
 body.pirate-theme .ocean-chart-layout{grid-template-columns:minmax(0,1fr)!important}
 body.pirate-theme .ocean-navigation{gap:10px;font-size:15px}
 body.pirate-theme .ocean-navigation label{font-size:14px}body.pirate-theme .ocean-navigation input{width:76px}
 body.pirate-theme .ocean-naming a{font-size:14px!important;padding:10px;min-height:44px;box-sizing:border-box}
 body.pirate-theme .ocean-zoom-controls{gap:6px;font-size:14px}body.pirate-theme .ocean-zoom-controls small{flex-basis:100%;font-size:12px}
 body.pirate-theme .ocean-rename-actions{align-items:stretch;flex-direction:column}
 body.pirate-theme .ocean-rename-actions a{padding:10px 0}
 body.pirate-theme .ocean-fixed-zoom{bottom:max(12px,env(safe-area-inset-bottom))}
}
@media(max-width:760px) and (max-height:500px){body.pirate-theme .command-top{display:flex;gap:8px;align-items:center}body.pirate-theme .command-identity{max-width:160px;flex-wrap:wrap;margin:0}body.pirate-theme .command-stores{flex:1;min-width:0}body.pirate-theme .command-left,body.pirate-theme .island-quest-widget{top:105px}body.pirate-theme .command-bottom .command-action{min-height:60px}body.pirate-theme .command-bottom .command-action>span{font-size:18px}}
/* Phone hierarchy: large values and actions, fewer secondary captions. */
@media(max-width:760px){
 body.pirate-theme .command-resource [id],body.pirate-theme .command-resource strong,body.pirate-theme .command-resource [data-population-reserve],body.pirate-theme .command-resource [data-population-people]{font-size:21px!important;line-height:1.35}
 body.pirate-theme .command-resource small:first-child{font-size:13px!important}
 body.pirate-theme .command-resource [data-resource-rate],body.pirate-theme .command-resource [data-population-free],body.pirate-theme .command-resource small:not(:first-child){display:none!important}
 body.pirate-theme .command-resource{min-height:64px}
 body.pirate-theme .command-journal-heading>small,body.pirate-theme .command-journal-heading>p,body.pirate-theme .command-journal-footer,body.pirate-theme .nautical-scroll>header>small,body.pirate-theme .nautical-scroll>header>p,body.pirate-theme .mail-heading>small,body.pirate-theme .mail-heading>p,body.pirate-theme .population-eyebrow,body.pirate-theme .population-footnote,body.pirate-theme .ocean-map-legend,body.pirate-theme .ocean-zoom-controls>small{display:none!important}
 body.pirate-theme .command-journal-heading,body.pirate-theme .nautical-scroll>header,body.pirate-theme .mail-heading{padding-bottom:12px;margin-bottom:12px}
 body.pirate-theme .island-building-window .island-building-description{font-size:14px!important;line-height:1.5}
 body.pirate-theme .island-building-window .island-production-table th,body.pirate-theme .island-building-window .island-production-table td{font-size:15px!important}
 body.pirate-theme .island-building-window .island-price,body.pirate-theme .island-building-window .island-requirements,body.pirate-theme .island-building-window .island-build-unavailable{font-size:15px!important;line-height:1.6}
 body.pirate-theme .population-stats strong{font-size:24px!important}
 body.pirate-theme .island-quest-widget .island-quest-pager{display:none!important}
 body.pirate-theme .command-left{top:146px}body.pirate-theme .island-quest-widget{top:138px}
}
@media(max-width:760px) and (max-height:500px){body.pirate-theme .command-left,body.pirate-theme .island-quest-widget{top:95px}}
.mobile-resource-bar{display:none}
@media(max-width:760px), (orientation:landscape) and (max-height:600px) and (max-width:1100px){
 body.pirate-theme .command-top{max-width:100vw;box-sizing:border-box;display:block!important;padding:6px 8px}
 body.pirate-theme .command-identity{max-width:none;min-width:0;display:flex;flex-wrap:nowrap;align-items:center;margin:0 0 4px}
 body.pirate-theme .command-stores{pointer-events:auto;box-sizing:border-box;display:flex!important;flex-wrap:nowrap!important;width:100%;max-width:100%;min-width:0;overflow-x:auto!important;overflow-y:hidden;justify-content:flex-start!important;gap:6px;touch-action:pan-x;overscroll-behavior-x:contain;scrollbar-width:thin;-webkit-overflow-scrolling:touch}
 body.pirate-theme .command-stores>.command-resource{flex:0 0 106px!important;min-width:106px;max-width:106px}
 body.pirate-theme .mobile-resource-bar{display:flex;align-items:center;justify-content:space-between;gap:8px;pointer-events:auto;margin-bottom:4px}
 body.pirate-theme .mobile-resource-bar>button{min-height:36px!important;min-width:44px;padding:0 8px!important;font-size:23px;line-height:1}
 body.pirate-theme .mobile-resource-bar>.mobile-resource-toggle{flex:1;font:14px/1.3 Georgia,serif!important;min-height:36px!important}
 body.pirate-theme .command-left{top:190px}body.pirate-theme .island-quest-widget{top:182px}
}
@media(orientation:landscape) and (max-height:600px) and (max-width:1100px){
 body.pirate-theme .command-top{display:grid!important;grid-template-columns:minmax(0,1fr) auto;gap:0 12px;align-items:center;padding:4px 8px}
 body.pirate-theme .command-identity{margin:0;gap:6px}
 body.pirate-theme .command-identity strong{font-size:14px}
 body.pirate-theme .command-identity select{min-height:34px;font-size:13px!important;max-width:180px;margin-left:auto}
 body.pirate-theme .command-crest{width:28px;height:30px;font-size:22px}
 body.pirate-theme .mobile-resource-bar{margin:0}
 body.pirate-theme .command-stores{grid-column:1/-1;margin-top:6px}
 body.pirate-theme .command-top.mobile-resources-collapsed .command-stores{display:none!important}
 body.pirate-theme .command-left{top:125px}body.pirate-theme .island-quest-widget{top:117px}
 body:has(.mobile-resources-collapsed) .command-left{top:55px!important}
 body:has(.mobile-resources-collapsed) .island-quest-widget{top:47px!important}
}
