/* ==========================================================================
   SUPER-BOT • life-sim style HUD over a Three.js world
   Light, friendly "Live Mode" look: white/sky panels, teal-blue accents,
   brand-blue price-tag marker, rounded Rubik type. No dark mode.
   ========================================================================== */

:root {
  --sky-1: #dff1ff;
  --sky-2: #bfe3ff;
  --panel: rgba(255, 255, 255, 0.94);
  --panel-2: #f2f8fd;
  --panel-border: #b9d8ef;
  --panel-shadow: 0 10px 30px rgba(20, 70, 120, 0.18), 0 2px 6px rgba(20, 70, 120, 0.12);
  --blue: #1f9be6;
  --blue-dark: #0a6fb5;
  --blue-soft: #e3f3fe;
  --teal: #17bfae;
  --text: #1d3348;
  --text-soft: #4f6a82;
  --text-dim: #587388; /* >= 4.5:1 on white and on the light panels (WCAG AA) */
  --green: #4fc23a;
  --green-dark: #257a1b; /* text on light greens >= 4.5:1 (WCAG AA) */
  --yellow: #f5c518;
  --orange: #f59a23;
  --red: #e5484d;
  --rl-red: #d7263d;
  --gold: #e7a613;
  --radius: 18px;
  --font: 'Rubik', 'Heebo', 'Segoe UI', Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: var(--font);
  color: var(--text);
  background: linear-gradient(180deg, var(--sky-1), var(--sky-2));
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; cursor: pointer; }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* Skip link: off-screen until it gets keyboard focus (first Tab stop) */
.skip-link {
  position: fixed; top: 10px; inset-inline-start: 50%; transform: translate(50%, -160%);
  z-index: 10000; padding: 10px 18px; border-radius: 99px;
  background: var(--blue-dark); color: #fff; font-weight: 800; text-decoration: none;
  box-shadow: var(--panel-shadow); transition: transform 0.15s;
}
.skip-link:focus { transform: translate(50%, 0); outline: 3px solid #fff; outline-offset: 2px; }

/* Visible keyboard focus on the custom widgets */
#branchList:focus-visible, #dialogLog:focus-visible, #householdSlots:focus-visible,
.ip-tab:focus-visible, .speed-btn:focus-visible, .sp-chip:focus-visible {
  outline: 3px solid rgba(31, 155, 230, 0.6); outline-offset: 2px;
}

/* ---------------- Icons (Phosphor duotone sprite, web/ph_icons.js) ----------------
   Size follows the font-size of the container (1.15em), colour follows currentColor,
   so the font-size rules that sized the old emoji keep sizing the icons. */
.ph {
  display: inline-block; width: 1.15em; height: 1.15em; flex: none;
  fill: currentColor; vertical-align: -0.22em; overflow: visible;
}
.icon-mirror { transform: scaleX(-1); } /* arrows/send in RTL */
.icon-lead { margin-inline-end: 0.3em; } /* icon before text inside buttons/labels */
.icon-trail { margin-inline-start: 0.3em; } /* icon after text */
.ic-good { color: var(--green-dark); }
.ic-bad { color: var(--red); }
.ic-warn { color: #b86e00; }
.ic-gold { color: var(--gold); }
.ic-blue { color: var(--blue-dark); }
/* Icon colours per container (the emoji brought their own colours; the line icons get accents) */
.ic-badge .ph { color: var(--teal); }
.ic-role-nutrition .ic-role-icon { color: #1e9a4c; }
.ic-role-finance .ic-role-icon { color: #c98400; }
.ic-f-icon, .sp-title .ph, .hc-icon, .need-ico, .inv-group .ph, .b-cat-icon, .ob-icon,
.mp-tab-icon, .day-type-badge .ph, .enp-title .ph, .pie-opt .ph, .aq-item { color: var(--blue-dark); }
.sp-search-icon { color: var(--text-soft); line-height: 0; }
.round-btn, .ip-tab { color: var(--blue-dark); }
.round-btn .ph { font-size: 20px; }
.price-disclaimer .ph, .day-prep-tip .ph { color: #b86e00; }
.promo-badge .ph, .promo-card .b-stat-label .ph { color: inherit; }
.cel-trophy { color: var(--gold); filter: drop-shadow(0 6px 10px rgba(231, 166, 19, 0.35)); }
.notif .n-icon { color: var(--blue-dark); line-height: 0; }
.notif.good .n-icon { color: var(--green-dark); }
.notif.warn .n-icon { color: #b86e00; }
.hc-list li .ph { color: var(--text-dim); font-size: 15px; }
.hc-list li.filled .ph { color: var(--green-dark); }
.speed-btn:not(.instant-btn) { font-size: 13px; letter-spacing: 0; }
.speed-btn .ph + .ph { margin-inline-start: -0.55em; }
.enp-val .ph { font-size: 0.9em; opacity: 0.85; }
.meal-name .ph { color: var(--blue); }
.recipe-time .ph, .ing-title .ph { color: inherit; }
.chip .ph { font-size: 1.05em; }
/* Cart rows during shopping: check when picked, hourglass + text while on the way */
.row-picked, .row-pending { display: none; }
.basket-item-row.picked .row-picked { display: inline; color: var(--green-dark); }
.basket-item-row.pending .row-pending { display: inline; margin-inline-start: 6px; font-size: 11px; font-weight: 700; color: #b86e00; }

/* ---------------- World ---------------- */
#world { position: fixed; inset: 0; }
#worldCanvas { width: 100%; height: 100%; display: block; outline: none; }
#worldOverlay { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }

/* ---------------- Mood tag (Shira's price-tag marker) ---------------- */
.mood-tag {
  display: inline-block;
  width: 20px; height: 28px;
  clip-path: polygon(28% 0, 72% 0, 100% 27%, 100% 100%, 0 100%, 0 27%);
  -webkit-mask: radial-gradient(circle at 50% 19%, transparent 0 9%, #000 10%);
  mask: radial-gradient(circle at 50% 19%, transparent 0 9%, #000 10%);
  background:
    linear-gradient(115deg, rgba(255,255,255,0.55) 0 16%, transparent 17% 100%),
    linear-gradient(180deg, #6cc4ff 0%, #1f9be6 50%, #0a6fb5 100%);
  transform-origin: 50% 0;
  animation: tagSwing 3.2s ease-in-out infinite;
}
.mood-tag.big { width: 72px; height: 100px; }
.mood-tag.small { width: 22px; height: 31px; }
.mood-tag.tiny { width: 11px; height: 15px; vertical-align: middle; animation: none; }
.mood-tag.mood-yellow { background: linear-gradient(115deg, rgba(255,255,255,0.55) 0 16%, transparent 17%), linear-gradient(180deg, #fff59a, #f5c518 50%, #c99400); }
.mood-tag.mood-red { background: linear-gradient(115deg, rgba(255,255,255,0.55) 0 16%, transparent 17%), linear-gradient(180deg, #ff9a9a, #e5484d 50%, #a8161b); }

@keyframes tagSwing {
  0%, 100% { transform: rotate(-7deg) translateY(0); }
  50% { transform: rotate(7deg) translateY(-2px); }
}

/* ---------------- Loading screen ---------------- */
#loadingScreen {
  position: fixed; inset: 0; z-index: 100;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: radial-gradient(circle at 50% 35%, #ffffff 0%, #d9efff 45%, #a9d8ff 100%);
  transition: opacity 0.7s ease, visibility 0.7s;
}
#loadingScreen.hide { opacity: 0; visibility: hidden; }
.ls-tag { height: 130px; display: flex; align-items: center; }
.ls-title { font-size: 46px; font-weight: 900; color: var(--blue-dark); letter-spacing: -0.5px; text-shadow: 0 3px 0 #fff; }
.ls-sub { font-size: 16px; font-weight: 600; color: var(--text-soft); }
.ls-bar { width: min(360px, 70vw); height: 12px; border-radius: 99px; background: #fff; border: 2px solid var(--panel-border); overflow: hidden; }
.ls-bar-fill { height: 100%; width: 5%; border-radius: 99px; background: linear-gradient(90deg, #4fc23a, #8be36f); transition: width 0.4s ease; }
.ls-tip { font-size: 15px; color: var(--text-soft); min-height: 22px; font-weight: 500; }

/* ---------------- Store picker (on the loading screen) ---------------- */
body.picking-store #loadingScreen { justify-content: flex-start; overflow-y: auto; padding: 10px 16px 0; gap: 4px; }
body.picking-store .ls-tag { display: none; }
body.picking-store .ls-title { font-size: 30px; }
body.picking-store .ls-bar, body.picking-store .ls-tip { display: none; }
.sp-card {
  --chain: var(--blue-dark); /* white text on it: 4.5:1 (--blue is 3:1) */
  width: min(760px, 96vw);
  margin-top: 6px;
  padding: 16px 22px 0;
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid var(--panel-border);
  border-radius: 24px;
  box-shadow: 0 18px 50px rgba(20, 70, 120, 0.22), inset 0 1px 0 #fff;
  backdrop-filter: blur(10px);
  animation: spIn 0.45s cubic-bezier(.2, 1.3, .4, 1) both;
}
.sp-card[hidden] { display: none; }
@keyframes spIn { from { opacity: 0; transform: translateY(18px) scale(0.97); } to { opacity: 1; transform: none; } }
.sp-title { margin: 0; font-size: 24px; font-weight: 900; color: var(--text); text-align: center; }
.sp-sub { margin: 4px 0 12px; text-align: center; color: var(--text-soft); font-weight: 500; font-size: 14.5px; }
.sp-step { display: flex; align-items: center; gap: 8px; margin: 12px 2px 8px; font-weight: 800; color: var(--text); font-size: 15px; }
.sp-step-n {
  width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(180deg, #5ccf45, #33a321); color: #fff; font-size: 13px; box-shadow: 0 2px 6px rgba(47, 154, 34, 0.35);
}
.sp-chains { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.sp-chip {
  --chain: var(--blue-dark);
  display: flex; align-items: center; gap: 9px; padding: 8px 10px; text-align: right;
  border: 2px solid color-mix(in srgb, var(--chain) 28%, #fff); border-radius: 16px;
  background: linear-gradient(180deg, #fff, color-mix(in srgb, var(--chain) 6%, #fff));
  color: var(--text); cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, background 0.2s, border-color 0.2s;
}
.sp-chip:hover { transform: translateY(-2px); box-shadow: 0 8px 18px color-mix(in srgb, var(--chain) 25%, transparent); border-color: var(--chain); }
.sp-chip-logo {
  flex: none; width: 34px; height: 34px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--chain); color: #fff; font-weight: 900; font-size: 18px; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.15);
}
.sp-chip-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.sp-chip-text b { font-size: 15px; font-weight: 800; white-space: nowrap; }
.sp-chip-text small { font-size: 12px; color: var(--text-dim); font-weight: 600; }
.sp-chip.active { background: var(--chain); border-color: var(--chain); color: #fff; box-shadow: 0 8px 20px color-mix(in srgb, var(--chain) 40%, transparent); }
.sp-chip.active .sp-chip-logo { background: #fff; color: var(--chain); }
.sp-chip.active .sp-chip-text small { color: #fff; }
.sp-search { position: relative; }
.sp-search-icon { position: absolute; right: 13px; top: 50%; transform: translateY(-50%); font-size: 15px; opacity: 0.7; pointer-events: none; }
#branchSearch {
  width: 100%; padding: 11px 40px 11px 14px; border-radius: 14px; border: 2px solid var(--panel-border);
  font: 600 15px var(--font); color: var(--text); background: #fff; outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
#branchSearch:focus { border-color: var(--chain); box-shadow: 0 0 0 4px color-mix(in srgb, var(--chain) 16%, transparent); }
.sp-branches {
  list-style: none; margin: 8px 0 0; padding: 4px; max-height: max(150px, calc(100vh - 520px)); overflow-y: auto;
  border: 2px solid #e4f0f9; border-radius: 14px; background: #f8fcff;
}
.sp-branch {
  display: grid; grid-template-columns: 1fr auto auto auto; gap: 10px; align-items: center;
  padding: 8px 12px; border-radius: 10px; cursor: pointer; transition: background 0.12s;
}
.sp-branch:hover { background: color-mix(in srgb, var(--chain) 9%, #fff); }
.sp-branch.selected { background: color-mix(in srgb, var(--chain) 16%, #fff); box-shadow: inset 0 0 0 2px var(--chain); }
.sp-b-name { font-weight: 700; color: var(--text); }
.sp-b-main { display: flex; flex-direction: column; min-width: 0; }
.sp-b-addr { font-size: 11.5px; color: #4a6278; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-b-online {
  display: inline-block; margin-inline-start: 4px; padding: 0 7px; border-radius: 99px; vertical-align: 1px;
  font-size: 11px; font-weight: 800; color: #0b6aa8; background: #e3f3ff; border: 1px solid #b9e0fb;
}
.sp-b-city { font-size: 13px; color: var(--text-soft); font-weight: 600; }
.sp-b-n { font-size: 12px; color: var(--text-dim); font-weight: 700; background: #fff; border: 1px solid #e1edf6; border-radius: 99px; padding: 1px 8px; }
.sp-empty { padding: 14px; text-align: center; color: var(--text-soft); font-weight: 600; }

/* In-store / online toggle (step 2) and "near me" */
.sp-step-row { flex-wrap: wrap; }
.sp-mode { margin-inline-start: auto; display: inline-flex; padding: 3px; gap: 3px; border-radius: 99px; background: #eaf3fa; border: 1px solid #d6e7f4; }
.sp-mode button {
  display: inline-flex; align-items: center; border: none; border-radius: 99px; padding: 5px 12px;
  font: 800 13.5px var(--font); color: var(--text-soft); background: transparent; cursor: pointer; transition: background 0.15s, color 0.15s;
}
.sp-mode button[aria-checked="true"] { background: var(--chain, var(--blue-dark)); color: #fff; box-shadow: 0 3px 8px color-mix(in srgb, var(--chain, var(--blue-dark)) 35%, transparent); }
.sp-mode button:focus-visible, .sp-near:focus-visible { outline: 3px solid #0b5fa5; outline-offset: 2px; }
.sp-search { display: flex; gap: 8px; align-items: center; }
.sp-search #branchSearch { flex: 1; min-width: 0; }
.sp-near {
  flex: none; display: inline-flex; align-items: center; padding: 10px 14px; border-radius: 14px;
  border: 2px solid var(--panel-border); background: #fff; color: var(--text); font: 800 14px var(--font); cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.sp-near:hover { border-color: var(--chain, var(--blue)); }
.sp-near[aria-pressed="true"] { background: var(--chain, var(--blue-dark)); border-color: var(--chain, var(--blue-dark)); color: #fff; }
.sp-near.busy { opacity: 0.7; cursor: progress; }
.sp-near-status { margin: 6px 2px 0; font-size: 12.5px; font-weight: 600; color: var(--text-soft); line-height: 1.5; }
.sp-near-status[hidden] { display: none; }
.sp-near-status.err { color: #8a4b00; }
.sp-near-status a { color: inherit; }
.sp-b-chain {
  display: inline-block; margin-inline-end: 4px; padding: 0 7px; border-radius: 99px; vertical-align: 1px;
  font-size: 11.5px; font-weight: 800; color: color-mix(in srgb, var(--chain) 55%, #000);
  background: color-mix(in srgb, var(--chain) 13%, #fff); border: 1px solid color-mix(in srgb, var(--chain) 35%, #fff);
}
.sp-chip-all .sp-chip-logo { font-size: 17px; }
.sp-b-dist { font-size: 12px; font-weight: 800; color: #0b5f9c; white-space: nowrap; display: inline-flex; align-items: center; }
.sp-chip[disabled] { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }
.spin { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.sp-foot {
  position: sticky; bottom: 0; z-index: 2;
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  margin: 12px -22px 0; padding: 12px 22px 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.85), #fff 40%);
  border-top: 1px solid #e4f0f9; border-radius: 0 0 22px 22px;
}
.sp-selected { display: flex; align-items: center; gap: 10px; color: var(--text); font-size: 15px; line-height: 1.35; min-height: 42px; }
.sp-selected small { color: var(--text-soft); font-weight: 600; }
.sp-sel-dot { flex: none; width: 14px; height: 14px; border-radius: 50%; background: var(--chain); box-shadow: 0 0 0 4px color-mix(in srgb, var(--chain) 20%, transparent); }
.sp-sel-city { color: var(--text-soft); font-weight: 600; font-size: 13px; }
.sp-sel-empty { color: var(--text-soft); font-weight: 600; }
.sp-go { font-size: 18px; padding: 12px 26px; border-radius: 16px; box-shadow: 0 8px 20px rgba(47, 154, 34, 0.35); animation: spGlow 2.2s ease-in-out infinite; }
.sp-go:disabled { opacity: 0.5; cursor: not-allowed; animation: none; }
@keyframes spGlow { 0%, 100% { box-shadow: 0 8px 20px rgba(47, 154, 34, 0.35); } 50% { box-shadow: 0 8px 26px rgba(47, 154, 34, 0.6), 0 0 0 6px rgba(92, 207, 69, 0.25); } }
.sp-updated { flex-basis: 100%; text-align: center; font-size: 12.5px; color: var(--text-dim); font-weight: 600; }

/* Intro card: what the project is (before the store picker) */
.intro-card { width: min(820px, 96vw); padding-top: 20px; }
.ic-badge {
  width: fit-content; margin: 0 auto 8px; padding: 4px 14px; border-radius: 99px;
  background: linear-gradient(90deg, #e3f3fe, #e6fbf2); border: 1.5px solid #bfe1f8;
  color: var(--blue-dark); font-weight: 800; font-size: 13.5px;
}
.ic-title { margin: 0; text-align: center; font-size: 30px; font-weight: 900; line-height: 1.15; color: var(--text); }
.ic-title span {
  font-size: 22px; font-weight: 800;
  background: linear-gradient(90deg, #17bfae, #1f9be6); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.ic-lead { margin: 12px auto 14px; max-width: 640px; text-align: center; font-size: 16px; line-height: 1.6; color: var(--text-soft); font-weight: 500; }
.ic-lead b { color: var(--text); font-weight: 800; }
.ic-roles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ic-role {
  display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 18px;
  border: 2px solid transparent; transition: transform 0.18s, box-shadow 0.18s;
}
.ic-role:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(20, 70, 120, 0.14); }
.ic-role-nutrition { background: linear-gradient(135deg, #eafbf0, #f6fff9); border-color: #c4ecd1; }
.ic-role-finance { background: linear-gradient(135deg, #fff7e3, #fffcf3); border-color: #f5dfa6; }
.ic-role-icon { flex: none; width: 46px; height: 46px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; font-size: 26px; background: #fff; box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08); }
.ic-role b { display: block; font-size: 17px; font-weight: 900; color: var(--text); }
.ic-role small { display: block; font-size: 13.5px; line-height: 1.4; color: var(--text-soft); font-weight: 600; }
.ic-features { list-style: none; margin: 12px 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; }
.ic-features li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 6px; }
.ic-f-icon { flex: none; width: 34px; height: 34px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; font-size: 18px; background: var(--blue-soft); }
.ic-features b { display: block; font-size: 15px; font-weight: 800; color: var(--text); }
.ic-features small { display: block; font-size: 13px; line-height: 1.4; color: var(--text-soft); font-weight: 600; }
.ic-foot { justify-content: center; }
@media (max-width: 640px) {
  .ic-roles, .ic-features { grid-template-columns: 1fr; }
  .ic-title { font-size: 24px; }
  .ic-title span { font-size: 18px; }
}

/* ---- Pre-game screens fit one screen, no page scrolling (X19) ----
   The loading screen is exactly the viewport; the card is a flex column that shrinks to fit, and in
   the picker the branch list absorbs the leftover height. The card can still scroll internally as a
   last resort on very small screens, so nothing is ever cut off. */
body.picking-store #loadingScreen { height: 100vh; height: 100dvh; padding: 8px 12px 0; overflow: hidden; }
body.picking-store .ls-title { font-size: 26px; line-height: 1.1; }
body.picking-store .ls-sub { font-size: 14px; }
body.picking-store .sp-card:not([hidden]) { flex: 0 1 auto; min-height: 0; display: flex; flex-direction: column; overflow-y: auto; overscroll-behavior: contain; }
body.picking-store .sp-card > * { flex-shrink: 0; }
body.picking-store #storePicker .sp-branches { flex: 1 1 auto; min-height: 120px; max-height: none; }
body.picking-store #loadingScreen .tl-credit { flex: none; margin: 6px 0 8px; }

/* Laptops (768 / 720 px tall) */
@media (max-height: 820px) {
  .intro-card { padding-top: 14px; }
  .ic-title { font-size: 27px; }
  .ic-title span { font-size: 20px; }
  .ic-lead { margin: 8px auto 10px; font-size: 15px; line-height: 1.5; }
  .ic-role { padding: 9px 12px; }
  .ic-features { margin-top: 8px; gap: 4px 14px; }
  .ic-features li { padding: 4px 6px; }
  .ic-disclaimer, .ic-consent { margin-top: 8px; }
  .ic-foot { margin-top: 8px; padding-top: 10px; padding-bottom: 10px; }
  .sp-sub { margin: 2px 0 6px; }
  .sp-step { margin: 8px 2px 6px; }
  .sp-foot { margin-top: 8px; padding-top: 8px; padding-bottom: 10px; }
  /* 9 chains in 2 compact rows instead of 3, so the branch list keeps several rows visible */
  .sp-chains { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 6px; }
  .sp-chip { padding: 5px 8px; gap: 7px; border-radius: 13px; }
  .sp-chip-logo { width: 28px; height: 28px; font-size: 15px; border-radius: 9px; }
  .sp-chip-text b { font-size: 14px; }
  .sp-chip-text small { font-size: 11.5px; }
}
@media (max-height: 700px) {
  body.picking-store .ls-sub, .ic-badge { display: none; }
  .ic-features small { display: none; }
  .ic-features li { align-items: center; }
}

/* Phones */
@media (max-width: 640px) {
  body.picking-store #loadingScreen { padding: 6px 8px 0; gap: 2px; }
  body.picking-store .ls-title { font-size: 21px; }
  body.picking-store .ls-sub { font-size: 12.5px; }
  .sp-card { padding: 12px 14px 0; border-radius: 18px; }
  .sp-foot { margin: 8px -14px 0; padding: 10px 14px 12px; gap: 8px; border-radius: 0 0 16px 16px; }
  .sp-go { font-size: 16px; padding: 10px 20px; }
  .sp-updated { font-size: 11px; }
  /* intro */
  .intro-card { padding-top: 12px; }
  .ic-badge { display: none; }
  .ic-title { font-size: 21px; }
  .ic-title span { font-size: 15.5px; }
  .ic-lead { font-size: 14px; line-height: 1.5; margin: 8px auto 10px; }
  .ic-roles { gap: 8px; }
  .ic-role { padding: 8px 10px; gap: 10px; }
  .ic-role-icon { width: 36px; height: 36px; font-size: 20px; border-radius: 11px; }
  .ic-role b { font-size: 15px; }
  .ic-role small { font-size: 12.5px; }
  .ic-features { grid-template-columns: 1fr 1fr; gap: 2px 8px; margin-top: 8px; }
  .ic-features li { padding: 4px 2px; align-items: center; gap: 8px; }
  .ic-features small { display: none; }
  .ic-f-icon { width: 28px; height: 28px; font-size: 15px; border-radius: 9px; }
  .ic-features b { font-size: 13.5px; }
  .ic-disclaimer { font-size: 11.5px; padding: 5px 10px; margin-top: 8px; }
  .ic-consent { font-size: 13px; margin-top: 8px; }
  /* picker: chains in one swipeable row, compact rows */
  .sp-title { font-size: 19px; }
  .sp-sub { font-size: 12.5px; margin: 2px 0 6px; }
  .sp-step { margin: 8px 2px 6px; font-size: 14px; }
  .sp-chains { display: flex; overflow-x: auto; gap: 6px; padding-bottom: 4px; scroll-snap-type: x proximity; scrollbar-width: thin; }
  .sp-chip { flex: 0 0 auto; padding: 6px 9px; gap: 7px; scroll-snap-align: start; }
  .sp-chip-logo { width: 28px; height: 28px; font-size: 15px; border-radius: 9px; }
  .sp-chip-text b { font-size: 14px; }
  .sp-mode button { padding: 4px 10px; font-size: 13px; }
  .sp-near { padding: 9px 10px; font-size: 13px; }
  #branchSearch { padding: 9px 36px 9px 10px; font-size: 14px; }
  .sp-branch { grid-template-columns: 1fr auto; gap: 6px; padding: 7px 9px; }
  .sp-b-city:empty, .sp-b-n { display: none; }
  .sp-selected { font-size: 13.5px; min-height: 0; }
}
@media (max-width: 640px) and (max-height: 700px) {
  .ic-lead { font-size: 13px; margin: 6px auto 8px; }
  .ic-role small { display: none; }
  .ic-roles { grid-template-columns: 1fr 1fr; }
  .ic-role { padding: 7px 8px; gap: 8px; }
  .ic-role b { font-size: 14px; }
}

/* Price/stock disclaimer (intro card + cart) and terms-of-use consent */
.price-disclaimer {
  margin: 10px auto 0; max-width: 680px; padding: 7px 12px; border-radius: 12px;
  background: #fffaf0; border: 1.5px dashed #f1d9a3; color: #7a5a14;
  font-size: 12.5px; line-height: 1.5; font-weight: 600; text-align: center;
}
.ic-disclaimer { margin-top: 12px; }
.ic-consent {
  display: flex; align-items: center; justify-content: center; gap: 8px; margin: 12px auto 0;
  font-size: 14px; font-weight: 700; color: var(--text); cursor: pointer; user-select: none;
}
.ic-consent input { width: 19px; height: 19px; accent-color: #33a321; cursor: pointer; }
.link-btn {
  background: none; border: 0; padding: 0; font: inherit; color: var(--blue-dark); font-weight: 800;
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
.tl-credit .link-btn { font-weight: 600; color: var(--text-soft); text-decoration: none; border-bottom: 1px dotted currentColor; }
.link-btn:hover, .link-btn:focus-visible { color: var(--blue); }
.sims-modal-backdrop.terms-backdrop { z-index: 130; } /* above #loadingScreen (100); must beat the generic modal rule below */
.terms-modal { max-height: 86vh; }
.terms-body h3 { margin: 14px 0 4px; font-size: 15px; font-weight: 900; color: var(--text); }
.terms-body p { margin: 0 0 6px; font-size: 13.5px; line-height: 1.65; color: var(--text-soft); }
.terms-body .terms-updated { font-size: 12px; color: var(--text-dim); }
.terms-body .terms-credits { margin: 0 0 6px; padding-inline-start: 18px; font-size: 12.5px; line-height: 1.6; color: var(--text-soft); }
.terms-body .terms-credits li { margin-bottom: 2px; }
.terms-body a { color: inherit; text-decoration: underline; }
.terms-foot { display: flex; gap: 8px; justify-content: center; padding: 10px 16px 14px; border-top: 1px solid var(--panel-border); }

/* HUD chip with the current store (click = switch store) */
.store-chip {
  --chain: var(--blue);
  height: 44px; display: inline-flex; align-items: center; gap: 8px; padding: 0 14px 0 12px; max-width: 280px;
  border-radius: 99px; border: 2px solid var(--panel-border); background: linear-gradient(180deg, #fff, #e9f4fc);
  box-shadow: 0 4px 12px rgba(20, 70, 120, 0.18); font: 800 14px var(--font); color: var(--text);
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.store-chip:hover { transform: translateY(-2px); border-color: var(--chain); box-shadow: 0 8px 18px color-mix(in srgb, var(--chain) 30%, transparent); }
.store-chip #storeChipLabel { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.store-chip-dot { flex: none; width: 12px; height: 12px; border-radius: 50%; background: var(--chain); }
.store-chip-swap { color: var(--text-dim); font-size: 15px; }
.store-chip-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.store-chip-upd { font: 600 11px var(--font); color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.store-chip-upd:empty { display: none; }
.store-chip-upd.stale { color: #b7791f; }
.price-updated { margin: 10px 0 0; font-size: 13px; font-weight: 600; color: #1f7a4a; display: flex; align-items: center; gap: 6px; }
.price-updated[hidden] { display: none; }
.price-updated .ph { width: 16px; height: 16px; }
.price-updated.stale { color: #b7791f; }

/* Cart: product not found in the branch price list */
.est-badge {
  display: inline-block; margin-inline-start: 6px; padding: 1px 8px; border-radius: 99px; vertical-align: middle;
  background: #fff4d6; border: 1px solid #f5c518; color: #8a6100; font-size: 11.5px; font-weight: 800;
}
.basket-item-row.is-estimated .col-price { color: #8a6100; }
.col-price small { font-size: 11px; color: var(--text-soft); font-weight: 600; }

/* ---------------- Generic HUD blocks ---------------- */
.hud-block { position: fixed; z-index: 20; }

.sims-card {
  background: var(--panel);
  border: 2px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: var(--panel-shadow);
  backdrop-filter: blur(6px);
}

.round-btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 2px solid var(--panel-border);
  background: linear-gradient(180deg, #ffffff, #e9f4fc);
  box-shadow: 0 4px 12px rgba(20, 70, 120, 0.18);
  font-size: 19px;
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.round-btn:hover { transform: translateY(-2px) scale(1.05); border-color: var(--blue); box-shadow: 0 8px 18px rgba(31, 155, 230, 0.3); }
.round-btn.active { border-color: var(--blue); background: linear-gradient(180deg, #e3f3fe, #c6e6fb); }

/* ---------------- Action queue (top-left) ---------------- */
#actionQueue { top: 16px; left: 16px; display: flex; flex-direction: column; gap: 6px; direction: ltr; }
.aq-track { display: flex; align-items: center; gap: 8px; }
.aq-item {
  width: 46px; height: 46px; border-radius: 50%;
  background: linear-gradient(180deg, #ffffff, #e8f3fb);
  border: 2px solid var(--panel-border);
  box-shadow: 0 4px 10px rgba(20, 70, 120, 0.18);
  display: flex; align-items: center; justify-content: center;
  font-size: 21px; position: relative;
  transition: transform 0.25s, opacity 0.25s;
  animation: popIn 0.35s cubic-bezier(.2,1.6,.4,1);
}
.aq-item.current {
  width: 66px; height: 66px; font-size: 30px;
  border: none;
  background: conic-gradient(var(--green) calc(var(--p, 0) * 1%), #d7e7f3 0);
  padding: 5px;
}
.aq-item.current .aq-inner {
  width: 100%; height: 100%; border-radius: 50%;
  background: linear-gradient(180deg, #ffffff, #e3f3fe);
  display: flex; align-items: center; justify-content: center;
}
.aq-item.done { opacity: 0.35; transform: scale(0.8); }
.aq-label {
  align-self: flex-start;
  direction: rtl;
  background: var(--panel);
  border: 2px solid var(--panel-border);
  border-radius: 99px;
  padding: 4px 14px;
  font-size: 13px; font-weight: 700; color: var(--blue-dark);
  box-shadow: 0 3px 8px rgba(20,70,120,0.12);
}

@keyframes popIn { from { transform: scale(0.3); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------------- Top menu (top-right) ---------------- */
#topMenu { top: 16px; right: 16px; display: flex; gap: 8px; }

/* ---------------- Household card ---------------- */
#householdCard {
  position: fixed; z-index: 19;
  top: 72px; right: 16px;
  width: 270px;
  padding: 12px 14px;
  transition: opacity 0.4s, transform 0.4s;
}
#householdCard.collapsed { opacity: 0; transform: translateX(30px); pointer-events: none; }
.hc-head { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 15px; margin-bottom: 8px; }
.hc-icon { font-size: 18px; }
.hc-progress { margin-inline-start: auto; font-size: 12px; font-weight: 700; color: var(--blue-dark); background: var(--blue-soft); border-radius: 99px; padding: 2px 9px; }
/* every row visible without scrolling (X56): compact single-line rows, long values ellipsised (full text on hover) */
.hc-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.hc-list li {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; padding: 3px 8px; border-radius: 9px; min-width: 0;
  background: #f4f8fb; color: var(--text-dim);
  transition: background 0.3s, color 0.3s;
}
.hc-list li .hc-k { font-weight: 600; min-width: 88px; flex-shrink: 0; }
.hc-list li .hc-v { font-weight: 700; color: var(--text-dim); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hc-list li.filled { background: #ecfbe8; color: var(--text); }
.hc-list li.filled .hc-v { color: var(--green-dark); }
.hc-list li.flash { animation: slotFlash 0.9s ease; }
@keyframes slotFlash { 0% { background: #c9f7b9; transform: scale(1.04); } 100% { background: #ecfbe8; transform: scale(1); } }

/* ---------------- Notifications ---------------- */
#notifications {
  position: fixed; z-index: 30; top: 16px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none;
}
.notif {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel); border: 2px solid var(--panel-border); border-radius: 16px;
  padding: 10px 16px; box-shadow: var(--panel-shadow);
  font-size: 14px; font-weight: 600; max-width: 520px;
  animation: notifIn 0.45s cubic-bezier(.2,1.4,.4,1), notifOut 0.5s ease forwards;
  animation-delay: 0s, var(--life, 4s);
}
.notif .n-icon { font-size: 22px; }
.notif.good { border-color: #9be07f; background: linear-gradient(180deg, #ffffff, #effbea); }
.notif.warn { border-color: #f2d27a; background: linear-gradient(180deg, #ffffff, #fff8e1); }
@keyframes notifIn { from { transform: translateY(-20px) scale(0.9); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes notifOut { to { transform: translateY(-14px); opacity: 0; } }

/* ---------------- Live panel (bottom-left) ---------------- */
#livePanel {
  left: 16px; bottom: 16px;
  display: flex; align-items: center; gap: 12px;
  direction: ltr;
}
.lp-portrait {
  position: relative;
  width: 104px; height: 104px; border-radius: 50%;
  padding: 0; border: 4px solid #fff;
  box-shadow: 0 0 0 3px var(--green), 0 8px 22px rgba(20,70,120,0.3);
  overflow: visible; background: #fff;
  transition: transform 0.2s;
}
.lp-portrait:hover { transform: scale(1.04); }
.lp-portrait img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.lp-portrait .mood-tag { position: absolute; top: -40px; left: 50%; margin-left: -10px; }
.lp-body {
  direction: rtl;
  background: var(--panel); border: 2px solid var(--panel-border); border-radius: var(--radius);
  box-shadow: var(--panel-shadow); padding: 10px 14px;
  display: flex; flex-direction: column; gap: 6px; min-width: 300px;
}
.lp-name-row { display: flex; align-items: baseline; gap: 8px; }
.lp-name { font-size: 18px; font-weight: 900; color: var(--text); }
.lp-role { font-size: 12px; font-weight: 600; color: var(--text-soft); }
.lp-moodlet {
  align-self: flex-start;
  font-size: 13px; font-weight: 700;
  background: #ecfbe8; color: var(--green-dark);
  border: 1.5px solid #b7e8a6; border-radius: 99px; padding: 3px 10px;
  transition: all 0.3s;
}
.lp-moodlet.thinking { background: #fff7d6; color: #9a7200; border-color: #f2d27a; }
.lp-controls { display: flex; align-items: center; gap: 8px; direction: ltr; }
.speed-group { display: flex; background: #e8f2fa; border-radius: 99px; padding: 3px; gap: 2px; }
.speed-btn {
  border: none; background: transparent; color: var(--blue-dark);
  font-size: 11px; font-weight: 900; letter-spacing: -2px;
  padding: 5px 9px; border-radius: 99px; min-width: 32px;
  transition: background 0.15s, color 0.15s;
}
.speed-btn:hover { background: #d3e8f8; }
.speed-btn.active { background: var(--green); color: #fff; box-shadow: 0 2px 6px rgba(79,194,58,0.4); }
.speed-btn[data-speed="0"].active { background: var(--orange); box-shadow: 0 2px 6px rgba(245,154,35,0.45); }
.speed-btn.instant-btn {
  direction: rtl; letter-spacing: 0; font-size: 12px; white-space: nowrap; margin-inline-start: 3px;
  background: linear-gradient(180deg, #ffe27a, #f5b921); color: #6b4a00; box-shadow: 0 2px 6px rgba(245, 185, 33, 0.45);
}
.speed-btn.instant-btn:hover { background: linear-gradient(180deg, #ffeb99, #f7c440); transform: translateY(-1px); }
.lp-clock { font-size: 13px; font-weight: 700; color: var(--text-soft); direction: rtl; white-space: nowrap; }
.lp-funds {
  margin-left: auto;
  font-size: 15px; font-weight: 900; color: #fff;
  background: linear-gradient(180deg, #5ccf45, #33a321);
  border-radius: 99px; padding: 4px 12px;
  box-shadow: 0 3px 8px rgba(51,163,33,0.35);
  white-space: nowrap;
}
.lp-funds.bump { animation: fundsBump 0.45s ease; }
@keyframes fundsBump { 50% { transform: scale(1.15); } }

/* ---------------- Info panel (bottom-right) ---------------- */
#infoPanel {
  right: 16px; bottom: 16px;
  width: 330px;
  background: var(--panel); border: 2px solid var(--panel-border); border-radius: var(--radius);
  box-shadow: var(--panel-shadow);
  overflow: hidden;
}
.ip-tabs { display: flex; align-items: center; gap: 4px; padding: 6px; background: linear-gradient(180deg, #eaf5fd, #dcedf9); border-bottom: 2px solid var(--panel-border); }
.ip-tabs-group { display: flex; align-items: center; gap: 4px; }
.ip-tab {
  width: 40px; height: 36px; border-radius: 12px;
  border: 2px solid transparent; background: transparent;
  font-size: 18px; transition: all 0.15s;
}
.ip-tab:hover { background: #fff; border-color: var(--panel-border); transform: translateY(-1px); }
.ip-tab.active { background: #fff; border-color: var(--blue); box-shadow: 0 2px 6px rgba(31,155,230,0.25); }
.ip-sep { width: 2px; height: 24px; background: var(--panel-border); margin: 0 4px; border-radius: 2px; }
.ip-pane { display: none; padding: 10px 14px 14px; }
.ip-pane.active { display: block; }
.ip-title { font-size: 14px; font-weight: 800; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.ip-count { background: var(--blue); color: #fff; border-radius: 99px; font-size: 11px; padding: 1px 8px; }

.needs-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
.need { display: flex; flex-direction: column; gap: 3px; }
.need-head { display: flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 700; color: var(--text-soft); }
.need-head .need-ico { font-size: 15px; }
.need-bar { height: 12px; border-radius: 99px; background: #e2ebf2; overflow: hidden; box-shadow: inset 0 1px 2px rgba(0,0,0,0.08); }
.need-fill { height: 100%; border-radius: 99px; width: 5%; transition: width 0.8s ease, background 0.8s ease; background: var(--red); }

.inv-list { max-height: 210px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.inv-empty { font-size: 13px; color: var(--text-dim); padding: 10px 0; text-align: center; }
.inv-group { font-size: 11.5px; font-weight: 800; color: var(--blue-dark); margin-top: 4px; }
.inv-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; padding: 4px 8px; background: #f4f8fb; border-radius: 9px; animation: popIn 0.3s ease; }
.inv-row .inv-name { flex: 1; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.inv-row .inv-qty { font-weight: 800; color: var(--blue-dark); }
.inv-row .inv-price { font-weight: 800; color: var(--green-dark); }

.targets-box { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.target-chip { background: #f4f8fb; border-radius: 10px; padding: 6px 8px; display: flex; flex-direction: column; }
.tc-label { font-size: 11px; color: var(--text-soft); font-weight: 600; }
.tc-val { font-size: 15px; font-weight: 900; color: var(--text); }
.tc-val.highlight-val { color: var(--green-dark); }
.tc-note { font-size: 10.5px; color: var(--text-dim); }

/* ---------------- Shira dialog ---------------- */
.sims-dialog {
  position: fixed; z-index: 40;
  /* sits in the gap between the live panel (left) and the info panel (right) */
  left: 524px; right: 362px; bottom: 16px;
  margin-inline: auto;
  max-width: 640px;
  background: var(--panel);
  border: 3px solid var(--blue);
  border-radius: 22px;
  box-shadow: 0 16px 40px rgba(10, 80, 140, 0.28);
  display: flex; flex-direction: column;
  animation: dialogIn 0.4s cubic-bezier(.2,1.3,.4,1);
}
.sims-dialog[hidden] { display: none; }
.sims-dialog.minimized .sd-log, .sims-dialog.minimized .sd-chips, .sims-dialog.minimized .sd-input-row { display: none; }
@keyframes dialogIn { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.sd-head {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  background: linear-gradient(180deg, #2aa8f0, #1286d2);
  border-radius: 18px 18px 0 0;
  color: #fff;
}
.sd-avatar { width: 40px; height: 40px; border-radius: 50%; border: 2px solid #fff; object-fit: cover; }
.sd-head-text { display: flex; flex-direction: column; line-height: 1.2; }
.sd-name { font-weight: 900; font-size: 16px; }
.sd-sub { font-size: 12px; opacity: 0.9; }
.sd-min { margin-inline-start: auto; width: 30px; height: 30px; border-radius: 50%; border: none; background: rgba(255,255,255,0.25); color: #fff; font-weight: 900; }
.sd-log { max-height: 34vh; min-height: 70px; overflow-y: auto; padding: 12px 14px 4px; display: flex; flex-direction: column; gap: 8px; scroll-behavior: smooth; }
.msg { max-width: 88%; padding: 9px 13px; border-radius: 16px; font-size: 14.5px; line-height: 1.5; animation: popIn 0.25s ease; }
.msg.shira { align-self: flex-start; background: var(--blue-soft); border: 1.5px solid #bfe1f8; border-start-start-radius: 4px; }
.msg.user { align-self: flex-end; background: #ecfbe8; border: 1.5px solid #bfe9ae; border-start-end-radius: 4px; font-weight: 600; }
.msg.ack { align-self: flex-start; background: #fff; border: 1.5px dashed #9be07f; font-size: 13px; color: var(--green-dark); font-weight: 700; }
.msg .caret { display: inline-block; width: 7px; height: 15px; background: var(--blue); margin-inline-start: 2px; vertical-align: middle; animation: blink 0.8s infinite; }
@keyframes blink { 50% { opacity: 0; } }
.sd-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 14px 4px; }
.chip {
  border: 2px solid var(--panel-border); background: #fff; color: var(--text);
  border-radius: 99px; padding: 7px 13px; font-size: 13.5px; font-weight: 600;
  transition: all 0.15s; animation: popIn 0.3s ease;
}
.chip:hover { border-color: var(--blue); background: var(--blue-soft); transform: translateY(-1px); }
.chip.primary { background: linear-gradient(180deg, #5ccf45, #33a321); color: #fff; border-color: #2f9a22; font-weight: 800; }
.chip.primary:hover { filter: brightness(1.06); }
.chip.ghost { border-style: dashed; color: var(--text-soft); }
.sd-input-row { display: flex; gap: 8px; padding: 8px 14px 12px; }
.sd-input-row[hidden] { display: none; }
#dialogInput {
  flex: 1; border: 2px solid var(--panel-border); border-radius: 99px;
  padding: 10px 16px; font-family: inherit; font-size: 14.5px; color: var(--text);
  outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
#dialogInput:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(31,155,230,0.15); }
.sd-send { width: 44px; height: 44px; border-radius: 50%; border: none; background: linear-gradient(180deg, #2aa8f0, #1286d2); color: #fff; font-size: 18px; transform: scaleX(-1); transition: filter 0.15s, opacity 0.15s; }
#dialogInput:disabled { background: #f1f5f9; border-style: dashed; color: var(--text-dim); cursor: not-allowed; }
#dialogInput:disabled::placeholder { color: var(--text-dim); }
.sd-send:disabled { filter: grayscale(1); opacity: 0.45; cursor: not-allowed; }

/* ---------------- 3D-anchored balloons & labels ---------------- */
.balloon {
  position: absolute; transform: translate(-50%, -100%);
  background: #fff; border: 2.5px solid var(--panel-border); border-radius: 18px;
  padding: 6px 12px; font-size: 13.5px; font-weight: 700; color: var(--text);
  box-shadow: 0 6px 16px rgba(20,70,120,0.2);
  white-space: nowrap; max-width: 300px; overflow: hidden; text-overflow: ellipsis;
  pointer-events: none;
  animation: balloonIn 0.3s cubic-bezier(.2,1.6,.4,1);
}
.balloon::after {
  content: ''; position: absolute; left: 50%; bottom: -9px; margin-left: -8px;
  border: 8px solid transparent; border-top-color: #fff; border-bottom: 0;
}
.balloon.thought { border-radius: 50%; padding: 8px 10px; font-size: 22px; }
.balloon.npc { font-size: 12.5px; padding: 4px 10px; border-color: #e0e8ef; color: var(--text-soft); }
.balloon.ask { border-color: var(--yellow); }
@keyframes balloonIn { from { transform: translate(-50%, -80%) scale(0.5); opacity: 0; } to { transform: translate(-50%, -100%) scale(1); opacity: 1; } }

.float-label {
  position: absolute; transform: translate(-50%, -50%);
  font-weight: 900; font-size: 18px; color: var(--green-dark);
  text-shadow: 0 2px 0 #fff, 0 0 8px #fff;
  pointer-events: none;
  animation: floatUp 1.4s ease-out forwards;
}
@keyframes floatUp { 0% { opacity: 0; transform: translate(-50%, -30%) scale(0.6); } 15% { opacity: 1; transform: translate(-50%, -60%) scale(1.1); } 100% { opacity: 0; transform: translate(-50%, -260%) scale(1); } }

/* ---------------- Pie menu ---------------- */
#pieMenu { position: fixed; z-index: 60; width: 0; height: 0; }
#pieMenu[hidden] { display: none; }
.pie-center {
  position: absolute; transform: translate(-50%, -50%);
  background: linear-gradient(180deg, #2aa8f0, #1286d2); color: #fff;
  border: 3px solid #fff; border-radius: 99px;
  padding: 6px 14px; font-weight: 900; font-size: 14px; white-space: nowrap;
  box-shadow: 0 6px 16px rgba(10,80,140,0.35);
  animation: popIn 0.25s ease;
}
.pie-opt {
  position: absolute; transform: translate(-50%, -50%);
  background: #fff; border: 2.5px solid var(--panel-border); border-radius: 99px;
  padding: 8px 14px; font-size: 13.5px; font-weight: 700; color: var(--text); white-space: nowrap;
  box-shadow: 0 6px 16px rgba(20,70,120,0.22);
  animation: pieIn 0.3s cubic-bezier(.2,1.5,.4,1) both;
  transition: background 0.12s, border-color 0.12s, transform 0.12s;
}
.pie-opt:hover { background: var(--blue-soft); border-color: var(--blue); transform: translate(-50%, -50%) scale(1.06); }
@keyframes pieIn { from { opacity: 0; transform: translate(-50%, -50%) scale(0.3); } to { opacity: 1; transform: translate(-50%, -50%) scale(1); } }

#hoverTip {
  position: fixed; z-index: 55; pointer-events: none;
  background: rgba(29, 51, 72, 0.9); color: #fff;
  font-size: 12.5px; font-weight: 700; padding: 5px 10px; border-radius: 10px;
  transform: translate(-50%, -140%);
  white-space: nowrap;
}
#hoverTip[hidden] { display: none; }

#deptCard {
  position: fixed; z-index: 58;
  width: 300px; padding: 12px 14px;
  animation: popIn 0.25s ease;
}
#deptCard[hidden] { display: none; }
.dc-head { display: flex; align-items: center; gap: 8px; font-weight: 900; font-size: 15px; margin-bottom: 8px; }
.dc-head .dc-close { margin-inline-start: auto; border: none; background: #eef4f9; border-radius: 50%; width: 26px; height: 26px; font-weight: 900; color: var(--text-soft); }
.dc-row { display: flex; gap: 8px; font-size: 13px; padding: 5px 8px; border-radius: 9px; background: #f4f8fb; margin-bottom: 4px; }
.dc-row .dc-name { flex: 1; font-weight: 600; }
.dc-row .dc-price { font-weight: 800; color: var(--green-dark); }
.dc-row.pending { opacity: 0.55; }
.dc-empty { font-size: 13px; color: var(--text-soft); }

/* ---------------- Modals ---------------- */
.sims-modal-backdrop {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(150, 195, 230, 0.35);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.25s ease;
}
.sims-modal-backdrop[hidden] { display: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.sims-modal {
  width: min(1080px, 94vw); max-height: 88vh;
  background: linear-gradient(180deg, #ffffff, #f4f9fd);
  border: 3px solid var(--blue); border-radius: 24px;
  box-shadow: 0 24px 60px rgba(10, 70, 130, 0.35);
  display: flex; flex-direction: column; overflow: hidden;
  animation: modalIn 0.35s cubic-bezier(.2,1.3,.4,1);
}
.sims-modal.small { width: min(560px, 94vw); }
@keyframes modalIn { from { transform: scale(0.92) translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }
.sm-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px;
  background: linear-gradient(180deg, #2aa8f0, #1286d2); color: #fff;
}
.sm-head h2 { margin: 0; font-size: 19px; font-weight: 900; }
.sm-icon { font-size: 22px; }
.sm-badge { font-size: 12.5px; font-weight: 800; background: rgba(255,255,255,0.22); border-radius: 99px; padding: 3px 10px; }
.sm-badge:empty { display: none; }
.sm-close { margin-inline-start: auto; width: 36px; height: 36px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.7); background: rgba(255,255,255,0.18); color: #fff; font-size: 16px; font-weight: 900; }
.sm-close:hover { background: rgba(255,255,255,0.35); }
.sm-body { padding: 16px 18px 20px; overflow-y: auto; }
.help-body p { font-size: 15px; line-height: 1.7; margin: 0 0 8px; }

/* Targets window (per-member daily kcal / protein) */
.targets-modal { width: min(620px, 94vw); }
.tg-intro { margin: 0 0 12px; font-size: 14px; line-height: 1.6; color: var(--text-soft); }
.tg-member { background: #fff; border: 2px solid #dbe9f4; border-radius: 16px; padding: 10px 14px 12px; margin-bottom: 10px; }
.tg-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.tg-head h3 { margin: 0; font-size: 16px; font-weight: 900; }
.tg-emoji { font-size: 20px; }
.tg-goal { font-size: 12.5px; font-weight: 700; color: var(--text-soft); background: #eef4f9; border-radius: 99px; padding: 2px 10px; }
.tg-adj { margin-inline-start: auto; font-size: 12px; font-weight: 800; color: #9a5b00; background: #fff4dc; border-radius: 99px; padding: 2px 10px; display: inline-flex; align-items: center; }
.tg-adj[hidden] { display: none; }
.tg-field { margin-top: 6px; }
.tg-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.tg-top label { font-size: 13.5px; font-weight: 800; }
.tg-top output { font-size: 14px; font-weight: 900; color: var(--text); }
.tg-field input[type="range"] { width: 100%; margin: 4px 0 2px; accent-color: #1286d2; height: 22px; cursor: pointer; }
.tg-rec { font-size: 12.5px; line-height: 1.5; color: var(--text-soft); }
.tg-status { font-size: 11.5px; font-weight: 800; border-radius: 99px; padding: 1px 8px; margin-inline-start: 4px; }
.tg-status.good { background: #e6f7df; color: #22731a; }
.tg-status.warn { background: #fff0d9; color: #8a4b00; }
.tg-status.info { background: #e5f1fb; color: #0d5f9c; }
.tg-macros { margin-top: 6px; font-size: 12.5px; font-weight: 700; color: var(--text); background: #f4f8fb; border-radius: 9px; padding: 4px 8px; }
.tg-note { margin: 8px 0 0; font-size: 12.5px; line-height: 1.6; color: var(--text-soft); }
.tg-actions { display: flex; gap: 10px; justify-content: flex-start; padding: 10px 18px 14px; border-top: 2px solid #e3eef7; background: #fff; }

.sims-btn {
  border: 2px solid var(--panel-border); background: #fff; color: var(--text);
  border-radius: 99px; padding: 9px 18px; font-size: 14px; font-weight: 800;
  transition: all 0.15s; box-shadow: 0 3px 8px rgba(20,70,120,0.12);
}
.sims-btn:hover { border-color: var(--blue); transform: translateY(-1px); }
.sims-btn.primary { background: linear-gradient(180deg, #5ccf45, #33a321); border-color: #2f9a22; color: #fff; }
.sims-btn.ghost { background: transparent; box-shadow: none; border-style: dashed; }

/* Cart / receipt (markup rendered by simulator.js) */
.basket-summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 12px; }
.b-stat-card { background: #fff; border: 2px solid #dbe9f4; border-radius: 16px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.b-stat-card.highlight-card { border-color: #9be07f; background: #f2fbee; }
.b-stat-label { font-size: 12px; font-weight: 700; color: var(--text-soft); }
.b-stat-val { font-size: 20px; font-weight: 900; color: var(--text); }
.b-stat-val.primary-val { color: var(--blue-dark); }
.b-stat-val.save-val { color: var(--green-dark); }
.b-stat-sub { font-size: 11px; color: var(--text-dim); }
.basket-actions-bar { display: flex; gap: 8px; margin-bottom: 12px; }
.basket-table-wrap { background: #fff; border: 2px solid #dbe9f4; border-radius: 16px; overflow: auto; }
.basket-table { width: 100%; border-collapse: collapse; font-size: 13.5px; text-align: right; }
.basket-table th { background: #eef6fc; color: var(--text-soft); font-size: 12px; font-weight: 800; padding: 10px 14px; position: sticky; top: 0; }
.basket-table td { padding: 10px 14px; border-bottom: 1px solid #eef3f7; }
.basket-cat-header-row td { padding: 0 !important; }
.b-cat-header-content { display: flex; justify-content: space-between; align-items: center; padding: 8px 14px; background: #f3f9fd; border-inline-start: 5px solid var(--blue); }
.b-cat-left { display: flex; align-items: center; gap: 8px; }
.b-cat-icon { font-size: 18px; }
.b-cat-title { font-weight: 900; }
.b-cat-badge { font-size: 11px; font-weight: 700; background: #fff; border: 1.5px solid #dbe9f4; border-radius: 99px; padding: 1px 8px; color: var(--text-soft); }
.b-cat-total strong { color: var(--green-dark); }
.p-name { font-weight: 800; }
.p-barcode { font-size: 11px; color: var(--text-dim); font-family: ui-monospace, monospace; }
.dep-pill { font-size: 11px; font-weight: 700; background: #eef4f9; color: var(--text-soft); border-radius: 99px; padding: 3px 9px; }
.qty-badge { display: inline-block; min-width: 28px; text-align: center; background: var(--blue-soft); color: var(--blue-dark); font-weight: 900; border-radius: 99px; padding: 2px 8px; }
.basket-item-row.pending { opacity: 0.45; }
/* picked/pending markers: .row-picked / .row-pending (icons section above) */
.promo-badge {
  display: inline-block; margin-inline-start: 6px; padding: 1px 8px; border-radius: 99px; vertical-align: 1px;
  font-size: 11px; font-weight: 800; color: #9a3d00; background: #fff1e0; border: 1px solid #ffd2a3;
}
.p-promo { font-size: 11.5px; font-weight: 600; color: #b25200; margin-top: 1px; }
.was-price { display: block; font-size: 11px; color: var(--text-dim); font-weight: 600; }
.promo-card .b-stat-label { color: #b25200; }

/* Reasons (markup rendered by simulator.js) */
.explanations-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.explanation-card { background: #fff; border: 2px solid #dbe9f4; border-radius: 18px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.explanation-card { scroll-margin-top: 64px; }
.explanation-card:focus { outline: none; }
.explanation-card.why-flash { animation: whyFlash 2.2s ease-out; }
@keyframes whyFlash {
  0%, 30% { border-color: #ff9f1c; box-shadow: 0 0 0 4px rgba(255, 159, 28, .35); }
  100% { border-color: #dbe9f4; box-shadow: 0 0 0 0 rgba(255, 159, 28, 0); }
}
/* cart row "?" -> that product's card in the "why" tab */
.why-link {
  display: inline-flex; align-items: center; justify-content: center; vertical-align: middle;
  width: 22px; height: 22px; margin-inline: 4px; padding: 0; border-radius: 50%;
  border: 1.5px solid #9cc3e4; background: #eef6fd; color: #1f6fb2; font-size: 13px; cursor: pointer;
  transition: background .15s, transform .15s, border-color .15s;
}
.why-link:hover { background: #d9ecfb; border-color: #1f6fb2; transform: scale(1.1); }
.why-link:focus-visible { outline: 3px solid #ff9f1c; outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .explanation-card.why-flash { animation: none; border-color: #ff9f1c; } .why-link { transition: none; } }
.exp-header { display: flex; justify-content: space-between; gap: 10px; }
.exp-title-row { display: flex; flex-direction: column; gap: 4px; }
.exp-dep-badge { align-self: flex-start; font-size: 11px; font-weight: 800; background: var(--blue-soft); color: var(--blue-dark); border-radius: 99px; padding: 2px 9px; }
.exp-prod-name { margin: 0; font-size: 15px; font-weight: 900; }
.exp-price-badge { display: flex; flex-direction: column; align-items: flex-end; }
.exp-price-num { font-weight: 900; color: var(--green-dark); font-size: 16px; }
.exp-qty-label { font-size: 11px; color: var(--text-soft); }
.exp-nutrition-panel { background: #f8fbfd; border: 1.5px solid #e4eef6; border-radius: 12px; padding: 8px; }
.enp-header { display: flex; justify-content: space-between; font-size: 11.5px; font-weight: 700; color: var(--text-soft); margin-bottom: 6px; }
.enp-verified { color: var(--green-dark); }
.enp-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.enp-cell { display: flex; flex-direction: column; align-items: center; background: #fff; border-radius: 8px; padding: 4px; }
.enp-cell.highlight { background: #ecfbe8; }
.enp-val { font-weight: 900; font-size: 13px; }
.enp-label { font-size: 10px; color: var(--text-dim); }
.exp-body { display: flex; flex-direction: column; gap: 8px; }
.block-title { display: flex; gap: 6px; font-size: 12.5px; font-weight: 800; color: var(--text-soft); }
.block-text { margin: 2px 0 0; font-size: 13px; line-height: 1.55; }
.exp-footer { display: flex; justify-content: space-between; align-items: center; }
.exp-saving-pill { font-size: 12px; font-weight: 800; background: #ecfbe8; color: var(--green-dark); border-radius: 99px; padding: 3px 10px; }
.exp-store-tag { font-size: 11px; color: var(--text-dim); }

/* Meal plan (markup rendered by simulator.js) */
.mp-avg-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.mp-avg-pill { background: #fff; border: 2px solid #dbe9f4; border-radius: 99px; padding: 5px 12px; font-size: 13px; }
.mp-day-tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 12px; padding-bottom: 4px; }
.mp-tab-btn { border: 2px solid #dbe9f4; background: #fff; border-radius: 14px; padding: 6px 12px; display: flex; flex-direction: column; align-items: center; min-width: 86px; transition: all 0.15s; }
.mp-tab-btn.active { border-color: var(--blue); background: var(--blue-soft); }
.mp-tab-name { font-weight: 900; font-size: 13.5px; }
.mp-tab-icon { font-size: 14px; color: var(--text-soft); }
.day-overview-banner { background: #fff; border: 2px solid #dbe9f4; border-radius: 16px; padding: 12px 14px; margin-bottom: 12px; }
.day-title-wrap { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.day-main-title { margin: 0; font-size: 18px; font-weight: 900; }
.day-type-badge { font-size: 12px; font-weight: 700; background: var(--blue-soft); color: var(--blue-dark); border-radius: 99px; padding: 3px 10px; }
.day-target-focus { margin: 6px 0; font-size: 13.5px; color: var(--text-soft); }
.day-prep-tip { font-size: 13px; background: #fff8e1; border-radius: 10px; padding: 6px 10px; }
.meals-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.meal-card { background: #fff; border: 2px solid #dbe9f4; border-radius: 16px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.meal-name-row { display: flex; justify-content: space-between; }
.meal-name { margin: 0; font-size: 14px; font-weight: 900; }
.meal-time { font-size: 12px; color: var(--text-dim); font-weight: 700; }
.meal-dish { font-size: 13px; font-weight: 600; }
.meal-ingredients-box { background: #f8fbfd; border-radius: 10px; padding: 6px 8px; }
.meal-ingredients-box > summary { cursor: pointer; list-style: none; }
.meal-ingredients-box > summary::-webkit-details-marker { display: none; }
.meal-ingredients-box > summary::after { content: ' ▾'; color: var(--blue); }
.meal-ingredients-box[open] > summary::after { content: ' ▴'; }
.ing-title { font-size: 11.5px; font-weight: 800; color: var(--text-soft); }
.ing-list { margin: 4px 0 0; padding-inline-start: 18px; font-size: 12px; line-height: 1.55; }
.ing-prod { color: var(--text-dim); font-size: 11px; }
.ing-prep { display: inline-block; margin-inline-start: 4px; padding: 1px 7px; border-radius: 999px; background: #e8f7ee; color: #1f7a4a; font-size: 11px; font-weight: 600; }
.day-totals-card { margin-top: 12px; background: #fff; border: 2px solid #dbe9f4; border-radius: 14px; padding: 10px 14px; font-size: 13px; }
.dt-title { font-weight: 900; margin-inline-end: 8px; }

/* Family menu: members strip */
.mp-avg-bar { display: block; }
.fm-family { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; margin-bottom: 8px; }
.fm-member {
  display: flex; align-items: center; gap: 10px; background: linear-gradient(160deg, #fff, #f1f9ff);
  border: 2px solid #cfe6f7; border-radius: 16px; padding: 8px 10px; box-shadow: 0 3px 0 #d7eaf8;
  animation: fmPop 0.35s ease both;
}
.fm-member:nth-child(2) { animation-delay: 0.05s; }
.fm-member:nth-child(3) { animation-delay: 0.1s; }
.fm-member:nth-child(4) { animation-delay: 0.15s; }
.fm-member:nth-child(5) { animation-delay: 0.2s; }
@keyframes fmPop { from { transform: translateY(6px) scale(0.96); opacity: 0; } }
.fm-emoji { font-size: 30px; line-height: 1; filter: drop-shadow(0 2px 2px rgba(0,0,0,0.12)); }
.fm-info { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.fm-info b { font-size: 14.5px; font-weight: 900; }
.fm-goal { font-size: 11.5px; color: var(--blue-dark); font-weight: 700; line-height: 1.3; }
.fm-target { font-size: 11px; color: var(--text-dim); }
.fm-groups { font-size: 11px; color: var(--text-dim); }
.fm-groups .fg-ok { color: #1f9d57; }
.fm-groups .fg-mid { color: #b7791f; }
.fm-groups .fg-low { color: #c53030; }
.fm-pct {
  min-width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 900; font-size: 13px; color: #fff; background: var(--green-dark); /* white text >= 4.5:1 */
  box-shadow: inset 0 -3px 0 rgba(0,0,0,0.15);
}
.fm-pct.mid { background: #b45f06; }
.fm-pct.low { background: #c0262d; }

/* Family menu: meal cards */
.meals-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.meal-card { transition: transform 0.15s, box-shadow 0.15s; }
.meal-card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(20, 70, 120, 0.12); }
.meal-card.skipped { background: repeating-linear-gradient(-45deg, #fbfdff, #fbfdff 10px, #f1f6fb 10px, #f1f6fb 20px); border-style: dashed; opacity: 0.85; }
.meal-header { display: flex; flex-direction: column; gap: 3px; }
.meal-dish { font-size: 14px; font-weight: 800; color: var(--text); }
.meal-diners { display: flex; align-items: center; gap: 2px; font-size: 17px; }
.meal-diners .meal-cost { margin-inline-start: auto; font-size: 12px; font-weight: 800; color: #0f6b3a; background: #e6f7ec; border-radius: 99px; padding: 2px 9px; white-space: nowrap; }
.meal-diners .meal-cost .ph { color: #0f6b3a; }
.day-cost { font-size: 13px; color: #0f6b3a; background: #e6f7ec; border-radius: 10px; padding: 5px 10px; margin-top: 6px; }
.day-cost .ph { color: #0f6b3a; }
.meal-diners .guests { font-size: 11.5px; font-weight: 800; background: #ffe9ef; color: var(--rl-red); border-radius: 99px; padding: 2px 8px; margin-inline-start: 6px; }
.meal-portions { display: flex; flex-direction: column; gap: 5px; }
.portion-row {
  display: grid; grid-template-columns: 92px 1fr; grid-template-areas: 'who what' 'who num';
  gap: 1px 8px; align-items: center; background: #f6fafe; border-radius: 10px; padding: 5px 8px;
  border-inline-start: 4px solid var(--teal);
}
.portion-row:nth-child(2) { border-inline-start-color: var(--blue); }
.portion-row:nth-child(3) { border-inline-start-color: var(--orange); }
.portion-row:nth-child(4) { border-inline-start-color: #c86bd6; }
.portion-row:nth-child(5) { border-inline-start-color: var(--gold); }
.portion-who { grid-area: who; font-weight: 900; font-size: 12.5px; }
.portion-what { grid-area: what; font-size: 12.5px; line-height: 1.45; }
.portion-num { grid-area: num; font-size: 11px; color: var(--text-dim); font-weight: 700; }

/* Family menu: day totals per member */
.dt-members { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px; margin-top: 8px; }
.dt-member { display: flex; flex-direction: column; gap: 2px; background: #f6fafe; border-radius: 10px; padding: 6px 10px; font-size: 12.5px; }
.dt-who { font-weight: 900; }
.dt-share { font-size: 11px; color: var(--text-dim); }
.dt-member i, .fm-member i { font-style: normal; font-weight: 900; border-radius: 99px; padding: 0 6px; font-size: 11px; }
i.ok { background: #e3f8de; color: var(--green-dark); }
i.mid { background: #fff1dc; color: #b86a00; }
i.low { background: #ffe4e5; color: var(--red); }

/* Celebration */
.celebrate { text-align: center; padding: 26px 24px 22px; border-color: var(--green); }
.cel-trophy { font-size: 64px; animation: trophyBounce 1.2s ease infinite; }
@keyframes trophyBounce { 50% { transform: translateY(-8px) rotate(-6deg); } }
.cel-title { margin: 6px 0; font-size: 24px; font-weight: 900; color: var(--green-dark); }
.cel-text { font-size: 15px; color: var(--text-soft); line-height: 1.6; margin: 0 0 12px; }
.cel-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 16px; }
.cel-stat { background: #f4f8fb; border-radius: 14px; padding: 8px; }
.cel-stat b { display: block; font-size: 20px; font-weight: 900; color: var(--text); }
.cel-stat span { font-size: 12px; color: var(--text-soft); font-weight: 600; }
.cel-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 80; overflow: hidden; }
.confetto { position: absolute; top: -20px; width: 10px; height: 16px; border-radius: 3px; animation: confettiFall linear forwards; }
@keyframes confettiFall { to { transform: translateY(110vh) rotate(720deg); } }

/* short screens: tighter rows so the whole household still fits */
@media (max-height: 760px) {
  #householdCard { top: 64px; padding: 9px 12px; }
  .hc-head { margin-bottom: 5px; font-size: 14px; }
  .hc-list { gap: 2px; }
  .hc-list li { font-size: 12px; padding: 2px 8px; }
}
.chip:disabled { opacity: 0.55; cursor: default; }
.chip.busy:disabled { opacity: 1; }
.speed-btn:disabled { opacity: 0.5; cursor: default; }

/* ---------------- Responsive ---------------- */
@media (max-width: 1180px) {
  .sims-dialog { left: 16px; right: 16px; max-width: 720px; bottom: 170px; }
  #householdCard { width: 230px; }
}
@media (max-width: 760px) {
  #livePanel .lp-body { min-width: 0; }
  .lp-portrait { width: 72px; height: 72px; }
  .lp-clock { display: none; }
  #infoPanel { width: calc(100vw - 32px); bottom: 120px; }
  #infoPanel .ip-pane { display: none !important; }
  .sims-dialog { bottom: 180px; }
  #householdCard { display: none; }
  #actionQueue .aq-item:not(.current) { display: none; }
}
/* Phones (X20): the HUD fits a 360-430 px screen - no control cut off at the edges */
@media (max-width: 520px) {
  #topMenu { top: 8px; right: 8px; gap: 6px; }
  #topMenu .round-btn { width: 38px; height: 38px; font-size: 17px; }
  #btnFullscreen { display: none; } /* iOS Safari has no fullscreen API; the page is full screen already */
  .store-chip { max-width: 44vw; }
  #actionQueue { top: 56px; left: auto; right: 8px; direction: rtl; }
  #actionQueue .aq-item.current { transform: scale(0.8); transform-origin: top right; }
  #livePanel { left: 8px; right: 8px; bottom: 8px; gap: 8px; }
  #livePanel .lp-body { flex: 1; padding: 8px 10px; gap: 5px; }
  .lp-portrait { width: 56px; height: 56px; border-width: 3px; }
  .lp-portrait .mood-tag { top: -30px; }
  .lp-name { font-size: 15px; }
  .lp-role { display: none; }
  .lp-moodlet { font-size: 12px; padding: 2px 8px; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .lp-controls { gap: 6px; }
  .speed-btn { padding: 4px 6px; min-width: 26px; }
  .speed-btn.instant-btn { font-size: 11px; }
  .lp-funds { font-size: 13px; padding: 3px 9px; }
  #infoPanel { right: 8px; width: calc(100vw - 16px); bottom: 118px; }
  /* the chat stays between the top menu and the bottom panels: its log and chips scroll inside */
  .sims-dialog { left: 8px; right: 8px; bottom: 172px; max-height: calc(100dvh - 272px); display: flex; flex-direction: column; }
  .sd-log { max-height: none; flex: 1 1 auto; min-height: 60px; }
  .sd-chips { flex: 0 1 auto; max-height: 32dvh; overflow-y: auto; }
  .plan-tab { padding: 8px 9px 9px; font-size: 13px; gap: 5px; }
  .plan-tab-icon { display: none; }
}

@media print {
  #world, .hud-block, #householdCard, .sims-dialog, #loadingScreen { display: none !important; }
  .sims-modal-backdrop { position: static; background: none; }
  .sims-modal { max-height: none; box-shadow: none; }
}

/* Joint optimizer banner (cart + menu modals) */
.opt-banner { display: flex; gap: 10px; align-items: flex-start; margin: 0 0 12px; padding: 10px 14px; border-radius: 14px;
  background: linear-gradient(135deg, #eef6ff, #f3efff); border: 2px solid #c9dcf7; color: #23324a; font-size: 13.5px; line-height: 1.55; }
.opt-banner[hidden] { display: none; }
.opt-banner .ob-icon { font-size: 22px; line-height: 1; margin-top: 2px; }
.opt-banner .ob-meta { display: inline-block; margin-inline-start: 6px; padding: 1px 8px; border-radius: 999px; background: #fff; border: 1px solid #c9dcf7; font-size: 12px; color: #4a5d7a; }
.opt-banner.fallback { background: #fff8e8; border-color: #f2d48a; }

/* ---------------- Developer credit (small, unobtrusive) ---------------- */
.tl-credit,
.help-body p.tl-credit {
  margin: 10px 0 12px;
  font-size: 11.5px;
  line-height: 1.5;
  font-weight: 500;
  color: var(--text-dim);
  text-align: center;
  direction: rtl;
}
.tl-credit a {
  color: var(--text-soft);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px dotted currentColor;
  transition: color 0.15s ease;
}
.tl-credit a:hover, .tl-credit a:focus-visible { color: var(--blue-dark); }
.tl-credit a[href^="mailto:"] { direction: ltr; unicode-bidi: isolate; }
#loadingScreen .tl-credit { margin-top: 6px; }
body.picking-store #loadingScreen .tl-credit { margin: 10px 0 14px; }
.help-body p.tl-credit { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--panel-border); }

/* ---------------- Plan window: cart / menu / why as tabs ---------------- */
.plan-modal { height: 88vh; }
.plan-tabs {
  display: flex; gap: 6px; padding: 10px 16px 0;
  background: linear-gradient(180deg, #e3f3fe, #f4f9fd);
  border-bottom: 2px solid var(--panel-border);
  overflow-x: auto; scrollbar-width: none;
}
.plan-tabs::-webkit-scrollbar { display: none; }
.plan-tab {
  position: relative; display: inline-flex; align-items: center; gap: 7px;
  padding: 10px 18px 11px; margin-bottom: -2px;
  border: 2px solid transparent; border-bottom: none; border-radius: 14px 14px 0 0;
  background: transparent; color: var(--text-soft);
  font-size: 15px; font-weight: 800; white-space: nowrap;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}
.plan-tab:hover { background: rgba(255, 255, 255, 0.7); color: var(--blue-dark); transform: translateY(-1px); }
.plan-tab:focus-visible { outline: 3px solid rgba(31, 155, 230, 0.45); outline-offset: -3px; }
.plan-tab.active {
  background: #fff; color: var(--blue-dark);
  border-color: var(--panel-border);
  box-shadow: 0 -4px 12px rgba(20, 70, 120, 0.08);
}
.plan-tab.active::after {
  content: ''; position: absolute; inset-inline: 14px; top: 0; height: 3px;
  border-radius: 0 0 3px 3px; background: linear-gradient(90deg, var(--blue), var(--teal));
  animation: tabInk 0.25s ease;
}
@keyframes tabInk { from { transform: scaleX(0.3); opacity: 0; } to { transform: none; opacity: 1; } }
.plan-tab-icon { font-size: 18px; }
.plan-tab-count {
  min-width: 22px; padding: 1px 8px; border-radius: 99px;
  background: var(--blue-soft); color: var(--blue-dark);
  font-size: 12px; font-weight: 800; text-align: center;
}
.plan-tab.active .plan-tab-count { background: var(--blue); color: #fff; }
.plan-tab-count:empty { display: none; }
.plan-pane { flex: 1; min-height: 0; }
.plan-pane.active { animation: paneIn 0.22s ease; }
@keyframes paneIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (max-width: 640px) {
  .plan-tab { padding: 9px 12px 10px; font-size: 14px; }
}
@media print {
  .plan-modal { height: auto; }
  .plan-tabs { display: none; }
  .plan-pane[hidden] { display: block !important; }
  .plan-pane { break-before: page; }
  .plan-pane:first-of-type { break-before: auto; }
}

/* ---------------- Print sheets (simulator.js printPlan): only the sheet is printed ---------------- */
/* Print as a small icon: next to the day tabs (menu, with a 2-choice popover) / top corner (prep) */
.icon-btn {
  flex: none; width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; border: 1.5px solid #d6e4ef; background: #fff; color: #36506a; font-size: 18px; cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.icon-btn:hover { background: #f1f7fc; border-color: var(--orange, #ff9f1c); transform: translateY(-1px); }
.icon-btn:focus-visible { outline: 3px solid #0b5fa5; outline-offset: 2px; }
.icon-btn[aria-expanded="true"] { background: #fff4e3; border-color: var(--orange, #ff9f1c); }
.mp-tabs-row { display: flex; align-items: flex-start; gap: 8px; }
.mp-tabs-row .mp-day-tabs { flex: 1; min-width: 0; }
.print-menu { position: relative; flex: none; }
.print-pop {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 20; min-width: 230px; padding: 6px;
  display: flex; flex-direction: column; gap: 2px; background: #fff; border: 1px solid #dfe9f2; border-radius: 12px;
  box-shadow: 0 12px 28px rgba(20, 50, 80, 0.18); animation: popIn 0.14s ease-out;
}
.print-pop[hidden] { display: none; }
.print-pop button {
  display: flex; align-items: center; text-align: right; padding: 8px 10px; border: none; border-radius: 8px;
  background: transparent; font: 600 14px var(--font, inherit); color: var(--text, #1d2b3a); cursor: pointer;
}
.print-pop button:hover, .print-pop button:focus-visible { background: #fff4e3; outline: none; }
@keyframes popIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.pane-tools { float: left; margin: 0 0 6px 8px; position: relative; z-index: 2; }
#printSheet { display: none; }
@media print {
  @page { size: A4; margin: 12mm; }
  html { background: #fff !important; }
  body.print-sheet > *:not(#printSheet) { display: none !important; }
  body.print-sheet { background: #fff !important; overflow: visible !important; height: auto !important; }
  body.print-sheet #printSheet { display: block; direction: rtl; color: #111; font: 11pt/1.45 'Rubik', system-ui, sans-serif; }
  .ps-head { border-bottom: 2px solid #111; padding-bottom: 6px; margin-bottom: 10px; }
  .ps-brand { font-size: 9pt; color: #555; }
  .ps-head h1 { font-size: 18pt; margin: 2px 0; }
  .ps-meta { font-size: 9.5pt; color: #333; }
  #printSheet h2 { font-size: 13pt; margin: 12px 0 4px; break-after: avoid; }
  #printSheet h3 { font-size: 11pt; margin: 6px 0 2px; break-after: avoid; }
  .ps-table { width: 100%; border-collapse: collapse; font-size: 10pt; }
  .ps-table th, .ps-table td { border: 1px solid #bbb; padding: 3px 6px; text-align: right; vertical-align: top; }
  .ps-table thead th { background: #eee; }
  .ps-table tr { break-inside: avoid; }
  .ps-week th:first-child { white-space: nowrap; width: 1%; }
  .ps-week td { font-size: 9.5pt; }
  .ps-check { width: 18px; }
  .ps-box { display: inline-block; width: 11px; height: 11px; border: 1.5px solid #333; border-radius: 2px; vertical-align: -1px; }
  .ps-block, .ps-meal { break-inside: avoid; }
  .ps-day { break-before: page; }
  .print-sheet-prep .ps-day:first-of-type { break-before: auto; }
  .ps-week-page + .ps-week-page { break-before: page; }
  .ps-steps { margin: 2px 0; padding-inline-start: 18px; }
  .ps-steps li { margin-bottom: 1px; }
  .ps-ing, .ps-tip { margin: 2px 0; }
  .ps-muted { color: #666; font-weight: normal; }
  .ps-total { margin-top: 10px; font-size: 12pt; }
  .ps-foot { margin-top: 14px; padding-top: 6px; border-top: 1px solid #bbb; font-size: 8.5pt; color: #555; }
}

/* ---------------- Recipe (how to make it) on each menu card ---------------- */
.meal-recipe-box {
  margin-top: 6px; padding: 6px 8px; border-radius: 10px;
  background: linear-gradient(180deg, #fff8ec, #fff3df);
  border: 1px solid #f6dfb5;
}
.meal-recipe-box > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 6px; }
.meal-recipe-box > summary::-webkit-details-marker { display: none; }
.meal-recipe-box > summary::after { content: ' ▾'; color: var(--orange); }
.meal-recipe-box[open] > summary::after { content: ' ▴'; }
.meal-recipe-box > summary:hover { color: #b86b00; }
.recipe-time {
  margin-inline-start: auto; padding: 1px 8px; border-radius: 99px;
  background: #fff; border: 1px solid #f6dfb5; color: #a3620a; font-size: 11px; font-weight: 800;
}
.recipe-steps { margin: 6px 0 2px; padding-inline-start: 20px; font-size: 12.5px; line-height: 1.6; color: var(--text); }
.recipe-steps li { margin-bottom: 3px; }
.recipe-steps li::marker { color: var(--orange); font-weight: 800; }
.meal-recipe-box[open] .recipe-steps { animation: paneIn 0.2s ease; }
.meal-desc { margin: 2px 0 4px; font-size: 12px; line-height: 1.45; color: var(--muted, #5b6472); font-style: italic; }
.recipe-tip { margin: 6px 0 4px; font-size: 12px; line-height: 1.5; color: #713f12; background: linear-gradient(135deg, #fffbeb, #fef3c7); border: 1px solid #fde68a; border-radius: 10px; padding: 6px 10px; }
.recipe-tip b { color: #92400e; }
.recipe-pantry { margin: 2px 0 4px; font-size: 11.5px; color: var(--muted, #5b6472); }
.recipe-without { margin: 4px 0 2px; font-size: 11.5px; color: #9a3412; background: #fff7ed; border: 1px solid #fed7aa; border-radius: 8px; padding: 3px 8px; display: inline-block; }
@media print { .meal-recipe-box { break-inside: avoid; } }

/* Nutrition from the standard profile of the food type (no label data for this barcode) */
.nut-est-badge {
  display: inline-block; margin-inline-start: 6px; padding: 1px 7px; border-radius: 999px;
  font-size: 10.5px; font-weight: 600; color: #075985; background: #e0f2fe;
  border: 1px solid #bae6fd; vertical-align: middle; white-space: nowrap; cursor: help;
}
.nowrap { white-space: nowrap; }

/* Batch cooking tab (הכנה מראש) */
.prep-intro { display: flex; gap: 10px; align-items: flex-start; background: linear-gradient(135deg, #eef8f2, #f4f1ff); border: 1px solid #d9eadf; border-radius: 14px; padding: 12px 14px; margin-bottom: 12px; }
.prep-intro .ph { width: 22px; height: 22px; color: #1f9d57; flex: none; margin-top: 2px; }
.prep-intro p { margin: 0; font-size: 13.5px; line-height: 1.55; color: var(--text); }
.prep-choose { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.prep-choose-label { font-size: 13.5px; font-weight: 600; color: var(--text); }
.prep-per { border: 1px solid #cfd8e3; background: #fff; color: var(--text); border-radius: 999px; padding: 6px 14px; font-size: 13px; transition: background .15s, border-color .15s, transform .1s; }
.prep-per:hover { border-color: #1f9d57; transform: translateY(-1px); }
.prep-per.active { background: #1f9d57; border-color: #1f9d57; color: #fff; font-weight: 600; }
.prep-per:focus-visible { outline: 2px solid #1f9d57; outline-offset: 2px; }
.prep-session { background: #fff; border: 1px solid #e3e8ef; border-radius: 16px; padding: 12px 14px; margin-bottom: 12px; box-shadow: 0 2px 8px rgba(20, 40, 80, .05); }
.prep-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-bottom: 8px; }
.prep-head h3 { margin: 0; font-size: 16px; display: flex; align-items: center; gap: 6px; }
.prep-covers { font-size: 12.5px; color: var(--text-dim); }
.prep-time { margin-inline-start: auto; font-size: 12.5px; font-weight: 600; color: #b7791f; background: #fff7e6; border-radius: 999px; padding: 3px 10px; display: inline-flex; align-items: center; gap: 4px; }
.prep-tasks { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.prep-task { display: flex; gap: 10px; align-items: flex-start; padding: 9px 10px; border-radius: 12px; background: #f7f9fc; border: 1px solid #edf1f6; }
.prep-task.frozen { background: #f1f7ff; border-color: #dbe8fb; }
.prep-ico { flex: none; width: 30px; height: 30px; border-radius: 9px; background: #fff; display: grid; place-items: center; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.prep-ico .ph { width: 18px; height: 18px; color: #1f9d57; }
.prep-task.frozen .prep-ico .ph { color: #2b6cb0; }
.prep-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.prep-body b { font-size: 13.5px; line-height: 1.45; }
.prep-keeps { font-size: 12px; color: #1f7a4a; display: inline-flex; align-items: center; gap: 4px; }
.prep-task.frozen .prep-keeps { color: #2b6cb0; }
.prep-for { font-size: 12px; color: var(--text-dim); line-height: 1.5; }
.prep-empty { margin: 0; font-size: 13px; color: var(--text-dim); }
.prep-body { flex: 1; }
.prep-how { margin: 4px 0 2px; background: #fff; border: 1px solid #e6ecf3; border-radius: 10px; padding: 6px 10px 8px; }
.prep-how summary { cursor: pointer; font-size: 12.5px; font-weight: 600; color: #1f7a4a; list-style-position: inside; padding: 2px 0; }
.prep-how summary:focus-visible { outline: 2px solid #1f9d57; outline-offset: 2px; border-radius: 6px; }
.prep-ing { margin: 6px 0 4px; font-size: 12.5px; line-height: 1.55; color: var(--text); }
.prep-body .prep-ing b, .prep-body .prep-onday b { font-size: 12.5px; }
.prep-steps { margin: 4px 0 0; padding-inline-start: 20px; display: grid; gap: 4px; font-size: 13px; line-height: 1.55; color: var(--text); }
.prep-steps li::marker { color: #1f9d57; font-weight: 700; }
.prep-onday { margin: 8px 0 0; padding: 6px 8px; border-radius: 8px; background: #f2faf5; font-size: 12.5px; line-height: 1.55; color: var(--text); display: block; }
.prep-onday .ph { width: 14px; height: 14px; color: #1f9d57; vertical-align: -2px; margin-inline-end: 4px; }
/* "Why each product": search */
.why-search { position: relative; display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.why-search input { flex: 1; min-width: 0; font: inherit; font-size: 14px; padding: 10px 38px 10px 12px; border: 2px solid #dbe9f4; border-radius: 12px; background: #fff; color: var(--text); transition: border-color .15s, box-shadow .15s; }
.why-search input:focus { outline: none; border-color: #1f9d57; box-shadow: 0 0 0 3px rgba(31, 157, 87, .15); }
.why-search-ico { position: absolute; inset-inline-start: 12px; width: 18px; height: 18px; color: var(--text-dim); pointer-events: none; }
.why-search-count { font-size: 12.5px; color: var(--text-dim); white-space: nowrap; }
.explanation-card[hidden] { display: none; }
.why-search-empty { grid-column: 1 / -1; margin: 8px 0; font-size: 13.5px; color: var(--text-dim); text-align: center; }
