/* My Simple Farm — the screen is a field seen from above:
   mowed grass, tilled soil plots, paper cards for the market and profile. */
:root {
  --grass: #66a646;
  --grass-light: #6fb04d;
  --grass-dark: #2f5e22;
  --grass-deep: #234818;
  --soil: #7a4e2d;
  --soil-dark: #5c3a20;
  --furrow: rgba(0, 0, 0, 0.14);
  --paper: #fff4d6;
  --paper-dark: #ecdcb2;
  --ink: #3a2a1a;
  --ink-soft: #7a6650;
  --gold: #f2b632;
  --gold-dark: #c98d12;

  --nav-h: 62px;
  --radius-plot: 16px;
  --radius-card: 12px;
  --font: "Rubik", -apple-system, BlinkMacSystemFont, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

body {
  min-height: 100vh;
  background: repeating-linear-gradient(180deg, var(--grass) 0 32px, var(--grass-light) 32px 64px);
  /* Room for the action bar and the menu that are fixed at the bottom. */
  padding-bottom: calc(160px + env(safe-area-inset-bottom));
}

button {
  font: inherit;
  color: inherit;
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
}

button:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 2px;
}

[hidden] { display: none !important; }

/* --- Top bar: coins, level, XP ------------------------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 16px 16px;
  background: var(--grass-dark);
  color: #fff;
}

.coins {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  font-size: 23px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.coins-icon { font-size: 21px; }
.coins-value { display: inline-block; }
.coins.is-bumped .coins-value { animation: bump 0.35s ease-out; }

@keyframes bump {
  40% { transform: scale(1.25); color: var(--gold); }
}

.level {
  display: flex;
  align-items: baseline;
  gap: 4px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--grass-deep);
  color: #fff;
  white-space: nowrap;
}

.level-label { font-size: 13px; font-weight: 500; opacity: 0.8; }
.coins-value { white-space: nowrap; }
.level-value { font-size: 20px; font-weight: 900; font-variant-numeric: tabular-nums; }

/* XP runs along the whole bottom edge of the header. */
.xp-track {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 5px;
  background: var(--grass-deep);
}

.xp-fill {
  display: block;
  height: 100%;
  width: 0;
  background: var(--gold);
  transition: width 0.5s ease-out;
}

/* --- Screens ---------------------------------------------------------------- */
.screen { padding: 8px 16px 16px; }

.status {
  margin: 8px 0 0;
  text-align: center;
  color: #fff;
  font-size: 15px;
  font-weight: 500;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.status:empty { display: none; }

.screen-title {
  margin: 16px 0 10px;
  color: #fff;
  font-size: 20px;
  font-weight: 900;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* --- Farm sections switcher (Field / Garden / Orchard) ------------------- */
.segments {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  margin-top: 8px;
  padding: 4px;
  border-radius: 14px;
  background: var(--grass-deep);
}

.segment {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 2px;
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.75);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.segment-icon { font-size: 22px; line-height: 1; }

.segment.is-active { background: var(--paper); color: var(--ink); }
.segment.is-locked { opacity: 0.55; }
.segment.is-locked .segment-icon { filter: grayscale(1); }

.farm-view > .plots { margin-top: 16px; }

/* Seed packets for the vegetable garden. */
.seeds {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 96px;
  gap: 10px;
  margin: 8px -16px 0;
  padding: 14px 16px 10px;   /* room for the lifted, outlined selected packet */
  overflow-x: auto;
  scrollbar-width: none;
}

.seeds::-webkit-scrollbar { display: none; }

.packet {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 16px 6px 8px;
  border-radius: 10px;
  background: var(--paper);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.18);
  overflow: hidden;
  transition: transform 0.15s ease-out, box-shadow 0.15s ease-out;
}

.packet::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 8px;
  background: var(--crop-color, #9be36b);
}

.packet.is-selected {
  transform: translateY(-4px);
  box-shadow: 0 0 0 3px var(--gold), 0 7px 0 rgba(0, 0, 0, 0.2);
}

.packet.is-locked { filter: grayscale(1); opacity: 0.6; }
.packet-emoji { font-size: 28px; line-height: 1.15; }
.packet-name { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.packet-line { font-size: 11px; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--ink-soft); }

/* Fruit count on a tree tile. */
.plot.is-tree { background: var(--grass-dark); box-shadow: inset 0 -6px 0 var(--grass-deep), 0 2px 0 rgba(0, 0, 0, 0.15); padding-bottom: 6px; }
/* The fruit sits in the middle of a light round "crown"; the label goes under it. */
.plot.is-tree .plot-plant {
  display: grid;
  place-items: center;
  width: 58%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #7cb85a;
  box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.12);
}
.plot.is-tree.is-ready { box-shadow: inset 0 -6px 0 var(--grass-deep), 0 0 0 3px var(--gold); }

.sell-all-btn { margin-bottom: 12px; }

/* --- Farm: one section per plot size ---------------------------------------- */
.field-section { margin-top: 16px; }

.field-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.field-name { font-size: 18px; font-weight: 900; }
.field-meta { font-size: 13px; font-weight: 700; opacity: 0.9; font-variant-numeric: tabular-nums; }

.plots {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.plot {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-plot);
  background:
    repeating-linear-gradient(180deg, transparent 0 12px, var(--furrow) 12px 16px),
    var(--soil);
  box-shadow: inset 0 -6px 0 var(--soil-dark), 0 2px 0 rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: #fff;
  transition: transform 0.08s;
}

.plot:active { transform: scale(0.94); }

.plot-plant {
  font-size: 36px;
  line-height: 1;
  transition: transform 0.3s ease-out;
}

.plot.is-empty .plot-plant { opacity: 0.35; transform: scale(0.7); }
.plot.is-growing .plot-plant { transform: scale(var(--grow-scale, 0.8)); }
.plot.is-ready { box-shadow: inset 0 -6px 0 var(--soil-dark), 0 0 0 3px var(--gold); }
.plot.is-ready .plot-plant { animation: bob 1.4s ease-in-out infinite; }

@keyframes bob {
  50% { transform: translateY(-4px) scale(1.08); }
}

.plot-label {
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.plot-bar {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  height: 5px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.3);
  overflow: hidden;
  opacity: 0;
}

