:root {
  color-scheme: light; --cream: #f6f2e7; --paper: #fffdf6; --ink: #332b32;
  --muted: #6d665d; --line: #e9e1d1; --moss: #3c5a43; --soft-green: #e9eedb;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Noto Sans CJK SC', sans-serif;
  background: var(--cream); color: var(--ink); font-synthesis: none;
}
* { box-sizing: border-box; }
body { margin: 0; }
button { font: inherit; }
button:focus-visible { outline: 3px solid #966836; outline-offset: 3px; }
img { image-rendering: pixelated; }
.bar { border-bottom: 1px solid #e6decf; background: #faf7ed; }
.bar-content { max-width: 1144px; margin: auto; height: 77px; padding: 0 22px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.brand { display: flex; align-items: center; gap: 11px; }
.brand-icon { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 14px; background: #e8eadb; border: 1px solid #dde2cb; flex: none; }
.eyebrow { margin: 0 0 2px; font-size: 9px; letter-spacing: 2px; font-weight: 800; color: #687355; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 19px; letter-spacing: .045em; }
.save-status { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.save-status i { background: #789261; width: 7px; height: 7px; border-radius: 100%; }
.save-status[data-error] i { background: #b06343; }
.layout { max-width: 1144px; margin: auto; padding: 26px 22px 36px; display: grid; grid-template-columns: minmax(0, 1.33fr) minmax(0, 1fr); gap: 23px; align-items: start; }
.farm-column { min-width: 0; display: grid; gap: 14px; }
.farm-card, .field-log, .shop { background: var(--paper); border: 1px solid var(--line); border-radius: 21px; box-shadow: 0 3px 0 #b9a78312; }
.farm-card { overflow: hidden; }
.scene { position: relative; min-height: 430px; display: flex; flex-direction: column; align-items: center; padding: 17px 14px 82px; background: #edf0d8 url('./field.svg') center bottom / cover no-repeat; isolation: isolate; overflow: hidden; }
.scene-tags { width: 100%; display: flex; justify-content: space-between; gap: 4px; }
.scene-tags span { border: 1px solid #81955a29; background: #f7f8e9c9; border-radius: 30px; padding: 4px 9px; color: #5b694c; font-size: 10px; letter-spacing: .07em; font-weight: 700; white-space: nowrap; }
.wallet { text-align: center; margin-top: 12px; position: relative; z-index: 1; }
.wallet-label { font-size: 12px; letter-spacing: 4px; color: #57674c; font-weight: 800; }
.wallet-label span { font-size: 7px; color: #907f52; vertical-align: 2px; }
.balance { color: #2d3b2e; font-weight: 850; font-size: clamp(39px, 5vw, 59px); line-height: 1.03; font-variant-numeric: tabular-nums; letter-spacing: -.055em; margin: 5px 0 6px; }
.rate { display: inline-block; padding: 3px 12px; border-radius: 999px; background: #ffffecb5; color: var(--moss); font-size: 12px; font-weight: 750; }
.rice-button { margin-top: 3px; width: 200px; display: grid; justify-items: center; padding: 0 0 4px; border: 0; border-radius: 28px; cursor: pointer; background: transparent; position: relative; z-index: 2; touch-action: manipulation; user-select: none; -webkit-tap-highlight-color: transparent; }
.rice-button img { width: 100%; height: auto; transform-origin: center 82%; filter: drop-shadow(0 8px 0 #615b4640); transition: transform .15s ease; }
.rice-button:hover img { transform: scale(1.04); }
.rice-button:active img { transform: scale(1.10, .91); }
.rice-button span { margin-top: -5px; color: #2f4935; border: 1px solid #526d4c52; background: #f8fae8; border-radius: 30px; padding: 5px 13px; font-size: 12px; font-weight: 800; }
#sparks { position: absolute; inset: 0; pointer-events: none; z-index: 4; }
.spark { position: absolute; font-size: 22px; font-weight: 900; color: #725038; text-shadow: 1px 1px #fff8e5, -1px -1px #fff8e5; animation: float-up .64s ease-out both; }
@keyframes float-up { from { opacity: 1; transform: translate(-50%, -20%); } to { opacity: 0; transform: translate(calc(-50% + var(--drift)), -85px); } }
.field-units { position: absolute; height: 72px; display: flex; align-items: end; gap: clamp(2px,1vw,10px); justify-content: center; bottom: 24px; inset-inline: 10px; z-index: 1; pointer-events: none; }
.field-units img { flex: 0 1 auto; min-width: 0; max-width: 15%; width: clamp(37px, 6vw, 68px); height: auto; object-fit: contain; filter: drop-shadow(0 3px #70554436); }
.field-log { padding: 12px 15px; }
.log-title { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.log-title h2 { font-size: 14px; }
.log-title span, .log-content { color: var(--muted); font-size: 12px; }
.log-content { padding-top: 7px; }
.log-row { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; padding: 5px 0; }
.log-row + .log-row { border-top: 1px dashed var(--line); }
.log-row strong { color: var(--moss); font-variant-numeric: tabular-nums; }
.shop { overflow: hidden; padding-bottom: 11px; }
.shop-header { padding: 14px 15px 12px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); gap: 8px; }
.shop-header h2 { font-size: 20px; }
.quantities { display: flex; border: 1px solid var(--line); background: #f5efe3; border-radius: 9px; gap: 3px; padding: 3px; }
.quantities button { min-width: 35px; padding: 4px 5px; cursor: pointer; border: 0; border-radius: 6px; color: var(--muted); background: transparent; font-size: 12px; font-weight: 800; }
.quantities button[aria-pressed="true"] { background: var(--moss); color: #fffdf6; }
.shop-group { padding: 9px 11px 0; }
.group-title { display: flex; justify-content: space-between; gap: 6px; align-items: center; padding: 1px 4px 5px; }
.group-title h3 { font-size: 12px; color: #485b45; }
.group-title span { font-size: 10px; color: #6e665a; text-align: right; }
.shop-row { display: grid; grid-template-columns: 42px minmax(0,1fr) auto; gap: 8px; align-items: center; min-height: 62px; padding: 5px 7px; background: #fbf8ee; border: 1px solid #ede5d7; border-radius: 11px; margin-bottom: 4px; }
.shop-row[data-locked="true"] { background: #f7f4eb; }
.shop-icon { width: 42px; height: 42px; padding: 3px; object-fit: contain; background: #f0eadd; border-radius: 8px; }
.shop-row[data-locked="true"] .shop-icon { opacity: .57; }
.item-name { display: flex; flex-wrap: wrap; align-items: baseline; align-content: center; gap: 0 6px; line-height: 1.2; }
.item-name strong { font-size: 13px; }
.owned { color: var(--muted); font-size: 10px; white-space: nowrap; }
.item-detail, .item-effect { font-size: 10px; color: var(--muted); line-height: 1.35; }
.item-detail { margin-top: 2px; }
.item-effect { color: #486449; font-weight: 650; }
.shop-row[data-locked="true"] .item-effect { color: var(--muted); }
.buy { min-width: 65px; display: flex; align-items: center; justify-content: center; gap: 2px; border: 1px solid #35523e; border-radius: 8px; color: #fffdf6; background: #49694f; padding: 6px; min-height: 36px; cursor: pointer; font-weight: 800; font-size: 12px; font-variant-numeric: tabular-nums; }
.buy:hover:not(:disabled) { background: #365740; }
.buy:disabled { background: #f0ebdf; border-color: #e8e0d2; color: #6e6556; cursor: default; }
.buy img { width: 15px; height: 15px; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 24px); border-radius: 12px; padding: 10px 14px; font-size: 13px; font-weight: 700; color: #fffdf6; background: #3c5042; box-shadow: 0 5px 20px #281b2133; z-index: 10; text-align: center; }
@media (max-width: 800px) {
  .layout { grid-template-columns: minmax(0,1fr); max-width: 590px; padding: 14px 12px 24px; gap: 14px; }
  .bar-content { padding: 0 12px; height: 64px; }
  .scene { min-height: 350px; padding-bottom: 64px; }
  .field-units { bottom: 13px; }
  .rice-button { width: 166px; }
  .farm-column { display: contents; }
  .field-log { grid-row: 3; }
}
@media (max-width: 350px) { h1 { font-size: 15px; } .save-status { font-size: 9px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
/* Crop ladder: number + named tier + framing, so color isn't the only cue. */
[data-tier="0"] { --tier-ink: #3d6447; --tier-wash: #e4eed6; --tier-edge: #829c6c; }
[data-tier="1"] { --tier-ink: #7d5827; --tier-wash: #f6e9bc; --tier-edge: #c8a455; }
[data-tier="2"] { --tier-ink: #475b87; --tier-wash: #e5eaf9; --tier-edge: #8e9fcd; }
[data-tier="3"] { --tier-ink: #664982; --tier-wash: #f0e1f6; --tier-edge: #aa82bc; }
[data-tier="4"] { --tier-ink: #794361; --tier-wash: #f5e2ef; --tier-edge: #ca87aa; }
.shop-row[data-tier] { border-inline-start: 3px solid var(--tier-edge); }
.shop-row[data-tier] .shop-icon { background: var(--tier-wash); }
.tier-label { display: inline-block; color: var(--tier-ink); background: var(--tier-wash); border-radius: 4px; padding: 2px 4px; font-weight: 800; font-size: 9px; line-height: 1.1; white-space: nowrap; font-variant-numeric: tabular-nums; }
.shop-row.crop-preview { border-style: dashed; background: #faf7ee; }
.preview-tag { background: #f2eddf; color: #74664e; font-size: 10px; font-weight: 800; border-radius: 5px; padding: 4px 6px; margin-inline-end: 4px; white-space: nowrap; }
.log-crop { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 7px; }
.log-row strong { white-space: nowrap; }
#crops-list, #boost-list, #boost-archive-list { max-height: 329px; overflow: auto; scrollbar-color: #c9c7b4 transparent; scrollbar-width: thin; }
#crop-next:not(:empty) { margin-top: 4px; }
.boost-filters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; margin: 0 0 5px; }
.boost-filter { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 2px 6px; border: 1px solid #e6dfcf; border-radius: 8px; background: #f5efe3; color: #645c50; min-height: 37px; padding: 4px; font-size: 11px; font-weight: 750; cursor: pointer; }
.boost-filter[aria-pressed="true"] { color: #fffdf6; background: var(--moss); border-color: var(--moss); }
.filter-count { border-radius: 4px; background: #9584632c; font-size: 9px; min-width: 15px; padding: 1px 3px; text-align: center; }
.boost-filter[aria-pressed="true"] .filter-count { background: #fff4c831; }
.empty-boost { font-size: 11px; color: var(--muted); padding: 3px 4px 6px; }
.empty-boost { border: 1px dashed #e9e2d2; border-radius: 8px; padding: 9px; }
.boost-archive { margin: 8px 4px 0; font-size: 11px; }
.boost-archive summary { color: var(--muted); padding: 3px 0; cursor: pointer; }
.archive-row { display: flex; align-items: center; gap: 7px; padding: 4px; }
.archive-row .shop-icon { width: 28px; height: 28px; font-size: 13px; flex: none; }
.header-controls { display: flex; align-items: center; gap: 10px; }
.settings-button { white-space: nowrap; color: var(--moss); background: #f7f6e9; border: 1px solid #dedbc4; border-radius: 8px; padding: 6px 9px; font-size: 12px; font-weight: 750; cursor: pointer; }
.settings-dialog { width: min(360px,calc(100% - 32px)); padding: 18px; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 8px 35px #271d2633; }
.settings-dialog::backdrop { background: #292b2466; }
.settings-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.settings-header h2 { font-size: 18px; }
.settings-dialog label { display: block; font-size: 13px; margin: 0 0 6px; }
.settings-dialog select { width: 100%; color: var(--ink); font: inherit; padding: 6px; border: 1px solid var(--line); border-radius: 7px; background: var(--cream); }
@media (max-width: 430px) {
  .header-controls { gap: 5px; }
  .header-controls .save-status { font-size: 0; }
}
.mini-icon { display: block; width: 28px; height: 28px; object-fit: contain; flex: none; }
.boost-filter .mini-icon { width: 21px; height: 21px; }
@media (max-width: 430px) { .boost-filter .mini-icon { width: 17px; height: 17px; } }
.privilege-form { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 14px; }
.privilege-controls { display: grid; grid-template-columns: minmax(0,1fr) auto auto; gap: 8px; }
.privilege-controls input { min-width: 0; color: var(--ink); background: var(--cream); border: 1px solid var(--line); border-radius: 7px; padding: 6px; font: inherit; }
#privilege-status { margin-top: 6px; font-size: 12px; color: var(--muted); }
#privilege-status:empty { display: none; }
.save-settings { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.save-settings h3 { font-size: 13px; margin-bottom: 5px; }
.save-settings-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.save-preview { margin-top: 8px; padding: 8px; background: #f5efe1; border: 1px solid var(--line); border-radius: 8px; font-size: 12px; }
.save-preview h4 { margin: 0 0 3px; font-size: 13px; }
.save-preview p { margin: 3px 0; overflow-wrap: anywhere; }
.save-preview .save-settings-actions { margin-top: 6px; }
.save-replace { color: #fff; background: #81533f; }
#save-file-status { color: #824f3e; font-size: 12px; }
#save-file-status:not(:empty) { margin-top: 4px; }
