/* V131: mobile sheets only. Account/character editing belongs to mobile-flow. */
html[data-mobile-ui="true"] :is(
  .fv25-overlay:has(> .fv25-dialog:not([data-view="account"])),
  .fish35-overlay, .cwork40-overlay, .cmail39-overlay, .friends118-overlay,
  .cs42-overlay, .sh49-overlay, .living118-overlay, .community120-sound-overlay
):not([hidden]) {
  position: fixed !important;
  inset: auto 0 auto !important;
  top: var(--mobile-vtop, 0px) !important;
  width: 100% !important;
  height: var(--mobile-vh, 100dvh) !important;
  max-height: none !important;
  padding: 0 !important;
  margin: 0 !important;
  display: flex !important;
  align-items: stretch !important;
  justify-content: stretch !important;
  box-sizing: border-box;
  z-index: 2100 !important;
  overflow: hidden;
}

/* Fishing keeps its phase and primary hold/retract controls outside the menu. */
html[data-mobile-ui="true"] body #cc-game .fish35-hud{
  display:grid;grid-template-columns:96px minmax(0,1fr);grid-template-rows:auto auto;
  align-items:stretch;gap:5px 8px;left:8px;right:8px;bottom:calc(8px + var(--mobile-safe-bottom,0px));
  width:auto;max-width:none;transform:none;z-index:94;
}
html[data-mobile-ui="true"] body #cc-game .fish35-hud .fish35-info{grid-column:1/-1;grid-row:1;box-sizing:border-box;min-width:0;width:100%;max-height:46px;overflow:auto;padding:5px 9px;border-radius:9px;pointer-events:auto}
html[data-mobile-ui="true"] body #cc-game .fish35-hud .fish35-status{font-size:12px;line-height:1.4;margin:0}
html[data-mobile-ui="true"] body #cc-game .fish35-hud .fish35-power{margin:4px auto 0;height:5px;max-width:100%}
html[data-mobile-ui="true"] body #cc-game .fish35-hud .fish35-controls{grid-column:2;grid-row:2;min-width:0;max-width:none;justify-content:flex-end;gap:6px;padding:0;border:0;background:transparent;box-shadow:none;border-radius:0}
html[data-mobile-ui="true"] body #cc-game .fish35-hud .fish35-hold{flex:1;min-width:0;max-width:220px;min-height:48px;padding:8px;font-size:13px;line-height:1.35;border-radius:10px}
html[data-mobile-ui="true"] body #cc-game .fish35-hud .fish35-retract{flex:none;min-width:48px;min-height:48px;padding:6px;font-size:12px;border-radius:10px}
html[data-mobile-ui="true"] body #cc-game .fish131-menu{grid-column:1;grid-row:2;align-self:stretch;min-width:0;pointer-events:auto}
html[data-mobile-ui="true"] body #cc-game .fish131-menu>summary{display:flex;align-items:center;justify-content:center;box-sizing:border-box;height:100%;min-height:48px;padding:6px;border:1px solid #a58d63;border-bottom-width:3px;border-radius:10px;background:#f7efda;color:#4b5941;font:600 13px/1.3 "PingFang SC","Microsoft YaHei",sans-serif;list-style:none;cursor:pointer;touch-action:manipulation}
html[data-mobile-ui="true"] body #cc-game .fish131-menu>summary::-webkit-details-marker{display:none}
html[data-mobile-ui="true"] body #cc-game .fish131-menu[open]>summary{background:#e2ebd4;border-color:#789167}
html[data-mobile-ui="true"] body #cc-game .fish131-menu-body{position:fixed;top:calc(var(--mobile-vtop,0px) + 84px + var(--mobile-safe-top,0px));left:max(8px,env(safe-area-inset-left,0px));right:max(8px,env(safe-area-inset-right,0px));box-sizing:border-box;max-height:calc(var(--mobile-vh,100dvh) - 360px);min-height:100px;overflow:auto;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;padding:10px 12px;border:1px solid #ae956f;border-radius:12px;background:#fbf4e2;box-shadow:0 5px 20px #273e3350;color:#4b5941}
html[data-mobile-ui="true"] body #cc-game .fish131-menu-body>header{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:6px}
html[data-mobile-ui="true"] body #cc-game .fish131-menu-body button{min-height:44px;min-width:44px;border:1px solid #b5a177;border-radius:8px;background:#fff9eb;color:#4b5941;font:inherit;font-size:13px;padding:8px 12px;touch-action:manipulation}
html[data-mobile-ui="true"] body #cc-game .fish131-menu-body button:disabled{opacity:.55;cursor:default}
html[data-mobile-ui="true"] body #cc-game .fish131-spots{display:flex;flex-wrap:wrap;gap:7px;padding-bottom:10px;border-bottom:1px solid #d1c29f}
html[data-mobile-ui="true"] body #cc-game .fish131-spots>p{flex:0 0 100%;font-size:12px;line-height:1.5;margin:0 0 2px}
html[data-mobile-ui="true"] body #cc-game .fish131-spots>button{flex:1 1 auto;padding:8px}
html[data-mobile-ui="true"] body #cc-game .fish131-spots>button[aria-pressed="true"]{background:#e4edd7;border-color:#789167}
html[data-mobile-ui="true"] body #cc-game .fish131-menu-body .fish35-resources{margin:6px 0 12px;font-size:12px;line-height:1.7;text-align:left}
html[data-mobile-ui="true"] body #cc-game .fish131-menu-body .fish35-tools{display:flex;flex-wrap:wrap;gap:8px}
html[data-mobile-ui="true"] body #cc-game .fish131-menu-body .fish35-tools button{flex:1 1 auto}
html[data-mobile-ui="true"] body #cc-game .fish131-menu-body .fish40-receipt{position:static;transform:none;max-width:100%;width:100%;max-height:none;margin-top:8px;padding:7px;gap:6px;box-sizing:border-box}
html[data-mobile-ui="true"] body #cc-game .fish35-hud .fish40-receipt .fish35-icon{display:none}
html[data-mobile-ui="true"] body #cc-game .fish35-hud .fish40-receipt>div{min-width:0;gap:3px}
html[data-mobile-ui="true"] body #cc-game .fish35-hud .fish40-receipt small{display:none}
html[data-mobile-ui="true"] body #cc-game .fish35-hud .fish40-receipt strong{font-size:12px}
html[data-mobile-ui="true"] body #cc-game .fish35-hud .fish40-receipt button{min-width:44px;min-height:44px;font-size:11px;padding:4px}
@media(min-width:600px) and (max-height:500px){
 html[data-mobile-ui="true"] body #cc-game .fish35-hud{left:146px;right:120px;bottom:8px;grid-template-columns:96px minmax(0,1fr)}
 html[data-mobile-ui="true"] body #cc-game .fish35-hud .fish35-info{max-height:36px;padding:3px 7px}
 html[data-mobile-ui="true"] body #cc-game .fish35-hud .fish35-status{font-size:11px}
 html[data-mobile-ui="true"] body #cc-game .fish131-menu-body{top:calc(var(--mobile-vtop,0px) + 60px);left:146px;right:120px;min-height:0;max-height:calc(var(--mobile-vh,100dvh) - 220px)}
}