.plot.is-growing .plot-bar { opacity: 1; }

.plot-fill {
  display: block;
  height: 100%;
  width: 0;
  background: #e9c46a;
  transition: width 1s linear;
}

/* Land you don't own yet: a dashed outline in the grass. */
.plot-new {
  aspect-ratio: 1;
  border-radius: var(--radius-plot);
  border: 3px dashed rgba(255, 255, 255, 0.75);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.plot-new-plus { font-size: 30px; font-weight: 900; line-height: 1; }
.plot-new-price { font-size: 13px; font-weight: 700; }
.plot-new.is-unaffordable { opacity: 0.5; }
.plot-new.is-locked { opacity: 0.6; border-color: rgba(255, 255, 255, 0.45); }
.plot-new.is-locked .plot-new-plus { font-size: 22px; }

.field-locked {
  padding: 16px;
  border-radius: var(--radius-plot);
  border: 3px dashed rgba(255, 255, 255, 0.45);
  color: rgba(255, 255, 255, 0.9);
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* --- Paper cards (market, profile) -------------------------------------------- */
.list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }

.card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-card);
  background: var(--paper);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.18);
}

.card-emoji { font-size: 34px; line-height: 1; flex: none; }
.card-body { flex: 1; min-width: 0; }
.card-title { margin: 0; font-size: 16px; font-weight: 700; }

.card-sub {
  margin: 2px 0 0;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.card-btn {
  flex: none;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--gold);
  box-shadow: inset 0 -4px 0 var(--gold-dark);
  font-size: 14px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.card-btn:disabled {
  background: var(--paper-dark);
  box-shadow: none;
  color: var(--ink-soft);
  cursor: default;
}

.card.is-locked .card-emoji { filter: grayscale(1); opacity: 0.6; }

.empty-note {
  margin: 0;
  padding: 14px;
  border-radius: var(--radius-card);
  background: rgba(255, 244, 214, 0.85);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
}

/* --- Animals: one paper card per building ---------------------------------- */
.animal-card {
  margin-top: 16px;
  padding: 14px;
  border-radius: var(--radius-card);
  background: var(--paper);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.18);
}

.animal-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.animal-emoji { font-size: 44px; line-height: 1; flex: none; }
.animal-title { margin: 0; font-size: 20px; font-weight: 900; }

.meter {
  margin-top: 14px;
}

.meter-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.meter-note { color: var(--ink-soft); font-weight: 500; }
.meter.is-full .meter-note { color: #b4441e; font-weight: 700; }

.meter-track {
  height: 12px;
  border-radius: 6px;
  background: var(--paper-dark);
  overflow: hidden;
}

.meter-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 6px;
  background: var(--gold);
  transition: width 1s linear;
}

.meter.is-full .meter-fill { background: #e0703a; }

.animal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.animal-actions .card-btn { padding: 12px 8px; }
.card-btn.is-quiet { background: var(--paper-dark); box-shadow: inset 0 -4px 0 #d8c590; }

.upgrades {
  margin: 14px 0 0;
  padding: 12px 0 0;
  border-top: 2px solid var(--paper-dark);
  list-style: none;
  display: grid;
  gap: 10px;
}

.upgrade {
  display: flex;
  align-items: center;
  gap: 10px;
}

.upgrade-emoji { font-size: 24px; flex: none; }
.upgrade-body { flex: 1; min-width: 0; }
.upgrade-title { margin: 0; font-size: 14px; font-weight: 700; }
.upgrade-sub { margin: 1px 0 0; color: var(--ink-soft); font-size: 12px; font-weight: 500; }

/* --- Profile ------------------------------------------------------------------- */
.farm-card {
  margin-top: 8px;
  padding: 18px 16px;
  border-radius: var(--radius-card);
  background: var(--paper);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.18);
}

.farm-name { margin: 0; font-size: 26px; font-weight: 900; }
.farmer-name { margin: 2px 0 14px; color: var(--ink-soft); font-size: 14px; font-weight: 500; }

.xp-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.xp-big {
  height: 10px;
  border-radius: 5px;
  background: var(--paper-dark);
  overflow: hidden;
}

.xp-big .xp-fill { border-radius: 5px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.stat {
  padding: 12px 8px;
  border-radius: var(--radius-card);
  background: var(--paper);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.18);
  text-align: center;
}

.stat-value { display: block; font-size: 20px; font-weight: 900; font-variant-numeric: tabular-nums; }
.stat-label { display: block; margin-top: 2px; color: var(--ink-soft); font-size: 12px; font-weight: 500; }

.unlock-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border-radius: var(--radius-card);
  background: var(--paper);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.18);
  overflow: hidden;
}

.unlock {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  font-size: 15px;
  font-weight: 700;
}

.unlock + .unlock { border-top: 2px solid var(--paper-dark); }
.unlock-level { width: 56px; flex: none; color: var(--ink-soft); font-size: 13px; font-variant-numeric: tabular-nums; }
.unlock-check { margin-left: auto; color: var(--grass-dark); font-weight: 900; }
.unlock.is-future { color: var(--ink-soft); }
.unlock.is-future .unlock-emoji { filter: grayscale(1); opacity: 0.6; }

/* --- Bottom: primary action + tabs ---------------------------------------------- */
.action-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
  z-index: 5;
  padding: 12px 16px 10px;
  background: linear-gradient(transparent, rgba(35, 72, 24, 0.55) 45%);
}

