@charset "UTF-8";
/* Shared presentation for the farm village. Loaded after the existing component styles. */
:root {
  --farm-ink: #493b2c;
  --farm-muted: #78694f;
  --farm-paper: #fff9eb;
  --farm-paper-deep: #f3e8cf;
  --farm-border: #d7be8e;
  --farm-wood: #987148;
  --farm-wood-dark: #705131;
  --farm-sage: #597747;
  --farm-sage-soft: #e7edd7;
  --farm-ochre: #b88530;
  --farm-shadow: 0 4px 0 rgba(133, 95, 48, .22), 0 16px 44px rgba(70, 62, 31, .13);
  --farm-small-shadow: inset 0 1px 0 #fffdf5, 0 2px 0 rgba(139, 102, 53, .19);
  --action-primary: #57753f;
  --action-on-primary: #fffdf3;
  --action-secondary: #eee2c5;
  --action-secondary-ink: #665132;
  --action-tool: #705c3e;
  --action-danger: #a34838;
  --action-danger-soft: #f9e9de;
  --action-disabled: #e4ddca;
  --action-disabled-ink: #625b49;
  --action-focus: #966210;
  --world-gutter: clamp(16px, 2.4vw, 36px);
  --world-panel-width: clamp(360px, 44vw, 620px);
  --world-mobile-scene: min(28vh, 240px);
}

