/* The farm's shell: the room's chrome (header, start gate, prompt, control
   hint) in a daylight palette. The build-mode frame is the shared
   css/space-editor.css; this file only tints it. */

:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #dbe9f4;
  color: #f8fbf4;
  --farm-ink: rgba(24, 38, 22, .86);
  --farm-ink-soft: rgba(24, 38, 22, .68);
  --farm-line: rgba(255, 240, 200, .45);
  --farm-accent: #ffd33d;
  --farm-leaf: #9ee27a;
}

* { box-sizing: border-box; }
html, body, .farm-shell { width: 100%; height: 100%; margin: 0; overflow: hidden; }
button, a { font: inherit; }

#farmCanvas { display: block; width: 100%; height: 100%; outline: 0; }

.farm-header {
  position: fixed;
  z-index: 4;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 22px clamp(18px, 4vw, 54px);
  pointer-events: none;
  background: linear-gradient(180deg, rgba(20, 34, 18, .78), transparent);
}
.farm-header > * { pointer-events: auto; }
.farm-header h1 { margin: 2px 0 0; font: 900 clamp(23px, 3vw, 42px)/1 "Arial Black", sans-serif; letter-spacing: -.05em; text-transform: uppercase; text-shadow: 0 2px 12px rgba(0,0,0,.35); }
.farm-header__actions { margin-left: auto; display: flex; gap: 8px; }
.farm-owner-link[hidden] { display: none; }