.primary-btn {
  width: 100%;
  padding: 16px;
  border-radius: 14px;
  background: var(--gold);
  box-shadow: inset 0 -5px 0 var(--gold-dark);
  color: var(--ink);
  font-size: 17px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.primary-btn:active { transform: translateY(2px); box-shadow: inset 0 -3px 0 var(--gold-dark); }

/* --- Level-up moment ----------------------------------------------------------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(35, 72, 24, 0.75);
  animation: fade-in 0.2s ease-out;
}

.level-card {
  width: 100%;
  max-width: 340px;
  padding: 24px 20px 20px;
  border-radius: 20px;
  background: var(--paper);
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.25);
  text-align: center;
  animation: pop-in 0.45s cubic-bezier(0.2, 1.4, 0.4, 1);
}

.level-card-kicker { margin: 0; color: var(--ink-soft); font-size: 16px; font-weight: 700; }

.level-card-number {
  margin: 0;
  color: var(--gold-dark);
  font-size: 96px;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 4px 0 var(--paper-dark);
}

.level-card-unlocks {
  margin: 16px 0 20px;
  padding: 0;
  list-style: none;
  font-size: 16px;
  font-weight: 700;
}

.level-card-unlocks li + li { margin-top: 6px; }
.level-card-unlocks:empty { margin: 12px 0; }

@keyframes fade-in { from { opacity: 0; } }
@keyframes pop-in { from { opacity: 0; transform: scale(0.6); } }

/* --- Toast and floating "+3" effects --------------------------------------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(150px + env(safe-area-inset-bottom));
  z-index: 30;   /* above sheets too */
  transform: translateX(-50%) translateY(10px);
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--paper);
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}

.toast.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); }

.fx-layer { position: fixed; inset: 0; z-index: 15; pointer-events: none; }

.fx {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: 20px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
  white-space: nowrap;
  animation: float-up 0.9s ease-out forwards;
}

@keyframes float-up {
  from { opacity: 1; transform: translate(-50%, -50%); }
  to   { opacity: 0; transform: translate(-50%, -150%); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* --- Top bar buttons, sheets ------------------------------------------------- */
.topbar-buttons { display: flex; align-items: center; gap: 6px; flex: none; }

.top-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--grass-deep);
  color: #fff;
  font-size: 17px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.top-btn-value { font-size: 14px; }
.top-btn-value:empty { display: none; }

.overlay-sheet { align-items: flex-end; padding: 0; }

.sheet {
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 20px 16px calc(16px + env(safe-area-inset-bottom));
  border-radius: 20px 20px 0 0;
  background: var(--paper);
  animation: sheet-up 0.25s ease-out;
}

@keyframes sheet-up { from { transform: translateY(100%); } }

.sheet-title { margin: 0 0 12px; font-size: 22px; font-weight: 900; }
.sheet .list { margin-bottom: 16px; }
.sheet .card { box-shadow: 0 0 0 2px var(--paper-dark); }

.primary-btn.is-quiet {
  background: var(--paper-dark);
  box-shadow: inset 0 -5px 0 #d8c590;
}

.dev-note { margin: -6px 0 8px; color: var(--ink-soft); font-size: 13px; font-weight: 500; }
.dev-label { margin: 14px 0 6px; font-size: 14px; font-weight: 700; }

.dev-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 4px;
}

.dev-grid .card-btn { padding: 12px 4px; font-size: 13px; }
.dev-grid + .primary-btn { margin-top: 18px; }
.card-btn.is-danger { background: #e0703a; box-shadow: inset 0 -4px 0 #b4441e; color: #fff; }

/* --- Locked section preview -------------------------------------------------- */
.locked-preview { margin-top: 16px; }

.locked-head {
  padding: 18px 16px;
  border-radius: var(--radius-card);
  border: 3px dashed rgba(255, 255, 255, 0.6);
  color: #fff;
  text-align: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.locked-emoji { display: block; font-size: 44px; line-height: 1.1; filter: grayscale(0.4); }
.locked-title { margin: 6px 0 2px; font-size: 20px; font-weight: 900; }
.locked-sub { margin: 0; font-size: 14px; font-weight: 500; opacity: 0.9; }
.locked-preview .unlock-list { margin-top: 12px; }

/* --- Profile ----------------------------------------------------------------- */
.back-btn {
  margin-top: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--grass-deep);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}

.name-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.edit-btn { padding: 8px 12px; font-size: 13px; }

.name-form { display: grid; gap: 8px; margin-bottom: 12px; }
.name-form label { font-size: 13px; font-weight: 700; color: var(--ink-soft); }

.name-form input {
  width: 100%;
  padding: 12px;
  border: 2px solid var(--paper-dark);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 16px; /* 16px stops iOS from zooming into the field */
}

.name-form input:focus { outline: none; border-color: var(--gold-dark); }
.name-form .form-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 4px; }

.bonus-line { margin: 12px 0 0; font-size: 14px; font-weight: 700; color: var(--grass-dark); }

/* --- Monkeys -------------------------------------------------------------------- */
.monkey-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 20px;
  line-height: 1;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.4));
}

.monkey-bar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-card);
  background: var(--paper);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.18);
  font-size: 14px;
  font-weight: 700;
}

.monkey-bar.is-active { box-shadow: 0 0 0 3px var(--gold), 0 3px 0 rgba(0, 0, 0, 0.18); }
.plot.is-placing { outline: 3px dashed rgba(255, 255, 255, 0.8); outline-offset: -6px; }
.monkey-btn { width: 100%; }

/* --- Friends ------------------------------------------------------------------- */
.friends-card, .settings-card { padding: 16px; }
.invite-text { margin: 0 0 12px; font-size: 14px; font-weight: 500; line-height: 1.4; }
.friends-card .form-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.friend-list { margin: 14px 0 0; padding: 0; list-style: none; }
.friend {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-top: 2px solid var(--paper-dark);
  font-size: 14px;
  font-weight: 700;
}
.friend-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.friend-level { color: var(--ink-soft); font-size: 13px; font-variant-numeric: tabular-nums; }
.friend-status { color: var(--ink-soft); font-size: 12px; font-weight: 500; }
.friend-status.is-done { color: var(--grass-dark); font-weight: 700; }

