/* Remembered desktop: crisp 98 chrome, a quiet pixel countryside, one hot accent.
   Cosmetic themes retain their own palette; this file owns shared visual geometry. */
:root {
  --game-font: 'Pixelated MS Sans Serif', 'MS Sans Serif', sans-serif;
  --desktop-ink: #252c35;
  --desktop-red: #a83232;
  --desktop-paper: #f4f1e6;
  --desktop-shadow: #454d50;
}
body.default:not([class*="theme-"]), body.theme-default {
  --theme-bg: #315b60;
  --theme-surface: #d6d5ca;
  --theme-text: #252c35;
  --theme-text-muted: #545d61;
  --theme-border: #797e78;
  --theme-accent: #344994;
  --theme-control-bg: #deded4;
  --theme-control-text: #252c35;
  --theme-control-border-hi: #fffef3;
  --theme-control-border-lo: #747b78;
  --theme-control-active-bg: #c7d3da;
  --theme-control-active-text: #1d2c46;
  --theme-control-active-border-hi: #747b78;
  --theme-control-active-border-lo: #fffef3;
  --theme-progress-track: #bcbfb5;
  --theme-progress-fill: #50827c;
  --theme-table-header-bg: #344994;
  --theme-table-header-text: #fffdf4;
  --theme-table-even: #e9ebe2;
  --theme-table-odd: #f5f2e7;
  --theme-table-text: #252c35;
  --theme-highlight-row: #d8e2ef;
  --theme-subtle-bg: #e7e8df;
  --theme-subtle-border: #b5b9ae;
  --header-bg: #202f70;
  --secondary-color: #57699e;
  --header-fg: #fffdf4;
  --tone-good-fg: #285a49;
  --tone-good-bg: #e1ebdb;
  --tone-good-border: #65816a;
  --tone-bad-fg: #932a31;
  --tone-bad-bg: #f5e1d8;
  --tone-bad-border: #a35653;
  --tone-neutral-fg: #655438;
  --tone-neutral-bg: #eee8d8;
  --tone-neutral-border: #a39774;
  background: #315b60 url('../resources/ui/desktop-lake.webp') center / cover no-repeat;
}
body {
  font-family: 'Pixelated MS Sans Serif', 'MS Sans Serif', Tahoma, Arial, sans-serif;
  font-size: 14px;
  --font-ui: 14px;
  --font-table: 14px;
  --font-title: 14px;
  --font-button: 14px;
  padding: calc(18px + var(--safe-top)) calc(18px + var(--safe-right)) calc(72px + var(--safe-bottom) + var(--bottom-bar-height)) calc(18px + var(--safe-left));
  line-height: 1.35;
}
#desktop-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 30px;
  flex: 0 0 auto;
  box-sizing: border-box;
  color: var(--header-fg, #fffdf4);
  background: linear-gradient(90deg, var(--header-bg, #202f70), var(--secondary-color, #57699e));
  border: 2px solid var(--theme-control-border-hi, #fffef3);
  border-right-color: var(--theme-control-border-lo, #747b78);
  border-bottom-color: var(--theme-control-border-lo, #747b78);
  box-shadow: 1px 1px 0 var(--desktop-shadow);
  padding: 3px 8px;
}
.desktop-brand { display: inline-flex; align-items: center; gap: 7px; font-weight: bold; }
.desktop-brand img { width: 20px; height: 20px; image-rendering: pixelated; }
.desktop-tagline { font: 10px Tahoma, sans-serif; letter-spacing: .13em; opacity: .9; }
#hud-top-stats {
  min-height: 34px;
  padding: 4px 9px;
  margin-bottom: 12px;
  background: var(--theme-control-bg);
  border: 2px solid var(--theme-control-border-hi);
  border-top: 0;
  border-right-color: var(--theme-control-border-lo);
  border-bottom-color: var(--theme-control-border-lo);
  box-shadow: 1px 1px 0 var(--desktop-shadow);
  gap: 18px;
  font-size: 13px;
}
#hud-cash { font-family: Tahoma, Arial, sans-serif; font-weight: 700; font-variant-numeric: tabular-nums; }
#hud-top-stats > span + span { border-left: 1px solid var(--theme-control-border-lo); padding-left: 14px; }
body[class] .panel {
  border: 2px solid var(--theme-control-border-hi, #fffef3);
  border-right-color: var(--theme-control-border-lo, #747b78);
  border-bottom-color: var(--theme-control-border-lo, #747b78);
  box-shadow: 1px 1px 0 var(--desktop-shadow);
  border-radius: 0;
}
#market-layout { gap: 12px; }
.panel-title, .market-insight-head {
  background: linear-gradient(90deg, var(--header-bg, #202f70), var(--secondary-color, #57699e));
  color: var(--header-fg, #fffdf4);
  min-height: 26px;
  padding: 4px 7px;
  box-sizing: border-box;
  font-size: 13px;
  letter-spacing: .025em;
  border: 0;
}
#farm-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 7px; }
#farm-title::after { position: static; inset: auto; animation: none; background: none; transform: none; content: '7 × 7'; font: 11px Tahoma, sans-serif; opacity: .8; }
#farm-panel { padding: 7px; }
.farm-scenery {
  position: relative;
  height: 50px;
  background: #576d84 url('../resources/ui/farm-daylight.webp') center 0% / 100% 500% no-repeat;
  border: 1px solid var(--theme-control-border-lo);
  box-shadow: inset 1px 1px 0 #fff7;
  margin-bottom: 7px;
}
.farm-scenery::after {
  content: 'Morning';
  position: absolute;
  right: 4px;
  bottom: 3px;
  padding: 2px 5px;
  color: #fffdf4;
  background: #202f70;
  font-size: 10px;
  line-height: 1.2;
  border: 1px solid #fff8;
}
body[data-time-of-day='midday'] .farm-scenery { background-position-y: 25%; }
body[data-time-of-day='midday'] .farm-scenery::after { content: 'Midday'; }
body[data-time-of-day='afternoon'] .farm-scenery { background-position-y: 50%; }
body[data-time-of-day='afternoon'] .farm-scenery::after { content: 'Afternoon'; }
body[data-time-of-day='evening'] .farm-scenery { background-position-y: 75%; }
body[data-time-of-day='evening'] .farm-scenery::after { content: 'Evening'; }
body[data-time-of-day='night'] .farm-scenery { background-position-y: 100%; }
body[data-time-of-day='night'] .farm-scenery::after { content: 'Night'; }
body[class][data-weather='rain'] {
  background-image: url('../resources/ui/desktop-lake-rain.webp');
}
/* Rain stays local to the scenery; no idle animation or full-screen effects. */
body[data-weather='rain'] .farm-scenery::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(115deg, transparent 0 19px, #c8dcec66 20px, transparent 22px 39px), #20395133;
  pointer-events: none;
}
/* Keep interface and crops readable instead of tinting the whole farm window. */
body[data-time-of-day] #farm-panel { filter: none; }
#desktop-chat-log, body:not(.mobile-layout) #desktop-chat-log, body.mobile-layout #mobile-chat-log {
  background: #223d3b;
  border: 1px solid #112f2e;
  box-shadow: inset 1px 1px 0 #101f24;
  color: #e2e9d4;
  font-family: Tahoma, Arial, sans-serif;
  font-size: 12px;
}
.desktop-chat-entry, body.mobile-layout .mobile-chat-entry { color: #e2e9d4; }
#guidance-panel {
  background: var(--theme-table-odd, #f4f1e6);
  color: var(--theme-text, #252c35);
  border: 1px solid var(--theme-control-border-lo);
  border-left: 3px solid var(--theme-accent);
  box-shadow: inset 0 1px 0 var(--theme-control-border-hi);
  margin: 7px 0;
  padding: 8px 9px;
  line-height: 1.4;
}
.guidance-heading { align-items: center; }
#guidance-objective-text { font-size: 13px; }
#guidance-objective-chip {
  border: 1px solid var(--theme-border);
  background: var(--theme-subtle-bg);
  color: var(--theme-text-muted);
  font: 10px Tahoma, Arial, sans-serif;
  text-transform: uppercase;
  padding: 2px 5px;
  letter-spacing: .05em;
}
#guidance-hint-text { font: 12px/1.5 Tahoma, Arial, sans-serif; margin-top: 5px; }
button, .button, .tab-button, .tool-button {
  border-radius: 0;
  color: var(--theme-control-text);
  background: var(--theme-control-bg);
  border: 0;
  box-shadow: inset -1px -1px #303837, inset 1px 1px var(--theme-control-border-hi), inset -2px -2px var(--theme-control-border-lo), inset 2px 2px #eceee2;
  font-family: inherit;
  font-size: 13px;
  text-shadow: none;
}
button:not(:disabled):active, .button:not(:disabled):active {
  box-shadow: inset -1px -1px var(--theme-control-border-hi), inset 1px 1px #303837, inset -2px -2px #eceee2, inset 2px 2px var(--theme-control-border-lo);
}
button:disabled { color: var(--theme-text-muted); opacity: .58; }
button:focus-visible, summary:focus-visible, a:focus-visible { outline: 2px dashed var(--theme-accent); outline-offset: 3px; }
.farm-toolbar { gap: 5px; margin: 6px 0; max-width: none; }
.tool-button { height: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 4px; }
.tool-name { font: 11px Tahoma, Arial, sans-serif; }
.tool-key-label { font: 10px Tahoma, Arial, sans-serif; color: var(--theme-text-muted); }
.tool-button img { width: 24px; height: 24px; }
.tool-button.active {
  background: var(--theme-control-active-bg);
  color: var(--theme-control-active-text);
  box-shadow: inset 1px 1px 0 var(--theme-control-border-lo), inset -1px -1px 0 var(--theme-control-border-hi);
  outline: 1px dotted var(--theme-accent);
  outline-offset: -5px;
}
#grid-container { border: 3px solid var(--theme-control-border-lo); border-right-color: var(--theme-control-border-hi); border-bottom-color: var(--theme-control-border-hi); box-sizing: border-box; }
#grid { border: 1px solid #555e53; }
#grid .grid-cell {
  background-color: #cbd0bf;
  background-image: repeating-linear-gradient(135deg, #ffffff0a 0px, #ffffff0a 2px, #00000004 2px, #00000004 4px);
  border: 1px solid #eaf0da;
  border-right-color: #86917f;
  border-bottom-color: #86917f;
  box-shadow: inset -1px -1px 0 #aeb8a3, inset 1px 1px 0 #e2e8d6;
  transition: box-shadow var(--action-fast) ease-out;
}
#grid .grid-cell.revealed {
  background-color: #785647;
  background-image: repeating-linear-gradient(0deg, #33291f26 0px, #33291f26 2px, transparent 2px, transparent 9px);
  border-color: #493c35;
  border-right-color: #a78a62;
  border-bottom-color: #a78a62;
  box-shadow: inset 0 2px 0 #4e3d32, inset 2px 0 0 #594134;
}
#grid.farm-two .grid-cell { background-color: #b2bec1; }
#grid.farm-two .grid-cell.revealed { background-color: #5b423c; }
.grid-cell img:not(.grid-overlay) { width: 86%; height: 86%; object-fit: contain; }
#grid .grid-cell.grid-cell-selected, #grid .grid-cell.grid-cell-bulk-selected {
  outline: 2px solid #fff2c4;
  outline-offset: -4px;
  box-shadow: inset 0 0 0 3px var(--theme-accent), inset 0 0 0 5px #303d76;
}
#grid .grid-cell.grid-cell-selected::after, #grid .grid-cell.grid-cell-bulk-selected::after {
  content: '+';
  position: absolute;
  left: 3px;
  top: 0;
  color: #fff9df;
  font: bold 13px monospace;
  z-index: 8;
}
.crop-state {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  bottom: 2px;
  right: 2px;
  min-width: 16px;
  padding: 1px 2px;
  color: #fdf3d2;
  background: #283e38;
  border: 1px solid #8b9c7b;
  font: bold 10px/1.1 Tahoma, Arial, sans-serif;
  box-shadow: 1px 1px 0 #1e292a;
}
.pixel-water-drop, .crop-state.is-watered::before {
  display: inline-block;
  content: '';
  width: 7px;
  height: 10px;
  flex: 0 0 auto;
  background: #92d7e0;
  clip-path: polygon(43% 0, 57% 0, 57% 20%, 72% 20%, 72% 40%, 100% 40%, 100% 80%, 72% 80%, 72% 100%, 28% 100%, 28% 80%, 0 80%, 0 40%, 28% 40%, 28% 20%, 43% 20%);
}
#hud-profile-panel { padding: 6px; gap: 7px; }
#hud-profile-panel:not(:has(.profile-goal-button)) .profile-goals-info { display: none; }
.hud-profile-avatar { border: 2px solid #212f31; box-shadow: 1px 1px 0 var(--theme-control-border-hi); image-rendering: pixelated; }
.profile-energy-info, .player-level-info, .profile-goals-info { background: var(--theme-subtle-bg); padding: 6px; border: 1px solid var(--theme-border); }
.profile-section-label, .profile-goals-title { font: bold 10px Tahoma, Arial, sans-serif; text-transform: uppercase; letter-spacing: .09em; }
.player-level-label { font-size: 12px; }
.desktop-roll-indicator { font: 10px Tahoma, Arial, sans-serif; background: transparent; border: 0; padding: 4px 0 0; }
.energy-bar-fill, .player-xp-fill { background: var(--theme-progress-fill); }
.player-xp-bar { height: 10px; }
#profile-goals-list { font: 11px/1.4 Tahoma, Arial, sans-serif; }
#market-header { padding: 7px; }
.market-tabs { gap: 4px; margin-bottom: 8px; }
.market-tabs .tab-button { min-height: 34px; min-width: 70px; padding: 5px 12px; }
.market-tabs .tab-button.active { color: var(--header-fg, #fffdf4); background: var(--header-bg, #202f70); box-shadow: inset 1px 1px 0 #fff7, inset -1px -1px 0 #151b43; }
.tab-badge { border-radius: 0; font: bold 10px Tahoma, sans-serif; background: var(--desktop-red); color: #fff; box-shadow: none; }
#market-table-container { flex: 0 1 auto; min-height: 190px; }
#market-table { padding: 8px; }
.market-table-switcher { gap: 3px; border-bottom: 1px solid var(--theme-control-border-lo); padding-bottom: 6px; margin-bottom: 8px; }
.market-table-switcher-button.tab-button { min-height: 28px; padding: 4px 9px; }
.market-table-switcher-button.active { background: var(--theme-control-active-bg); color: var(--theme-control-active-text); }
.market-subtable-note { font: 11px/1.5 Tahoma, Arial, sans-serif; border: 0; border-left: 2px solid var(--theme-accent); background: var(--theme-subtle-bg); padding: 5px 7px; }
.zebra-table th { font: bold 10px Tahoma, Arial, sans-serif; text-transform: uppercase; letter-spacing: .075em; padding: 7px 8px; }
.zebra-table td { padding: 6px 8px; border-color: var(--theme-table-border); }
.market-price-value { font: bold 17px Tahoma, Arial, sans-serif; font-variant-numeric: tabular-nums; }
.market-day-move { font: 10px/1.7 Tahoma, Arial, sans-serif; color: var(--theme-text-muted); }
.insight-chip { border-radius: 0; padding: 3px 6px; font: 11px/1.35 Tahoma, Arial, sans-serif; background: var(--tone-neutral-bg); border-color: var(--tone-neutral-border); color: var(--tone-neutral-fg); }
.insight-chip.good { color: var(--tone-good-fg); background: var(--tone-good-bg); border-color: var(--tone-good-border); }
.insight-chip.bad { color: var(--tone-bad-fg); background: var(--tone-bad-bg); border-color: var(--tone-bad-border); }
.market-insight-panel { border: 1px solid var(--theme-control-border-lo); background: var(--theme-table-odd); padding: 0; }
.market-insight-empty { font: 12px/1.5 Tahoma, Arial, sans-serif; padding: 9px; }
.market-insight-title { font-size: 12px; }
.market-insight-close { min-width: 22px; min-height: 22px; padding: 0; }
.market-context { font: 12px/1.55 Tahoma, Arial, sans-serif; color: var(--theme-text-muted); margin: 8px; }
.market-insight-grid { padding: 0 8px; gap: 5px; }
.market-insight-metric { border-radius: 0; background: var(--theme-subtle-bg); border: 1px solid var(--theme-border); padding: 7px; }
.metric-label { font: 10px Tahoma, Arial, sans-serif; text-transform: uppercase; letter-spacing: .04em; }
.metric-value { font-family: Tahoma, Arial, sans-serif; font-size: 17px; font-variant-numeric: tabular-nums; }
.market-insight-row { padding: 0 8px; margin: 8px 0; gap: 5px; }
.sale-breakdown { border: 1px solid var(--theme-border); background: var(--theme-table-odd); color: var(--theme-text); padding: 7px 9px; font: 12px/1.5 Tahoma, Arial, sans-serif; }
.sale-breakdown summary { min-height: 24px; font-size: 12px; }
button[data-sell-action-button='true'] {
  color: #fff7eb;
  background: var(--desktop-red);
  min-height: 36px;
  padding: 7px 12px;
  font-weight: bold;
  box-shadow: inset 1px 1px 0 #dc8380, inset -1px -1px 0 #551d26, 1px 1px 0 #552c2c;
}
#rest-dock {
  left: calc(18px + var(--safe-left));
  right: calc(18px + var(--safe-right));
  bottom: calc(12px + var(--safe-bottom) + var(--bottom-bar-height));
  padding: 4px;
  background: var(--theme-surface);
  border: 2px solid var(--theme-control-border-hi);
  border-right-color: var(--theme-control-border-lo);
  border-bottom-color: var(--theme-control-border-lo);
  box-shadow: 1px 1px 0 var(--desktop-shadow);
}
#next-day { font-weight: bold; letter-spacing: .035em; min-height: 40px; }
#next-day::before { content: '→'; margin-right: 9px; color: var(--desktop-red); }
.daily-roll-panel, .goal-celebration-panel, .day-summary-panel {
  background: var(--theme-surface);
  color: var(--theme-text);
  border-radius: 0;
  border: 2px solid var(--theme-control-border-hi);
  border-right-color: var(--theme-control-border-lo);
  border-bottom-color: var(--theme-control-border-lo);
  box-shadow: 2px 2px 0 #252c35;
}
.daily-roll-modal, .goal-celebration-modal, .day-summary-modal, .feedback-modal { background: #18283888; backdrop-filter: none; }
.daily-roll-title, #goal-celebration-title, #day-summary-title { color: var(--header-fg, #fffdf4); background: var(--header-bg, #202f70); padding: 7px 10px; font: bold 15px Tahoma, Arial, sans-serif; text-shadow: none; letter-spacing: .025em; }
.daily-roll-reel { border-radius: 0; background: var(--theme-table-odd); border: 2px solid var(--theme-border); box-shadow: inset 1px 1px 0 #424b55; }
.daily-roll-result-chip, .daily-roll-impact-chip, .day-summary-card { border-radius: 0; }
.daily-roll-continue, #goal-celebration-continue { min-height: 44px; }
.daily-roll-reel, .daily-roll-reel-summary, .daily-roll-fatigue,
.daily-roll-day-summary-value, .daily-roll-day-summary-value.sales,
.goal-celebration-unlock { color: var(--theme-text); }
.daily-roll-reel-slot img { filter: none; }
.daily-roll-day-summary, .daily-roll-result-chip, .day-summary-next {
  background: var(--theme-table-odd);
  color: var(--theme-text);
  border-color: var(--theme-border);
  border-radius: 0;
}
.daily-roll-day-summary-card, .day-summary-card {
  background: var(--theme-subtle-bg);
  color: var(--theme-text);
  border-color: var(--theme-border);
  border-radius: 0;
}
.daily-roll-day-summary-subtitle, .daily-roll-day-summary-label,
.daily-roll-fatigue-note, .day-summary-subtitle, .day-summary-label { color: var(--theme-text-muted); }
#goal-celebration-title { max-width: none; align-self: stretch; margin: 0; }
.goal-celebration-unlock { max-width: 38ch; font: 13px/1.5 Tahoma, Arial, sans-serif; }
.data-card, .data-graph-surface, .data-summary-card, .data-series-button, .goal-card { border-radius: 0; box-shadow: none; border-color: var(--theme-border); }
.data-card-title { font: bold 14px Tahoma, Arial, sans-serif; }
.data-card-subtitle, .data-summary-card, .data-series-name { font-family: Tahoma, Arial, sans-serif; }
.data-graph-surface { background: var(--theme-table-odd); }
@media (hover: hover) and (pointer: fine) {
  #grid .grid-cell:hover { transform: none; box-shadow: inset 0 0 0 2px #fff1c799; }
  .market-row:hover { background: var(--theme-highlight-row) !important; }
}
body.mobile-layout {
  padding: calc(8px + var(--safe-top)) calc(8px + var(--safe-right)) calc(64px + var(--safe-bottom) + var(--bottom-bar-height)) calc(8px + var(--safe-left));
  --font-ui: 13px;
  --font-table: 13px;
  --font-button: 13px;
}
body.mobile-layout #desktop-titlebar { min-height: 28px; padding: 2px 6px; }
body.mobile-layout .desktop-brand { font-size: 12px; }
body.mobile-layout .desktop-brand img { width: 16px; height: 16px; }
body.mobile-layout .desktop-tagline { display: none; }
body.mobile-layout #hud-top-stats { min-height: 28px; margin-bottom: 8px; gap: 8px; padding: 3px 6px; font: 11px Tahoma, Arial, sans-serif; }
body.mobile-layout #hud-top-stats > span + span { padding-left: 7px; }
body.mobile-layout #market-layout { gap: 8px; }
body.mobile-layout .farm-scenery { display: none; }
@media (min-height: 740px) {
  body.mobile-layout .farm-scenery { display: block; height: 24px; margin-bottom: 4px; }
}
body.mobile-layout #farm-panel { padding: 6px; }
body.mobile-layout #farm-title { min-height: 24px; margin: 0 0 4px; }
body.mobile-layout #guidance-panel { padding: 6px 7px; margin: 5px 0; }
body.mobile-layout #guidance-objective-text { font-size: 12px; }
body.mobile-layout #guidance-hint-text { font-size: 12px; line-height: 1.4; }
body.mobile-layout .farm-toolbar { margin: 5px 0 0; min-height: 44px; }
body.mobile-layout .tool-button { min-height: 44px; gap: 5px; }
body.mobile-layout .tool-button img { width: 24px; height: 24px; }
body.mobile-layout .tool-key-label { display: none; }
body.mobile-layout #hud-profile-panel { padding: 5px; }
body.mobile-layout .hud-profile-avatar { width: 52px; max-width: 52px; }
body.mobile-layout .profile-energy-info, body.mobile-layout .player-level-info { padding: 0; background: transparent; }
body.mobile-layout #market-table-container { flex: 1 1 auto; min-height: 0; }
body.mobile-layout #market-table { padding: 6px; }
body.mobile-layout .zebra-table td { padding: 6px 4px; }
body.mobile-layout .zebra-table th { padding: 6px 4px; font-size: 9px; letter-spacing: .025em; }
body.mobile-layout .market-price-value { font-size: 15px; }
body.mobile-layout .market-table-switcher-button.tab-button { min-height: 36px; }
body.mobile-layout .market-insight-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
body.mobile-layout .market-insight-close { min-height: 36px; min-width: 36px; }
body.mobile-layout #rest-dock { left: calc(8px + var(--safe-left)); right: calc(8px + var(--safe-right)); padding: 0; border: 0; bottom: calc(8px + var(--safe-bottom) + var(--bottom-bar-height)); }
body.mobile-layout #next-day { min-height: 44px; }
body.mobile-layout #mobile-bottom-tabs { border: 2px solid var(--theme-control-border-hi); border-right-color: var(--theme-control-border-lo); border-bottom-color: var(--theme-control-border-lo); box-shadow: 1px 1px 0 var(--desktop-shadow); }
body.mobile-layout #mobile-bottom-tabs .tab-button { min-height: 44px; border: 0; }
body.mobile-layout #mobile-bottom-tabs .tab-button.active { color: var(--header-fg, #fffdf4); background: var(--header-bg, #202f70); }
body.mobile-layout #farm-action-button { min-height: 44px; }
@media (max-width: 350px) {
  body.mobile-layout .tool-name { font-size: 10px; }
  body.mobile-layout .insight-chip { font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  #grid .grid-cell, button, .button { transition: none; }
}
@media (forced-colors: active) {
  #desktop-titlebar, .panel-title, .market-insight-head { background: Canvas; color: CanvasText; }
  .crop-state { color: CanvasText; background: Canvas; border-color: CanvasText; }
}

/* Match the desktop geometry when a saved cosmetic palette is active. */
body[class] .tab-button, body[class] .tool-button {
  border-radius: 0;
  box-shadow: inset -1px -1px #303837, inset 1px 1px var(--theme-control-border-hi), inset -2px -2px var(--theme-control-border-lo), inset 2px 2px var(--theme-control-bg);
}
body[class] .tool-button.active {
  box-shadow: inset 1px 1px 0 var(--theme-control-border-lo), inset -1px -1px 0 var(--theme-control-border-hi);
}
body[class] .goal-celebration-panel {
  box-shadow: 2px 2px 0 #252c35;
}
body[class] #hud-cash, body[class] #hud-networth { animation: none; text-shadow: none; }
@media (max-height: 760px) and (min-width: 901px) {
  .farm-scenery { height: 36px; }
}

/* Keep controls, chart labels and every cosmetic in the same pixel font. */
body, body *, body *::before, body *::after {
  font-family: var(--game-font) !important;
}

/* Clear action hierarchy, with optional detail rather than a wall of estimates. */
.market-context > span { display: block; }
.market-context > span:first-child { color: var(--theme-text); font-weight: bold; }
.seed-summary .metric-value { font-size: 15px; }
.seed-farm-action { display: block; width: calc(100% - 16px); margin: 8px; min-height: 44px; font-weight: bold; }
body.mobile-layout .market-insight-panel .seed-farm-action { min-height: 44px; }
body.mobile-layout .market-insight-panel .market-insight-close { min-width: 44px !important; width: 44px; min-height: 44px; height: 44px; }
body.mobile-layout .market-insight-panel button[data-sell-action-button='true'] { min-height: 44px; }
.crop-outlook-details { margin: 8px; border-top: 1px solid var(--theme-border); }
.crop-outlook-details > summary { padding: 8px 2px; cursor: pointer; }
.crop-outlook-details .market-context { margin: 4px 0 8px; }
.crop-outlook-details .market-insight-grid { padding: 0; }
body.mobile-layout .crop-outlook-details > summary { min-height: 44px; box-sizing: border-box; display: list-item; align-content: center; }
body.mobile-layout .market-insight-close { min-width: 44px; min-height: 44px; }
body.mobile-layout #next-day[data-buy-mode-override='true']::before { content: '×'; }
#grid .grid-cell.plant-target { outline: 2px dashed #fff2c4; outline-offset: -5px; }
#grid .grid-cell.plant-target::before { content: '+'; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); color: #fff2c4; font-size: 22px; pointer-events: none; }
#grid .grid-cell.crop-seeded::before { content: ''; position: absolute; width: 3px; height: 3px; left: 35%; top: 40%; background: #efdb9e; box-shadow: 8px 4px #efdb9e, 3px 11px #efdb9e; pointer-events: none; }

/* The farm keeps the same geometry as contextual information changes. */
body:not(.mobile-layout) #market-layout { grid-template-columns: 120px minmax(280px, 1fr) minmax(280px, 1fr); }
body:not(.mobile-layout) #farm-panel { overflow: visible; box-sizing: border-box; }
body:not(.mobile-layout) #grid-container { margin: 0 auto; flex-shrink: 0; }
/* One scroll area for a long market or goals list; the farm never scrolls. */
body:not(.mobile-layout) #market { overflow-y: auto; }
body:not(.mobile-layout) #market-header { max-height: none; overflow: visible; flex: 0 0 auto; }
body:not(.mobile-layout) #market-table-container,
body:not(.mobile-layout) #goals-panel,
body:not(.mobile-layout) #data-panel { overflow: visible; max-height: none; flex: 0 0 auto; }
#market-table-container { flex: 1 1 auto; min-height: 0; }
.next-unlock-preview { margin: 8px 0; padding: 9px; border: 1px solid var(--theme-border); border-left: 3px solid var(--theme-accent); background: var(--theme-table-odd); font-size: 12px; line-height: 1.5; }
.next-unlock-preview p { margin: 5px 0; }
.trading-challenge summary { min-height: 30px; cursor: pointer; }
#farm-gesture-hint { margin: 4px 0; color: var(--theme-text-muted); font-size: 11px; line-height: 1.4; }
#farm-gesture-hint summary { cursor: pointer; padding: 5px; }
#farm-gesture-hint button { min-width: 28px; min-height: 28px; margin-left: 8px; }
#farm-gesture-hint:empty { display: none; }
#farm-notes { display: none; }
#guidance-panel { padding: 5px 7px; }
#guidance-panel summary { display: list-item; cursor: pointer; }
#guidance-objective-text { font-size: 12px; }
#guidance-objective-chip { float: right; }
.market-insight-empty { display: none; }
.market-insight-panel:has(> .market-insight-empty) { display: none; }
body.mobile-layout { height: auto; min-height: 100dvh; overflow-y: auto; overflow-x: hidden; }
body.mobile-layout #market-layout { height: auto; flex: 0 0 auto; overflow: visible; }
body.mobile-layout #farm-panel { overflow: visible; flex: 0 0 auto; }
body.mobile-layout #grid-container { flex-shrink: 0; }
body.mobile-layout[data-active-main-tab='farm'] { height: 100dvh; overflow: hidden; }
body.mobile-layout[data-active-main-tab='farm'] #market-layout { flex: 1 1 auto; min-height: 0; }
body.mobile-layout #farm-notes { order: 4; display: flex; align-items: center; gap: 8px; height: 30px; margin-top: 4px; position: relative; }
body.mobile-layout #farm-notes > details { background: transparent; border: 0; box-shadow: none; margin: 0; padding: 0; min-width: 0; flex: 1; }
body.mobile-layout #farm-notes summary { font-size: 10px; min-height: 24px; line-height: 24px; padding: 0 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
body.mobile-layout #farm-notes #guidance-objective-text { font-size: 10px; font-weight: normal; }
body.mobile-layout #farm-notes #guidance-objective-chip { display: none; }
body.mobile-layout #farm-notes #farm-gesture-hint { flex: 0 0 65px; }
body.mobile-layout #farm-notes > details[open] > .farm-note-content,
body.mobile-layout #farm-notes > details[open] > p { position: absolute; bottom: calc(100% + 5px); left: 0; right: 0; z-index: 180; margin: 0; padding: 10px; background: var(--theme-table-odd); color: var(--theme-text); border: 1px solid var(--theme-border); box-shadow: 2px 2px 0 var(--desktop-shadow); font-size: 12px; line-height: 1.5; max-height: min(220px, 50dvh); overflow-y: auto; }
body.mobile-layout #market { height: auto; min-height: 260px; overflow: visible; flex: 0 0 auto; }
body.mobile-layout #market-table-container,
body.mobile-layout #goals-panel,
body.mobile-layout #data-panel { overflow: visible; max-height: none; flex: 0 0 auto; }
/* Sale and Rest share one stable row above the tabs. */
body.mobile-layout #farm-action-dock { left: 43%; right: calc(8px + var(--safe-right)); bottom: calc(8px + var(--safe-bottom) + var(--bottom-bar-height)); }
body.mobile-layout #farm-action-button { font-size: 11px; line-height: 1.25; padding: 5px 7px; }
body.mobile-layout #farm-action-button:disabled { opacity: 1; background: var(--theme-surface); color: var(--theme-text-muted); }
body.mobile-layout .daily-roll-panel, .goal-celebration-panel, .day-summary-panel { max-height: calc(100dvh - 24px); overflow-y: auto; box-sizing: border-box; }
.daily-roll-quick-option { display: flex; align-items: center; gap: 6px; margin: 8px 0; font-size: 12px; cursor: pointer; }
.daily-roll-quick-option input[type='checkbox'] { position: static; opacity: 1; appearance: auto; width: 16px; height: 16px; margin: 0; }
.daily-roll-modal.is-compact .daily-roll-reels { display: none; }
.daily-roll-modal.is-compact .daily-roll-fatigue-note { margin-bottom: 8px; }
/* Short landscape uses the width: tools beside the farm and one bottom row. */
body.compact-farm-layout #market-layout { display: grid; grid-template-columns: 96px minmax(0, 1fr); grid-template-rows: auto; grid-template-areas: 'profile farm'; align-items: start; }
body.compact-farm-layout[data-active-main-tab='farm'] #market-layout { width: min(100%, calc(var(--grid-size) + 252px)); margin: 0 auto; }
body.compact-farm-layout #farm-panel { display: grid; grid-template-columns: minmax(0, 1fr) 112px; grid-template-rows: 28px auto; column-gap: 8px; }
body.compact-farm-layout #farm-title { grid-column: 1 / -1; grid-row: 1; }
body.compact-farm-layout .farm-scenery { display: none; }
body.compact-farm-layout #grid-container { grid-column: 1; grid-row: 2; margin: 0 auto; }
body.compact-farm-layout .farm-toolbar { grid-column: 2; grid-row: 2; align-self: start; flex-direction: column; height: auto; min-height: 0; margin: 0; gap: 3px; }
body.compact-farm-layout .tool-button { width: 100%; min-height: 32px; height: 32px; flex: 0 0 32px; }
body.compact-farm-layout #farm-title::after { display: none; }
body.compact-farm-layout #farm-notes { position: absolute; top: 6px; right: 8px; width: 180px; height: 24px; margin: 0; }
body.compact-farm-layout #farm-notes summary { color: var(--header-fg); }
body.compact-farm-layout #farm-notes #farm-gesture-hint { flex: 1; }
body.compact-farm-layout #farm-notes #guidance-objective-text { display: none; }
body.compact-farm-layout #farm-notes #guidance-panel summary::after { content: 'Guide'; }
body.compact-farm-layout #farm-notes #sale-receipt summary { font-size: 0; }
body.compact-farm-layout #farm-notes #sale-receipt summary::after { content: 'Receipt'; font-size: 10px; }
body.compact-farm-layout #farm-notes > details[open] > .farm-note-content,
body.compact-farm-layout #farm-notes > details[open] > p { left: auto; bottom: auto; top: calc(100% + 5px); width: min(320px, 65vw); }
body.compact-farm-layout #hud-profile-panel { padding: 4px; align-self: start; }
body.compact-farm-layout #mobile-profile-row { flex-direction: column; gap: 6px; height: auto; overflow: visible; }
body.compact-farm-layout #mobile-chat-log { display: none; }
body.compact-farm-layout #mobile-profile-side { width: 100%; flex: 0 0 auto; overflow: visible; }
body.compact-farm-layout #mobile-profile-side .level-heading-row { display: block; }
body.compact-farm-layout #market { grid-area: auto; grid-column: 1 / -1; }
body.compact-farm-layout:not([data-active-main-tab='farm']) #hud-profile-panel { display: none; }
body.compact-farm-layout #mobile-bottom-tabs { right: 56%; }
body.compact-farm-layout #rest-dock { left: 46%; right: 8px; bottom: calc(12px + var(--safe-bottom)); }
body.compact-farm-layout #farm-action-dock { left: 68%; right: 8px; bottom: calc(12px + var(--safe-bottom)); }
body.compact-farm-layout #mobile-bottom-tabs .tab-button { font-size: 11px; padding: 4px; }
@media (max-width: 479px) and (max-height: 520px) {
  body.mobile-layout[data-active-main-tab='farm'] { height: auto; overflow-y: auto; }
}
