/* Giardino: cozy, mobile-first. Light palette by default, dark follows the system. */

:root {
  --bg: #f3ecdc;
  --surface: #fffaf0;
  --surface-2: #f5edda;
  --surface-3: #ebe0c8;
  --line: rgba(84, 66, 38, .13);
  --ink: #3b3326;
  --ink-2: #7a6e58;
  --ink-3: #a3977f;
  --leaf: #5b9a56;
  --leaf-strong: #477f43;
  --leaf-ink: #ffffff;
  --leaf-soft: #e1eed3;
  --sun: #d99a2b;
  --sun-soft: #f8e9c4;
  --water: #3f8fbc;
  --water-soft: #dcebf4;
  --rose: #c95f6f;
  --rose-soft: #f6dfe0;
  --shadow: 0 10px 28px rgba(70, 50, 20, .14);
  --shadow-sm: 0 2px 8px rgba(70, 50, 20, .10);
  --radius: 16px;
  --tab-h: 62px;
  --top-h: 56px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --font: ui-rounded, "SF Pro Rounded", "Nunito", "Quicksand", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Roboto, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151b17;
    --surface: #1f2822;
    --surface-2: #26312a;
    --surface-3: #2f3c33;
    --line: rgba(255, 255, 255, .09);
    --ink: #eef1e6;
    --ink-2: #a9b6a5;
    --ink-3: #7d8b7a;
    --leaf: #7cc47a;
    --leaf-strong: #95d690;
    --leaf-ink: #10200f;
    --leaf-soft: #263a24;
    --sun: #f0bd55;
    --sun-soft: #3b3220;
    --water: #6db8e0;
    --water-soft: #1f3341;
    --rose: #e88592;
    --rose-soft: #3d2629;
    --shadow: 0 12px 30px rgba(0, 0, 0, .45);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.35;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

body { touch-action: manipulation; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { display: block; }
.hidden { display: none !important; }
.muted { color: var(--ink-2); font-size: .88rem; }
a { color: var(--leaf-strong); }
:focus-visible { outline: 3px solid var(--leaf); outline-offset: 2px; }

.screen { position: fixed; inset: 0; display: flex; flex-direction: column; }

/* ---------------- splash ---------------- */
.splash {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center;
  background: var(--bg); font-size: 3rem; transition: opacity .3s ease;
  animation: bob 1.4s ease-in-out infinite;
}
.splash.gone { opacity: 0; pointer-events: none; }
@keyframes bob { 50% { transform: translateY(-6px); } }

/* ---------------- login ---------------- */
.auth {
  align-items: center; justify-content: center;
  padding: calc(24px + var(--safe-t)) 18px calc(24px + var(--safe-b));
  background:
    radial-gradient(120% 70% at 50% 0%, var(--leaf-soft) 0%, transparent 65%),
    var(--bg);
  overflow-y: auto;
}
.auth-card {
  width: min(400px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 28px 22px 22px;
  box-shadow: var(--shadow);
  margin: auto 0;
}
.auth-logo { color: var(--leaf); width: 60px; margin: 0 auto 6px; }
.auth-logo svg { width: 100%; display: block; }
.auth h1 { margin: 0; text-align: center; font-size: 1.75rem; letter-spacing: .2px; }
.auth-sub { margin: 6px 0 22px; text-align: center; color: var(--ink-2); font-size: .95rem; }
.auth-foot { margin: 16px 4px 0; text-align: center; color: var(--ink-3); font-size: .8rem; }
.error { color: var(--rose); font-size: .9rem; min-height: 1.2em; margin: 10px 0 0; text-align: center; }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: .8rem; font-weight: 700; color: var(--ink-2); margin: 0 0 6px 2px; }
input[type=text], input[type=password], input[type=search], input[type=number], select, textarea {
  width: 100%; min-height: 48px; padding: 12px 14px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink);
  font-size: 16px; /* 16px avoids the iOS zoom on focus */
  -webkit-appearance: none; appearance: none;
}
select { background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%); background-position: calc(100% - 20px) 21px, calc(100% - 15px) 21px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
input:focus, select:focus { outline: 3px solid color-mix(in srgb, var(--leaf) 45%, transparent); outline-offset: 0; border-color: var(--leaf); }

/* ---------------- buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 12px 18px; border-radius: 14px; border: 0;
  font-size: 1rem; font-weight: 700; letter-spacing: .1px;
  background: var(--surface-3); color: var(--ink);
  transition: transform .1s ease, filter .15s ease, opacity .15s;
  user-select: none; -webkit-user-select: none;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn.primary { background: var(--leaf); color: var(--leaf-ink); box-shadow: 0 3px 0 var(--leaf-strong); }
.btn.water { background: var(--water); color: #fff; box-shadow: 0 3px 0 color-mix(in srgb, var(--water) 70%, #000); }
.btn.sun { background: var(--sun); color: #2d2208; box-shadow: 0 3px 0 color-mix(in srgb, var(--sun) 70%, #000); }
.btn.ghost { background: transparent; border: 1.5px solid var(--line); color: var(--ink-2); }
.btn.danger { background: var(--rose-soft); color: var(--rose); }
.btn.big { width: 100%; min-height: 54px; font-size: 1.05rem; }
.btn.wide { width: 100%; }
.btn.small { min-height: 44px; padding: 8px 14px; font-size: .9rem; border-radius: 12px; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.btn-row.three { grid-template-columns: 1fr 1fr 1fr; }
.btn-col { display: grid; gap: 10px; margin-top: 14px; }

/* ---------------- game shell ---------------- */
.game { padding-left: var(--safe-l); padding-right: var(--safe-r); }

.topbar {
  flex: 0 0 auto; display: flex; align-items: center; gap: 10px;
  min-height: calc(var(--top-h) + var(--safe-t)); padding: var(--safe-t) 12px 0 12px;
  background: var(--surface); border-bottom: 1px solid var(--line); z-index: 10;
}
.top-title {
  flex: 1; min-width: 0; text-align: left; background: none; border: 0; padding: 6px 4px;
}
.garden-name { display: block; font-weight: 800; font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.garden-owner { display: block; font-size: .76rem; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { display: flex; gap: 6px; align-items: center; flex: 0 0 auto; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px;
  padding: 6px 11px; border-radius: 999px; font-size: .9rem;
  background: var(--surface-2); border: 1px solid var(--line);
}
.chip b { font-weight: 800; }
.chip.coins { background: var(--sun-soft); }
.chip.level { flex-direction: column; gap: 3px; padding: 5px 11px; align-items: stretch; }
.chip.level span { font-size: .78rem; line-height: 1; text-align: center; }
.xp-bar { display: block; width: 38px; height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; }
.xp-bar > i { display: block; height: 100%; width: 0; background: var(--leaf); border-radius: 4px; transition: width .4s; }

.stage { position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden; }
#garden-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: manipulation; }

/* banner while visiting */
.visit-banner {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 3;
  display: flex; align-items: center; gap: 10px; max-width: calc(100% - 20px);
  padding: 6px 6px 6px 16px; border-radius: 999px; background: var(--surface);
  box-shadow: var(--shadow); font-size: .9rem; font-weight: 700;
}
.visit-banner span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.visit-banner .btn { border-radius: 999px; white-space: nowrap; }

.hint {
  position: absolute; left: 50%; top: 14px; transform: translateX(-50%); z-index: 2;
  width: max-content; max-width: calc(100% - 28px); text-align: center;
  background: var(--surface); padding: 10px 16px; border-radius: 16px; box-shadow: var(--shadow-sm);
  font-size: .92rem; animation: fadeup .4s ease;
}

/* bottom dock on the garden: summary + water-all */
.garden-dock {
  position: absolute; left: 0; right: 0; bottom: 10px; z-index: 2;
  display: flex; justify-content: center; align-items: center; gap: 8px; padding: 0 12px;
  pointer-events: none;
}
.garden-dock > * { pointer-events: auto; }
.dock-stats {
  display: flex; gap: 6px; flex-wrap: wrap; justify-content: center;
}
.dock-stats .pill {
  display: inline-flex; align-items: center; gap: 5px; min-height: 36px; padding: 6px 12px;
  border-radius: 999px; background: var(--surface); box-shadow: var(--shadow-sm);
  font-size: .86rem; font-weight: 700; border: 0;
}
.dock-stats .pill.ready { background: var(--sun-soft); }
.dock-stats .pill.thirsty { background: var(--water-soft); }
.water-all { border-radius: 999px; min-height: 44px; background: var(--water); color: #fff; box-shadow: var(--shadow-sm); }

/* ---------------- tabbar ---------------- */
.tabbar {
  flex: 0 0 auto; display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 4px 6px var(--safe-b); background: var(--surface);
  border-top: 1px solid var(--line); z-index: 10;
}
.tab {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  height: var(--tab-h); border: 0; background: none; color: var(--ink-2);
  font-size: .72rem; font-weight: 700; padding: 0; border-radius: 14px;
}
.tab .two-lines { font-size: .62rem; line-height: 1.05; text-align: center; }
.tab .ico { font-size: 1.35rem; line-height: 1; filter: grayscale(.6) opacity(.75); transition: transform .2s, filter .2s; }
.tab.active { color: var(--leaf-strong); }
.tab.active .ico { filter: none; transform: translateY(-1px) scale(1.08); }
.tab.active::before {
  content: ""; position: absolute; inset: 6px 10px; border-radius: 14px; background: var(--leaf-soft); z-index: -1;
}
.tab { isolation: isolate; }
.tab .badge {
  position: absolute; top: 6px; left: calc(50% + 8px); min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--rose); color: #fff; font-size: .68rem; font-style: normal;
  font-weight: 800; display: grid; place-items: center;
}

/* ---------------- views (non-garden tabs) ---------------- */
.view {
  position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column;
  background: var(--bg); animation: fadeup .2s ease;
}
@keyframes fadeup { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.view-head {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px 6px;
}
.view-head h2 { margin: 0; font-size: 1.3rem; font-weight: 800; flex: 1; }
.view-tools { padding: 6px 16px 10px; display: grid; gap: 10px; border-bottom: 1px solid var(--line); }
.view-scroll {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  padding: 8px 14px calc(24px + var(--safe-b));
}
.section-title { margin: 18px 4px 8px; font-size: .82rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }
.section-title:first-child { margin-top: 6px; }

.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.filter {
  flex: 0 0 auto; min-height: 36px; padding: 7px 12px; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--surface); font-size: .84rem; font-weight: 700; color: var(--ink-2);
}
.filter.on { background: var(--leaf); border-color: var(--leaf); color: var(--leaf-ink); }

/* ---------------- cards ---------------- */
.card {
  display: flex; gap: 12px; align-items: center;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 10px; margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
}
button.card { width: 100%; text-align: left; font: inherit; color: inherit; }
button.card:active { transform: scale(.99); }
.card .photo, .photo {
  width: 60px; height: 60px; object-fit: cover; border-radius: 12px; flex: 0 0 auto;
  background: var(--surface-3);
}
.photo.no-photo { background: var(--leaf-soft) center / 28px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 21V11' stroke='%235b9a56' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3Cpath d='M12 12c-5 0-7-3-7-7 4 0 7 2 7 7zM12 14c5 0 7-3 7-7-4 0-7 2-7 7z' fill='%235b9a56'/%3E%3C/svg%3E"); }
.card .grow { flex: 1; min-width: 0; }
.card .name { font-weight: 800; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .sci { font-size: .8rem; font-style: italic; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .meta { font-size: .78rem; color: var(--ink-2); margin-top: 5px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.card .side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: 0 0 auto; }
.qty { font-weight: 800; font-size: 1rem; }
.price { font-weight: 800; color: var(--ink); white-space: nowrap; }

.tag {
  display: inline-flex; align-items: center; gap: 3px; min-height: 22px;
  padding: 2px 8px; border-radius: 999px; font-size: .74rem; font-weight: 700;
  background: var(--surface-2); color: var(--ink-2);
}
.tag.sun { background: var(--sun-soft); color: color-mix(in srgb, var(--sun) 70%, var(--ink)); }
.tag.water { background: var(--water-soft); color: var(--water); }
.tag.gift { background: var(--rose-soft); color: var(--rose); }
.tag.good { background: var(--leaf-soft); color: var(--leaf-strong); }
.tag.fine { background: var(--surface-2); color: var(--ink-2); }
.tag.meh { background: var(--sun-soft); color: color-mix(in srgb, var(--sun) 60%, var(--ink)); }
.tag.bad { background: var(--surface-2); color: var(--ink-3); }
.tag.rare { background: color-mix(in srgb, #9b7fd1 18%, var(--surface)); color: #7d5fc0; }
.tag.out { background: var(--surface-2); color: var(--ink-3); }

.rarity { display: inline-flex; gap: 3px; align-items: center; }
.rarity i { width: 6px; height: 6px; border-radius: 50%; background: var(--line); }
.rarity i.on { background: var(--sun); }

.empty { text-align: center; color: var(--ink-2); padding: 34px 16px; font-size: .95rem; }
.empty .big { font-size: 2.4rem; display: block; margin-bottom: 8px; }
.empty .btn { margin-top: 14px; }

.more { display: block; margin: 6px auto 16px; }

/* ---------------- town ---------------- */
.avatar {
  width: 44px; height: 44px; border-radius: 50%; flex: 0 0 auto;
  background: linear-gradient(140deg, var(--leaf), var(--leaf-strong)); color: var(--leaf-ink);
  display: grid; place-items: center; font-weight: 800; font-size: 1.05rem;
}
.avatar.big { width: 60px; height: 60px; font-size: 1.4rem; }
.event { display: flex; gap: 10px; padding: 10px 4px; border-bottom: 1px solid var(--line); font-size: .92rem; }
.event:last-child { border-bottom: 0; }
.event .ico { font-size: 1.1rem; line-height: 1.3; }
.event time { display: block; color: var(--ink-3); font-size: .76rem; margin-top: 2px; }
.event.announcement { background: var(--sun-soft); border-radius: 12px; padding: 10px; border: 0; margin-bottom: 6px; }

/* ---------------- profile ---------------- */
.profile-card { display: flex; gap: 14px; align-items: center; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0 4px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px; text-align: center; }
.stat b { display: block; font-size: 1.2rem; }
.stat span { font-size: .76rem; color: var(--ink-2); }
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.list-item {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 54px; padding: 12px 14px;
  background: none; border: 0; border-bottom: 1px solid var(--line); text-align: left; font-size: .98rem;
}
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; }
.list-item .chev { color: var(--ink-3); }
.switch { position: relative; width: 50px; height: 30px; flex: 0 0 auto; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: var(--surface-3); transition: background .2s; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .2s; }
.switch input:checked + i { background: var(--leaf); }
.switch input:checked + i::after { transform: translateX(20px); }
.credit { font-size: .74rem; color: var(--ink-3); line-height: 1.5; }

/* ---------------- sheets ---------------- */
#sheet-root { position: relative; z-index: 50; }
.sheet-back {
  position: fixed; inset: 0; background: rgba(30, 24, 12, 0); transition: background .2s ease;
  display: flex; align-items: flex-end; justify-content: center;
}
.sheet-back.open { background: rgba(30, 24, 12, .42); }
.sheet {
  width: min(560px, 100%); max-height: calc(100% - 40px - var(--safe-t));
  display: flex; flex-direction: column;
  background: var(--surface); border-radius: 24px 24px 0 0; box-shadow: var(--shadow);
  transform: translateY(100%); transition: transform .24s cubic-bezier(.2, .9, .3, 1);
  padding-bottom: var(--safe-b);
}
.sheet.tall { height: calc(100% - 40px - var(--safe-t)); }
.sheet-back.open .sheet { transform: none; }
.sheet-back.closing .sheet { transform: translateY(100%); }
.sheet-head { position: relative; padding: 10px 56px 6px 18px; min-height: 44px; flex: 0 0 auto; }
.sheet-grip { width: 42px; height: 5px; border-radius: 5px; background: var(--line); margin: 0 auto 8px; transform: translateX(19px); }
.sheet-head h3 { margin: 4px 0 0; font-size: 1.15rem; font-weight: 800; }
.sheet-x {
  position: absolute; top: 8px; right: 10px; width: 44px; height: 44px; border-radius: 50%;
  border: 0; background: var(--surface-2); color: var(--ink-2); font-size: 1rem;
}
.sheet-body { overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 6px 18px 20px; }
.sheet-text { margin: 4px 0 6px; color: var(--ink-2); line-height: 1.5; }

/* plant sheet */
.plant-head { display: flex; gap: 14px; align-items: center; }
.plant-head .photo { width: 92px; height: 92px; border-radius: 18px; }
.plant-head h4 { margin: 0; font-size: 1.2rem; font-weight: 800; }
.plant-head .sci { font-style: italic; color: var(--ink-2); font-size: .88rem; }
.plant-head .meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.status { margin-top: 16px; display: grid; gap: 12px; }
.status-row { display: grid; grid-template-columns: 26px 1fr; gap: 10px; align-items: center; }
.status-row .ico { font-size: 1.15rem; text-align: center; }
.status-row .txt { font-size: .92rem; }
.status-row .txt b { font-weight: 800; }
.status-row .sub { font-size: .8rem; color: var(--ink-2); }
.meter { height: 10px; border-radius: 999px; background: var(--surface-3); overflow: hidden; margin-top: 5px; }
.meter > span { display: block; height: 100%; border-radius: 999px; transition: width .5s ease; }
.meter.growth > span { background: linear-gradient(90deg, var(--leaf), var(--sun)); }
.meter.water > span { background: var(--water); }
.desc { margin-top: 16px; }
.desc summary { font-weight: 800; font-size: .92rem; min-height: 44px; display: flex; align-items: center; cursor: pointer; color: var(--leaf-strong); }
.desc p { font-size: .92rem; line-height: 1.55; color: var(--ink-2); margin: 4px 0 8px; }

.pick-row { display: flex; gap: 8px; margin-top: 12px; }
.stepper { display: inline-flex; align-items: center; gap: 6px; }
.stepper button { width: 44px; height: 44px; border-radius: 12px; border: 0; background: var(--surface-3); font-size: 1.2rem; font-weight: 800; }
.stepper b { min-width: 28px; text-align: center; font-size: 1.1rem; }

.player-pick { display: grid; gap: 8px; }

/* admin */
.form-grid { display: grid; gap: 10px; }
.admin-row .side .btn { min-width: 44px; }
.inline-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---------------- toast ---------------- */
.toast {
  position: fixed; left: 50%; top: calc(var(--top-h) + var(--safe-t) + 12px); z-index: 80;
  transform: translate(-50%, -12px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--bg);
  padding: 12px 18px; border-radius: 16px; font-size: .95rem; font-weight: 700;
  transition: opacity .22s ease, transform .22s ease; width: max-content; max-width: calc(100vw - 32px); text-align: center;
  box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------------- larger screens ---------------- */
@media (min-width: 760px) {
  .view-scroll, .view-head, .view-tools { width: 100%; max-width: 680px; margin-left: auto; margin-right: auto; }
  .tabbar { grid-template-columns: repeat(5, minmax(0, 120px)); justify-content: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ================================================================ v3 additions */

/* topbar chips */
.chip.weather { min-width: 0; gap: 4px; }
.chip.weather b { font-size: .86rem; }
.chip.level { flex-direction: row; align-items: center; gap: 6px; padding: 4px 10px 4px 4px; }
.mini-avatar {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(140deg, var(--leaf), var(--leaf-strong)); color: var(--leaf-ink);
  font-weight: 800; font-size: .85rem;
}
.chip.level .lv { display: flex; flex-direction: column; gap: 3px; font-size: .74rem; line-height: 1; }
@media (max-width: 380px) { .chip.weather b { display: none; } .topbar-right { gap: 4px; } .chip { padding: 5px 8px; } }

/* garden dock + hud */
.dock-btn { width: 44px; min-height: 44px; padding: 0; border-radius: 50%; background: var(--surface); box-shadow: var(--shadow-sm); font-size: 1.2rem; }
.dock-btn.on { background: var(--sun); }
.game-hud {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 3;
  display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 16px;
  border-radius: 999px; background: rgba(20, 24, 50, .85); color: #fff6c8; font-weight: 800;
  box-shadow: var(--shadow); white-space: nowrap;
}
.game-hud .btn.ghost { color: #fff; border-color: rgba(255,255,255,.3); border-radius: 999px; }

/* segmented control */
.segmented { display: flex; gap: 4px; padding: 4px; border-radius: 14px; background: var(--surface-3); overflow-x: auto; scrollbar-width: none; }
.segmented::-webkit-scrollbar { display: none; }
.segmented button {
  position: relative; flex: 1 0 auto; min-height: 38px; padding: 6px 10px; border: 0; border-radius: 10px;
  background: transparent; font-size: .86rem; font-weight: 800; color: var(--ink-2); white-space: nowrap;
}
.segmented button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.seg-badge { position: absolute; top: 2px; right: 4px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--rose); color: #fff; font-size: .64rem; font-style: normal; display: grid; place-items: center; }
.view-tools-inner { display: grid; gap: 8px; }
.filters.small .filter { min-height: 32px; padding: 5px 10px; font-size: .8rem; }

/* pixel previews */
.pixel { image-rendering: pixelated; image-rendering: crisp-edges; }
.decor-thumb { width: 60px; height: 60px; border-radius: 12px; background: var(--leaf-soft); display: grid; place-items: center; flex: 0 0 auto; }
.decor-thumb img { max-width: 52px; max-height: 52px; }
.tag.event { background: color-mix(in srgb, #f08a3c 20%, var(--surface)); color: #b65d1e; }

/* botany */
.iucn { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; font-size: .76rem; font-weight: 800; }
.iucn.LC { background: #dff0d4; color: #3e7a2e; }
.iucn.NT { background: #f4f0c9; color: #7c6a12; }
.iucn.VU { background: #fbe3c4; color: #a35a12; }
.iucn.EN { background: #f8d2c6; color: #b23a1f; }
.iucn.CR { background: #f2c0c0; color: #8f1d1d; }
.iucn.EW, .iucn.EX { background: #3a3530; color: #fff; }
.iucn.DD { background: var(--surface-2); color: var(--ink-2); }
.botany { display: grid; gap: 12px; margin-top: 4px; }
.botany h5 { margin: 0 0 3px; font-size: .86rem; font-weight: 800; }
.botany p { margin: 0; font-size: .9rem; line-height: 1.55; color: var(--ink-2); }
.nectar-dots { letter-spacing: 2px; color: var(--sun); }

/* orders */
.order { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 10px; box-shadow: var(--shadow-sm); }
.order-head { display: flex; gap: 10px; align-items: center; }
.order-head .npc { font-size: 1.8rem; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); flex: 0 0 auto; }
.order-note { font-style: italic; color: var(--ink-2); font-size: .88rem; margin: 6px 0 8px; }
.order-items { display: grid; gap: 6px; }
.order-item { display: flex; align-items: center; gap: 8px; font-size: .9rem; }
.order-item .photo { width: 34px; height: 34px; border-radius: 8px; }
.order-item .ok { margin-left: auto; font-weight: 800; }
.order-item .ok.yes { color: var(--leaf-strong); }
.order-item .ok.no { color: var(--ink-3); }

/* chat */
.chat-list { display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 82%; padding: 8px 12px; border-radius: 16px 16px 16px 4px; background: var(--surface); border: 1px solid var(--line); align-self: flex-start; }
.msg.mine { align-self: flex-end; border-radius: 16px 16px 4px 16px; background: var(--leaf-soft); }
.msg .who { font-size: .74rem; font-weight: 800; color: var(--leaf-strong); }
.msg .txt { font-size: .95rem; overflow-wrap: anywhere; }
.msg time { display: block; font-size: .68rem; color: var(--ink-3); margin-top: 2px; text-align: right; }
.chat-bar { display: flex; gap: 8px; padding: 8px 12px calc(8px + var(--safe-b)); background: var(--surface); border-top: 1px solid var(--line); }
.chat-bar input { flex: 1; min-height: 44px; }

/* leaderboards */
.rank-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.rank-row:last-child { border-bottom: 0; }
.rank-row .pos { width: 26px; text-align: center; font-weight: 800; color: var(--ink-2); }
.rank-row.me { background: var(--leaf-soft); }
.rank-row .val { margin-left: auto; font-weight: 800; }

/* games */
.event-banner { border-radius: var(--radius); padding: 14px; margin-bottom: 12px; background: linear-gradient(135deg, #f8e3c4, #f3c99a); color: #5a3412; }
.event-banner b { display: block; font-size: 1.05rem; }
.event-banner small { opacity: .85; }
@media (prefers-color-scheme: dark) { .event-banner { background: linear-gradient(135deg, #4a3520, #3a2a1a); color: #f8e3c4; } }
.game-card { display: flex; gap: 12px; align-items: center; }
.game-card .gico { font-size: 2rem; width: 54px; height: 54px; border-radius: 16px; background: var(--surface-2); display: grid; place-items: center; flex: 0 0 auto; }
.quiz-photo { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 16px; background: var(--surface-3); }
.quiz-options { display: grid; gap: 8px; margin-top: 12px; }
.quiz-options .btn.right { background: var(--leaf); color: var(--leaf-ink); }
.quiz-options .btn.wrong { background: var(--rose-soft); color: var(--rose); }
.memory-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
@media (min-width: 420px) { .memory-grid { grid-template-columns: repeat(4, 1fr); } }
.mem-card { aspect-ratio: 1; border-radius: 12px; border: 0; padding: 0; overflow: hidden; position: relative; background: var(--leaf); }
.mem-card .back { position: absolute; inset: 0; display: grid; place-items: center; font-size: 1.6rem; color: var(--leaf-ink); }
.mem-card img, .mem-card .photo { width: 100%; height: 100%; object-fit: cover; display: none; border-radius: 0; }
.mem-card.open img, .mem-card.open .photo { display: block; }
.mem-card.open .back { display: none; }
.mem-card.done { opacity: .55; }
.bouquet-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.bq { position: relative; border: 2px solid transparent; border-radius: 14px; padding: 0; background: var(--surface-2); overflow: hidden; text-align: left; }
.bq img, .bq .photo { width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; border-radius: 0; }
.bq .bq-name { display: block; padding: 4px 6px 6px; font-size: .74rem; font-weight: 700; line-height: 1.2; }
.bq .dot { position: absolute; top: 6px; right: 6px; width: 16px; height: 16px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.bq.on { border-color: var(--leaf); }
.bq.on::after { content: "\2713"; position: absolute; top: 4px; left: 6px; color: #fff; background: var(--leaf); width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: .8rem; }
.theme-dots { display: inline-flex; gap: 4px; vertical-align: middle; }
.theme-dots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line); }
.stars { font-size: 1.8rem; letter-spacing: 4px; text-align: center; color: var(--sun); }
.prize { display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: var(--radius); background: var(--sun-soft); margin-top: 12px; }
.prize.exotic { background: linear-gradient(135deg, #fff1c2, #f2d6ff); }
@media (prefers-color-scheme: dark) { .prize.exotic { background: linear-gradient(135deg, #4a3f1e, #3b2a4a); } }

/* hive */
.hive-hero { display: flex; gap: 14px; align-items: center; }
.hive-hero .big-emoji { font-size: 2.6rem; width: 64px; height: 64px; border-radius: 18px; background: var(--sun-soft); display: grid; place-items: center; flex: 0 0 auto; }
.meter.honey > span { background: linear-gradient(90deg, #e8b23a, #f2c94c); }
.meter.colony > span { background: linear-gradient(90deg, #c9a24a, #8a6a2a); }

.top-title { padding-right: 0; }
.garden-name { font-size: .98rem; }

.select-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mini-select { display: grid; gap: 2px; }
.mini-select span { font-size: .72rem; font-weight: 800; color: var(--ink-2); margin-left: 4px; }
.mini-select select { min-height: 42px; padding: 8px 32px 8px 12px; font-size: 15px; background-position: calc(100% - 18px) 19px, calc(100% - 13px) 19px; }

.segmented button { flex: 1 1 0; min-width: 0; padding: 6px 4px; font-size: .8rem; }
@media (max-width: 360px) { .segmented button { font-size: .74rem; } }