/* --- Settings ------------------------------------------------------------------ */
.settings-label {
  margin: 0 0 8px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.settings-label:not(:first-child) { margin-top: 18px; }
.settings-note { margin: 10px 0 0; color: var(--ink-soft); font-size: 13px; font-weight: 500; }

.lang-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.lang-btn {
  padding: 10px;
  border: 2px solid var(--paper-dark);
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font: 700 15px var(--font);
  cursor: pointer;
}
.lang-btn.is-active { border-color: var(--grass-dark); background: var(--grass-dark); color: #fff; }

.switch-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  cursor: pointer;
}
.switch-row + .switch-row { border-top: 2px solid var(--paper-dark); }
.switch-text { flex: 1; min-width: 0; font-size: 15px; font-weight: 700; }
.switch-text small { display: block; margin-top: 2px; color: var(--ink-soft); font-size: 12px; font-weight: 500; }
.switch-row.is-disabled { opacity: 0.45; cursor: default; }

/* A checkbox drawn as an iOS-like switch. */
.switch {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  flex: none;
  width: 46px;
  height: 28px;
  margin: 0;
  border-radius: 14px;
  background: var(--paper-dark);
  transition: background 0.15s;
  cursor: inherit;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s;
}
.switch:checked { background: var(--grass); }
.switch:checked::after { transform: translateX(18px); }

.notify-sections { margin-top: 6px; }
.notify-sections.is-disabled { opacity: 0.45; }
.notify-section {
  margin-top: 8px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.04);
}
.notify-section summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  font-size: 15px;
  font-weight: 700;
  list-style: none;
  cursor: pointer;
}
.notify-section summary::-webkit-details-marker { display: none; }
.notify-section summary::after { content: "▾"; color: var(--ink-soft); transition: transform 0.15s; }
.notify-section[open] summary::after { transform: rotate(180deg); }
.notify-section-name { flex: 1; }
.notify-count { color: var(--ink-soft); font-size: 13px; font-variant-numeric: tabular-nums; }
.notify-section .switch-row { padding: 9px 12px; }
.notify-section .switch-row:first-of-type { border-top: 2px solid var(--paper-dark); }

/* --- Bottom menu --------------------------------------------------------------- */
.nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 6;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding: 6px 8px env(safe-area-inset-bottom);
  background: var(--grass-deep);
  box-shadow: 0 -2px 0 rgba(0, 0, 0, 0.15);
}
.nav-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  font-weight: 700;
}
.nav-icon { font-size: 22px; line-height: 1; }
.nav-btn.is-active { background: rgba(255, 255, 255, 0.14); color: #fff; }
.nav-badge {
  position: absolute;
  top: 2px;
  left: calc(50% + 8px);
  min-width: 18px;
  padding: 1px 5px;
  border-radius: 9px;
  background: #e0703a;
  color: #fff;
  font-size: 11px;
  line-height: 16px;
  text-align: center;
}

/* --- Pills (board / tab switches) ---------------------------------------------- */
.tabs-row {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  padding: 4px;
  border-radius: 14px;
  background: var(--grass-deep);
}
.pill {
  flex: 1;
  padding: 9px 4px;
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.75);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}
.pill.is-active { background: var(--paper); color: var(--ink); }

.scope-row { display: flex; justify-content: center; gap: 6px; margin-top: 10px; }
.scope {
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.12);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}
.scope.is-active { background: #fff; color: var(--grass-deep); }

.small-status { font-size: 13px; }

/* --- Leaderboard ---------------------------------------------------------------- */
.board-note { margin: 10px 0 0; }
.board { margin-top: 12px; }
.board {
  margin: 0;
  padding: 0;
  list-style: none;
  border-radius: var(--radius-card);
  background: var(--paper);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.18);
  overflow: hidden;
}
.board:empty { display: none; }
.board-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
}
.board-row + .board-row { border-top: 2px solid var(--paper-dark); }
.board-row.is-me { background: #ffe9a8; }
.board-rank { width: 30px; flex: none; text-align: center; font-size: 15px; font-weight: 900; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.board-rank:not(:empty) { font-size: 15px; }
.board-name { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.board-nick, .board-farm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-nick { font-size: 15px; font-weight: 700; }
.board-farm { color: var(--ink-soft); font-size: 12px; font-weight: 500; }
.board-value { flex: none; font-size: 15px; font-weight: 900; font-variant-numeric: tabular-nums; }
.board-me {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 10px);
  z-index: 4;
}
.board-me .board { box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3); }

/* --- Friends -------------------------------------------------------------------- */
.code-card { padding: 16px; }
.code-row { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 8px; }
.code-row .small-btn { padding: 8px 10px; }
.friend-code {
  flex: 1;
  min-width: 0;
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
  user-select: text;
}
.small-btn { padding: 8px 12px; font-size: 14px; }
.add-row { display: flex; gap: 8px; margin-top: 14px; }
.add-row input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border: 2px solid var(--paper-dark);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: 700 16px var(--font);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.add-row input::placeholder { letter-spacing: normal; text-transform: none; font-weight: 500; color: var(--ink-soft); }
.add-row input:focus { outline: none; border-color: var(--gold-dark); }

.friend-list-card {
  margin: 0;
  padding: 0;
  list-style: none;
  border-radius: var(--radius-card);
  background: var(--paper);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.18);
}
.friend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
}
.friend-row + .friend-row, .recent + .recent { border-top: 2px solid var(--paper-dark); }
.friend-main { flex: 1; min-width: 0; display: flex; flex-direction: column; text-align: left; }
.friend-main .friend-name { font-size: 15px; font-weight: 700; }
.friend-sub { color: var(--ink-soft); font-size: 12px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.friend-buttons { display: flex; gap: 6px; flex: none; }
.online-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 6px;
  border-radius: 50%;
  background: #4cc24a;
  vertical-align: middle;
}
.recent {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 500;
}
.recent-time { flex: none; color: var(--ink-soft); font-size: 12px; }
.invite-title { margin: 0 0 6px; font-size: 17px; font-weight: 900; }

