/* Mobile popup sheets: the work-mode readers in the game's own colours. */
body.mobile #mobile-sheet-root { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
body.mobile .mobile-sheet {
  pointer-events: auto; position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; flex-direction: column;
  background: #1f1c19; color: #e8dcc0; font-family: Georgia, serif; font-size: 16px;
  border-top: 2px solid #8b5a2b; box-shadow: 0 -6px 18px rgba(0,0,0,.6);
  padding-bottom: env(safe-area-inset-bottom);
}
body.mobile .mobile-sheet--full { top: 0; padding-top: env(safe-area-inset-top); border-top: none; }
body.mobile .mobile-sheet--half { max-height: 62vh; border-radius: 12px 12px 0 0; }
body.mobile .mobile-sheet .wm-ui-reader-header { padding: 10px 12px 6px; border-bottom: 1px solid #3a3530; background: #2a2622; }
body.mobile .mobile-sheet .wm-ui-reader-subject-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
body.mobile .mobile-sheet .wm-ui-reader-subject { font-size: 19px; color: #d4a84b; }
body.mobile .mobile-sheet .wm-ui-reader-sender { display: none; }
body.mobile .mobile-sheet .wm-ui-reader-status { font-size: 13px; color: #b8ab90; }
body.mobile .mobile-sheet .wm-ui-tool { min-width: 44px; min-height: 44px; font-size: 20px; background: none; border: none; color: #e8dcc0; }
body.mobile .mobile-sheet .wm-ui-reader-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 10px 12px; overscroll-behavior: contain; }
body.mobile .mobile-sheet .wm-bank-columns { display: block; }
body.mobile .mobile-sheet .wm-bank-scroll { max-height: none; overflow: visible; }
/* Tabs grow to fill the row when they fit and scroll sideways when they don't. */
body.mobile .mobile-seg {
  display: flex; gap: 6px; margin: 0 0 10px;
  overflow-x: auto; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch;
  touch-action: pan-x; scrollbar-width: none;
}
body.mobile .mobile-seg::-webkit-scrollbar { display: none; }
body.mobile .mobile-seg-btn {
  flex: 1 0 auto; min-width: 76px; min-height: 48px; padding: 0 16px; white-space: nowrap;
  font-size: 16px; background: #2a2622; color: #c9a855; border: 1px solid #3a3530; border-radius: 6px;
}
body.mobile .mobile-seg-btn--on { background: #8b5a2b; color: #fff5e0; border-color: #c49660; }
body.mobile .mobile-sheet .wm-bank-tabs { flex-wrap: nowrap; }
body.mobile .mobile-sheet .wm-bank-tab { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 6px; }
body.mobile .mobile-sheet .wm-bank-tab .wm-ui-icon { width: 24px; height: 24px; font-size: 14px; }
body.mobile .mobile-sheet .wm-bank-placeholder { opacity: .55; }
/* Spreadsheet rows become cards */
body.mobile .mobile-sheet .wm-ui-sheet-head { display: none; }
body.mobile .mobile-sheet .wm-ui-sheet-row {
  display: flex !important; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; min-height: 48px; padding: 8px 10px; margin-bottom: 4px;
  background: #2a2622; color: inherit; border: 1px solid #3a3530; border-radius: 6px; font: inherit; text-align: left;
}
body.mobile .mobile-sheet .wm-ui-sheet-row--on { background: #4a3520; border-color: #c49660; }
body.mobile .mobile-sheet .wm-ui-sheet-letter { display: none; }
body.mobile .mobile-sheet .wm-ui-icon { width: 30px; height: 30px; font-size: 18px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; }
body.mobile .mobile-sheet .wm-ui-btn, body.mobile .mobile-sheet button.wm-ui-btn { min-height: 44px; padding: 0 14px; font-size: 15px; }
body.mobile .mobile-sheet .wm-ui-button-row { display: flex; flex-wrap: wrap; gap: 6px; }
body.mobile .mobile-sheet input, body.mobile .mobile-sheet select, body.mobile .mobile-sheet textarea { font-size: 16px; min-height: 44px; }
body.mobile .mobile-sheet-bar { display: flex; gap: 8px; align-items: center; padding: 8px 12px; border-top: 1px solid #3a3530; background: #2a2622; }
body.mobile .mobile-sheet-bar .mobile-close { flex: 1; min-height: 48px; font-size: 17px; background: #5c3d2e; color: #fff5e0; border: 1px solid #a87c4f; border-radius: 8px; }
body.mobile .mobile-sheet-hint { flex: 2; font-size: 12px; color: #8a8070; }
body.mobile .mobile-card { display: flex; justify-content: space-between; align-items: center; width: 100%; min-height: 48px; padding: 8px 10px; margin-bottom: 4px; background: #2a2622; color: inherit; border: 1px solid #3a3530; border-radius: 6px; font: inherit; text-align: left; }
body.mobile .mobile-card--done { border-color: #6b8e3a; }
body.mobile .mobile-card--dim { opacity: .6; }
body.mobile .mobile-card-meta { font-size: 13px; color: #b8ab90; }
/* Row menus (showWorkModeContextMenu), finger-sized and in the game palette */
body.mobile .wm-context-menu { font-size: 16px; font-family: Georgia, serif; background: #2a2622; border-color: #8b5a2b; max-width: calc(100vw - 16px); }
body.mobile .wm-context-menu-item { min-height: 44px; display: flex; align-items: center; padding: 0 16px; color: #e8dcc0; }
/* World map frame pans by finger (pointer events in visualPanels.js) */
body.mobile .mobile-sheet .wm-map-viewport { touch-action: none; }

/* Controls in the game palette (work-mode CSS draws them Outlook-grey) */
body.mobile .mobile-sheet .wm-ui-btn {
  background: #3a3530; color: #e8dcc0; border: 1px solid #5a4d3a; border-radius: 6px; font-family: Georgia, serif;
}
body.mobile .mobile-sheet .wm-ui-btn:disabled { opacity: .45; }
body.mobile .mobile-sheet .wm-ui-btn--primary { background: #8b5a2b; border-color: #c49660; color: #fff5e0; }
body.mobile .mobile-sheet input, body.mobile .mobile-sheet select, body.mobile .mobile-sheet textarea {
  background: #1a1816; color: #e8dcc0; border: 1px solid #5a4d3a; border-radius: 6px; padding: 0 10px;
}
body.mobile .mobile-sheet .wm-ui-status { background: #3a3020; color: #f0dca0; border-color: #8b6a2b; }
body.mobile .mobile-sheet .wm-ui-note { color: #b8ab90; }
/* Colour world map on a dark ground (the Outlook frame is white) */
body.mobile .mobile-sheet .wm-map-viewport { background: #0d0c0b; border-color: #3a3530; border-radius: 6px; }
body.mobile .mobile-sheet .wm-map-pin { width: 11px; height: 11px; margin: -5px 0 0 -5px; box-shadow: 0 0 0 2px #fff5e0; }
/* Crafting station rows: the desktop 4-column grid squeezes the recipe name to
   a few letters on a phone. Stack it: name + level on top, materials below. */
body.mobile .mobile-sheet .wm-station-list { max-width: none; }
body.mobile .mobile-sheet .wm-station-row {
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "name level" "mats mats" "acts acts";
  row-gap: 4px; column-gap: 8px; padding: 8px 6px; min-height: 48px;
  color: #e8dcc0; border-bottom-color: #3a3530; font-size: 15px;
}
body.mobile .mobile-sheet button.wm-station-row:hover { background: transparent; }
body.mobile .mobile-sheet .wm-station-row--open { background: #4a3520; }
body.mobile .mobile-sheet .wm-station-row--blocked { color: #8a8070; }
body.mobile .mobile-sheet .wm-station-row .wm-ui-cell-name { grid-area: name; }
body.mobile .mobile-sheet .wm-station-row .wm-ui-cell-label { white-space: normal; overflow-wrap: anywhere; }
body.mobile .mobile-sheet .wm-station-level { grid-area: level; color: #b8ab90; font-size: 12px; }
body.mobile .mobile-sheet .wm-station-materials {
  grid-area: mats; white-space: normal; overflow: visible; color: #b8ab90; font-size: 13px; padding-left: 38px;
}
body.mobile .mobile-sheet .wm-station-row .wm-ui-actions { grid-area: acts; display: flex; gap: 6px; padding-left: 38px; }
body.mobile .mobile-sheet .wm-station-amounts { background: #2a2622; border-bottom-color: #3a3530; padding-left: 12px; }
body.mobile .mobile-sheet .wm-station-amounts-label { color: #e8dcc0; }
body.mobile .mobile-sheet .wm-station-note { color: #e8dcc0; }
/* Buy/Sell/Withdraw amount rows stay pinned to the bottom of the sheet while
   the list above scrolls: pick an item near the top of a long shop and the
   buttons are still under your thumb. */
body.mobile .mobile-sheet .wm-bank-side > .wm-ui-button-row {
  position: sticky; bottom: -10px; z-index: 2;
  margin: 0 -12px; padding: 8px 12px 10px;
  background: #1f1c19; border-top: 1px solid #3a3530;
  align-items: center;
}
body.mobile .mobile-sheet .wm-bank-transfer-label { font-weight: bold; min-width: 40px; }
body.mobile .mobile-sheet .wm-shop-price { padding: 6px 0 2px; color: #d4a84b; }

/* Landscape phone (~340px tall): every row of chrome costs list space. The
   header's ✕ replaces the Close bar, the header packs onto one line, intro
   lines go, and half sheets may use the full height. */
@media (orientation: landscape) {
  body.mobile .mobile-sheet {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }
  body.mobile .mobile-sheet--half { max-height: calc(100dvh - env(safe-area-inset-top)); }
  body.mobile .mobile-sheet-bar { display: none; }
  body.mobile .mobile-sheet .wm-ui-reader-header {
    display: flex; flex-wrap: wrap; align-items: center; column-gap: 12px; row-gap: 4px;
    padding: 2px 8px 4px 12px;
  }
  body.mobile .mobile-sheet .wm-ui-reader-subject-row { flex: 1 1 auto; min-width: 0; }
  body.mobile .mobile-sheet .wm-ui-reader-subject { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  body.mobile .mobile-sheet .wm-ui-reader-meta-row { order: -1; flex: 0 0 auto; }
  body.mobile .mobile-sheet .wm-ui-reader-intro { display: none; }
  body.mobile .mobile-sheet .wm-ui-tool { min-height: 38px; }
  body.mobile .mobile-sheet .wm-ui-reader-header .mobile-seg { flex: 1 1 100%; margin: 0; }
  body.mobile .mobile-seg-btn { min-height: 38px; }
  body.mobile .mobile-sheet .wm-ui-reader-body { padding: 6px 12px; }
  body.mobile .mobile-sheet .wm-ui-sheet-row { min-height: 40px; padding: 4px 10px; }
  body.mobile .mobile-sheet .wm-bank-side > .wm-ui-button-row { bottom: -6px; padding: 4px 12px 6px; }
  body.mobile .mobile-sheet .wm-ui-btn, body.mobile .mobile-sheet button.wm-ui-btn { min-height: 38px; }
  body.mobile.mobile-sheet-open #mobile-keyboard-bar { bottom: env(safe-area-inset-bottom); }
}
/* Slayer Master reader states in the game palette (desktop CSS is Outlook blue). */
body.mobile .mobile-sheet .wm-slayer-shop-row--open,
body.mobile .mobile-sheet .wm-slayer-chip--on { background: #4a3520; border-color: #c49660; color: #fff5e0; }
body.mobile .mobile-sheet .wm-slayer-card--picked { border-color: #c49660; }
/* Equipment Stats: slot tiles over the stat sheet, in the game palette. */
body.mobile .mobile-sheet .wm-equip-slots { max-width: none; }
body.mobile .mobile-sheet .wm-equip-slot {
  min-height: 72px; background: #2a2622; border-color: #3a3530; border-radius: 6px; color: #e8dcc0; font-size: 12px;
}
body.mobile .mobile-sheet .wm-equip-slot:hover:not(:disabled) { background: #2a2622; }
body.mobile .mobile-sheet .wm-equip-slot--empty { opacity: .55; }
body.mobile .mobile-sheet .wm-equip-slot--on { background: #4a3520; border-color: #c49660; }
body.mobile .mobile-sheet .wm-equip-slot-label { color: #8a8070; }
body.mobile .mobile-sheet .wm-equip-slot-qty { color: #b8ab90; }
body.mobile .mobile-sheet .wm-equip-focus { max-width: none; min-height: 44px; }
body.mobile .mobile-sheet .wm-equip-stats { max-width: none; grid-template-columns: 1fr; }
body.mobile .mobile-sheet .wm-equip-stats .wm-ui-section { color: #c9a855; border-bottom-color: #3a3530; }
body.mobile .mobile-sheet .wm-equip-stat { font-size: 14px; padding: 3px 0; border-bottom: 1px solid #2a2622; }
body.mobile .mobile-sheet .wm-equip-stat-label { color: #b8ab90; }
body.mobile .mobile-sheet .wm-equip-stat--bonus .wm-equip-stat-label,
body.mobile .mobile-sheet .wm-equip-stat-bonus { color: #f0c860; }
@media (orientation: landscape) {
  body.mobile .mobile-sheet .wm-equip-slots { grid-template-columns: repeat(8, minmax(0, 1fr)); }
  body.mobile .mobile-sheet .wm-equip-slot { min-height: 60px; padding: 4px 2px; }
  body.mobile .mobile-sheet .wm-equip-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 16px; }
}
/* Farm plot + compost heap: cards in the game palette. */
body.mobile .mobile-sheet .wm-grow-list { max-width: none; gap: 6px; }
body.mobile .mobile-sheet .wm-grow-card {
  min-height: 56px; padding: 8px 10px; background: #2a2622; border: 1px solid #3a3530; border-radius: 6px;
  color: #e8dcc0; font-size: 16px;
}
body.mobile .mobile-sheet .wm-grow-card .wm-ui-cell-label { white-space: normal; overflow-wrap: anywhere; }
body.mobile .mobile-sheet .wm-grow-card .wm-ui-cell-suffix { color: #b8ab90; font-size: 14px; }
body.mobile .mobile-sheet .wm-grow-card-meta { color: #b8ab90; font-size: 13px; padding-left: 38px; }
body.mobile .mobile-sheet .wm-grow-card--locked { opacity: .6; }
body.mobile .mobile-sheet .wm-grow-card--locked .wm-ui-cell-label,
body.mobile .mobile-sheet .wm-grow-card--locked .wm-grow-card-meta { color: inherit; }
body.mobile .mobile-sheet .wm-grow-card--locked .wm-ui-icon { opacity: 1; }
body.mobile .mobile-sheet .wm-grow-card-actions .wm-ui-btn { min-width: 48px; padding: 0 10px; }
body.mobile .mobile-sheet .wm-grow-lock { color: #e08a6a; font-size: 13px; }
body.mobile .mobile-sheet .wm-grow-meter { max-width: none; }
body.mobile .mobile-sheet .wm-grow-meter-top { font-size: 15px; color: #e8dcc0; margin-bottom: 4px; }
body.mobile .mobile-sheet .wm-ui-bar { height: 10px; background: #3a3530; border-radius: 5px; overflow: hidden; }
body.mobile .mobile-sheet .wm-ui-bar-fill { background: #c9a855; }
/* Two columns of essence bars keep "Add from inventory" near the top. */
body.mobile .mobile-sheet .wm-compost-essence { max-width: none; margin: 4px 0 8px; display: grid; grid-template-columns: 1fr 1fr; column-gap: 14px; }
body.mobile .mobile-sheet .wm-compost-essence-row { font-size: 13px; grid-template-columns: 66px 1fr 28px; gap: 6px; margin-bottom: 6px; color: #e8dcc0; }
body.mobile .mobile-sheet .wm-compost-countdown { color: #e8dcc0; font-size: 18px; }
body.mobile .mobile-sheet .wm-compost-layout { display: block; }
body.mobile .mobile-sheet .wm-compost-layout .wm-ui-button-row .wm-ui-btn--primary,
body.mobile .mobile-sheet .wm-ui-button-row .wm-ui-btn--primary:only-child { flex: 1; }
body.mobile .mobile-sheet .wm-grow-list ~ .wm-ui-section,
body.mobile .mobile-sheet .wm-compost-pane .wm-ui-section,
body.mobile .mobile-sheet .wm-ui-reader-body > .wm-ui-section { color: #c9a855; border-bottom-color: #3a3530; }
body.mobile .mobile-sheet .wm-essence-chips { font-size: 13px; }
@media (orientation: landscape) {
  body.mobile .mobile-sheet .wm-compost-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
  body.mobile .mobile-sheet .wm-grow-card { min-height: 48px; padding: 4px 10px; }
}
/* Form labels: the work-mode grey (#444) vanishes on the dark sheet. */
body.mobile .mobile-sheet .wm-ui-field-label { color: #b8ab90; }
/* Trade inventory: name and count on top, the five amount buttons below,
   so neither squeezes the other. Accept stays under the thumb. */
body.mobile .mobile-sheet .wm-trade-inv-row { flex-wrap: wrap; row-gap: 6px; }
body.mobile .mobile-sheet .wm-trade-inv-row > .wm-ui-sheet-cell:first-child { flex: 1 1 auto; }
body.mobile .mobile-sheet .wm-trade-inv-row > .wm-ui-sheet-cell:last-child { flex: 1 0 100%; overflow: visible; }
body.mobile .mobile-sheet .wm-trade-inv-row .wm-ui-actions { justify-content: stretch; gap: 6px; }
body.mobile .mobile-sheet .wm-trade-inv-row .wm-ui-actions .wm-ui-btn { flex: 1; min-width: 0; }
body.mobile .mobile-sheet .wm-trade-ready-row {
  position: sticky; bottom: -10px; z-index: 2; margin: 0 -12px; padding: 8px 12px 10px;
  background: #1f1c19; border-top: 1px solid #3a3530;
}
body.mobile .mobile-sheet .wm-trade-ready-row .wm-ui-btn { flex: 1; }
