/* Same palette as the rest of the series: ink, cream panels, warm lines, green
   accent. The ground is a room instead of a garden, so the backdrop is darker
   and the box carries the colour. */
:root {
  --ink: #1f1710;
  --muted: #6a5a4a;
  --panel: rgba(255, 250, 240, 0.97);
  --line: #e0d4c2;
  --chip: #efe6d6;
  --accent: #3f7d63;
  --accent-ink: #fff;
  --danger: #b4462f;
  --room: #2a3a33;
  --room-low: #1b2620;
  --bar: rgba(20, 15, 10, 0.55);
  --wet: #4a9fd8;
  --leaf: #5bb04f;
  --bone: #d8cdb4;
  --clean: #8a7fd0;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; background: linear-gradient(var(--room), var(--room-low) 70%);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
button { font: inherit; }

/* ---------- the top bar ---------- */
#bar { position: fixed; top: 0; left: 0; right: 0; height: calc(50px + var(--safe-t)); padding: var(--safe-t) 10px 0;
  display: flex; align-items: center; gap: 8px; background: var(--bar); color: #fff; z-index: 5; backdrop-filter: blur(4px); }
#portrait { width: 44px; height: 34px; flex: none; }
#bar .who { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
#bar strong { font-size: 17px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; padding: 2px 7px; border-radius: 999px;
  background: rgba(255,255,255,0.16); white-space: nowrap; }