html[data-mobile-ui="true"] :is(
  .fv25-dialog:not([data-view="account"]), .fish35-panel, .cwork40-dialog,
  .cmail39-dialog, .friends118-dialog, .cs42-panel, .sh49-dialog, .living118-guide
) {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 1 auto;
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  height: 100% !important;
  min-height: 0 !important;
  max-height: none !important;
  margin: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-sizing: border-box;
  overflow: hidden !important;
  box-shadow: none !important;
  overflow-wrap: anywhere;
}

html[data-mobile-ui="true"] :is(
  .fv25-dialog:not([data-view="account"]), .fish35-panel, .cwork40-dialog,
  .cmail39-dialog, .friends118-dialog, .cs42-panel, .sh49-dialog, .living118-guide,
  .audio120-settings
) :is(button, input:not([type="checkbox"]):not([type="radio"]), select, textarea) {
  box-sizing: border-box;
  min-height: 44px !important;
  max-width: 100%;
}

html[data-mobile-ui="true"] :is(
  .fv25-dialog:not([data-view="account"]), .fish35-panel, .cwork40-dialog,
  .cmail39-dialog, .friends118-dialog, .cs42-panel, .sh49-dialog, .living118-guide,
  .audio120-settings
) :is(input, select, textarea) {
  font-size: 16px !important;
  min-width: 0;
}