/* --- Player card ---------------------------------------------------------------- */
.player-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.player-head .sheet-title { margin-bottom: 2px; }
.player-head .farmer-name { margin: 0; }
.level-chip {
  flex: none;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--grass-deep);
  color: #fff;
  font-size: 14px;
  font-weight: 900;
}
.player-meta { margin: 8px 0 12px; color: var(--ink-soft); font-size: 13px; font-weight: 500; }
.sheet .stat { box-shadow: 0 0 0 2px var(--paper-dark); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.chip {
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--paper-dark);
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.player-actions { margin: 14px 0; }
.player-actions .primary-btn:disabled { opacity: 0.7; }
.sheet-sub { margin: 18px 0 8px; font-size: 17px; font-weight: 900; }
.gift-items { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.gift-item {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 56px;
  padding: 6px;
  border: 2px solid var(--paper-dark);
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.gift-item.is-active { border-color: var(--grass-dark); background: #e7f3d9; }
.gift-emoji { font-size: 24px; line-height: 1.2; }
.stepper { display: flex; align-items: center; gap: 8px; margin: 10px 0; }
.stepper-value { flex: 1; text-align: center; font-size: 18px; font-weight: 900; font-variant-numeric: tabular-nums; }
.link-btn { display: block; margin: 16px auto 0; padding: 6px; font-size: 14px; font-weight: 700; }
.danger-link { color: #b4441e; }
.sheet > .primary-btn.is-quiet { margin-top: 8px; }

/* --- FAQ ------------------------------------------------------------------------ */
.faq {
  border-radius: var(--radius-card);
  background: var(--paper);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.18);
  overflow: hidden;
}
.faq-item + .faq-item { border-top: 2px solid var(--paper-dark); }
.faq-item summary {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 14px;
  font-size: 15px;
  font-weight: 700;
  list-style: none;
  cursor: pointer;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "▾"; color: var(--ink-soft); transition: transform 0.15s; }
.faq-item[open] summary::after { transform: rotate(180deg); }
.faq-item p { margin: 0; padding: 0 14px 14px; color: var(--ink-soft); font-size: 14px; font-weight: 500; line-height: 1.45; }
.board-empty { padding: 16px; color: var(--ink-soft); font-size: 14px; font-weight: 500; text-align: center; }

/* --- Notifications (🔔) ----------------------------------------------------------- */
.bell-btn { position: relative; }
.top-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  padding: 1px 5px;
  border-radius: 9px;
  background: #e0703a;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}
.inbox-list {
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
  border-radius: var(--radius-card);
  box-shadow: 0 0 0 2px var(--paper-dark);
  overflow: hidden;
}
.inbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.inbox-row + .inbox-row { border-top: 2px solid var(--paper-dark); }
.inbox-row.is-ready { font-weight: 700; }
.inbox-row.is-new { background: #ffe9a8; font-weight: 700; }
.inbox-text { flex: 1; min-width: 0; }
.inbox-go { color: var(--ink-soft); font-size: 20px; font-weight: 700; }
.inbox-empty { color: var(--ink-soft); text-shadow: none; }

/* --- Overview --------------------------------------------------------------------- */
.ov-stats { margin-top: 16px; }
.ov-stats .stat-value { font-size: 18px; }
.ov-list {
  margin-top: 12px;
  border-radius: var(--radius-card);
  background: var(--paper);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.18);
  overflow: hidden;
}
.ov-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  text-align: left;
}
.ov-row + .ov-row { border-top: 2px solid var(--paper-dark); }
.ov-emoji { font-size: 28px; line-height: 1; }
.ov-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ov-name { font-size: 16px; font-weight: 700; }
.ov-status { color: var(--ink-soft); font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; }
.ov-status.is-ready { color: var(--grass-dark); font-weight: 700; }
.ov-next { color: var(--ink-soft); font-size: 13px; font-weight: 500; font-variant-numeric: tabular-nums; }
.ov-go { color: var(--ink-soft); font-size: 22px; font-weight: 700; }
.ov-row.is-locked .ov-emoji { filter: grayscale(1); opacity: 0.6; }

.ov-chart { padding: 14px 16px; }
.bars { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 104px 1fr auto; align-items: center; gap: 10px; }
.bar-label { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 12px; }
.bar-fill { display: block; height: 100%; border-radius: 0 4px 4px 0; background: var(--grass-dark); }
.bar-value { min-width: 48px; text-align: right; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink); }

/* Leaderboard tabs: a row that scrolls sideways */
.chip-tabs {
  display: flex;
  gap: 6px;
  margin: 8px -16px 0;
  padding: 4px 16px;
  overflow-x: auto;
  scrollbar-width: none;
}
.chip-tabs::-webkit-scrollbar { display: none; }
.chip-tab {
  flex: none;
  padding: 9px 14px;
  border-radius: 999px;
  background: var(--grass-deep);
  color: rgba(255, 255, 255, 0.8);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}
.chip-tab.is-active { background: var(--paper); color: var(--ink); }
.open-row { margin-top: 10px; border-top: 2px solid var(--paper-dark); }

/* Profile: farm facts */
.stat-grid + .stat-grid, .stat-grid { row-gap: 10px; }
.farm-card .chips { margin: 0 0 10px; }
.facts { margin: 0; padding: 0; list-style: none; }
.facts li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 0;
  font-size: 14px;
  font-weight: 500;
}
.facts li + li { border-top: 2px solid var(--paper-dark); }
.facts b { font-weight: 900; font-variant-numeric: tabular-nums; }

/* --- Achievements ------------------------------------------------------------------ */
.ach-card { display: block; width: 100%; text-align: left; color: var(--ink); }
.ach-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.ach-count { font-size: 20px; font-weight: 900; font-variant-numeric: tabular-nums; }
.ach-more { color: var(--ink-soft); font-size: 14px; font-weight: 700; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.badge {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: #ffe9a8;
  font-size: 22px;
}
.badge.is-locked { background: var(--paper-dark); filter: grayscale(1); opacity: 0.5; }
.ach-list {
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
  border-radius: var(--radius-card);
  box-shadow: 0 0 0 2px var(--paper-dark);
  overflow: hidden;
}
.ach-row { display: flex; gap: 12px; padding: 12px; }
.ach-row + .ach-row { border-top: 2px solid var(--paper-dark); }
.ach-row:not(.is-done) .ach-emoji { filter: grayscale(1); opacity: 0.55; }
.ach-row.is-done { background: #fff8e0; }
.ach-emoji { font-size: 28px; line-height: 1.1; }
.ach-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ach-name { font-size: 15px; font-weight: 700; }
.ach-desc { color: var(--ink-soft); font-size: 13px; font-weight: 500; }
.ach-bar { height: 6px; margin: 4px 0 2px; border-radius: 3px; background: var(--paper-dark); overflow: hidden; }
.ach-fill { display: block; height: 100%; background: var(--grass); }
.ach-reward { color: var(--ink-soft); font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ach-row.is-done .ach-reward { color: var(--grass-dark); }

/* --- GM ------------------------------------------------------------------------ */
.gm-card { max-width: 380px; }
.gm-title { margin: 4px 0 14px; font-size: 44px; font-weight: 900; line-height: 1; }
.gm-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin: 0 0 16px; padding: 0; list-style: none; }
.gm-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 2px;
  border-radius: 10px;
  background: var(--paper-dark);
  font-variant-numeric: tabular-nums;
}
.gm-day-n { font-size: 10px; font-weight: 700; color: var(--ink-soft); white-space: nowrap; }
.gm-day-icon { font-size: 18px; line-height: 1.2; }
.gm-day-coins { font-size: 10px; font-weight: 900; }
.gm-day.is-done { background: #dcefcd; }
.gm-day.is-done .gm-day-icon { filter: grayscale(0.6); opacity: 0.6; }
.gm-day.is-today { background: var(--gold); box-shadow: 0 0 0 2px var(--gold-dark); }
.gm-note { margin: 0 0 12px; color: var(--ink-soft); font-size: 14px; font-weight: 500; }
.gm-banner { display: flex; align-items: center; gap: 12px; width: 100%; margin-top: 16px; text-align: left; color: var(--ink); background: #fff1c2; }
.gm-banner-sun { font-size: 30px; }
.gm-banner-text { flex: 1; display: flex; flex-direction: column; }
.gm-banner-text b { font-size: 16px; }
.gm-banner-text small { color: var(--ink-soft); font-size: 13px; font-weight: 500; }
.streak-line { margin: 6px 0 0; font-size: 14px; font-weight: 700; color: #c1561d; }

/* --- Orders ---------------------------------------------------------------------- */
.orders-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.orders-time { color: rgba(255, 255, 255, 0.85); font-size: 12px; font-weight: 700; white-space: nowrap; }
.orders {
  margin: 0;
  padding: 0;
  list-style: none;
  border-radius: var(--radius-card);
  background: var(--paper);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.18);
  overflow: hidden;
}
.order { display: flex; align-items: center; gap: 10px; padding: 12px; }
.order + .order { border-top: 2px solid var(--paper-dark); }
.order-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.order-items { display: flex; flex-wrap: wrap; gap: 6px; }
.order-item {
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--paper-dark);
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.order-item.is-ok { background: #dcefcd; }
.order-reward { color: var(--ink-soft); font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.order-check { color: var(--grass-dark); font-size: 20px; font-weight: 900; }
.order.is-done { opacity: 0.6; }
.streak-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 6px; }
.streak-row .streak-line { margin: 0; }
.order-item small { color: var(--grass-dark); font-size: 12px; font-weight: 900; }

/* Achievement popup */
.ach-pop-emoji { margin: 6px 0 0; font-size: 72px; line-height: 1.1; animation: pop-in 0.6s cubic-bezier(0.2, 1.4, 0.4, 1); }
.ach-pop-name { margin: 6px 0 2px; font-size: 24px; font-weight: 900; }
.ach-pop-desc { margin: 0 0 12px; color: var(--ink-soft); font-size: 15px; font-weight: 500; }
.ach-pop-reward {
  display: inline-block;
  margin: 0 0 6px;
  padding: 8px 14px;
  border-radius: 999px;
  background: #fff1c2;
  font-size: 16px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}
.ach-pop-count { margin: 0 0 14px; color: var(--ink-soft); font-size: 13px; font-weight: 700; }

/* --- Scarecrow (field) and digging (orchard) ------------------------------------ */
.scarecrow-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  padding: 8px 10px;
  border-radius: 14px;
  background: var(--paper);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.15);
}
.scarecrow-row .card-btn { flex: none; }

.crow-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  font-size: 18px;
  line-height: 1;
  animation: crow-hop 1.2s ease-in-out infinite;
}
@keyframes crow-hop { 50% { transform: translateY(-3px); } }
@media (prefers-reduced-motion: reduce) { .crow-badge { animation: none; } }

#orchard-head { align-items: center; margin-top: 16px; }
.dig-btn {
  border: 0;
  border-radius: 999px;
  padding: 6px 12px;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.18);
  text-shadow: none;
  cursor: pointer;
}
.dig-btn.is-active { background: var(--gold); }
.dig-hint {
  grid-column: 1 / -1;
  margin: 0;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}
.plot.is-dig { box-shadow: inset 0 -6px 0 var(--grass-deep), 0 0 0 3px rgba(255, 255, 255, 0.7); }
.plot.is-dig.is-armed { box-shadow: inset 0 -6px 0 var(--grass-deep), 0 0 0 3px #e2574c; }
.card-count { color: var(--ink-soft); font-weight: 700; white-space: nowrap; }

/* --- Profile: stat details ---------------------------------------------------------- */
.stat.is-link { position: relative; width: 100%; color: var(--ink); }
.stat.is-link .stat-label::after { content: " ›"; font-weight: 900; }
.stat.is-link:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.18); }
.stat-rows { margin: 0 0 10px; padding: 0; list-style: none; }
.stat-row { display: flex; align-items: center; gap: 12px; padding: 9px 0; }
.stat-row + .stat-row { border-top: 2px solid var(--paper-dark); }
.stat-row-emoji {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #ffe9a8;
  font-size: 22px;
  line-height: 1;
}
.stat-row.is-old .stat-row-emoji { background: var(--paper-dark); }
.stat-row-body { flex: 1; min-width: 0; display: grid; gap: 6px; }
.stat-row-line { display: flex; justify-content: space-between; gap: 10px; font-size: 15px; font-weight: 700; }
.stat-row-line b { font-weight: 900; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat-row.is-old .stat-row-line span { color: var(--ink-soft); font-weight: 500; }
.stat-row-bar { height: 6px; border-radius: 3px; background: var(--paper-dark); overflow: hidden; }
.stat-row-bar span { display: block; height: 100%; border-radius: 3px; background: var(--gold); }
.sheet-note { margin: 0 0 10px; color: var(--ink-soft); font-size: 13px; font-weight: 500; line-height: 1.4; }

/* Achievements sheet: tabs on top, one even row of badges in the profile */
.sheet-tabs { margin: 0 0 12px; position: sticky; top: -1px; z-index: 1; }
.badges { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 12px; }
.badge { width: auto; height: auto; aspect-ratio: 1; line-height: 1; }

/* --- Profile: my farm ----------------------------------------------------------------- */
.mf-card { padding: 6px 14px; }
.mf-list { margin: 0; padding: 0; list-style: none; }
.mf-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; cursor: pointer; }
.mf-row + .mf-row { border-top: 2px solid var(--paper-dark); }
.mf-row.is-locked { opacity: 0.55; }
.mf-row.is-locked .mf-icon { filter: grayscale(1); }
.mf-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #e3f1d3;
  font-size: 24px;
  line-height: 1;
}
.mf-body { flex: 1; min-width: 0; display: grid; gap: 8px; }
.mf-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 22px; }
.mf-name { font-size: 16px; font-weight: 900; }
.mf-side { color: var(--grass-dark); font-size: 13px; font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; }
.mf-row.is-locked .mf-side { color: var(--ink-soft); }
.mf-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.mf-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--paper-dark);
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.mf-chip-emoji { font-size: 17px; line-height: 1; }
.mf-empty { color: var(--ink-soft); font-size: 13px; font-weight: 500; }
.mf-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 -14px;
  padding: 12px 14px;
  border-top: 2px solid var(--paper-dark);
  font-size: 14px;
  font-weight: 700;
}
.mf-total b { color: var(--grass-dark); font-size: 16px; font-weight: 900; font-variant-numeric: tabular-nums; }