.bar-btns { display: flex; gap: 6px; margin-left: auto; }
.icon-btn { width: 38px; height: 34px; border: none; border-radius: 10px; background: rgba(255,255,255,0.14); color: #fff; font-size: 16px; cursor: pointer; flex: none; }

/* ---------- the screen ---------- */
#stage { position: fixed; inset: calc(50px + var(--safe-t)) 0 0; display: flex; flex-direction: column; padding: 0 10px calc(8px + var(--safe-b)); }
#box { flex: 1 1 auto; width: 100%; min-height: 160px; max-height: 62vh; display: block; }
.mood { margin: auto 0 0; padding-top: 3px; text-align: center; color: #e9e2d2; font-weight: 700; font-size: 14px; min-height: 1.2em; }

.facts { display: flex; gap: 6px; margin: 6px 0 0; }
.fact { flex: 1; display: grid; gap: 0; padding: 4px 8px; border-radius: 10px; background: rgba(255,255,255,0.08); color: #fff; }
.fact .label { font-size: 10px; text-transform: uppercase; letter-spacing: .07em; opacity: .72; }
.fact .value { font-weight: 800; font-size: 15px; font-variant-numeric: tabular-nums; }

.needs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; margin: 8px 0 0; }
.need { display: grid; grid-template-columns: 64px 1fr; align-items: center; gap: 6px; }
.need .label { font-size: 10px; color: #d9d2c2; text-transform: uppercase; letter-spacing: .05em; }
.need .track { display: block; height: 7px; border-radius: 99px; background: rgba(0,0,0,0.3); overflow: hidden; }
.need .track i { display: block; height: 100%; width: 0; border-radius: 99px; transition: width .3s ease; }
.need[data-need="moisture"] i { background: var(--wet); }
.need[data-need="food"] i { background: var(--leaf); }
.need[data-need="calcium"] i { background: var(--bone); }
.need[data-need="clean"] i { background: var(--clean); }
.need.low .label { color: #ffbf9a; }
.need.low .track i { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }

.acts { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 10px 0 0; }
.act { display: grid; justify-items: center; gap: 1px; padding: 8px 2px 6px; border: 0; border-radius: 14px;
  background: var(--panel); color: var(--ink); font-size: 11px; font-weight: 700; cursor: pointer;
  box-shadow: 0 3px 0 rgba(0,0,0,.22), 0 8px 20px rgba(0,0,0,.18); }
.act .ico { font-size: 20px; line-height: 1.1; }
.act:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0,0,0,.22); }
.act[disabled] { opacity: .45; box-shadow: none; }

.links { display: flex; gap: 6px; margin: 8px 0 0; }
.links .btn { flex: 1; padding: 9px 4px; font-size: 13px; }

.toast { position: fixed; left: 12px; right: 12px; bottom: calc(128px + var(--safe-b)); margin: 0; padding: 10px 14px;
  border-radius: 12px; background: rgba(20,15,10,0.88); color: #fff; text-align: center; font-weight: 600; font-size: 14px; z-index: 8; }

/* ---------- overlays ---------- */
.overlay { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(20, 32, 27, 0.66); backdrop-filter: blur(3px); z-index: 10; overflow: auto; }
.panel { position: relative; width: min(460px, 100%); max-height: calc(100vh - 32px); overflow: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 22px 24px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.panel.small { width: min(380px, 100%); text-align: center; }
.panel.tall { width: min(520px, 100%); }
.panel h1 { margin: 6px 0 4px; font-size: 30px; line-height: 1.05; }
.panel h2 { margin: 0 0 10px; font-size: 22px; }
.panel h3 { margin: 16px 0 6px; font-size: 15px; }
.panel p { line-height: 1.5; }
.tagline { margin: 0 0 16px; color: var(--muted); }
.lang { position: absolute; top: 14px; right: 14px; display: flex; gap: 2px; background: var(--chip); border-radius: 999px; padding: 3px; }
.lang button { font-size: 12px; font-weight: 700; border: 0; background: transparent; padding: 4px 10px; border-radius: 999px; cursor: pointer; color: var(--muted); }
.lang button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 14px; }
.btn { border: 0; border-radius: 12px; padding: 11px 18px; font-weight: 800; cursor: pointer; text-decoration: none; }
.btn.primary { background: var(--accent); color: var(--accent-ink); flex: 1 1 100%; font-size: 16px; }
.btn.secondary { background: var(--chip); color: var(--ink); }
.btn.danger { color: var(--danger); }
.btn:hover { filter: brightness(1.05); }
.hint { min-height: 1.2em; margin: 10px 0 0; font-size: 12px; color: var(--muted); text-align: center; }
footer { margin-top: 14px; font-size: 12px; color: var(--muted); text-align: center; }
footer a { color: inherit; }
.why { font-size: 14px; color: var(--muted); line-height: 1.45; }
.score { font-size: 28px; font-weight: 800; margin: 6px 0; font-variant-numeric: tabular-nums; }

.field { display: grid; gap: 4px; margin: 14px 0 0; text-align: left; font-size: 13px; font-weight: 700; color: var(--muted); }
.field input { font: inherit; font-size: 17px; font-weight: 600; color: var(--ink); padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 12px; background: #fff; }

/* the menu of leaves */
.foods { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.food { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px;
  background: #fff; cursor: pointer; font-weight: 700; text-align: left; }
.food .ico { font-size: 20px; }
.food small { display: block; font-weight: 500; color: var(--muted); font-size: 11px; }

/* the diary */
.diary { max-height: 52vh; overflow: auto; border-top: 1px solid var(--line); }
.entry { padding: 10px 2px; border-bottom: 1px solid var(--line); }
.entry .d { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.entry p { margin: 2px 0 0; line-height: 1.45; }
.entry.birthday { background: rgba(63,125,99,0.08); }

/* badges */
.badges { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; max-height: 52vh; overflow: auto; }
.badges li { padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.badges li.locked { opacity: .5; background: transparent; }
.badges b { display: block; font-size: 14px; }
.badges small { color: var(--muted); font-size: 11px; line-height: 1.35; display: block; }

/* the numbers */
.stats { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; }
.stats dt { color: var(--muted); font-size: 13px; }
.stats dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.plain { list-style: none; margin: 0; padding: 0; font-size: 13px; color: var(--muted); }
.plain li { padding: 3px 0; }

@media (max-height: 620px) {
  .facts { display: none; }
  .act { padding: 6px 2px 5px; }
  .act .ico { font-size: 18px; }
}
@media (min-width: 720px) {
  #stage { padding: 0 16px calc(12px + var(--safe-b)); max-width: 760px; margin: 0 auto; }
  .needs { grid-template-columns: repeat(4, 1fr); }
  .need { grid-template-columns: 56px 1fr; }
}