html[data-mobile-ui="true"] :is(
  .fv25-dialog:not([data-view="account"]), .fish35-panel, .cwork40-dialog,
  .cmail39-dialog, .friends118-dialog, .cs42-panel, .sh49-dialog, .living118-guide
) > header {
  flex: 0 0 auto;
  min-height: 60px;
  padding: max(8px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 8px max(12px, env(safe-area-inset-left)) !important;
  gap: 10px !important;
  border-radius: 0 !important;
}

html[data-mobile-ui="true"] :is(
  .fv25-dialog:not([data-view="account"]), .fish35-panel, .cwork40-dialog,
  .cmail39-dialog, .friends118-dialog, .cs42-panel, .sh49-dialog, .living118-guide
) > header h2 {
  font-size: 20px !important;
  line-height: 1.3 !important;
  margin: 2px 0 !important;
}

html[data-mobile-ui="true"] :is(
  .fv25-dialog:not([data-view="account"]), .fish35-panel, .cwork40-dialog,
  .cmail39-dialog, .friends118-dialog, .cs42-panel, .sh49-dialog
) > header :is(p, small, .fv25-eyebrow) {
  font-size: 12px !important;
  line-height: 1.4 !important;
  margin: 2px 0 !important;
}

html[data-mobile-ui="true"] :is(
  .fv25-dialog:not([data-view="account"]), .fish35-panel, .cwork40-dialog,
  .cmail39-dialog, .friends118-dialog, .cs42-panel, .sh49-dialog
) > header button {
  flex: 0 0 auto;
  min-width: 44px;
  white-space: nowrap;
}

/* One horizontal navigation row; page contents have their own vertical scroll. */
html[data-mobile-ui="true"] :is(
  .fv25-dialog:not([data-view="account"]) .fv25-nav, .fish35-tabs,
  .cwork40-nav, .cmail39-tabs, .friends118-dialog > nav, .sh49-dialog > nav
) {
  display: flex !important;
  flex-flow: row nowrap !important;
  flex: 0 0 auto !important;
  min-width: 0 !important;
  min-height: 0 !important;
  max-height: none !important;
  gap: 6px !important;
  padding: 8px max(12px, env(safe-area-inset-right)) 8px max(12px, env(safe-area-inset-left)) !important;
  margin: 0 !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

html[data-mobile-ui="true"] :is(
  .fv25-dialog:not([data-view="account"]) .fv25-nav, .fish35-tabs,
  .cwork40-nav, .cmail39-tabs, .friends118-dialog > nav, .sh49-dialog > nav
) > button {
  flex: 0 0 auto !important;
  width: auto !important;
  min-width: 44px !important;
  min-height: 44px !important;
  padding: 8px 12px !important;
  font-size: 14px !important;
  line-height: 1.3 !important;
  white-space: nowrap !important;
}

html[data-mobile-ui="true"] :is(
  .fv25-dialog:not([data-view="account"]) > .fv25-body, .fish35-panel-body,
  .cwork40-area, .cmail39-scroll, .friends118-dialog > main, .sh49-body,
  .cs42-panel > [data-list], .cs42-panel > [data-room], .cs42-invite-content
) {
  flex: 1 1 0 !important;
  min-height: 0 !important;
  min-width: 0 !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  padding: 12px max(12px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)) !important;
  scroll-padding-block: 12px 72px;
}

html[data-mobile-ui="true"] .fv25-dialog:not([data-view="account"]) .fv25-nav {
  position: sticky;
  top: -12px;
  margin: -12px -12px 12px !important;
  background: var(--fv-paper, #f7efda);
  z-index: 2;
}

html[data-mobile-ui="true"] .cwork40-layout {
  display: flex !important;
  flex-direction: column !important;
  flex: 1 1 0;
  min-height: 0 !important;
  min-width: 0;
  overflow: hidden !important;
}
html[data-mobile-ui="true"] .cwork40-content {
  flex: 1 1 0 !important;
  min-height: 0 !important;
  min-width: 0;
  overflow: hidden;
}
html[data-mobile-ui="true"] :is(.cwork40-status, .friends118-status, .cs42-status, .sh49-dialog > [role="status"]) {
  flex: 0 0 auto;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 6px 12px !important;
  font-size: 13px !important;
}
html[data-mobile-ui="true"] :is(.cwork40-status, .friends118-status, .cs42-status, .sh49-dialog > [role="status"]):empty {
  padding-block: 0 !important;
}
html[data-mobile-ui="true"] :is(.cwork40-footer, .cmail39-footer) {
  flex: 0 0 auto;
  display: flex !important;
  flex-wrap: nowrap !important;
  gap: 8px !important;
  padding: 6px max(12px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)) !important;
  overflow-x: auto;
}
html[data-mobile-ui="true"] .cwork40-footer > p,
html[data-mobile-ui="true"] .cmail39-footer > span { display: none; }
html[data-mobile-ui="true"] .cwork40-footer .cwork40-actions {
  flex-wrap: nowrap !important;
  flex: 0 0 auto;
  gap: 8px !important;
  margin: 0 !important;
}
html[data-mobile-ui="true"] :is(.cwork40-footer, .cmail39-footer) button {
  flex: 0 0 auto;
  font-size: 13px !important;
  padding: 8px 10px !important;
  white-space: nowrap;
}
html[data-mobile-ui="true"] .cmail39-toolbar {
  display: flex !important;
  align-items: center;
  min-width: 0;
  flex: 0 0 auto;
  padding: 0 12px 0 0 !important;
}
html[data-mobile-ui="true"] .cmail39-dialog .cmail39-toolbar .cmail39-tabs { flex: 1 1 0 !important; }
html[data-mobile-ui="true"] .cmail39-toolbar > button { flex: 0 0 auto; }

/* The guide already has header/content/footer siblings: scroll only its cards. */
html[data-mobile-ui="true"] .living118-guide { padding: 0 !important; }
html[data-mobile-ui="true"] .living118-guide > .living118-copy {
  flex: 0 0 auto;
  margin: 0 !important;
  padding: 8px 14px;
  font-size: 14px;
  line-height: 1.5;
}
html[data-mobile-ui="true"] .living118-guide > .living118-cards {
  flex: 1 1 0;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 0 14px 12px;
}
html[data-mobile-ui="true"] .living118-guide > footer {
  flex: 0 0 auto;
  flex-wrap: nowrap !important;
  margin: 0 !important;
  gap: 8px !important;
  padding: 8px 12px max(8px, env(safe-area-inset-bottom));
}
html[data-mobile-ui="true"] .living118-guide > footer button { white-space: nowrap; padding-inline: 10px; }

html[data-mobile-ui="true"] .community120-sound-overlay .audio120-settings {
  box-sizing: border-box;
  width: 100% !important;
  max-width: none !important;
  height: 100% !important;
  max-height: none !important;
  overflow: auto !important;
  overscroll-behavior: contain;
  border: 0 !important;
  border-radius: 0 !important;
  padding: max(14px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)) !important;
}
html[data-mobile-ui="true"] .audio120-settings .audio120-done {
  position: sticky;
  bottom: 0;
  z-index: 1;
  box-shadow: 0 0 0 8px #fffdf7;
}