/* GM button: the word in the middle, the reward small under it */
.gm-btn { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 16px 13px; }
.gm-btn-main { font-size: 24px; font-weight: 900; line-height: 1.1; letter-spacing: 0.5px; }
.gm-btn-sub { font-size: 13px; font-weight: 700; opacity: 0.75; }

/* Level-up card: new things, more room/upgrades, reward */
.level-card-unlocks { text-align: left; }
.lu-section { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: #f6e9c4; }
.lu-section.is-reward { background: #e3f1d3; }
.lu-label { margin: 0 0 6px; color: var(--ink-soft); font-size: 12px; font-weight: 800; letter-spacing: 0.4px; text-transform: uppercase; }
.lu-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.lu-list li { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 700; line-height: 1.25; }
.lu-list li + li { margin-top: 0; }
.lu-emoji { flex: none; width: 24px; text-align: center; font-size: 18px; line-height: 1; }
.level-card-next { margin: 12px 0 0; color: var(--ink-soft); font-size: 14px; font-weight: 700; text-align: center; }

/* Order difficulty */
.order-tier {
  align-self: flex-start;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
.order-tier.is-t1 { background: #dcefcd; color: #2f5e22; }
.order-tier.is-t2 { background: #ffe9a8; color: #8a5d00; }
.order-tier.is-t3 { background: #f8d2c4; color: #9a3412; }
.plot.is-tree.is-ready .plot-plant { animation: none; }

/* Warehouse: keep products for orders */
.keep-row { margin-bottom: 4px; padding: 10px 12px; border-radius: var(--radius-card); background: #e3f1d3; }
.need-line { color: var(--grass-dark); font-weight: 700; }

.top-btn.is-hint { animation: hint-pulse 1.6s ease-in-out infinite; }
@keyframes hint-pulse { 50% { box-shadow: 0 0 0 4px var(--gold); } }
@media (prefers-reduced-motion: reduce) { .top-btn.is-hint { animation: none; box-shadow: 0 0 0 3px var(--gold); } }

/* Profile: the gear opens the settings sheet */
.gear-btn {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--paper-dark);
  box-shadow: inset 0 -3px 0 #d8c590;
  font-size: 22px;
  line-height: 1;
}
.gear-btn:active { transform: translateY(1px); }
.sheet .settings-card { box-shadow: 0 0 0 2px var(--paper-dark); margin-top: 0; }
.sheet .settings-card + .settings-card { margin-top: 12px; }
.save-names { margin-top: 6px; }

/* Orchard: what a tree gives even without fruit, free places */
.tree-fruit-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 18px;
  line-height: 1;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.4));
}
.tree-fruit { line-height: 1; }
.plot.is-tree.is-waiting .tree-fruit { filter: grayscale(0.6); opacity: 0.45; }
.plot-new.is-free-place { border-style: solid; border-color: rgba(255, 255, 255, 0.5); background: rgba(255, 255, 255, 0.12); }

.field-info { margin: -6px 0 10px; color: #fff; font-size: 13px; font-weight: 600; opacity: 0.92; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); }

.orders-all-done {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-card);
  background: var(--paper);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.18);
  font-size: 15px;
  font-weight: 800;
}
.orders-all-done .orders-time { color: var(--ink-soft); text-shadow: none; }

/* Overview: chips with what each section makes and has ready */
.ov-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.ov-income { color: var(--grass-dark); font-size: 13px; font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ov-chips { display: flex; flex-wrap: wrap; gap: 5px; margin: 5px 0 2px; }
.ov-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--paper-dark);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.ov-chip > span { font-size: 14px; line-height: 1; }
.ov-chip.is-ready { background: #dcefcd; color: var(--grass-dark); }
.ov-chip.is-full { background: #f8d2c4; color: #9a3412; }
.ov-chip.is-idle { color: var(--ink-soft); font-weight: 700; }
.ov-row.is-static { cursor: default; }
.notify-section.is-disabled { opacity: 0.45; }
.notify-section[data-section="social"] { margin-bottom: 8px; }

/* Warehouse: how many products */
.wh-total { margin: 0 0 4px; color: var(--ink-soft); font-size: 14px; font-weight: 700; text-align: center; }

/* While you were away */
.away-card { max-width: 360px; max-height: 88vh; overflow-y: auto; }
.away-title { margin: 4px 0 6px; font-size: 26px; font-weight: 900; }
.away-card .lu-section { text-align: left; }
.away-card .ov-chips { margin: 0; }
.away-news { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; font-size: 13px; font-weight: 600; line-height: 1.3; }
.away-note { margin: 12px 0; color: var(--ink-soft); font-size: 15px; font-weight: 600; }
.away-card .primary-btn { margin-top: 14px; }

/* Status next to the name */
/* Achievement badge before the name: an emoji in a small frame (not part of the name) */
.status-emoji {
  display: inline-flex; align-items: center; justify-content: center; width: 1.45em; height: 1.45em;
  margin-right: 5px; border: 1.5px solid #e2b54a; border-radius: 6px; background: #fff3cf;
  font-size: 0.8em; line-height: 1; vertical-align: 0.08em; cursor: pointer;
}
.status-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; margin: 10px 0 6px; }
.status-opt {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: 10px;
  background: var(--paper-dark);
  font-size: 22px;
  line-height: 1;
}
.status-opt.is-active { background: var(--gold); box-shadow: 0 0 0 2px var(--gold-dark); }
.status-opt.is-none { grid-column: span 2; aspect-ratio: auto; font-size: 13px; font-weight: 800; }
.sheet .status-card { margin-bottom: 12px; }

/* Long names never push buttons off the screen */
.name-row > div, .player-head > div { min-width: 0; overflow-wrap: anywhere; }
.name-row .gear-btn, .player-head .level-chip { flex-shrink: 0; }
.friend-name, .board-nick { overflow-wrap: anywhere; }
/* Big level-up cards (several levels at once) scroll on small phones */
.level-card { max-height: 88vh; overflow-y: auto; }
.retry-btn { margin-top: 10px; }

/* Feedback to the developer */
.feedback-kinds { margin: 4px 0 10px; }
.feedback-text {
  width: 100%;
  padding: 12px;
  border: 2px solid var(--paper-dark);
  border-radius: var(--radius-card);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  resize: vertical;
}
.feedback-text:focus { outline: none; border-color: var(--gold-dark); }
.feedback-count { margin: 4px 0 10px; color: var(--ink-soft); font-size: 12px; text-align: right; }

/* Narrow phones: the top bar has 4-5 buttons, so everything gets a little smaller */
.topbar-buttons { flex-shrink: 0; }
@media (max-width: 400px) {
  .topbar { padding-left: 12px; padding-right: 12px; gap: 6px; }
  .coins { font-size: 20px; gap: 4px; }
  .coins-icon { font-size: 18px; }
  .topbar-buttons { gap: 5px; }
  .top-btn { min-width: 34px; height: 34px; padding: 0 7px; font-size: 16px; }
  .top-btn-value { font-size: 13px; }
  .level { padding: 5px 9px; }
  .level-label { display: none; }
  .level-value::before { content: "⭐"; font-size: 13px; margin-right: 2px; }
}

.fx.is-loss { color: #ffb4a2; margin-top: 26px; }

/* Locked Friends / Leaders: some air under the tabs */
.friends-locked { margin-top: 18px; }
.screen-locked { margin-top: 8px; }

/* "How it works" cards; the emoji on an animal card opens one */
button.animal-emoji { position: relative; padding: 0; border: 0; background: none; cursor: pointer; font-family: inherit; }
.animal-emoji.is-info::after {
  content: "?"; position: absolute; right: -4px; bottom: -2px; width: 17px; height: 17px; border-radius: 50%;
  background: var(--ink-soft, #7a6a4f); color: #fff; font-size: 11px; font-weight: 900; line-height: 17px; text-align: center;
  box-shadow: 0 0 0 2px #fff8e6;
}
.guide-emoji { margin: 6px 0 0; font-size: 52px; line-height: 1.1; }
.guide-card .lu-section { text-align: left; }
.guide-list li { align-items: flex-start; font-size: 14px; font-weight: 600; }
.guide-list .lu-emoji { margin-top: 1px; }

/* "?" under the section tabs: how the field / garden / orchard works */
.view-help {
  display: flex; align-items: center; gap: 7px; margin: 10px auto 12px; padding: 6px 14px 6px 6px;
  border: 0; border-radius: 999px; background: rgba(255, 248, 230, 0.92); color: var(--ink, #3b2a14);
  font: inherit; font-size: 14px; font-weight: 800; cursor: pointer; box-shadow: 0 2px 0 rgba(0, 0, 0, 0.12);
}
.view-help[hidden] { display: none; }
.view-help-q {
  width: 22px; height: 22px; border-radius: 50%; background: var(--ink-soft, #7a6a4f); color: #fff;
  font-size: 13px; font-weight: 900; line-height: 22px; text-align: center;
}

/* First visit: choose the language */
.lang-card { max-width: 340px; }
.lang-title-ru { color: var(--ink-soft, #7a6a4f); font-size: 20px; }
.lang-pick { display: grid; gap: 10px; margin-top: 16px; }
.lang-pick-btn {
  padding: 14px; border: 2px solid transparent; border-radius: 14px; background: #f6e9c4;
  color: var(--ink, #3b2a14); font: inherit; font-size: 18px; font-weight: 800; cursor: pointer;
}
.lang-pick-btn.is-active { border-color: var(--gold-dark, #c98a12); background: #ffe7a3; }

/* Tags next to names: DEV, OG, FRIEND. Small and a little raised, like a note to the name.
   text-box trims the box to the capital letters, so the padding is equal above and below
   (measured: within one screen pixel). Old browsers without it get close-enough padding. */
.name-tag {
  display: inline-block; margin-left: 4px; padding: 1.6px 3.5px 2.4px; border-radius: 999px;
  color: #fff; font-size: 7.5px; font-weight: 900; letter-spacing: 0.3px; line-height: 1;
  text-box: trim-both cap alphabetic; vertical-align: 0.7em; white-space: nowrap; cursor: pointer;
}
@supports not (text-box: trim-both cap alphabetic) {
  .name-tag { padding: 1.5px 3.5px 0.5px; vertical-align: 0.65em; }
}
.name-tag.is-dev { background: linear-gradient(135deg, #8f5bd8, #5b3bb0); }
.name-tag.is-og { background: linear-gradient(135deg, #f2b33d, #d9822b); }
.name-tag.is-friend { background: linear-gradient(135deg, #5cb85c, #3a8f3a); }

/* Small "?" next to a section title (how it works) */
.title-help {
  display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; margin-left: 6px;
  border: 0; border-radius: 50%; background: rgba(255, 248, 230, 0.92); color: var(--ink-soft, #7a6a4f);
  font: inherit; font-size: 13px; font-weight: 900; vertical-align: 0.15em; cursor: pointer;
}
