/* V20 follows design/ui-v20/01-model-home.png (877x1794), mapped to412x842.
   The Android host has already applied system/cutout insets. Scene artwork,
   equipped8-part composites, text and input remain separate owned layers. */
:root { --ui-nextPartPanel:url('assets/ui-v20/reward-panel.png'); }
.wallet-chip { appearance:none; min-height:44px; font:inherit; font-size:14px; position:relative; }
.wallet-chip strong { font-weight:400; }
.wallet-chip:active { filter:brightness(1.04); }
.icon-button { min-width:44px; min-height:44px; }

/* Canonical Home. Percentage geometry tracks the actual app viewport; canvas
   drawing keeps the side-view ship's own aspect/crop rather than stretching it. */
.home-screen.home-v20 {
  display:block;
  height:var(--app-height);
  min-width:296px;
  min-height:620px;
  padding:0;
  overflow:hidden;
  background:#158f9d var(--ui-homeBackground,url('assets/home-v24/home-background-flat.png')) center/100% 100% no-repeat;
}
.home-v20>.home-header {
  position:absolute;
  left:2.91%; top:.48%; width:94.18%; height:44px;
  max-width:none; min-height:44px; gap:8px;
  grid-template-columns:minmax(0,1fr) 44px;
  z-index:6;
}
.home-v20 .home-header .wallet-strip { height:44px; gap:6px; }
.home-v20 .home-header .wallet-chip {
  height:44px; min-height:44px; padding:0 5px;
  border:0; border-radius:10px; background:transparent; box-shadow:none;
  gap:7px; color:#123c53; font-size:clamp(15px,4.7vw,20px);
  isolation:isolate;
}
.home-v20 .home-header .wallet-chip::before {
  content:''; position:absolute; inset:5.5px 0; z-index:-1; pointer-events:none;
  border:1px solid #d0b781; border-radius:10px;
  background:#fff8e6 var(--paper-texture) center/420px auto;
  box-shadow:inset 0 1px 1px #fffdf2,0 2px 2px #0c49602e;
}
.home-v20 .home-header .wallet-chip .icon { width:20px; height:20px; }
.home-v20 .home-header .home-info,.home-v20 .home-header .audio-settings-button {
  width:44px; height:44px; min-height:44px; padding:10px;
  background-size:88% 88%;
}
.home-v20 .home-header .home-info .icon { width:24px; height:24px; }
.home-v20>.home-logo {
  position:absolute; left:50%; top:5.7%; height:9.62%; width:auto;
  aspect-ratio:344/208; max-width:46%; margin:0;
  transform:translateX(-50%); z-index:4;
  filter:drop-shadow(0 2px 1px #21546a48);
}
.home-v20>.home-side-scene {
  position:absolute; left:7.77%; top:15.56%; width:83.01%; height:32.19%;
  pointer-events:none; z-index:2;
}
.home-v20 .home-side-scene .home-vessel {
  position:absolute; inset:0; width:100%; height:100%; max-width:none;
  min-height:0; flex:none; margin:0;
}
.home-v20 .home-vessel>canvas {
  position:absolute; left:50%; top:auto; bottom:0;
  width:100%; height:100%; max-width:none; max-height:none;
  aspect-ratio:auto; object-fit:contain; filter:none;
}
.home-v20 .home-vessel::after {
  bottom:-1px; width:77%; height:7px;
  border-color:#e6fff382; background:#e4fff011;
  box-shadow:0 0 0 2px #ddfff225;
}
.home-v20 .home-side-scene .ship-art-status {
  left:17%; right:17%; top:45%; bottom:auto; min-height:44px;
  z-index:5; border:1px solid #b7bb9b; border-radius:9px;
  background:#fff6e6ed var(--paper-texture) center/420px auto;
  color:#20495b; font-size:14px; padding:9px;
  pointer-events:auto;
}
.home-v20 .ship-art-status[hidden] { display:none; }
.home-v20>.voyage-selector {
  position:absolute; left:8.74%; top:64.01%; width:82.52%; height:5.58%;
  min-height:44px; padding:0 24px;
  display:grid; grid-template-columns:44px minmax(0,1fr) 44px;
  align-items:center; gap:8px; z-index:5;
  border:solid transparent; border-width:6px 13px;
  border-image:var(--ui-secondary) 17 24 fill / 6px 13px / 0 stretch;
  color:var(--ink); text-shadow:0 1px #fff8e8;
}
.voyage-selector>button {
  min-width:0; min-height:44px; height:44px; padding:0;
  display:flex; align-items:center; justify-content:center;
  color:var(--ink); font-size:clamp(23px,6.7vw,30px);
  border:0; background:transparent;
}
.voyage-selector>.icon-button {
  width:44px; min-width:44px; padding:11px;
  position:relative; isolation:isolate; background:transparent;
  filter:none; box-shadow:none;
}
.voyage-selector>.icon-button::before {
  content:''; position:absolute; inset:3.5px; z-index:-1; pointer-events:none;
  border:2px solid #d49a27; border-radius:50%;
  background:linear-gradient(#fffef1e8,#ffedcbe0),var(--paper-texture) center/420px auto;
  box-shadow:inset 0 0 0 1px #fff6c8,inset 0 -2px 2px #c7973740,0 0 0 1px #f3ce6e,0 2px 2px #76511c4f;
}
.voyage-selector>.icon-button:active::before { transform:translateY(1px); }
.voyage-selector>.icon-button .icon { width:22px; height:22px; }
.voyage-selector>[data-level] { gap:5px; line-height:1; white-space:nowrap; }
.voyage-selector>button:disabled { cursor:default; }
.voyage-selector>.icon-button:disabled { opacity:.5; }
.voyage-selector [data-digits="6"],.voyage-selector [data-digits="7"] { font-size:21px; }
.voyage-selector [data-digits="8"],.voyage-selector [data-digits="9"] { font-size:17px; }
.home-v20>.next-part-panel {
  position:absolute; left:2.91%; top:71.14%; width:94.18%; height:16.39%;
  min-height:120px; z-index:5;
  display:block; padding:0; border:0;
  background:var(--ui-nextPartPanel) center/100% 100% no-repeat;
  color:var(--ink); text-shadow:0 1px #fff9e9;
}
.next-part-panel>canvas,.next-part-panel>.part-reward-art {
  position:absolute; left:6.44%; top:18.12%; width:21.91%; height:61.59%;
  max-height:none; min-height:0; border:0; background:transparent;
  object-fit:contain;
}
.next-part-panel>.part-reward-art { display:grid; place-items:center; }
.part-reward-art>.icon { width:55%; height:55%; color:#edf6dd; filter:drop-shadow(0 2px 1px #285e6b55); }
.part-reward-copy { position:absolute; left:35.05%; right:5.15%; top:11.59%; bottom:13.04%; min-width:0; display:flex; flex-direction:column; justify-content:center; gap:3px; text-align:left; }
.part-reward-copy h2 { margin:0; font-weight:400; font-size:clamp(16px,5.3vw,23px); line-height:1.05; white-space:nowrap; }
.part-reward-copy p { margin:1px 0 2px; font-size:clamp(13px,4vw,17px); line-height:1.12; }
.part-reward-track {
  position:relative; width:100%; height:20px; min-height:20px;
  overflow:hidden; border:1px solid #aaa492; border-radius:12px;
  background:#d4cdbb; color:#163d57;
  display:flex; align-items:center; justify-content:center;
  font-size:16px; line-height:18px; font-variant-numeric:tabular-nums;
  box-shadow:inset 0 1px 2px #7c7b6626;
}
.part-reward-track .fill { position:absolute; left:0; top:0; bottom:0; background:linear-gradient(#82c3b3,#4b9e99); }
.part-reward-track>:not(.fill) { position:relative; z-index:1; }
.win-reward-line {
  min-height:29px; margin-top:2px; padding:3px 5px;
  display:flex; align-items:center; justify-content:center; flex-wrap:wrap; gap:3px 7px;
  border:1px solid #b6ab8e; border-radius:20px;
  background:#fff6df99; font-size:clamp(10px,3.1vw,13px); line-height:1.05;
}
.win-reward-line>span { display:inline-flex; gap:3px; align-items:center; white-space:nowrap; }
.win-reward-line .icon { width:17px; height:17px; }
.win-reward-line .icon:first-child { color:#ad7b23; }

/* One navigation geometry and material on Home, Shipyard and Shop. */
.meta-navigation { max-width:420px; height:79px; flex-basis:79px; gap:8px; }
.meta-nav-button {
  height:69px; min-height:60px; padding:1px 2px;
  border-width:8px 10px; border-image-width:8px 10px;
  font-size:clamp(12px,3.65vw,16px); line-height:1.03; gap:3px;
}
.meta-nav-button .icon { width:27px; height:27px; }
.meta-nav-button.meta-nav-main { height:79px; min-height:70px; gap:1px; font-size:26px; line-height:1; border-width:6px 10px; border-image-width:6px 10px; }
.meta-nav-main .icon { width:24px; height:24px; }
.meta-nav-main small { font-size:13px; line-height:1; letter-spacing:.2px; }
.home-v20>.meta-navigation {
  position:absolute; left:2.43%; top:88.95%; width:95.14%; height:9.38%; min-height:70px;
  max-width:none; margin:0; z-index:6;
}
.home-v20>.meta-navigation>.meta-nav-button { height:calc(100% - 10px); }
.home-v20>.meta-navigation>.meta-nav-main { height:100%; }

/* Existing scenes retain their art/camera and frame ownership. These rules
   align typography, padding, paper/brass treatment and reachable controls. */
.meta-overlay { background:#153a5057; }
.meta-window { gap:5px; }
.meta-window::before { bottom:91px; border-width:1px; box-shadow:inset 0 0 0 2px #fffaf0,0 4px 12px #12384e40; }
.meta-heading,.shipyard-v7-screen .meta-heading { min-height:44px; grid-template-columns:minmax(0,1fr) 44px; }
.meta-heading .meta-close,.shipyard-v7-screen .meta-heading .icon-button { width:44px; height:44px; padding:11px; }
.meta-heading h1,.shipyard-v7-screen .meta-heading h1 { font-size:24px; line-height:1.1; }
.meta-window>.wallet-strip { min-height:44px; }
.meta-window .wallet-chip,.shipyard-v7-screen .wallet-chip { min-height:44px; padding:3px 7px; border-radius:9px; font-size:15px; }
.meta-window>.meta-navigation { margin-top:10px; }
.shipyard-v7-screen .vessel-preview.workshop-scene { border-color:#bdab80; }
.workshop-preview-reset { width:44px; min-height:44px; padding:11px; }
.workshop-preview-reset .icon { width:20px; height:20px; }
.workshop-drawer { flex-basis:258px; height:258px; }
.workshop-drawer.workshop-view-classic { flex-basis:302px; height:302px; }
.workshop-view-tabs { flex-basis:44px; height:44px; }
.workshop-view-tab { min-height:44px; font-size:13px; }
.workshop-slot-strip.workshop-slot-grid,.workshop-view-classic .workshop-slot-grid { flex-basis:92px; height:92px; }
.shipyard-v7-screen .vessel-slot.workshop-slot { min-height:44px; font-size:11px; }
.shipyard-v7-screen .workshop-slot .icon { width:18px; height:18px; }
.shipyard-v7-screen .theme-selector.workshop-classic-themes { flex-basis:44px; min-height:44px; height:44px; }
.shipyard-v7-screen .workshop-classic-themes .theme-chip { min-height:44px; font-size:11px; }
.workshop-catalog-label { flex-basis:16px; height:16px; }
.workshop-catalog-label>span,.workshop-catalog-label>small { font-size:10px; }
.shipyard-v7-screen .part-selection { grid-template-columns:minmax(0,1fr) 148px; }
.shipyard-v7-screen .part-selection strong { font-size:14px; }
.shipyard-v7-screen .part-selection .tool { min-height:48px; font-size:12px; }
.shop-tabs .theme-chip { min-height:44px; font-size:13px; }
.store-card { border-color:#c5ad78; padding:11px; border-radius:14px; gap:8px; box-shadow:inset 0 1px #fffdf5; }
.store-copy h3 { font-size:18px; }
.store-copy p { font-size:12px; line-height:1.3; }
.store-card .tool { min-height:46px; font-size:12px; padding:2px; }
.shop-support .tool { min-height:46px; font-size:11px; }
.exchange-card { grid-template-columns:36px minmax(0,1fr) 114px; }
.exchange-card h3 { font-size:17px; }
.dialog:not(.loss-dialog) { border-width:1px; padding:20px 18px 16px; }
.dialog h2 { font-size:27px; }
.dialog:not(.loss-dialog) p { font-family:'Bree Serif',Georgia,serif; font-style:normal; font-weight:400; font-size:15px; line-height:1.35; }
.dialog-actions .tool { min-height:46px; font-size:14px; }
.dialog-actions .tool.primary { min-height:52px; font-size:21px; }
.win-dialog .dialog-actions>.tool[data-action^="ad:"],.economy-notice .dialog-actions>.tool[data-action="restore-products"] { grid-column:1/-1; }
.game .brand { border-width:1px; }
.game .booster-tools .tool { min-height:58px; font-size:12px; }
.game .booster-tools .tool>small { font-size:10px; }
.game .crew-speech { font-size:15px; }

/* The existing modal owns this guide; only its list scrolls. Planned set
   targets and unlocked gates keep distinct truthful labels from root state. */
.dialog.economy-guide {
  width:380px; max-width:100%; max-height:calc(var(--app-height) - 32px);
  display:flex; flex-direction:column; overflow:hidden; gap:8px;
}
.economy-guide>h2 { flex:none; font-size:25px; line-height:1.1; }
.dialog.economy-guide .milestone-intro {
  flex:none; margin:0; font-size:13px; line-height:1.3;
  color:#3f6570; font-style:normal;
}
.milestone-list {
  flex:1 1 auto; min-height:0; max-height:min(52vh,calc(var(--app-height) - 260px));
  margin:0; padding:2px 3px; list-style:none;
  overflow-y:auto; overscroll-behavior:contain;
  scrollbar-width:thin; scrollbar-color:#87afa6 transparent;
}
.milestone-row {
  min-height:56px; display:grid; grid-template-columns:32px minmax(0,1fr) minmax(48px,64px);
  align-items:center; gap:8px; padding:8px 3px;
  border-bottom:1px solid #c8bd9c8c; text-align:left;
}
.milestone-row:last-child { border-bottom:0; }
.milestone-icon {
  width:32px; height:32px; display:grid; place-items:center;
  color:#a77d2a; background:#f5e7bd; border:1px solid #d5c38b; border-radius:50%;
}
.milestone-icon>.icon { width:21px; height:21px; }
.milestone-icon.icon { display:block; width:26px; height:26px; align-self:center; justify-self:center; background:none; border:0; border-radius:0; }
.milestone-row>div { min-width:0; display:flex; flex-direction:column; gap:3px; }
.milestone-row strong { font-size:15px; font-weight:400; line-height:1.15; overflow-wrap:anywhere; }
.milestone-row small { font-size:11px; line-height:1.25; color:#5b746f; overflow-wrap:anywhere; }
.milestone-row>b {
  min-width:0; max-width:64px; padding:5px 4px;
  border:1px solid #bdcdb6; border-radius:8px;
  background:#e5efdc; color:#286e6c;
  font-size:11px; font-weight:400; line-height:1.15; text-align:center;
  overflow-wrap:anywhere;
}
.milestone-row.reached>b,.milestone-row.is-reached>b,.milestone-row[data-reached="true"]>b { background:#d9ebe0; border-color:#99b8a5; color:#226761; }
.milestone-row.plan>b,.milestone-row[data-plan="true"]>b { background:#f0e9d6; border-color:#c9b991; color:#7e6940; }
.dialog.economy-guide .milestone-estimate { flex:none; margin:0; color:#63786e; font-size:11px; line-height:1.3; }
.economy-guide>.dialog-actions { flex:none; gap:7px; margin-top:1px; }
.economy-guide .dialog-actions .tool.primary { font-size:17px; }

@media(max-width:350px) {
  .home-v20>.home-header { gap:5px; }
  .home-v20 .home-header .wallet-strip { gap:4px; }
  .home-v20 .home-header .wallet-chip { gap:4px; padding:0 3px; font-size:15px; }
  .home-v20 .home-header .wallet-chip .icon { width:17px; height:17px; }
  .home-v20>.voyage-selector { padding-left:12px; padding-right:12px; gap:3px; }
  .home-v20>.next-part-panel { padding:0; }
  .part-reward-copy h2 { font-size:16px; }
  .part-reward-copy p { font-size:13px; }
  .part-reward-track { height:18px; min-height:18px; font-size:14px; }
  .win-reward-line { gap:2px 4px; padding:2px 3px; font-size:10px; }
  .win-reward-line .icon { width:14px; height:14px; }
  .meta-nav-button { font-size:12px; border-left-width:8px; border-right-width:8px; }
  .meta-nav-button.meta-nav-main { font-size:24px; }
  .meta-nav-main small { font-size:12px; }
  .shipyard-v7-screen .vessel-slot.workshop-slot { font-size:10px; }
  .shipyard-v7-screen .part-selection { grid-template-columns:minmax(0,1fr) 132px; }
  .store-copy p { font-size:11px; }
  .dialog.economy-guide { padding-left:13px; padding-right:13px; }
  .economy-guide>h2 { font-size:22px; }
  .milestone-row { grid-template-columns:28px minmax(0,1fr) 53px; gap:6px; }
  .milestone-row strong { font-size:14px; }
  .milestone-row>b { max-width:53px; font-size:10px; }
}
@media(max-height:740px) {
  .home-screen.home-v20 { min-height:620px; }
  .home-v20>.next-part-panel { min-height:108px; }
  .home-v20 .meta-nav-main { font-size:22px; gap:0; }
  .home-v20 .meta-nav-main .icon { width:22px; height:22px; }
  .home-v20 .meta-nav-main small { font-size:11px; }
  .meta-window { overflow-y:auto; }
  .shipyard-v7-screen .vessel-preview.workshop-scene { min-height:180px; flex-shrink:0; }
  .workshop-drawer { flex:0 0 258px; height:258px; }
  .workshop-drawer.workshop-view-classic { flex-basis:302px; height:302px; }
  .shipyard-v7-screen .workshop-slot-strip.workshop-slot-grid { flex-basis:92px; height:92px; }
  .meta-window>.meta-navigation { position:sticky; bottom:0; z-index:8; flex-shrink:0; }
  .shop-screen { overflow:hidden; }
}
@media(prefers-reduced-motion:reduce) {
  .home-v20 .home-vessel>canvas { transform:translateX(-50%); }
}