@media (max-width: 600px) {
  html[data-mobile-ui="true"] :is(.fv25-dialog:not([data-view="account"]) .fv25-grid, .fish35-grid, .friends120-dialog .friends118-grid, .sh49-grid) {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  html[data-mobile-ui="true"] .fv25-dialog:not([data-view="account"]) .fv47-catalog-controls {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  html[data-mobile-ui="true"] :is(.cwork40-area, .cmail39-scroll) table { font-size: 13px; }
  html[data-mobile-ui="true"] .friends120-dialog .friends118-card { padding: 14px; }
  html[data-mobile-ui="true"] .cs42-panel .cs42-book { grid-template-columns: minmax(0, 1fr) !important; }
}

/* In short landscape, use width for work navigation and guide illustrations. */
@media (min-width: 600px) and (max-height: 500px) {
  html[data-mobile-ui="true"] :is(
    .fv25-dialog:not([data-view="account"]), .fish35-panel, .cwork40-dialog,
    .cmail39-dialog, .friends118-dialog, .cs42-panel, .sh49-dialog, .living118-guide
  ) > header { min-height: 52px; padding-block: 4px !important; }
  html[data-mobile-ui="true"] :is(.fv25-dialog:not([data-view="account"]) .fv25-eyebrow, .cwork40-subtitle, .cmail39-kicker) { display: none; }
  html[data-mobile-ui="true"] .cwork40-layout { flex-direction: row !important; }
  html[data-mobile-ui="true"] .cwork40-dialog .cwork40-layout .cwork40-nav {
    flex-direction: column !important;
    width: 144px !important;
    padding: 6px max(8px, env(safe-area-inset-left)) !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
  }
  html[data-mobile-ui="true"] .cwork40-dialog .cwork40-layout .cwork40-nav > button { white-space: normal !important; }
  html[data-mobile-ui="true"] .living118-overlay .living118-guide {
    display: grid !important;
    grid-template-columns: minmax(210px, 34%) minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto;
  }
  html[data-mobile-ui="true"] .living118-guide > header { grid-column: 1; grid-row: 1; }
  html[data-mobile-ui="true"] .living118-guide > header canvas { width: 44px; height: 55px; }
  html[data-mobile-ui="true"] .living118-guide > .living118-copy { grid-column: 1; grid-row: 2; overflow: auto; min-height: 0; }
  html[data-mobile-ui="true"] .living118-guide > .living118-cards { grid-column: 2; grid-row: 1 / 3; padding-top: 10px; }
  html[data-mobile-ui="true"] .living118-guide > footer { grid-column: 1 / -1; grid-row: 3; }
}