.eyebrow { color: var(--farm-leaf); font: 800 10px/1.2 ui-monospace, monospace; letter-spacing: .18em; }
.back-link { color: #f8fbf4; text-decoration: none; border: 1px solid var(--farm-line); border-radius: 999px; padding: 10px 15px; background: var(--farm-ink-soft); backdrop-filter: blur(10px); }
.back-link:hover { border-color: var(--farm-accent); background: var(--farm-ink); }

.farm-button {
  border: 1px solid var(--farm-line);
  border-radius: 999px;
  padding: 10px 15px;
  background: var(--farm-ink-soft);
  color: #f8fbf4;
  font-weight: 800;
  cursor: pointer;
  backdrop-filter: blur(10px);
  text-decoration: none;
}
.farm-button:hover { border-color: var(--farm-accent); background: var(--farm-ink); }
.farm-button kbd { margin-left: 7px; padding: 2px 6px; border: 1px solid currentColor; border-radius: 5px; font: 800 10px ui-monospace, monospace; opacity: .85; }
.farm-button[hidden] { display: none; }
.farm-button--accent { border-color: var(--farm-accent); background: rgba(255, 211, 61, .18); }
.farm-button--games { border-color: var(--farm-leaf); background: rgba(158, 226, 122, .18); }
.farm-button--accent[aria-pressed="true"] { background: var(--farm-accent); color: #23301c; }
.is-visiting .control-hint__owner { display: none; }
.is-visiting #openPetGames { display: none; }

.start-gate {
  position: fixed;
  z-index: 3;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at 50% 45%, rgba(255, 244, 200, .18), rgba(20, 34, 18, .62));
  transition: opacity .2s ease;
}
.start-gate.is-hidden { opacity: 0; pointer-events: none; }
.start-card { width: min(480px, 100%); padding: 30px; text-align: center; border: 1px solid var(--farm-line); border-radius: 22px; background: var(--farm-ink); box-shadow: 0 30px 90px rgba(0, 0, 0, .4), inset 0 1px rgba(255,255,255,.08); backdrop-filter: blur(16px); }
.start-card__tag { color: var(--farm-accent); font: 800 10px ui-monospace, monospace; letter-spacing: .18em; }
.start-card h2 { margin: 10px 0 8px; font: 900 clamp(30px, 6vw, 48px)/.98 "Arial Black", sans-serif; letter-spacing: -.06em; }
.start-card p { margin: 0 auto 22px; max-width: 35ch; color: #d6e3c8; line-height: 1.55; }
.start-card button { border: 0; border-radius: 10px; padding: 13px 22px; background: var(--farm-accent); color: #23301c; font-weight: 900; text-transform: uppercase; cursor: pointer; box-shadow: 0 7px 0 #9c7911; }
.start-card button:active { transform: translateY(4px); box-shadow: 0 3px 0 #9c7911; }
.start-card small { display: block; margin-top: 18px; color: var(--farm-leaf); }
.start-gate[data-state="error"] .start-card button { display: none; }
.starter-dog[hidden], .start-card > button[hidden] { display: none; }
.starter-dog { margin: 0 auto 6px; text-align: left; }
.starter-dog label { display: block; margin-bottom: 8px; color: #fff6cf; font-weight: 850; }
.starter-dog__action { display: flex; gap: 9px; }
.starter-dog input { min-width: 0; flex: 1; border: 1px solid var(--farm-line); border-radius: 10px; padding: 13px 14px; background: rgba(255,255,255,.09); color: #fff; font: inherit; outline: 0; }
.starter-dog input:focus { border-color: var(--farm-accent); box-shadow: 0 0 0 3px rgba(255,211,61,.16); }
.starter-dog button { white-space: nowrap; }
.starter-dog span { display: block; min-height: 1.4em; margin-top: 10px; color: var(--farm-leaf); font-size: 12px; text-align: center; }

.farm-prompt {
  position: fixed;
  z-index: 5;
  left: 50%;
  bottom: 94px;
  translate: -50% 12px;
  padding: 13px 19px;
  border: 1px solid rgba(255, 211, 61, .8);
  border-radius: 10px;
  background: var(--farm-ink);
  color: #fff6cf;
  font-weight: 850;
  opacity: 0;
  transition: opacity .16s ease, translate .16s ease;
  pointer-events: none;
  box-shadow: 0 15px 45px rgba(0,0,0,.3);
}
.farm-prompt.is-visible { opacity: 1; translate: -50% 0; }
.farm-prompt::first-letter { color: var(--farm-accent); }

.farm-clock {
  position: fixed;
  z-index: 2;
  left: clamp(18px, 4vw, 54px);
  bottom: 20px;
  min-width: 116px;
  padding: 9px 13px;
  border: 1px solid var(--farm-line);
  border-radius: 10px;
  background: var(--farm-ink-soft);
  text-align: right;
  backdrop-filter: blur(10px);
}
.farm-clock span { display: block; color: var(--farm-leaf); font: 800 9px/1.2 ui-monospace, monospace; letter-spacing: .14em; text-transform: uppercase; }
.farm-clock strong { display: block; margin-top: 2px; color: #fff6cf; font: 900 17px/1.2 ui-monospace, monospace; }
.seed-hud { position: fixed; z-index: 2; left: clamp(152px, calc(4vw + 134px), 194px); bottom: 20px; min-width: 145px; padding: 9px 13px; border: 1px solid var(--farm-line); border-radius: 10px; background: var(--farm-ink-soft); backdrop-filter: blur(10px); }
.seed-hud span { display: block; color: var(--farm-leaf); font: 800 9px/1.2 ui-monospace, monospace; letter-spacing: .12em; text-transform: uppercase; }
.seed-hud strong { display: block; margin-top: 2px; color: #fff6cf; font-size: 13px; }

.nap-dialog { width: min(440px, calc(100vw - 36px)); padding: 0; border: 1px solid var(--farm-line); border-radius: 18px; background: var(--farm-ink); color: #f8fbf4; box-shadow: 0 30px 90px rgba(0,0,0,.65); }
.nap-dialog::backdrop { background: rgba(3, 7, 15, .68); backdrop-filter: blur(4px); }
.nap-dialog form { padding: 26px; text-align: center; }
.nap-dialog h2 { margin: 8px 0; font: 900 28px/1.05 "Arial Black", sans-serif; letter-spacing: -.04em; }
.nap-dialog p { margin: 0 0 20px; color: #d6e3c8; }
.nap-dialog__choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.nap-dialog__choices button, .nap-dialog__cancel { border: 1px solid var(--farm-line); border-radius: 10px; padding: 12px 9px; background: rgba(255,255,255,.07); color: #fff; font-weight: 850; cursor: pointer; }
.nap-dialog__choices button:hover { border-color: var(--farm-accent); background: rgba(255,211,61,.18); }
.nap-dialog__cancel { margin-top: 12px; border: 0; background: transparent; color: #c9d7bd; }
.nap-shade { position: fixed; z-index: 7; inset: 0; display: grid; place-items: center; background: #030711; color: #e8f1ff; font: 800 12px ui-monospace, monospace; letter-spacing: .18em; text-transform: uppercase; opacity: 0; pointer-events: none; transition: opacity .35s ease; }
.is-napping .nap-shade { opacity: .54; }

.control-hint { position: fixed; z-index: 2; right: 24px; bottom: 20px; display: flex; gap: 8px; color: #e2ecd6; font-size: 11px; }
.control-hint span { padding: 7px 9px; background: var(--farm-ink-soft); border: 1px solid rgba(255,255,255,.12); border-radius: 7px; }
.control-hint b { color: #fff; margin-right: 5px; }

@media (max-width: 720px) {
  .farm-header { gap: 12px; padding: 14px 16px; }
  .farm-header h1 { font-size: 20px; }
  .control-hint { display: none; }
}

/* Build mode: the shared frame (css/space-editor.css) in the farm's daylight
   palette. While building, the walking chrome steps aside. */
.farm-editor {
  --editor-panel: linear-gradient(160deg, rgba(24, 38, 22, .96), rgba(14, 24, 13, .94));
  --editor-line: rgba(158, 226, 122, .32);
}
.farm-editor .editor-rail button[aria-selected="true"] { border-color: rgba(158, 226, 122, .55); background: rgba(158, 226, 122, .16); box-shadow: 0 0 18px rgba(158, 226, 122, .18); }
.farm-editor .camera-views button[aria-pressed="true"] { background: rgba(158, 226, 122, .18); box-shadow: inset 0 0 0 1px rgba(158, 226, 122, .5); }
.is-editing .farm-header,
.is-editing .control-hint,
.is-editing .farm-prompt,
.is-editing .farm-clock,
.is-editing .seed-hud { opacity: 0; pointer-events: none; }
.is-visiting #editFarm { display: none; }

/* Pets panel: a card on the right, over the field. Keys inside it are its own. */
.pets-panel {
  position: fixed;
  z-index: 6;
  top: 92px;
  right: 18px;
  bottom: 18px;
  width: min(420px, calc(100vw - 36px));
  display: flex;
  flex-direction: column;
  border: 1px solid var(--farm-line);
  border-radius: 18px;
  background: var(--farm-ink);
  box-shadow: 0 30px 90px rgba(0, 0, 0, .4);
  backdrop-filter: blur(16px);
  overflow: hidden;
}
.pets-panel[hidden] { display: none; }
.pets-panel__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid rgba(255,255,255,.1); }
.pets-panel__head strong { display: block; margin-top: 3px; font-size: 18px; }
.pets-panel__count { margin-left: 8px; color: var(--farm-leaf); font: 800 11px ui-monospace, monospace; letter-spacing: .1em; }
.pets-panel__body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 14px 18px 18px; scrollbar-width: thin; }
.pets-section + .pets-section { margin-top: 18px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,.1); }
.pets-section__title { margin: 0 0 10px; color: var(--farm-leaf); font: 800 11px ui-monospace, monospace; letter-spacing: .16em; text-transform: uppercase; }
.pets-empty { margin: 0; color: #c9d7bd; font-size: 13px; }
.pet-list { display: grid; gap: 6px; }
.pet-row { display: grid; gap: 9px; padding: 9px; border: 1px solid rgba(255,255,255,.1); border-radius: 10px; background: rgba(255,255,255,.04); }
.pet-row__head { display: grid; grid-template-columns: 84px minmax(0, 1fr) auto; align-items: center; gap: 8px; }
.pet-row__species { color: #c9d7bd; font-size: 12px; font-weight: 700; }
.pet-row__name { min-width: 0; padding: 7px 9px; border: 1px solid rgba(255,255,255,.14); border-radius: 8px; background: rgba(0,0,0,.25); color: #fff; font: inherit; }
.pet-row__name:focus { outline: 0; border-color: var(--farm-accent); }
.pet-row__release { padding: 7px 10px; border: 1px solid rgba(255,120,120,.4); border-radius: 8px; background: rgba(255,80,80,.12); color: #ffd6d6; font: 800 11px ui-monospace, monospace; cursor: pointer; }
.pet-row__release:hover { background: rgba(255,80,80,.28); }
.pet-row__stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; margin: 0; }
.pet-row__stats div { min-width: 0; padding: 6px; border-radius: 7px; background: rgba(0,0,0,.2); }
.pet-row__stats dt { color: #9db192; font: 750 8px/1.2 ui-monospace, monospace; letter-spacing: .08em; text-transform: uppercase; }
.pet-row__stats dd { margin: 2px 0 0; color: #fff6cf; font-size: 11px; text-transform: capitalize; }
.pet-row__need--hungry { box-shadow: inset 0 0 0 1px rgba(255, 197, 83, .34); }
.pet-row__need--hungry dd { color: #ffd77e; }
.pet-row__need--starving { box-shadow: inset 0 0 0 1px rgba(255, 105, 105, .48); background: rgba(120, 20, 20, .22) !important; }
.pet-row__need--starving dd { color: #ffabab; }
.pet-row__gained { color: #9ee27a; font-size: 10px; }
.pet-row__potential { color: #ffd77e; letter-spacing: .04em; }
.pet-row__potential-empty { opacity: .25; }
.pet-row__growth { grid-column: 1 / -1; }
.pet-row__growth--thriving dd { color: #9ee27a; }
.pet-row__growth--slow dd { color: #ffd77e; }
.pet-row__growth--stalled { box-shadow: inset 0 0 0 1px rgba(255, 105, 105, .4); }
.pet-row__growth--stalled dd { color: #ffabab; }
.pet-row__warning { margin: 0; padding: 7px 9px; border-radius: 7px; font-size: 11px; line-height: 1.35; }
.pet-row__warning--watch { color: #ffe0a0; background: rgba(137, 91, 18, .28); border: 1px solid rgba(255, 197, 83, .3); }
.pet-row__warning--urgent, .pet-row__warning--critical { color: #ffd1d1; background: rgba(120, 20, 20, .3); border: 1px solid rgba(255, 105, 105, .4); }
.pet-row__warning--critical { box-shadow: 0 0 12px rgba(255, 78, 78, .16); }
.pet-row__traits { display: flex; flex-wrap: wrap; gap: 5px; margin: 0; padding: 0; list-style: none; }
.pet-row__traits li { padding: 4px 7px; border: 1px solid rgba(158,226,122,.28); border-radius: 999px; color: #dff6ce; background: rgba(158,226,122,.08); font-size: 10px; }
.pet-row__unscoped { margin: 0; color: #9db192; font-size: 11px; }
.pet-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.pet-card { position: relative; display: grid; gap: 3px; padding: 6px 6px 8px; border: 1px solid rgba(255,255,255,.12); border-radius: 12px; background: rgba(255,255,255,.04); color: #f0f6e8; text-align: center; cursor: pointer; }
.pet-card:hover { border-color: var(--farm-leaf); background: rgba(158,226,122,.1); }
.pet-card.is-selected { border-color: var(--farm-accent); background: rgba(255,211,61,.14); }
.pet-card:disabled { opacity: .4; cursor: not-allowed; }
.pet-card__picture { display: grid; place-items: center; aspect-ratio: 4 / 5; border-radius: 9px; background: radial-gradient(circle at 50% 70%, rgba(158,226,122,.25), transparent 60%), rgba(0,0,0,.25); overflow: hidden; }
.pet-card__picture img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pet-card__letter { font: 900 34px "Arial Black", sans-serif; color: rgba(255,255,255,.35); }
.pet-card__title { font-weight: 800; font-size: 13px; }
.pet-card__note { color: #b9c9ad; font-size: 10.5px; text-transform: capitalize; }
.pet-card:disabled .pet-card__note { color: #ffd6a0; text-transform: none; }
.pets-adopt { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin-top: 12px; }
.pets-adopt__name { min-width: 0; padding: 10px 12px; border: 1px solid rgba(255,255,255,.14); border-radius: 10px; background: rgba(0,0,0,.25); color: #fff; font: inherit; }
.pets-adopt__name:focus { outline: 0; border-color: var(--farm-accent); }
.pets-status { min-height: 1.4em; margin: 10px 0 0; color: #d6e3c8; font-size: 12.5px; line-height: 1.4; }

.inventory-panel { position: fixed; z-index: 6; top: 92px; right: 18px; bottom: 18px; width: min(480px, calc(100vw - 36px)); display: flex; flex-direction: column; border: 1px solid var(--farm-line); border-radius: 18px; background: var(--farm-ink); box-shadow: 0 30px 90px rgba(0,0,0,.4); backdrop-filter: blur(16px); overflow: hidden; }
.inventory-panel[hidden] { display: none; }
.inventory-panel__body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 14px 18px 18px; }
.seed-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.seed-card { display: grid; grid-template-columns: 42px minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 10px; align-items: center; padding: 9px; border: 1px solid rgba(255,255,255,.12); border-radius: 11px; background: rgba(255,255,255,.04); color: #f8fbf4; text-align: left; cursor: pointer; }
.seed-card:hover { border-color: var(--farm-leaf); }
.seed-card[aria-pressed="true"] { border-color: var(--farm-accent); background: rgba(255,211,61,.15); }
.seed-card:disabled { opacity: .4; cursor: not-allowed; }
.seed-card__image { grid-row: 1 / 3; display: grid; place-items: center; width: 42px; height: 42px; overflow: hidden; border-radius: 10px; background: radial-gradient(circle at 50% 65%, rgba(112,148,59,.35), rgba(20,35,18,.2) 66%, transparent 67%); box-shadow: inset 0 0 0 1px rgba(255,255,255,.1); }
.seed-card__image img { display: block; width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 3px 3px rgba(0,0,0,.35)); }
.seed-card strong { font-size: 13px; }
.seed-card small { color: #b9c9ad; }
.editor-seed-grid { padding: 4px 0 18px; grid-template-columns: 1fr; }
.editor-seed-grid .seed-card { grid-template-columns: 48px minmax(0, 1fr) auto; }
.editor-seed-grid .seed-card__buy { grid-column: 3; grid-row: 1 / 3; white-space: nowrap; color: #fff0a8; }
.produce-grid { display: grid; gap: 5px; }
.produce-row { display: flex; justify-content: space-between; padding: 9px 11px; border-radius: 8px; background: rgba(255,255,255,.05); color: #d6e3c8; }
.produce-row strong { color: var(--farm-accent); }