body {
  color: var(--farm-ink);
  background: #e5e8cc;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}
button, input, select, textarea { color: inherit; }
button, a, input, select, textarea, summary { scroll-margin: 20px; }
button { transition: background-color .16s, border-color .16s, box-shadow .16s, filter .16s; }
button:enabled:not([aria-busy="true"]):active { filter: brightness(.96); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 3px solid var(--action-focus);
  outline-offset: 3px;
}
button:disabled:not([aria-busy="true"]) { border-color: #d1c7b0; }
input::placeholder, textarea::placeholder { color: #7d7058; opacity: 1; }
::selection { color: #3f4e2b; background: #e5d89b; }
.skip-link { border: 1px solid var(--farm-wood); background: var(--farm-paper); box-shadow: var(--farm-shadow); }
#app { z-index: 10; }

/* The world stays decorative. Dialog backdrops still own the dismiss click target. */
#world-stage {
  position: fixed;
  z-index: 0;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  background: radial-gradient(ellipse at 18% 2%, #fff5d3 0, transparent 44%), linear-gradient(#dfe9cb 0%, #d2dfbd 54%, #b9c89c 100%);
}
#world-stage[hidden], .world-scene-fallback[hidden] { display: none !important; }
.world-stage-surface, .world-stage-shade { position: absolute; inset: 0; width: 100%; height: 100%; overflow: hidden; }
.world-stage-surface canvas { display: block; width: 100%; height: 100%; }
.world-stage-shade {
  background: linear-gradient(90deg, transparent 38%, rgba(240, 233, 207, .12) 60%, rgba(237, 230, 206, .5));
}
.world-caption {
  position: absolute;
  z-index: 2;
  bottom: max(36px, 6vh);
  left: var(--world-gutter);
  width: 400px;
  max-width: calc(100% - var(--world-panel-width) - var(--world-gutter) * 3);
  padding: 19px 23px 21px;
  border: 1px solid rgba(172, 138, 83, .65);
  border-radius: 8px 24px 24px 24px;
  background: linear-gradient(120deg, rgba(255, 250, 230, .96), rgba(255, 246, 220, .86));
  box-shadow: 0 3px 0 rgba(133, 100, 54, .22), 0 8px 30px rgba(73, 78, 39, .1);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.world-eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
  color: #79633c;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .16em;
}
.world-eyebrow::before {
  content: "";
  width: 14px;
  height: 9px;
  flex: 0 0 auto;
  border: 1px solid #6b854d;
  border-radius: 1px 9px 1px 9px;
  background: #aabd7c;
  transform: rotate(-20deg);
}
.world-caption h2 {
  color: #544126;
  font-size: clamp(25px, 2.6vw, 38px);
  line-height: 1.25;
  font-weight: 750;
  letter-spacing: -.04em;
  text-wrap: balance;
}
.world-caption p { margin-top: 10px; color: #796a4f; font-size: 13px; line-height: 1.85; text-wrap: pretty; }
.world-scene-fallback {
  position: absolute;
  z-index: 3;
  top: 38%;
  left: var(--world-gutter);
  right: calc(var(--world-panel-width) + var(--world-gutter) * 2);
  width: fit-content;
  max-width: calc(100% - var(--world-panel-width) - var(--world-gutter) * 3);
  margin-inline: auto;
  padding: 13px 18px;
  border: 1px solid #cfbb8c;
  border-radius: 18px;
  background: rgba(255, 249, 231, .95);
  color: #725e3d;
  box-shadow: var(--farm-small-shadow);
  font-size: 13px;
  line-height: 1.7;
  text-align: center;
}
#world-stage[data-scene-state="unavailable"] .world-stage-surface {
  background: radial-gradient(ellipse 70% 36% at 24% 102%, #8eaa6a 0 65%, transparent 65.5%), radial-gradient(ellipse 55% 34% at 64% 100%, #a8bd7e 0 65%, transparent 65.5%);
}

/* App chrome uses the same paper, timber and sage hierarchy as the 3D village. */
.app-shell { background: linear-gradient(145deg, #f6efdb, #eee4cb); }
.app-header {
  border-bottom: 1px solid rgba(165, 130, 76, .24);
  background: linear-gradient(#fff9e9, #f6ecd6);
  color: var(--farm-ink);
  box-shadow: 0 2px 0 rgba(167, 128, 67, .07);
}
.brand-mark, .view-reminders .brand-mark {
  border: 1px solid #cdb37d;
  color: #8a692e;
  background: linear-gradient(#fbebbe, #edcf8f);
  box-shadow: inset 0 1px 0 #fff9df;
}
.date-label, .child-profile-copy > small { color: var(--farm-muted); }
.connection-state { color: #95612b; }
.child-avatar { position: relative; border-color: #fff9e8; box-shadow: 0 0 0 1px #b99560; }
.avatar-camera-badge { position: absolute; right: 0; bottom: 0; display: grid; place-items: center; width: 17px; height: 17px; border: 1px solid #fff5da; border-radius: 6px; color: #fff8df; background: #31573e; }
.avatar-camera-badge .icon { width: 11px; height: 11px; }
.child-profile-copy > .profile-edit-hint { margin-top: 1px; color: #6b593c; font-size: 11px; line-height: 14px; }
.home-profile .connection-state:empty { display: none; }
.view-points { --wallet-height: 100px; }
.view-points .home-header {
  height: calc(56px + env(safe-area-inset-top));
  min-height: calc(56px + env(safe-area-inset-top));
  padding: 3px 12px;
  padding-top: calc(3px + env(safe-area-inset-top));
}
.home-header .home-profile { min-height: 48px; }
.home-mode-switch {
  display: flex; flex: none; align-items: stretch;
  padding: 0 2px; border: 1px solid #d1c6a7; border-radius: 15px;
  background: #eee7d2;
}
.home-mode-switch button {
  position: relative; isolation: isolate; min-width: 52px; min-height: 48px; padding: 0 10px;
  color: #655c42; font-weight: 700;
}
.home-mode-switch button[aria-pressed="true"] { color: #fffced; }
.home-mode-switch button[aria-pressed="true"]::before {
  content: ""; position: absolute; z-index: -1; inset: 3px 0;
  border-radius: 11px; background: #49633b;
}
.pet-home-stage .farm-scene-caption > span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
@media (min-width: 700px) {
  .view-points .home-header { display: grid; grid-template-columns: 1fr auto 1fr; }
  .home-header .header-tools { justify-self: end; }
  .home-mode-switch button { min-width: 72px; }
}
@media (max-width: 440px) {
  .home-mode-switch button { min-width: 48px; padding: 0 6px; }
  .home-header .home-inbox-button { justify-content: center; gap: 2px; }
  .home-header .home-inbox-button .icon { margin: 0; }
  .home-header .home-inbox-button span { font-size: 0; line-height: 1; }
  .home-header .home-inbox-button b { display: inline; font-size: 13px; }
}
.home-header .child-profile-copy { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 5px; }
.home-header .child-profile-copy strong { grid-column: 1 / -1; font-size: 17px; line-height: 21px; }
.home-header .profile-edit-hint { grid-column: 1; margin: 0; }
.home-header .connection-state { grid-column: 2; margin: 0; font-size: 10px; line-height: 14px; }
.home-header .header-tools { gap: 6px; margin-left: 6px; }
.home-header .header-tools .icon-button { margin: 0; }
.home-header #home-inbox-slot:empty { display: none; }
.avatar-initial { color: #715327; background: linear-gradient(135deg, #f6d698, #dfb66b); }
.home-header .header-tools .icon-button, .header-tools .icon-button, .view-reminders .header-tools .icon-button {
  border: 1px solid #dbc494;
  background: linear-gradient(#fff9e9, #f0e2c3);
  box-shadow: var(--farm-small-shadow);
}
.home-inbox-button { border: 1px solid #dec080; color: #856124; background: linear-gradient(#fff0c6, #f7e1a6); box-shadow: var(--farm-small-shadow); }
.header-tools .parent-entry {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 74px;
  min-height: 48px;
  margin-left: 6px;
  padding: 7px 12px;
  border: 1px solid #426347;
  border-radius: 14px;
  color: #fff9e7;
  background: linear-gradient(#45684a, #34513b);
  box-shadow: inset 0 1px 0 rgba(226, 239, 193, .25), 0 2px 0 #d5c8a9;
  font-size: 13px;
  font-weight: 700;
}
.parent-entry .icon { width: 18px; height: 18px; }
.menu-row.parent-entry { margin: 0; border-color: #b0ba8a; color: #28482f; background: #e6eccf; }
.menu-row.parent-entry:hover { background: #dbe5bc; }
.menu-row.parent-entry small { color: #516341; }
.menu-row.parent-entry > .icon { color: #4f6a3b; }
.menu-row.parent-entry .menu-symbol { border-color: #9eaf77; color: #3e5e32; background: #f6f7e5; }
.home-profile:focus-visible { outline-offset: -3px; }
.bottom-nav {
  border-top: 1px solid #cdb383;
  background: linear-gradient(#fff8e5, #edddba);
  box-shadow: 0 -3px 14px rgba(103, 76, 38, .06);
}
.view-points .bottom-nav {
  height: calc(60px + env(safe-area-inset-bottom));
  min-height: calc(60px + env(safe-area-inset-bottom));
  padding: 5px 12px 6px;
  padding-bottom: calc(6px + env(safe-area-inset-bottom));
}
.view-points .main-tabs { align-items: center; }
.view-points .nav-item, .view-points .voice-entry { min-height: 48px; height: 48px; }
.nav-item { border: 1px solid transparent; color: #7a684b; }
.nav-item.active {
  border-color: #b2b984;
  color: #4c6839;
  background: linear-gradient(#f0f2d9, #dfe5bc);
  box-shadow: inset 0 1px 0 #ffffef, 0 2px 0 rgba(102, 120, 61, .16);
}
.voice-entry { border-color: #d0b67f; background: linear-gradient(#fff6df, #eed9ad); color: #76592f; box-shadow: var(--farm-small-shadow); }
.btn, .farm-tool, .companion-interact {
  border: 1px solid #ccb785;
  color: var(--action-secondary-ink);
  background: linear-gradient(#fff6de, #efdfb9);
  box-shadow: var(--farm-small-shadow);
  font-weight: 650;
}
.btn.primary, .btn.reminder-primary, .farm-tool-primary, .icon-button.nav-add {
  border: 1px solid #4b6737;
  color: var(--action-on-primary);
  /* The lightest stop also supports normal-size labels after hover brightening. */
  background: linear-gradient(var(--action-primary), #415d2c);
  box-shadow: inset 0 1px 0 rgba(218, 235, 166, .65), 0 3px 0 rgba(61, 91, 40, .24);
}
.farm-tool-primary:enabled b { background: rgba(0, 0, 0, .16); }
.btn.outline { border-color: #d5c096; color: #715c39; background: #fffbef; box-shadow: inset 0 1px 0 #fff; }
.btn.danger { border-color: #ddb29c; color: #9d4635; background: #faeade; box-shadow: inset 0 1px 0 #fff6ed; }
.btn.danger-primary { border-color: #8d3f30; background: linear-gradient(#a04b39, #8d3f30); box-shadow: inset 0 1px 0 #d8947b, 0 3px 0 rgba(126, 51, 35, .2); }
.text-button, .icon-button { color: #79603b; }
.text-button.danger { color: #9d4635; }
.icon-button.nav-add { border-radius: 14px; }
.text-button:enabled:hover, .menu-row:enabled:hover, .manage-row:enabled:hover { background-color: #f5ebd5; }
.btn:enabled:hover, .farm-tool:enabled:hover { filter: brightness(1.025); }

/* The home companion has its own play area; farming tools live inside the yard. */
.interaction-home .pet-home-card {
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: 8px;
  height: 100%; min-height: 0; padding: 10px; border-radius: 22px;
}
.pet-home-heading, .pet-identity, .pet-growth-line { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pet-home-heading { min-height: 48px; }
.pet-growth-summary { flex: 1; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 6px; }
.pet-identity { grid-column: 1; grid-row: 1; align-items: baseline; }
.pet-home-card .pet-name { min-width: 0; max-width: 65%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: #494c2c; font-size: 22px; line-height: 26px; }
.pet-home-heading .pet-level { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #596641; font-size: 12px; }
.pet-growth-line { grid-column: 1; grid-row: 2; }
.pet-growth-numbers { font-size: 12px; color: #4f603a; line-height: 18px; overflow-wrap: anywhere; }
.pet-growth-numbers strong { font-size: 15px; font-variant-numeric: tabular-nums; }
.pet-home-card .growth-track { flex: 1 1 60px; min-width: 20px; max-width: 144px; margin: 0; height: 5px; border-radius: 4px; background: #d0d9ac; }
.pet-home-card .growth-track > div { background: #65853a; }
.pet-preview-entry { grid-column: 2; grid-row: 1 / 3; display: inline-flex; align-items: center; gap: 2px; min-height: 48px; padding: 0 4px; background: transparent; color: #485936; font-size: 12px; white-space: nowrap; }
.pet-preview-entry .icon { width: 13px; height: 13px; }
.pet-preview-entry:hover { text-decoration: underline; text-underline-offset: 3px; }
.pet-home-card .pet-home-stage { min-height: 0; }
.pet-home-stage #home-feedback { display: none; }
.pet-home-stage #home-feedback[data-feedback="true"] { display: block; position: absolute; z-index: 4; left: 8px; right: 8px; bottom: 8px; width: fit-content; max-width: calc(100% - 16px); margin: auto; padding: 6px 10px; background: #fffbea; border-radius: 9px; color: #34502b; font-size: 13px; line-height: 18px; pointer-events: none; }
.pet-home-stage .farm-scene-caption { right: auto; max-width: calc(100% - 16px); }
.pet-home-stage .pet-announcement { position: absolute; z-index: 3; top: 8px; left: 12px; right: 12px; width: fit-content; max-width: calc(100% - 24px); height: auto; clip: auto; white-space: normal; margin: 0 auto; padding: 9px 13px; border: 1px solid #bdc88e; border-radius: 16px 16px 16px 3px; background: #fffbea; color: #38552a; box-shadow: 0 3px 10px #25351e22; font-size: 13px; line-height: 20px; pointer-events: none; }
.pet-home-stage.pet-speaking .farm-scene-caption { visibility: hidden; }
.pet-home-stage .pet-announcement:empty { visibility: hidden; }
.pet-home-interactions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.pet-home-interactions .pet-home-care { min-width: 0; min-height: 50px; gap: 5px; padding: 7px 3px; font-size: 14px; color: #465e31; border-color: #b9bf8e; background: linear-gradient(#fffce9, #eee7be); }
.pet-home-care .icon { width: 20px; height: 20px; flex-shrink: 0; margin: 0; }
.pet-home-care:first-child { color: #754e3a; background: linear-gradient(#fff2df, #f4dcc0); border-color: #c9aa7d; }
.pet-yard-entry { display: flex; align-items: center; justify-content: center; gap: 4px; min-height: 48px; padding: 4px 7px; border-radius: 11px; background: #fff8e1; border: 1px solid #c6be8d; color: #4a6332; font-size: 12px; }
.pet-yard-entry .icon { width: 16px; height: 16px; }
.pet-preview-panel { padding: 6px 10px 9px; border: 1px solid #b7be8a; border-radius: 14px; background: #faf8e5; }
.pet-growth-rule { margin: 3px 0 0; font-size: 11px; line-height: 16px; color: #626344; }
.pet-stage-choices { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 5px; }
.pet-stage-choice { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-width: 48px; min-height: 48px; border-radius: 11px; border: 1px solid #b9be8b; color: #4e6035; background: #f1efd1; }
.pet-stage-choice b { font-size: 14px; line-height: 21px; }
.pet-stage-choice span { font-size: 10px; }
.pet-stage-choice[aria-pressed="true"] { color: #fff8da; background: #425f2e; border-color: #324d22; }
.pet-look-row { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 2px 8px; padding-top: 7px; }
.pet-preview-description { margin: 0; color: #52603a; font-size: 12px; line-height: 19px; }
.pet-look-choices { display: inline-flex; border: 1px solid #c4bb92; border-radius: 12px; overflow: hidden; }
.pet-look-choice { min-height: 48px; min-width: 52px; padding: 3px 8px; border: 0; color: #59573b; background: #fcf7e5; font-size: 12px; }
.pet-look-choice[aria-pressed="true"] { color: #fff7dc; background: #635535; }
.pet-home-card.is-previewing .farm-scene-caption > span { border: 1px solid #c6b98a; background: #faf5df; color: #504c33; }
.pet-preview-entry:focus-visible, .pet-look-choice:focus-visible, .pet-stage-choice:focus-visible, .pet-yard-entry:focus-visible { outline: 3px solid var(--action-focus); outline-offset: -3px; }
@media (max-width: 420px) {
  .interaction-home .pet-home-card { padding: 6px; gap: 5px; border-radius: 16px; }
  .pet-home-interactions .pet-home-care { gap: 3px; font-size: 12px; min-height: 48px; }
  .pet-home-heading, .pet-identity, .pet-growth-line { gap: 4px; }
  .pet-home-heading .pet-name { font-size: 19px; line-height: 23px; }
  .pet-home-heading .pet-level { font-size: 10px; }
  .pet-preview-entry .icon { display: none; }
  .pet-home-card .growth-track { flex-basis: 30px; }
  .pet-yard-entry { padding-inline: 5px; }
  .pet-preview-panel { padding-inline: 6px; }
  .pet-stage-choices { gap: 3px; }
}

/* Earned growth stays in the treasure chest; the spendable balance has a separate label. */
.view-points .app-main { min-height: 0; overflow: auto; }
.interaction-home {
  flex: 1 1 auto; align-self: stretch; height: auto; min-height: 0;
  grid-template-rows: var(--wallet-height, 100px) minmax(0, 1fr) auto;
  gap: 8px; padding: 8px 10px;
}
.interaction-home .credit-card {
  position: relative;
  isolation: isolate;
  grid-template-columns: minmax(0, 1fr) 56px;
  grid-template-rows: minmax(0, 1fr);
  gap: 6px;
  padding: 0 6px;
  overflow: hidden;
  border: 1px solid #647955;
  border-radius: 18px;
  color: #fff6d6;
  background: radial-gradient(ellipse at 100% 0, #37654b, transparent 72%), linear-gradient(130deg, #163d30, #214c37);
  box-shadow: inset 0 1px 0 rgba(237, 229, 171, .27), 0 4px 0 #c5b98c, 0 9px 22px rgba(41, 63, 31, .12);
}
.home-portrait .credit-card { height: var(--wallet-height, 100px); }
.interaction-home .credit-score {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: center;
  justify-items: start;
  gap: 0;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 0 52px 0 2px;
  border-radius: 12px;
  color: #fff6d6;
  text-align: left;
}
.credit-score:focus-visible { outline-color: #ffe39b; outline-offset: 2px; }
.credit-score > :not(.credit-scene-art) { position: relative; z-index: 1; min-width: 0; max-width: 100%; }
.credit-kicker { color: #fff2ce; font-size: 11px; font-weight: 650; line-height: 14px; letter-spacing: .02em; }
.interaction-home .credit-score > .credit-value { margin: 0; color: #ffe8a6; font-size: 26px; line-height: 28px; letter-spacing: -.04em; overflow-wrap: anywhere; text-shadow: 0 2px 0 #0e2b20; }
.interaction-home .credit-score > .credit-value.long-balance { font-size: clamp(12px, 3.75vw, 18px); line-height: 1.15; }
.credit-redeemable {
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0 4px;
  max-width: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #eff5d9;
  font-size: 10px;
  line-height: 14px;
}
.credit-redeemable > span { white-space: nowrap; }
.credit-redeemable b { min-width: 0; max-width: 100%; color: #e6f5b6; font-size: 14px; line-height: 18px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; white-space: normal; }
.credit-redeemable b.long-balance { font-size: clamp(11px, 3.4vw, 14px); line-height: 14px; }
.credit-history-hint { display: inline-flex; align-items: center; gap: 4px; color: #fff1c5; font-size: 10px; line-height: 14px; text-decoration: underline; text-underline-offset: 2px; }
.credit-history-hint .icon { width: 12px; height: 12px; }
.credit-scene-art {
  position: absolute;
  z-index: 0;
  top: 50%;
  right: 0;
  width: 48px;
  height: 76px;
  object-fit: contain;
  object-position: center;
  transform: translateY(-50%);
  pointer-events: none;
}
.credit-scene-art:not([src]) { visibility: hidden; }
.interaction-home .credit-actions { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: repeat(2, 48px); align-self: center; gap: 2px; width: 56px; height: 98px; }
.interaction-home .credit-add {
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  width: 100%;
  min-height: 48px;
  height: 48px;
  padding: 3px 2px;
  border: 1px solid #f6d481;
  border-radius: 11px;
  color: #183d2d;
  background: linear-gradient(#ffe7ac, #edc96c);
  box-shadow: inset 0 1px 0 #fff3cb, 0 2px 0 #102c20;
  font-size: 11px;
  line-height: 13px;
  white-space: nowrap;
}
.interaction-home .credit-add .icon { width: 17px; height: 17px; margin: 0; }
.interaction-home .credit-rewards {
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  min-width: 0;
  width: 100%;
  min-height: 48px;
  height: 48px;
  margin: 0;
  padding: 3px 2px;
  border: 1px solid #a6ba8d;
  color: #fff6d6;
  background: linear-gradient(#315d43, #274c37);
  box-shadow: inset 0 1px 0 rgba(233, 234, 191, .2), 0 2px 0 #102c20;
  font-size: 12px;
  line-height: 14px;
}
.interaction-home .credit-rewards .icon { width: 17px; height: 17px; margin: 0; }
.home-wide {
  grid-template-columns: minmax(245px, 38fr) minmax(0, 62fr);
  grid-template-rows: clamp(156px, 29vh, 270px) minmax(0, 1fr);
  padding: 10px 14px; gap: 12px;
}
.home-wide .credit-card { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) 48px; gap: 8px; padding: 12px; border-radius: 22px; }
.home-wide .credit-score { gap: 1px; padding: 0 38% 0 2px; }
.home-wide .credit-kicker { font-size: 12px; line-height: 16px; }
.home-wide .credit-score > .credit-value { margin: 0; font-size: clamp(34px, 4vw, 54px); line-height: 1; }
.home-wide .credit-score > .credit-value.long-balance { font-size: clamp(13px, 1.5vw, 20px); line-height: 1.15; }
.home-wide .credit-redeemable { padding: 2px 6px; border: 1px solid #6f9275; border-radius: 8px; background: #183f30; font-size: 10px; line-height: 14px; }
.home-wide .credit-redeemable b { font-size: 18px; line-height: 20px; }
.home-wide .credit-redeemable b.long-balance { font-size: 12px; line-height: 14px; }
.home-wide .credit-history-hint { margin: 0; font-size: 11px; line-height: 16px; }
.home-wide .credit-scene-art { right: 0; width: 36%; height: 100%; }
.home-wide .credit-actions { grid-template-columns: minmax(0, 1fr) 76px; grid-template-rows: 48px; gap: 8px; width: 100%; height: 48px; }
.home-wide .credit-add, .home-wide .credit-rewards { flex-direction: row; gap: 6px; height: 48px; min-height: 48px; padding: 6px 8px; }
.home-wide .credit-add { font-size: 15px; }
.home-wide .credit-rewards { min-width: 0; font-size: 13px; }
.home-wide .credit-add .icon, .home-wide .credit-rewards .icon { width: 19px; height: 19px; }
.companion-card, .home-wide .companion-card {
  border-color: #acb581;
  background: linear-gradient(#f4f3da, #e9ebc8);
  box-shadow: inset 0 1px 0 #ffffef, 0 3px 0 rgba(108, 119, 58, .18);
}
.farm-home-stage { border: 1px solid #a8b17e; background: #dae5ba; box-shadow: inset 0 2px 4px rgba(91, 102, 46, .1); }
.pet-name { color: #5c532f; }
.pet-level { color: #6c7547; }
.companion-heading > .text-button { border: 1px solid #c6c595; color: #66703b; background: #fffbe5; box-shadow: var(--farm-small-shadow); }
.growth-track { background: #d7dcb5; }
.growth-track > div { background: linear-gradient(90deg, #9fb466, #6e9144); }
.farm-scene-caption > span { border: 1px solid rgba(192, 178, 129, .7); color: #5d683e; background: rgba(255, 250, 227, .94); }
.farm-scene-caption .farm-weather .icon { color: #b48631; }
.interaction-home .behavior-card {
  align-self: start;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  grid-template-rows: minmax(0, 1fr);
  align-items: center;
  column-gap: 9px;
  height: auto;
  min-height: 72px;
  padding: 12px;
  border: 1px solid #d9c69a;
  background: linear-gradient(125deg, #fffdf0, #fcf2d9);
  box-shadow: var(--farm-small-shadow);
}
.home-behaviors { align-content: start; grid-template-rows: 48px auto; }
.interaction-home .home-behavior-buttons {
  align-content: start;
  align-items: start;
  grid-template-rows: none;
  grid-auto-rows: auto;
  gap: 10px;
}
.interaction-home .behavior-card > strong { position: static; align-self: center; margin: 0; color: #4b6b32; font-size: 21px; }
.interaction-home .behavior-symbol {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  min-height: 34px;
  max-height: 34px;
  margin: 0;
  flex: 0 0 34px;
  border-radius: 11px;
  aspect-ratio: 1;
}
.interaction-home .behavior-symbol .icon { width: 21px; height: 21px; }
.interaction-home .behavior-copy b { font-size: 14px; line-height: 21px; }
.home-portrait .behavior-card { grid-template-columns: minmax(0, 1fr) auto; min-height: 64px; padding: 10px; }
.home-portrait .behavior-symbol { display: none; }
.home-wide .home-behavior { grid-template-columns: 34px minmax(0, 1fr); grid-template-rows: 34px auto; gap: 8px; min-height: 96px; }
.home-wide .home-behavior .behavior-symbol { grid-column: 1; grid-row: 1; }
.home-wide .home-behavior .behavior-copy { grid-column: 1 / -1; grid-row: 2; }
.home-wide .home-behavior > strong { grid-column: 2; grid-row: 1; justify-self: end; }
.home-wide .home-behavior-buttons.count-0, .home-wide .home-behavior-buttons.count-1, .home-wide .home-behavior-buttons.count-2 { grid-template-rows: none; }
.home-wide .home-behavior-buttons.count-1 > .home-behavior { grid-template-columns: 34px minmax(0, 1fr) auto; grid-template-rows: auto; min-height: 80px; }
.home-wide .home-behavior-buttons.count-1 .behavior-copy { grid-column: 2; grid-row: 1; }
.home-wide .home-behavior-buttons.count-1 .home-behavior > strong { grid-column: 3; }
.home-wide .home-behavior-buttons.count-3 > :last-child { grid-column: auto; }
.home-wide .behavior-copy b { font-size: 15px; }
.home-wide .behavior-symbol, .home-wide .behavior-symbol-1 { border: 1px solid #c7cd9d; color: #72864e; background: #e9eccc; }
.home-wide .behavior-symbol-2 { border-color: #e0bf79; color: #a17b2e; background: #f9e9b7; }
.home-wide .behavior-symbol-3 { border-color: #ddb3a0; color: #ab7156; background: #f7e0cc; }
/* On a portrait tablet the two small sections share a row above the full-width scene. */
@media (min-width: 700px) and (orientation: portrait) {
  .interaction-home.home-wide {
    grid-template-areas: "wallet behaviors" "companion companion";
    grid-template-columns: minmax(245px, 43fr) minmax(0, 57fr);
    grid-template-rows: clamp(172px, 20vh, 200px) minmax(0, 1fr);
  }
}
@media (min-width: 700px) and (orientation: portrait), (max-height: 610px) {
  .home-wide .home-behavior-buttons { gap: 6px; }
  .home-wide .home-behavior, .home-wide .home-behavior-buttons.count-1 > .home-behavior {
    grid-template: auto / minmax(0, 1fr) auto; min-height: 52px; gap: 4px; padding: 6px 9px;
  }
  .home-wide .home-behavior .behavior-symbol { display: none; }
  .home-wide .home-behavior-buttons .behavior-copy { grid-area: 1 / 1; }
  .home-wide .home-behavior-buttons .home-behavior > strong { grid-area: 1 / 2; font-size: 17px; }
}
.home-portrait:not(.home-tall) .home-behaviors {
  grid-template: auto / max-content minmax(0, 1fr); align-items: center; column-gap: 8px;
}
.home-portrait:not(.home-tall) .home-behavior-heading { display: grid; grid-template: 1fr / 1fr; }
.home-portrait:not(.home-tall) .home-behavior-heading h2, .home-portrait:not(.home-tall) .home-behavior-heading .text-button { grid-area: 1 / 1; }
.home-portrait:not(.home-tall) .home-behavior-heading h2 { align-self: start; pointer-events: none; font-size: 15px; line-height: 21px; }
.home-portrait:not(.home-tall) .home-behavior-heading .text-button { align-self: stretch; align-items: end; justify-content: start; padding: 20px 0 4px; font-size: 11px; }
.home-portrait:not(.home-tall) .home-behavior-heading small { margin-inline: 3px; font-size: 10px; }
.home-portrait:not(.home-tall) .home-behavior-heading .icon { width: 12px; }
.home-portrait:not(.home-tall) .home-behavior-buttons { gap: 5px; }
.home-portrait:not(.home-tall) .home-behavior { gap: 3px; padding: 5px 7px; min-height: 50px; }
.home-portrait:not(.home-tall) .behavior-copy b { font-size: 13px; line-height: 18px; }
.home-portrait:not(.home-tall) .home-behavior > strong { font-size: 16px; }
@media (max-width: 699px) {
  .home-portrait .pet-preview-entry { min-width: 48px; justify-content: center; }
  .home-portrait .pet-yard-entry { background: transparent; border-color: transparent; }
  .home-portrait .pet-home-interactions { gap: 4px; }
  .home-portrait .pet-home-interactions .pet-home-care {
    flex-direction: column; gap: 3px; padding: 3px 2px; border-color: transparent; box-shadow: none;
    color: #40512e; background: transparent; font-size: 13px; line-height: 17px; white-space: nowrap;
  }
  .home-portrait .pet-home-care .icon { width: 20px; height: 20px; }
  .home-portrait .pet-home-care:first-child .icon { color: #9b5e47; }
  .home-portrait .pet-home-care:active, .home-portrait .pet-yard-entry:active { background: #e1e6c5; }
  .view-points .bottom-nav { background: #fbf6e7; box-shadow: none; }
  .view-points .nav-item.active { background: #e7ecd3; border-color: transparent; box-shadow: none; }
  .view-points .voice-entry { background: transparent; border-color: transparent; box-shadow: none; }
}
/* A taller phone can show two clear amounts and a full-width row of actions.
   Shorter viewports keep the same actions next to the balance. */
.interaction-home.home-roomy {
  --wallet-height: 140px;
  gap: 10px; padding: 10px 12px;
}
.home-roomy .credit-card {
  grid-template: minmax(0, 1fr) 48px / minmax(0, 1fr);
  gap: 8px; padding: 10px 12px; border-radius: 19px;
}
.home-roomy .credit-score {
  grid-template: auto auto / minmax(0, 1fr) minmax(0, 1fr) 64px;
  align-items: center; align-content: center; column-gap: 10px; padding: 0;
}
.home-roomy .credit-kicker { grid-area: 1 / 1; font-size: 12px; line-height: 17px; }
.home-roomy .credit-score > .credit-value { grid-area: 2 / 1; font-size: 29px; line-height: 32px; }
.home-roomy .credit-score > .credit-value.long-balance { font-size: 13px; line-height: 16px; }
.home-roomy .credit-redeemable {
  grid-area: 1 / 2 / 3 / 3; align-self: stretch; align-content: center; display: grid;
  gap: 1px; padding-left: 8px; border-left: 1px solid #6d886c; font-size: 12px; line-height: 17px;
}
.home-roomy .credit-redeemable b { font-size: 23px; line-height: 29px; }
.home-roomy .credit-redeemable b.long-balance { font-size: 13px; line-height: 16px; }
.home-roomy .credit-scene-art { right: 3px; top: 0; width: 58px; height: calc(100% - 19px); transform: none; }
.home-roomy .credit-history-hint {
  position: absolute; bottom: 0; right: 0; width: 64px; justify-content: center; color: #f9efd0;
  font-size: 11px; line-height: 15px; gap: 3px; text-decoration: none;
}
.home-roomy .credit-actions { grid-template: 48px / minmax(0, 3fr) minmax(0, 2fr); width: 100%; height: 48px; gap: 8px; }
.home-roomy .credit-add, .home-roomy .credit-rewards { flex-direction: row; gap: 6px; font-size: 15px; }
.home-roomy .pet-home-card { gap: 7px; padding: 8px; border-radius: 19px; }
.home-roomy .pet-identity, .home-roomy .pet-growth-line { gap: 6px; }
.home-roomy .pet-home-heading .pet-level { font-size: 12px; }
.home-roomy .pet-growth-numbers strong { font-size: 17px; }
.home-roomy .pet-home-care { min-height: 50px; }
.home-tall .home-behaviors { grid-template-rows: 48px auto; }
.home-tall .home-behavior-heading h2 { font-size: 17px; }
.home-tall .home-behavior-heading .text-button { padding-inline: 8px 2px; }
.home-tall .home-behavior-buttons { gap: 8px; }
.home-tall .home-behavior { min-height: 50px; padding: 7px 11px; box-shadow: none; }
.home-tall .home-behavior > strong { font-size: 18px; }
@media (max-width: 699px) and (orientation: landscape) {
  .home-wide .pet-home-interactions .pet-home-care { flex-direction: column; min-height: 48px; gap: 1px; padding: 2px; font-size: 12px; }
}
@media (max-height: 450px) {
  .interaction-home.home-wide {
    grid-template-columns: minmax(184px, 38fr) minmax(0, 62fr);
    grid-template-rows: 100px minmax(0, 1fr); padding: 4px 8px; gap: 4px 8px;
  }
  .home-wide .home-behavior-heading h2 { font-size: 15px; }
  .interaction-home .pet-home-card { padding: 5px; gap: 4px; }
}
.home-gallery.gallery-focused .interaction-home { grid-template: minmax(0, 1fr) / minmax(0, 1fr); grid-template-areas: "companion"; }
.gallery-focused .credit-card, .gallery-focused .home-behaviors { display: none; }
.gallery-landscape .pet-home-card { grid-template: auto minmax(0, 1fr) / minmax(0, 6fr) minmax(270px, 4fr); }
.gallery-landscape .pet-home-heading, .gallery-landscape .pet-home-stage { grid-column: 1; }
.gallery-landscape .pet-preview-panel { grid-column: 2; grid-row: 1 / 3; align-self: center; }
@media (min-width: 480px) and (max-height: 350px) {
  .interaction-home.home-wide { padding-block: 2px; row-gap: 2px; }
  .home-wide .home-behavior, .home-wide .home-behavior-buttons.count-1 > .home-behavior { min-height: 48px; padding-block: 3px; }
  .home-wide .pet-home-card:not(.is-previewing) { grid-template: auto minmax(0, 1fr) / minmax(0, 1fr) 112px; }
  .home-wide .pet-home-card:not(.is-previewing) .pet-home-heading { grid-column: 1 / -1; }
  .home-wide .pet-home-interactions { align-self: center; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; }
  .home-wide .pet-home-interactions .pet-home-care { flex-direction: column; min-height: 48px; padding: 2px; gap: 0; font-size: 12px; }
}
.empty-behaviors { border-color: #c9b785; color: #88734b; background: rgba(255, 250, 232, .6); }
@media (max-width: 359px) {
  .pet-home-interactions { gap: 4px; }
  .pet-home-interactions .pet-home-care { gap: 2px; padding-inline: 1px; white-space: nowrap; }
  .pet-home-care .icon { width: 16px; height: 16px; }
}
/* Give the dragon the full shot on short screens; the care buttons sit directly below. */
@media (max-width: 699px) and (max-height: 620px), (max-height: 450px) {
  .pet-home-card:not(.is-previewing) .farm-scene-caption { display: none; }
}
.template-create { gap: 6px; min-height: 48px; border: 1px solid #cbbd97; color: #5d5838; background: #fffbee; box-shadow: inset 0 1px 0 #fff; font-size: 13px; }
.template-create .icon { width: 18px; height: 18px; }

/* Side panels share a framed title bar, fixed actions, and an independent scroll area. */
.sheet:not(.farm-game-sheet) {
  border: 1px solid #b79761;
  background: linear-gradient(150deg, #fff8e8, #f2e8d0);
  box-shadow: var(--farm-shadow);
}
.sheet:not(.farm-game-sheet) > .sheet-grip { width: 36px; height: 3px; background: #c5ad7d; }
.sheet-overlay, .saas-main {
  position: fixed;
  top: clamp(0px, var(--form-viewport-top, 0px), var(--form-covered-height, 0px));
  bottom: auto;
  --app-height: var(--form-height, 100vh);
}
.sheet:not(.farm-game-sheet) > .sheet-header {
  min-height: 76px;
  padding: 9px 16px 12px;
  border-bottom: 1px solid #d8c296;
  background: linear-gradient(#fffaeb, #f4e8c9);
  box-shadow: 0 2px 0 rgba(166, 125, 60, .05);
}
.sheet:not(.farm-game-sheet) .sheet-heading { padding-inline: 12px; }
.sheet:not(.farm-game-sheet) .sheet-header h2 { color: #5f482a; font-size: 21px; font-weight: 750; }
.sheet:not(.farm-game-sheet) .sheet-header p { color: #8a7552; font-size: 11px; }
.sheet:not(.farm-game-sheet) .sheet-header .icon-button:not(.nav-add) {
  border: 1px solid #dac596;
  border-radius: 14px;
  color: #7c6441;
  background: #fff9e8;
  box-shadow: var(--farm-small-shadow);
}
.sheet-body { scrollbar-width: thin; scrollbar-color: #c9b184 transparent; }
.sheet:not(.farm-game-sheet) .sheet-body { padding: 22px 26px 28px; padding-bottom: calc(28px + env(safe-area-inset-bottom)); }
.sheet:not(.farm-game-sheet) .sheet-footer {
  gap: 10px;
  padding: 15px 26px 18px;
  padding-bottom: calc(18px + env(safe-area-inset-bottom));
  border-top: 1px solid #ddcba6;
  background: #f8efd9;
}
.sheet-footer > .btn + .btn { margin-left: 0; }
.sheet:not(.farm-game-sheet) .sheet-save { min-width: 72px; padding-inline: 15px; }

/* Authorization interrupts the whole app, with one centered, viewport-contained dialog. */
.sheet-overlay.global-dialog-overlay {
  z-index: 150;
  align-items: center;
  justify-content: center;
  padding: 16px;
  padding-top: max(16px, env(safe-area-inset-top));
  padding-bottom: max(16px, env(safe-area-inset-bottom));
}
.global-dialog-overlay > .sheet-backdrop { background: rgba(11, 32, 24, .72); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); }
.sheet.global-dialog {
  width: 100%;
  max-width: 500px;
  height: auto;
  max-height: calc(var(--app-height, 100vh) - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  margin: 0;
  border: 1px solid #d4c196;
  border-radius: 25px;
  background: #fff8e7;
  box-shadow: 0 22px 80px rgba(4, 20, 11, .38), inset 0 1px 0 #fff;
}
.global-dialog > .sheet-grip { display: none; }
.sheet.global-dialog > .sheet-header { min-height: 82px; padding: 12px 16px; background: linear-gradient(#fff9e8, #f1e6c9); }
.sheet.global-dialog .sheet-header h2 { font-size: 23px; line-height: 30px; white-space: normal; }
.sheet.global-dialog .sheet-header p { color: #6a5a3d; font-size: 12px; }
.global-dialog .sheet-body { padding: 24px; }
.global-dialog .sheet-footer { padding: 16px 24px 20px; }
.global-dialog .sheet-footer > .btn { min-height: 50px; }
.global-dialog .authorization-summary { margin-bottom: 20px; padding: 16px; border-radius: 15px; }
.global-dialog .authorization-values { font-size: 15px; }
.global-dialog .authorization-values > div { gap: 18px; }
.global-dialog .authorization-values dd { color: #354d2b; }
.parent-dialog-prompt {
  margin: 0 0 20px;
  padding: 14px 16px;
  border-left: 4px solid #5a7540;
  border-radius: 0 12px 12px 0;
  color: #36522e;
  background: #e9edd3;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.65;
}
.parent-dialog .field input[type="password"] { min-height: 56px; padding: 10px 14px; font-size: 25px; line-height: 1.2; letter-spacing: .3em; text-align: center; }
.parent-dialog .field > span { font-size: 14px; }
.points-confirm-dialog .authorization-values { font-size: 16px; }
.points-confirm-dialog .sheet-footer > .primary { flex: 1.5; }

/* Labels sit above the single control boundary, including date/time and account forms. */
.field {
  margin-bottom: 14px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.field > span { margin-bottom: 6px; color: #6b5739; font-size: 13px; font-weight: 600; line-height: 18px; }
.field input, .field select, .field textarea {
  min-height: 48px;
  padding: 11px 12px;
  border: 1px solid #cbb88e;
  border-radius: 11px;
  background: #fffdf6;
  color: #4d402e;
  box-shadow: inset 0 1px 2px rgba(114, 91, 47, .035);
  scroll-margin: 20px;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: #8a6831; outline-offset: 2px; }
.field input::placeholder, .field textarea::placeholder { color: #7d7058; }
.field textarea { min-height: 88px; }
.field input[aria-invalid="true"], .field select[aria-invalid="true"], .field textarea[aria-invalid="true"] { background: #fff4e8; }
.field-pair { gap: 12px; margin-bottom: 14px; border: 0; border-radius: 0; background: transparent; }
.field-pair > .field { margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; }
.field-pair > .field:first-child, .field-pair > .field:last-child { border-radius: 0; }
.field-pair > .field + .field { border-left: 0; }
.field-group { display: grid; gap: 14px; border: 0; border-radius: 0; background: transparent; }
.field-group > .field, .field-group > .field-pair { margin: 0; border: 0; }
.field-group > .field + .field, .field-group > .field + .field-pair, .field-group > .field-pair + .field { border-top: 0; }
.form-error { border-left-color: #ae5640; color: #994632; background: #f9e6d7; }
.sheet-form > .form-error { margin-inline: 26px; }
.filter-tabs, .day-tabs, .history-tabs, .pet-tabs, .form-type-toggle, .date-shortcuts {
  border: 1px solid #d6c195;
  background: #eadbb8;
  box-shadow: inset 0 1px 3px rgba(116, 84, 34, .06);
}
.filter-tab, .day-tab, .mode-tab { color: #88704a; }
.filter-tab.active, .day-tab.active, .mode-tab.active {
  color: #586c37;
  background: linear-gradient(#fffef0, #fbf2d6);
  box-shadow: inset 0 1px 0 #fff, 0 2px 4px rgba(123, 92, 37, .1);
}
.template-toggle { color: #766142; }
.template-toggle input { accent-color: #6e8749; }
.template-duplicate, .availability-note, .request-strip, .inbox-task, .reminder-banner {
  border: 1px solid #dfbf7d;
  background: linear-gradient(120deg, #fff6da, #f6e5b8);
  color: #82632f;
}
.availability-note { line-height: 1.7; }
.request-strip, .inbox-task, .reminder-banner { box-shadow: inset 0 1px 0 #fffbe9, 0 2px 0 rgba(155, 116, 47, .09); }
.status-label { color: #916b2d; }
.inbox-task > p, .request-copy small, .reminder-banner-copy small { color: #8b7144; }
.entry-summary, .redemption-math, .authorization-summary, .ledger-summary, .pet-resource-summary, .pet-buy-item {
  border: 1px solid #c9cca1;
  color: #5b6338;
  background: linear-gradient(130deg, #f0f1d7, #e3e7c3);
  box-shadow: inset 0 1px 0 #ffffef;
}
.entry-summary > strong, .redeem-preview > strong, .record-number, .rewards-sheet-heading strong { color: #5d783e; }
.redemption-math > div span, .redemption-math > span { color: #81825a; }
.redemption-math b { color: #61753f; }
.ledger-summary b { color: #566e37; font-variant-numeric: tabular-nums; }
.record-row { border-bottom-color: #decba5; }
.record-row p, .record-row small { color: #89734f; }
.record-number small { color: inherit; }
.manage-list, .menu-group, .farm-collection-links { border: 1px solid #deccab; background: #fffaf0; box-shadow: inset 0 1px 0 #fff; }
.manage-row, .menu-row { border-bottom-color: #e8dbc0; }
.manage-row small, .menu-row small, .sync-status { color: #8a7653; }
.manage-row > .icon, .menu-row > .icon { color: #a4936c; }
.menu-symbol { border: 1px solid #c9cb9d; color: #7e8951; background: #eef0d8; }
.menu-group + .menu-group { margin-top: 14px; }
.empty-state, .picker-empty p { color: #8b7c5b; }
.empty-state {
  margin-block: 12px;
  padding: 38px 20px;
  border: 1px dashed #d9c79f;
  border-radius: 18px;
  background: rgba(255, 252, 239, .55);
}
.value-list > div { border-bottom-color: #decfac; }
.value-list dt, .status-line, .template-save-preview { color: #83704c; }
.math-question { padding: 22px 0 28px; color: #745a30; font-variant-numeric: tabular-nums; letter-spacing: .04em; }
.profile-photo-preview { border-color: #d1b47d; background: #fff1cc; box-shadow: inset 0 1px 0 #fff9e9; }
.profile-photo-editor > p { color: #8d7956; }
.profile-photo-editor > .profile-photo-help { color: #6b593c; line-height: 1.7; }

/* Reward and companion collections look like shelves in the same village. */
.reward-card, .pet-supply-card, .pet-scene-card, .journey-step {
  border: 1px solid #ddcba4;
  border-radius: 17px;
  background: #fffbef;
  box-shadow: inset 0 1px 0 #fff;
}
.reward-symbol { border: 1px solid #cace9e; color: #7d8b50; background: #ecf0d2; }
.reward-symbol.weekend { border-color: #e4c388; color: #ab7b35; background: #faebbf; }
.reward-symbol.outing { border-color: #c0cbae; color: #6d8162; background: #e7efdc; }
.reward-cost { color: #668046; }
.reward-rule, .rewards-sheet-heading p, .pet-supply-card p, .pet-buy-item p, .pet-resource-summary small { color: #8a7854; }
.rewards-sheet-heading { flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.sheet .rewards-history-entry { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; gap: 7px; min-width: 108px; min-height: 48px; margin: 0; padding: 10px 12px; border: 1px solid #bdc394; border-radius: 13px; color: #405d33; background: #edf0d7; font-size: 14px; font-weight: 650; }
.rewards-history-entry .icon { width: 19px; height: 19px; }
.reward-card > .icon { color: #ab9770; }
.sheet .rewards-grid { display: flex; flex-direction: column; flex-wrap: nowrap; margin: 0; }
.sheet .reward-card { flex-wrap: nowrap; width: 100%; min-height: 96px; margin: 0 0 10px; padding: 16px; }
.sheet .reward-info { flex: 1; margin: 0 10px 0 14px; }
.sheet .reward-info > strong { min-width: 0; font-size: 16px; }
.sheet .reward-card > .reward-symbol { width: 52px; height: 52px; border-radius: 15px; }
.scene-badge { border-color: #d5b773; color: #9d7931; background: #fff0c1; }
.pet-scene-card.locked { background: #f0ebda; }
.pet-scene-card.locked .scene-badge { border-color: #d1c9ad; color: #9c9477; background: #e9e4d4; }
.pet-daily-marks > span { border-color: #d4c8a4; color: #88794f; background: #fff8e4; }
.pet-daily-marks [data-completed="true"] { border-color: #afbc85; color: #657d43; background: #e6edcb; }
.pet-choice { border-color: #d4c299; background: #fff8e4; }
.pet-choice.selected { border-color: #7e9554; background: #eaf0d2; }
.pet-choice small, .journey-step span, .journey-step small { color: #8b7953; }
.journey-step.current { border-color: #b0bd83; background: #edf0d4; }
.journey-badge { color: #788c4d; background: #e6ebc7; }
.journey-badge .icon { color: inherit; }
.context-ai { border: 1px solid #d5c095; background: #ece3ca; box-shadow: inset 0 1px 0 #fff5db; }
.context-ai-heading > strong { color: #867044; }
.context-ai-heading > span { border: 1px solid #d6c49a; color: #88784e; background: #f7efd9; }
.context-ai .field { border: 0; box-shadow: none; }
.context-ai .field > span, .context-ai-status, .context-voice-status { color: #8a7751; }
.context-ai textarea { border-color: #d2bd8b; background: #fffbef; }
.ai-field-filled { animation: ai-field-filled 1.1s ease-out; }
@keyframes ai-field-filled { from { box-shadow: 0 0 0 2px #7b9654; } to { box-shadow: 0 0 0 0 transparent; } }
@media (prefers-reduced-motion: reduce) { .ai-field-filled { animation: none; } }
.voice-start { border-color: #b4bf87; color: #687e41; background: linear-gradient(#f3f2d8, #e0e8ba); }
.voice-box p { color: #8a7751; }
.assistant-answer { border-color: #c2c99b; color: #60723e; background: #edf1d7; }
.picker-search input { border: 1px solid #d8c39a; background: #fffaf0; color: #5f4d32; }
.picker-grid .behavior-card { border: 1px solid #dfcda6; background: #fffaf0; box-shadow: var(--farm-small-shadow); }
.picker-grid .behavior-symbol { border: 1px solid #cbd1a1; color: #829456; background: #eaf0d2; }
.picker-grid .behavior-card > strong { color: #657d43; }
.picker-page-label { color: #88744d; }
.picker-page-label input { border: 1px solid #d8c39a; color: #725b35; background: #fffaf0; }
.behavior-picker-body { flex: 1 1 auto; min-height: 0; padding: 20px 26px 14px; }
.picker-footer { border-top: 1px solid #dfcba3; padding: 10px 26px; background: #f6ebd2; }
.picker-footer > .icon-button { color: #7d7444; }
.sheet .picker-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* Reminders are a paper noticeboard with the same sage completion action. */
.view-reminders { background: #e2e5c9; }
.reminders-screen { max-width: none; padding: 10px 26px 28px; }
.reminder-heading { margin: 8px 0 20px; }
.reminder-heading h2 { color: #674e2e; font-size: 29px; letter-spacing: -.03em; }
.reminder-heading p, .list-footnote { color: #8a7651; }
.reminder-heading > .icon-button { border-radius: 14px; }
.reminder-toolbar .day-tab { min-width: 58px; padding-inline: 13px; }
.reminder-toolbar > .text-button { color: #8e713e; }
.events-label { color: #7f693f; }
.task-row {
  border: 1px solid #ddcaa2;
  background: #fffaf0;
  box-shadow: inset 0 1px 0 #fff, 0 2px 0 rgba(143, 108, 50, .06);
}
.task-time { color: #9a793f; }
.task-time small, .task-copy p, .task-copy .task-note, .task-copy small { color: #8c7b59; }
.task-open > .icon { color: #af9c75; }
.task-complete { border-color: #c7c79b; color: #92986c; background: #f4f3de; box-shadow: inset 0 1px 0 #fff; }
.task-row.is-done { border-color: #cdd0a9; background: #e9edda; }
.task-row.is-done .task-copy strong { color: #8b8c70; }
.task-complete.done, .task-row.is-done .task-complete { border-color: #a8b67c; color: #688243; background: #dfe9c5; }
.advance-events { border-top-color: #d9c69d; }
.advance-events h3 { color: #806237; }
.advance-events .section-heading > small, .completed-list summary { color: #8b7851; }
.reminder-banner { margin: 12px 26px; padding: 13px; }
.reminder-banner-copy > .icon { color: #a47f35; }
.reminder-banner-copy strong { color: #755a32; }
.reminder-banner-actions { gap: 6px; }
.reminder-banner-actions .btn + .btn { margin-left: 0; }

/* Account and family pages use the same side panel and control system. */
.saas-main { display: flex; align-items: flex-start; justify-content: flex-end; padding: var(--world-gutter); }
.saas-card {
  position: relative;
  flex: 0 0 var(--world-panel-width);
  width: var(--world-panel-width);
  max-width: none;
  margin: auto 0;
  padding: clamp(25px, 3vw, 42px);
  border: 1px solid #b79761;
  border-radius: 28px 12px 28px 28px;
  background: linear-gradient(150deg, #fffaf0, #f3e7cb);
  box-shadow: var(--farm-shadow), inset 0 1px 0 #fffdf6;
}
.saas-card::before {
  content: "";
  position: absolute;
  left: 32px;
  top: -4px;
  width: 64px;
  height: 6px;
  border: 1px solid #b18c50;
  border-radius: 4px;
  background: #d9b570;
  box-shadow: inset 0 1px 0 #f9dda4;
}
.saas-brand { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; color: #907449; font-size: 12px; font-weight: 650; letter-spacing: .1em; }
.saas-brand::before { content: ""; width: 8px; height: 8px; border: 1px solid #b3924a; border-radius: 3px; background: #e8c675; transform: rotate(-12deg); }
.saas-card h1 { color: #5d482d; font-size: clamp(25px, 2.4vw, 32px); font-weight: 750; letter-spacing: -.035em; }
.saas-card h2 { color: #7d633d; }
.saas-short-status { color: #90774e; font-size: 14px; line-height: 1.75; }
.saas-short-status:empty { min-height: 0; margin: 13px 0; }
.saas-identity { padding: 12px 14px; border: 1px solid #dcc69c; border-radius: 12px; background: #f8edce; color: #887049; }
.saas-content form { gap: 16px; }
.saas-content .field { gap: 6px; padding: 0; border: 0; background: transparent; box-shadow: none; }
.saas-content .field > span { margin-bottom: 0; color: #6b5739; font-size: 13px; }
.saas-content .field input, .saas-content .field select {
  min-height: 48px;
  padding: 11px 12px;
  border: 1px solid #cbb88e;
  border-radius: 11px;
  color: #5a472e;
  background: #fffdf4;
  box-shadow: inset 0 2px 3px rgba(127, 97, 47, .03), 0 1px 0 #fff;
}
.saas-content form > .btn.primary { margin-top: 6px; min-height: 54px; }
.saas-footer { gap: 10px; padding-top: 21px; margin-top: 24px; border-top: 1px solid #e1cc9f; }
.saas-footer:empty { display: none; }
.saas-footer .btn { font-size: 14px; }
.saas-menu { gap: 10px; }
.saas-menu > .btn { justify-content: flex-start; min-height: 54px; padding-inline: 17px; }
.saas-list li { padding-block: 17px; border-bottom-color: #dfcda7; }
.saas-list small { color: #8e7851; font-size: 13px; }
.saas-list .btn { max-width: 45%; padding-inline: 13px; font-size: 14px; }
.saas-actions { gap: 10px; }

/* Loading, reconnecting and renderer fallback all remain readable without WebGL. */
.loading-screen {
  width: min(420px, calc(100% - 36px));
  margin: min(28vh, 220px) auto 0;
  padding: 35px 25px;
  border: 1px solid #c5a570;
  border-radius: 24px;
  background: linear-gradient(#fff9e5, #f3e4bf);
  color: #725834;
  box-shadow: var(--farm-shadow);
}
.loading-mark { font-size: 27px; color: #79602f; }
.loading-screen p { color: #927d52; }
.toast { border: 1px solid #8c754c; border-radius: 15px; color: #fff7df; background: #635333; box-shadow: 0 4px 0 rgba(60, 47, 24, .16), 0 10px 30px rgba(60, 47, 24, .14); }
.farm-scene-fallback { color: #6c784b; background: linear-gradient(140deg, #e7edc9, #cbdca9); }
.farm-scene-fallback strong { color: #5f6b3e; }
.farm-scene-fallback .pet-growth-portrait { max-height: 100%; }
.pet-still-caption { position: absolute; bottom: 8px; right: 10px; color: #344526; font-size: 12px; }
.farm-scene-fallback p { color: #79835c; }
.farm-retry, .farm-error { border-color: #dcb778; color: #886537; background: #fff0ca; }

/* Farm HUD preserves the renderer's existing camera and viewport measurements. */
.farm-game-sheet { background: #b4c88b; }
.farm-game-sheet .sheet-heading, .farm-game-sheet .sheet-header .icon-button, .farm-game-sheet .farm-home-link {
  border-color: #9d7947;
  color: #775b34;
  background: linear-gradient(#fffae9, #f3e4bb);
  box-shadow: inset 0 1px 0 #fffdf2, 0 3px 0 #a7834c, 0 7px 14px rgba(89, 70, 30, .09);
}
.farm-game-sheet > .farm-tabs, .farm-game-sheet .farm-plots, .farm-game-sheet > .farm-toolbar { border-color: #9f7b44; background: #d6b47b; box-shadow: inset 0 1px 0 #edcd95, 0 3px 0 #9e7a44; }
.farm-game-sheet .farm-tab.active { color: #6b7c41; background: linear-gradient(#fffbea, #f8eac7); }
.farm-game-sheet .farm-tool { border-color: #b8975d; color: #7b5e33; background: linear-gradient(#fffae9, #f2dfb1); }
.farm-game-sheet .farm-tool-primary { border-color: #4b6737; color: var(--action-on-primary); background: linear-gradient(var(--action-primary), #415d2c); }
.farm-game-sheet .farm-camera-button { border-color: #92703c; color: #7f5e2b; background: linear-gradient(#f8e2ac, #d9b574); box-shadow: inset 0 1px 0 #ffedc3, 0 3px 0 #9f7c43; }
.farm-game-sheet > .farm-focus-panel { border-color: #aa8751; background: linear-gradient(#fff9e8, #f5e9ca); box-shadow: inset 0 1px 0 #fff, 0 4px 0 #a5824b, 0 12px 28px rgba(74, 61, 28, .15); scrollbar-width: thin; scrollbar-color: #c8ae79 transparent; }
.farm-world-status { border-color: #c3a76e; color: #6e5934; background: rgba(255, 248, 222, .96); }
.farm-game-sheet .farm-plot { border-color: #c4a877; background: linear-gradient(#fff9e9, #f7eac8); }
.farm-game-sheet .farm-plot.ready { border-color: #9ead65; background: linear-gradient(#f3f5d9, #e1e9b1); }
.farm-catalog-item, .farm-seed, .farm-animal-row, .farm-companion-care { border-color: #dfca9e; background: #fffaf0; }
.farm-catalog-art, .farm-detail-art { background: linear-gradient(140deg, #e9edcf, #dce5b8); }
.farm-catalog-copy > strong, .farm-animal-row strong, .farm-seed strong { color: #697444; }
.farm-seed.selected { border-color: #91a45d; background: #edf2d4; }
.farm-tabs { border: 1px solid #d1bd8b; background: #eaddb9; }
.farm-tab { color: #8a7247; }
.farm-tab.active { color: #667a3f; background: #fffae9; }
.farm-note, .farm-intro p, .farm-companion-care p { color: #8a7b55; }
.farm-crop-count { border-color: #d9c28f; background: #fff6dc; }
.farm-album-card { border-color: #c3c596; background: #ecf0d4; }
.farm-album-card.achieved { border-color: #d4be7c; background: #fff1c5; }
.farm-link + .farm-link { border-top-color: #eadabb; }

/* Wide screens reserve a quiet left stage and a usable, consistently aligned panel. */
@media (min-width: 701px) and (orientation: landscape) {
  body[data-world-route]:not([data-world-route="farm"]) .app-shell { background: transparent; }
  body[data-world-route]:not([data-world-route="farm"]).sheet-open .app-shell { visibility: hidden; }
  body[data-world-route]:not([data-world-route="farm"]) .sheet-overlay:not(.global-dialog-overlay) {
    align-items: center;
    justify-content: flex-end;
    padding: var(--world-gutter);
  }
  body[data-world-route]:not([data-world-route="farm"]) .sheet-overlay:not(.global-dialog-overlay) > .sheet-backdrop { background: transparent; }
  body[data-world-route]:not([data-world-route="farm"]) .sheet:not(.global-dialog) {
    width: var(--world-panel-width);
    max-width: none;
    height: calc(var(--app-height, 100vh) - var(--world-gutter) * 2);
    max-height: calc(var(--app-height, 100vh) - var(--world-gutter) * 2);
    margin: 0;
    border-radius: 26px 12px 26px 26px;
  }
  body[data-world-route]:not([data-world-route="farm"]) .sheet-grip { display: none; }
  body[data-world-route="reminders"]:not(.sheet-open) .app-shell {
    position: absolute;
    inset: var(--world-gutter) var(--world-gutter) var(--world-gutter) auto;
    width: var(--world-panel-width);
    height: calc(var(--app-height, 100vh) - var(--world-gutter) * 2);
    border: 1px solid #b79761;
    border-radius: 26px 12px 26px 26px;
    background: linear-gradient(150deg, #fff8e8, #f2e8d0);
    box-shadow: var(--farm-shadow);
  }
  body[data-world-route="reminders"] .app-header { min-height: 78px; padding: 13px 22px; }
  body[data-world-route="reminders"] .bottom-nav { padding: 10px 18px; }
  body[data-world-route="reminders"] .nav-item { flex-direction: row; min-height: 48px; padding: 8px 12px; font-size: 14px; }
  body[data-world-route="reminders"] .nav-item .icon { margin-right: 6px; }
  body[data-world-route="reminders"] .voice-entry { min-width: 92px; min-height: 48px; margin-left: 10px; padding: 8px 10px; font-size: 14px; }
  body[data-world-route="reminders"] .reminder-banner { display: block; }
  body[data-world-route="reminders"] .reminder-banner-actions { margin-top: 10px; }
  body[data-world-route="reminders"] .reminder-banner-actions .btn { flex: 1; }
  .sheet .farm-catalog { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sheet .farm-seed { min-height: 145px; }
  .sheet .farm-seed .farm-art { width: 64px; height: 64px; }
}

/* Portrait is a window onto the village above a scrollable sheet. */
@media (max-width: 700px), (orientation: portrait) {
  :root { --world-gutter: 14px; --world-panel-width: calc(100vw - 28px); }
  .world-stage-shade { background: linear-gradient(transparent 8%, rgba(242, 234, 208, .12) 28%, #efe6ce 65%); }
  .world-caption {
    top: calc(12px + env(safe-area-inset-top));
    left: 16px;
    bottom: auto;
    width: auto;
    max-width: calc(100% - 32px);
    padding: 10px 14px 12px;
    border-radius: 7px 18px 18px 18px;
    background: rgba(255, 249, 228, .92);
    box-shadow: 0 2px 0 rgba(144, 107, 48, .2), 0 7px 18px rgba(79, 83, 39, .07);
  }
  .world-eyebrow { margin-bottom: 3px; font-size: 10px; letter-spacing: .1em; }
  .world-caption h2 { font-size: clamp(20px, 5vw, 27px); line-height: 1.3; }
  .world-caption p { display: none; }
  .world-scene-fallback {
    top: calc(var(--world-mobile-scene) * .64);
    left: 16px;
    right: 16px;
    max-width: calc(100% - 32px);
    padding: 7px 12px;
    border-radius: 11px;
    font-size: 11px;
  }
  body[data-world-route]:not([data-world-route="farm"]) .app-shell { background: transparent; }
  body[data-world-route]:not([data-world-route="farm"]).sheet-open .app-shell { visibility: hidden; }
  body[data-world-route]:not([data-world-route="farm"]) .sheet-overlay:not(.global-dialog-overlay) { align-items: flex-end; padding: 0; }
  /* Give the covered part of the screen back to the form before shrinking the editor. */
  .sheet-overlay, .saas-main {
    --form-scene: max(0px, calc(var(--world-mobile-scene) - var(--form-covered-height, 0px)));
  }
  body[data-world-route]:not([data-world-route="farm"]) .sheet-overlay:not(.global-dialog-overlay) > .sheet-backdrop { background: transparent; }
  body[data-world-route]:not([data-world-route="farm"]) .sheet:not(.global-dialog) {
    width: 100%;
    max-width: 100%;
    height: calc(var(--app-height, 100vh) - var(--form-scene));
    max-height: calc(var(--app-height, 100vh) - var(--form-scene));
    margin: 0;
    border-radius: 24px 24px 0 0;
    border-bottom: 0;
    box-shadow: 0 -5px 28px rgba(104, 85, 40, .12), inset 0 1px 0 #fffcf0;
  }
  .sheet:not(.farm-game-sheet) > .sheet-header { min-height: 66px; padding: 5px 10px 9px; }
  .sheet:not(.farm-game-sheet) .sheet-heading { padding-inline: 9px; }
  .sheet:not(.farm-game-sheet) .sheet-header h2 { font-size: 19px; }
  .sheet:not(.farm-game-sheet) .sheet-body { padding: 17px 18px 22px; padding-bottom: calc(22px + env(safe-area-inset-bottom)); }
  .sheet:not(.farm-game-sheet) .sheet-footer { padding: 12px 18px; padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .sheet-form > .form-error { margin-inline: 18px; }
  .sheet:not(.farm-game-sheet) .sheet-save { padding-inline: 12px; }
  .behavior-picker-body { padding: 16px 18px 12px; }
  .picker-footer { padding: 10px 18px; }
  .saas-main { display: block; padding: var(--form-scene) 0 0; padding-bottom: 0; }
  .saas-card {
    width: 100%;
    min-height: calc(var(--app-height, 100vh) - var(--form-scene));
    max-width: none;
    margin: 0;
    padding: 25px 24px;
    padding-bottom: calc(25px + env(safe-area-inset-bottom));
    border-bottom: 0;
    border-radius: 26px 26px 0 0;
    box-shadow: 0 -5px 28px rgba(104, 85, 40, .12), inset 0 1px 0 #fffcf0;
  }
  .saas-card::before { top: 10px; left: calc(50% - 17px); width: 34px; height: 3px; border: 0; border-radius: 4px; background: #cfb88a; box-shadow: none; }
  .saas-brand { margin-top: 3px; margin-bottom: 9px; }
  .saas-card h1 { font-size: 27px; }
  .saas-short-status:empty { margin-block: 11px; }
  .saas-footer { margin-top: 23px; }
  body[data-world-route="reminders"]:not(.sheet-open) .app-shell {
    position: absolute;
    top: var(--world-mobile-scene);
    width: 100%;
    height: calc(var(--app-height, 100vh) - var(--world-mobile-scene));
    border: 1px solid #c0a06a;
    border-bottom: 0;
    border-radius: 24px 24px 0 0;
    background: linear-gradient(150deg, #fff8e8, #f2e8d0);
    box-shadow: 0 -5px 24px rgba(93, 80, 39, .1);
  }
  body[data-world-route="reminders"] .app-header { min-height: 69px; padding: 10px 17px; }
  body[data-world-route="reminders"] .reminders-screen { padding: 8px 17px 24px; }
  body[data-world-route="reminders"] .bottom-nav { gap: 8px; min-height: 68px; padding: 8px 13px; padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
  body[data-world-route="reminders"] .main-tabs { flex: 2; }
  body[data-world-route="reminders"] .nav-item { flex-direction: row; min-height: 48px; padding: 6px 8px; font-size: 14px; }
  body[data-world-route="reminders"] .nav-item .icon { width: 20px; height: 20px; margin: 0 5px 0 0; }
  body[data-world-route="reminders"] .voice-entry { flex: 1; min-width: 0; min-height: 48px; margin-left: 0; padding: 6px 8px; font-size: 14px; }
  .reminder-banner { margin: 10px 17px; }
  .reminder-heading { margin-top: 3px; }
  .reminder-heading h2 { font-size: 25px; }
  .reminder-toolbar .day-tab { min-width: 48px; padding-inline: 10px; }
  .reminder-toolbar .day-tab small { display: none; }
  .farm-toolbar { gap: 5px; }
  .farm-tool { padding-inline: 3px; }
  .farm-game-sheet .farm-plots { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .farm-game-sheet .farm-plot { min-width: 0; min-height: 68px; }
  .sheet .reward-card { padding: 13px; }
  .sheet .reward-info { margin-left: 11px; }
  .context-ai-input { flex-wrap: wrap; }
  .context-ai-input > .field { flex-basis: 160px; }
  .context-ai-actions { margin-left: auto; }
}

/* Tablet portrait has space for a wider paper margin without losing the scene. */
@media (min-width: 701px) and (orientation: portrait) {
  :root { --world-mobile-scene: min(30vh, 330px); }
  .world-caption { top: 28px; left: 30px; padding: 16px 21px; }
  .world-eyebrow { font-size: 11px; }
  .world-caption h2 { font-size: 30px; }
  .world-caption p { display: block; margin-top: 7px; }
  .saas-card { padding: 34px max(36px, calc((100% - 540px) / 2)); padding-bottom: calc(34px + env(safe-area-inset-bottom)); }
  .sheet:not(.farm-game-sheet) .sheet-body, .behavior-picker-body { padding-inline: max(28px, calc((100% - 590px) / 2)); }
  body[data-world-route="reminders"] .reminders-screen { max-width: 660px; width: 100%; margin-inline: auto; padding-inline: 28px; }
  .sheet .picker-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 380px) {
  .home-header .child-avatar { flex-basis: 36px; width: 36px; height: 36px; margin-right: 7px; border-radius: 12px; }
  .home-header .child-profile-copy strong { font-size: 16px; line-height: 20px; }
  .home-header .header-tools { gap: 4px; margin-left: 4px; }
  .home-header .home-inbox-button { padding-inline: 5px; }
  .header-tools .parent-entry { min-width: 64px; padding-inline: 9px; }
  .parent-dialog-prompt { padding: 12px; font-size: 16px; }
  .global-dialog .authorization-summary { padding: 13px; }
  .global-dialog .authorization-values { font-size: 14px; }
  .saas-card { padding-inline: 19px; }
  .saas-card h1 { font-size: 25px; }
  .saas-footer { gap: 8px; }
  .saas-footer .btn { padding-inline: 11px; }
  .sheet:not(.farm-game-sheet) > .sheet-header { padding-inline: 8px; }
  .sheet:not(.farm-game-sheet) .sheet-heading { padding-inline: 7px; }
  .sheet:not(.farm-game-sheet) .sheet-header h2 { font-size: 17px; }
  .sheet:not(.farm-game-sheet) .sheet-body { padding-inline: 13px; }
  .sheet:not(.farm-game-sheet) .sheet-footer { padding-inline: 13px; }
  .sheet .reward-card { padding: 11px; }
  .sheet .reward-card > .reward-symbol { width: 44px; height: 44px; border-radius: 13px; }
  .sheet .reward-info { display: block; margin-inline: 10px 0; }
  .sheet .reward-info > strong { font-size: 15px; }
  .sheet .reward-cost { display: block; margin: 3px 0 0; font-size: 20px; }
  .sheet .reward-rule { margin-top: 2px; font-size: 11px; }
  .sheet .picker-grid { gap: 7px; }
  .picker-grid .behavior-card { grid-template-columns: 22px minmax(0, 1fr); column-gap: 6px; padding-inline: 9px; }
  .picker-grid .behavior-symbol { width: 23px; height: 25px; }
  .picker-grid .behavior-copy b { font-size: 13px; }
  .farm-game-sheet > .farm-yard-tray { left: 8px; right: 8px; }
  .farm-game-sheet .farm-plots { gap: 1px; padding: 2px; }
  .farm-game-sheet .farm-plot { min-width: 0; }
  .farm-home-card .farm-tool { font-size: 11px; gap: 3px; }
  .farm-home-card .farm-tool-art { width: 23px; height: 23px; }
  .redemption-math { padding-inline: 7px; }
  .redemption-math b { font-size: 23px; }
  .pet-scene-card { grid-template-columns: 30px minmax(0, 1fr) auto; gap: 7px; padding-inline: 10px; }
  .pet-scene-card .scene-badge { width: 30px; height: 36px; }
  .pet-scene-card h3 { font-size: 14px; }
  .pet-scene-card .btn { min-width: 60px; font-size: 13px; }
}

/* Short phones keep both actions beside the amounts instead of stacking them. */
.home-portrait:not(.home-roomy) { --wallet-height: 88px; }
.home-portrait:not(.home-roomy) .credit-card { grid-template-columns: minmax(0, 1fr) 108px; padding-block: 5px; }
.home-portrait:not(.home-roomy) .credit-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: 48px; gap: 4px; width: 108px; height: 48px; }
.home-portrait:not(.home-roomy) .credit-add, .home-portrait:not(.home-roomy) .credit-rewards { min-height: 48px; height: 48px; }

/* Short tablets reserve the full action row and reduce the balance typography. */
@media (min-height: 451px) and (max-height: 650px) {
  .interaction-home.home-wide { grid-template-columns: minmax(186px, 38fr) minmax(0, 62fr); padding-block: 6px; row-gap: 6px; }
  .home-wide .credit-card { gap: 6px; padding: 8px; }
  .home-wide .credit-score { gap: 0; }
  .home-wide .credit-kicker { font-size: 11px; line-height: 14px; }
  .home-wide .credit-score > .credit-value { font-size: clamp(28px, 5vh, 34px); line-height: 1; }
  .home-wide .credit-redeemable b { font-size: 14px; line-height: 18px; }
  .home-wide .credit-redeemable b.long-balance { font-size: 12px; line-height: 14px; }
  .home-wide .credit-history-hint { font-size: 10px; line-height: 14px; }
}

/* The two 48px actions fill a 100px wallet without stealing balance space. */
@media (max-height: 450px) {
  .home-header .child-avatar { flex-basis: 36px; width: 36px; height: 36px; border-radius: 12px; }
  .view-points .bottom-nav { height: calc(58px + env(safe-area-inset-bottom)); min-height: calc(58px + env(safe-area-inset-bottom)); padding-block: 4px 5px; padding-bottom: calc(5px + env(safe-area-inset-bottom)); }
  .home-wide .credit-card { grid-template-columns: minmax(0, 1fr) 56px; grid-template-rows: minmax(0, 1fr); min-height: 100px; gap: 6px; padding: 0 6px; border-radius: 18px; }
  .home-wide .credit-score { gap: 0; padding: 0 46px 0 2px; }
  .home-wide .credit-kicker { font-size: 10px; line-height: 13px; }
  .home-wide .credit-score > .credit-value { font-size: 25px; line-height: 26px; }
  .home-wide .credit-score > .credit-value.long-balance { font-size: 12px; line-height: 14px; }
  .home-wide .credit-redeemable { padding: 0; border: 0; border-radius: 0; background: transparent; font-size: 10px; line-height: 14px; }
  .home-wide .credit-redeemable b { font-size: 13px; line-height: 16px; }
  .home-wide .credit-redeemable b.long-balance { font-size: 11px; line-height: 14px; }
  .home-wide .credit-history-hint { font-size: 10px; line-height: 14px; }
  .home-wide .credit-scene-art { width: 44px; height: 72px; }
  .home-wide .credit-actions { grid-template-columns: minmax(0, 1fr); grid-template-rows: repeat(2, 48px); gap: 2px; width: 56px; height: 98px; }
  .home-wide .credit-add, .home-wide .credit-rewards { flex-direction: column; gap: 1px; min-height: 48px; height: 48px; padding: 3px 2px; }
  .home-wide .credit-add { font-size: 11px; line-height: 13px; }
  .home-wide .credit-rewards { font-size: 12px; line-height: 14px; }
  .home-wide .credit-add .icon, .home-wide .credit-rewards .icon { width: 17px; height: 17px; }
}

/* Short layout viewport, including browsers that resize the layout for the keyboard. */
@media (max-height: 620px) {
  :root { --world-gutter: 12px; --world-mobile-scene: 104px; }
  .world-caption { padding: 11px 16px; bottom: 22px; }
  .world-caption h2 { font-size: 25px; }
  .world-caption p { display: none; }
  .saas-card { padding-top: 25px; padding-bottom: 25px; }
  .sheet:not(.farm-game-sheet) > .sheet-header { min-height: 60px; padding-top: 5px; padding-bottom: 7px; }
  .sheet:not(.farm-game-sheet) .sheet-body { padding-top: 14px; }
  .sheet:not(.farm-game-sheet) .sheet-footer { padding-top: 10px; padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
}
@media (max-height: 620px) and (max-width: 700px), (max-height: 620px) and (orientation: portrait) {
  .world-caption { top: calc(8px + env(safe-area-inset-top)); bottom: auto; padding: 8px 12px; }
  .world-caption h2 { font-size: 19px; }
  .world-eyebrow { font-size: 9px; margin-bottom: 2px; }
  .world-scene-fallback { top: 75px; padding: 3px 9px; font-size: 10px; }
  body[data-world-route="reminders"] .app-header { min-height: 58px; padding-block: 5px; }
  body[data-world-route="reminders"] .bottom-nav { min-height: 60px; padding-top: 5px; padding-bottom: calc(5px + env(safe-area-inset-bottom)); }
}
@media (max-height: 430px) and (max-width: 700px), (max-height: 430px) and (orientation: portrait) {
  :root { --world-mobile-scene: 64px; }
  .world-caption { padding-block: 7px; }
  .world-eyebrow { display: none; }
  .world-scene-fallback { top: 36px; left: auto; right: 12px; max-width: 54%; padding: 1px 7px; font-size: 9px; }
  .world-caption h2 { font-size: 18px; }
  .sheet:not(.farm-game-sheet) > .sheet-grip { display: none; }
}

/* A landscape keyboard can leave less than 200px for the PIN and both actions. */
.short-form-viewport .global-dialog-overlay {
  padding-top: max(4px, env(safe-area-inset-top));
  padding-bottom: max(4px, calc(env(safe-area-inset-bottom) - var(--form-covered-height, 0px)));
}
.short-form-viewport .sheet.global-dialog { max-height: 100%; }
.short-form-viewport .sheet.global-dialog > .sheet-header,
.short-form-viewport .sheet.global-dialog .sheet-footer { min-height: 0; padding-block: 3px; }
.short-form-viewport .sheet.global-dialog .sheet-body { padding-block: 6px; }

/* A validation message shares the field row so it cannot take height from the PIN. */
.short-form-viewport #parent-form {
  display: grid;
  grid-template: "error fields" minmax(0, 1fr)
                 "actions actions" auto / fit-content(35%) minmax(0, 1fr);
}
.short-form-viewport #parent-error {
  grid-area: error;
  align-self: center;
  margin: 0 0 0 12px;
  max-height: 100%;
}
.short-form-viewport #parent-form > .sheet-body { grid-area: fields; }
.short-form-viewport #parent-form > .sheet-footer { grid-area: actions; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media (forced-colors: active) {
  .btn, .farm-tool, .task-complete, .nav-item, .voice-entry, .sheet, .saas-card, .app-header, .bottom-nav, .parent-entry, .interaction-home .credit-card { border: 1px solid ButtonText; box-shadow: none; }
  .interaction-home .credit-score, .credit-kicker, .interaction-home .credit-score > .credit-value, .credit-redeemable, .credit-redeemable b, .credit-history-hint { color: ButtonText; text-shadow: none; }
  .credit-redeemable { border-color: ButtonText; background: ButtonFace; }
  .credit-scene-art { opacity: .4; }
  .field input, .field select, .field textarea { border: 1px solid FieldText; background: Field; color: FieldText; }
  .parent-dialog-prompt { border-color: Highlight; }
  .credit-score:focus-visible { outline-color: Highlight; }
  .nav-item.active, .day-tab.active, .filter-tab.active, .mode-tab.active { outline: 2px solid Highlight; outline-offset: -3px; }
}
