/* The HUD in the soft storybook look (Aaron 2026-10-21, after The Wandering Village and
   Townsmen): cream tiles with a soft drop, rounded type, line icons. panels.js builds it:
   .hud-time (top left), .hud-alerts (top centre), .hud-stats (top right), .hud-tools (bottom
   centre). The #hud box itself lets taps through to the map; only its cards take them.
   Loaded after styles.css and styles-menu.css. */

/* --- icons: 24 px line drawings used as masks, so they take the text colour ------------------- */
.ico {
  display: inline-block; flex: none; width: 22px; height: 22px; background: currentColor;
  -webkit-mask: var(--i) center / contain no-repeat; mask: var(--i) center / contain no-repeat;
}
.ico-people { --i: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='9' cy='7' r='3.2'/><path d='M3 20.5c0-3.6 2.7-6.3 6-6.3s6 2.7 6 6.3'/><circle cx='17' cy='8' r='2.6'/><path d='M16.5 14.3c2.8.2 4.5 2.6 4.5 5.7'/></svg>"); }
.ico-idle { --i: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><path d='M3 10h6l-6 8h6M13 4h7l-7 9h7'/></svg>"); }
.ico-logs { --i: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='7' cy='16.5' r='4'/><circle cx='17' cy='16.5' r='4'/><circle cx='12' cy='8' r='4'/><circle cx='7' cy='16.5' r='1'/><circle cx='17' cy='16.5' r='1'/><circle cx='12' cy='8' r='1'/></svg>"); }
.ico-planks { --i: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='2.5' y='4.5' width='19' height='4.5' rx='1'/><rect x='2.5' y='9.8' width='19' height='4.5' rx='1'/><rect x='2.5' y='15' width='19' height='4.5' rx='1'/><path d='M8 6.7h4M12 12h5M6 17.3h5'/></svg>"); }
.ico-stone { --i: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M3 19l2.5-8 5-4 6.5 1.5 4 10.5z'/><path d='M10.5 7l1.5 6 9 6M5.5 11l6.5 2'/></svg>"); }
.ico-happy { --i: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='9.5'/><path d='M7.5 13.5c1.2 2 2.7 3 4.5 3s3.3-1 4.5-3'/><path d='M9 9v1M15 9v1'/></svg>"); }
.ico-meh { --i: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='9.5'/><path d='M8 15.5h8'/><path d='M9 9v1M15 9v1'/></svg>"); }
.ico-sad { --i: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='9.5'/><path d='M7.5 17c1.2-2 2.7-3 4.5-3s3.3 1 4.5 3'/><path d='M9 9v1M15 9v1'/></svg>"); }
.ico-hungry { --i: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M2.5 11.5h19a9.5 8 0 0 1-19 0z'/><path d='M8 8c0-1.2 1.2-1.6 1.2-3M12 8c0-1.2 1.2-1.6 1.2-3M16 8c0-1.2 1.2-1.6 1.2-3'/></svg>"); }
.ico-thirsty { --i: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M12 2.5s6.5 7.2 6.5 11.5a6.5 6.5 0 0 1-13 0C5.5 9.7 12 2.5 12 2.5z'/><path d='M9 14.5a3 3 0 0 0 3 3'/></svg>"); }
.ico-cold, .ico-winter { --i: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M12 2v20M3.3 7l17.4 10M3.3 17L20.7 7M9 3.5l3 2.2 3-2.2M9 20.5l3-2.2 3 2.2'/></svg>"); }
.ico-attack { --i: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M14.5 17.5L3 6V3h3l11.5 11.5M13 19l6-6M16 16l4 4M19 21l2-2'/><path d='M14.5 6.5L18 3h3v3l-3.5 3.5M5 14l4 4M7 17l-3 3M3 19l2 2'/></svg>"); }
.ico-offer { --i: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><path d='M4 8h15M15.5 4.5L19 8l-3.5 3.5M20 16H5M8.5 12.5L5 16l3.5 3.5'/></svg>"); }
.ico-banner { --i: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><path d='M5 21.5V3M5 4h13l-2.5 4.5L18 13H5'/></svg>"); }
.ico-goals { --i: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='9' r='6'/><path d='M9.5 9l2 2 3.2-3.5'/><path d='M8.5 14l-1.5 7.5 5-2.5 5 2.5-1.5-7.5'/></svg>"); }
.ico-stock { --i: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M3 7.5l9-4.5 9 4.5v9L12 21l-9-4.5z'/><path d='M3 7.5l9 4.5 9-4.5M12 12v9M7.5 5.2l9 4.6'/></svg>"); }
.ico-menu { --i: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='3'/><path d='M12 2.5v3M12 18.5v3M2.5 12h3M18.5 12h3M5.3 5.3l2.1 2.1M16.6 16.6l2.1 2.1M5.3 18.7l2.1-2.1M16.6 7.4l2.1-2.1'/><circle cx='12' cy='12' r='6.5'/></svg>"); }
.ico-castle { --i: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M3.5 21V8h3v2.5h2.5V8h3v2.5h2.5V8h3v2.5H20V8h.5v13z' /><path d='M10 21v-4.5a2 2 0 0 1 4 0V21'/></svg>"); }
.ico-map { --i: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M3 6.5l6-2.5 6 2.5 6-2.5v13.5l-6 2.5-6-2.5-6 2.5z'/><path d='M9 4v13.5M15 6.5V20'/></svg>"); }
.ico-road { --i: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M4 21c0-5 6-6 5-11-.5-3-2.5-4-1.5-7'/><path d='M20 21c0-5-4-7-3.5-11 .3-3 2.5-4 1.5-7'/><path d='M12.2 20.5v-2M12.6 15.5l.2-2M12.5 10.5l-.3-2M11.8 5.5l-.2-2'/></svg>"); }
.minimap-toggle { color: var(--ink); display: inline-flex; align-items: center; justify-content: center; }
.ico-pause { --i: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><rect x='6' y='5' width='4' height='14' rx='1.5'/><rect x='14' y='5' width='4' height='14' rx='1.5'/></svg>"); }
.ico-spring { --i: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M12 21.5V11'/><path d='M12 12c0-4.5 3-7 7.5-7 0 4.5-3 7-7.5 7zM12 14.5c0-3.5-2.4-6-6.5-6 0 3.5 2.4 6 6.5 6z'/></svg>"); }
.ico-summer { --i: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='4.2'/><path d='M12 2v2.5M12 19.5V22M2 12h2.5M19.5 12H22M4.9 4.9l1.8 1.8M17.3 17.3l1.8 1.8M4.9 19.1l1.8-1.8M17.3 6.7l1.8-1.8'/></svg>"); }
.ico-autumn { --i: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M4.5 19.5C4.5 10.5 10 4.5 20 4c-.5 10-6.5 15.5-15.5 15.5z'/><path d='M4.5 19.5l8.5-8.5M9 15h4.5M13 11V7'/></svg>"); }

/* the words that stay in the DOM for screen readers (and the smoke tests), off screen */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* --- the HUD frame ---------------------------------------------------------------------------- */
#hud {
  position: fixed; top: 0; left: 0; right: 0; pointer-events: none;
  padding: calc(10px + var(--safe-t)) calc(12px + var(--safe-r)) 0 calc(12px + var(--safe-l));
  display: grid; grid-template-columns: auto 1fr auto; align-items: start; gap: 10px;
  font-family: var(--round);
}
#hud > * { pointer-events: auto; }
#hud > .hud-alerts { pointer-events: none; }
#hud > .hud-alerts > * { pointer-events: auto; }
.hud-card {
  background: var(--paper); color: var(--ink); border-radius: 18px; box-shadow: var(--lift);
}

/* --- time card: dial, time, date, speeds ---------------------------------------------------- */
.hud-time { display: flex; flex-direction: column; gap: 6px; padding: 10px 10px 8px; min-width: 216px; }
.time-top { display: flex; align-items: flex-end; gap: 10px; padding: 0 2px; }
.dial {
  position: relative; flex: none; width: 76px; height: 38px; overflow: hidden;
  border-radius: 38px 38px 0 0; border-bottom: 3px solid var(--paper-2);
  transition: background 1.2s;
}
.dial.day { background: linear-gradient(#ffcf6e, #f3a64a); }
.dial.dusk { background: linear-gradient(#f39a7a, #f6c37a); }
.dial.night { background: linear-gradient(#2f3a73, #55609e); }
.dial .arm { position: absolute; left: 50%; bottom: 0; width: 0; height: 0; transition: transform 0.4s linear; }
.dial .orb { position: absolute; left: -7px; top: -7px; width: 14px; height: 14px; border-radius: 50%; transform: translateX(-27px); }
.dial .orb.sun { background: #fff; box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.45), 0 0 10px 3px rgba(255, 236, 170, 0.9); }
.dial .orb.moon { background: #eef0ff; box-shadow: inset -4px -2px 0 #c9ccea, 0 0 6px rgba(220, 225, 255, 0.6); }
.time-col { display: flex; flex-direction: column; line-height: 1.05; }
.time-col .time { font-size: 24px; font-weight: 800; letter-spacing: 0.5px; font-variant-numeric: tabular-nums; }
.time-col .period { font-size: 12px; color: var(--muted); font-weight: 600; }
.date { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; padding: 0 2px; white-space: nowrap; }
.date .ico { width: 18px; height: 18px; color: var(--leaf); }
.date .ico-winter { color: var(--frost); }
.date .ico-autumn { color: var(--orange); }
.date .ico-summer { color: #e0a020; }
.hud-time .speeds { display: flex; gap: 0; background: var(--paper-2); border-radius: 14px; padding: 3px; }
.hud-time .btn.speed {
  flex: 1 1 0; min-width: 0; min-height: 40px; padding: 0; border: 0; border-radius: 11px;
  background: transparent; color: var(--ink); font-family: var(--round); font-weight: 800; font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center; box-shadow: none;
}
.hud-time .btn.speed .ico { width: 18px; height: 18px; }
.hud-time .btn.speed.on { background: var(--paper); color: var(--indigo); box-shadow: 0 2px 0 rgba(47, 52, 66, 0.14); }
.date .version { margin-left: auto; padding-left: 8px; font-size: 10px; color: var(--muted); font-weight: 600; }

/* --- planning note: a new game starts paused; under the time card, fades by itself ---------- */
#hud > .hud-plan {
  grid-column: 1; grid-row: 2; justify-self: start; max-width: 280px; box-sizing: border-box; pointer-events: none;
  display: flex; flex-direction: column; gap: 2px; padding: 9px 12px; border-radius: 14px;
  opacity: 0.96; transition: opacity 1.2s ease;
}
#hud > .hud-plan.hidden { display: none; } /* the id rule above outranks a bare .hidden */
#hud > .hud-plan.fading { opacity: 0; }
.hud-plan .plan-title { font-size: 14px; font-weight: 800; }
.hud-plan .plan-sub { font-size: 12px; color: var(--muted); font-weight: 600; }
/* until a speed is chosen the speeds glow softly */
.hud-time.planning .speeds { animation: plan-glow 1.8s ease-in-out infinite; }
@keyframes plan-glow { 0%, 100% { box-shadow: 0 0 0 0 rgba(245, 190, 60, 0); } 50% { box-shadow: 0 0 0 4px rgba(245, 190, 60, 0.75); } }
@media (prefers-reduced-motion: reduce) { .hud-time.planning .speeds { animation: none; box-shadow: 0 0 0 3px rgba(245, 190, 60, 0.75); } }

/* --- stats: a grid of tiles and the round morale badge -------------------------------------- */
.hud-stats { display: flex; align-items: flex-start; gap: 8px; }
.stat-grid { display: grid; grid-template-columns: repeat(3, auto); gap: 4px; padding: 6px; }
.stat {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 74px; height: 40px; padding: 0 10px; border-radius: 12px; background: var(--paper-2);
  font-weight: 800; font-size: 16px; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.stat .ico { color: var(--ink-soft); }
.stat-people { grid-column: span 2; }
.stat-idle.zero { color: var(--muted); }
.stat-idle.zero .ico { opacity: 0.55; }
.morale-badge {
  --mood: var(--good); --ring-off: rgba(47, 52, 66, 0.12);
  /* the same height as the stat card beside it (40 px tiles + 6 px padding; Aaron 2026-10-30):
     the face and the number side by side */
  position: relative; display: flex; flex-direction: row; align-items: center; gap: 6px;
  height: 52px; box-sizing: border-box; padding: 0 12px 0 6px; border-radius: 16px; background: var(--paper); box-shadow: var(--lift);
  color: var(--ink); font-weight: 800; font-size: 16px; font-variant-numeric: tabular-nums;
}
.morale-badge.mid { --mood: #e9a23b; }
.morale-badge.low { --mood: var(--danger); }
.morale-badge .ring { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; }
.morale-badge .ring .ico {
  width: 33px; height: 33px; border-radius: 50%; padding: 5px; box-sizing: border-box;
  background: var(--mood); -webkit-mask: none; mask: none; position: relative;
}
/* the face itself: a mask over a white disc inside the coloured one */
.morale-badge .ring .ico::after {
  content: ''; position: absolute; inset: 5px; background: #fff;
  -webkit-mask: var(--i) center / contain no-repeat; mask: var(--i) center / contain no-repeat;
}

/* --- alerts: top centre, pill cards --------------------------------------------------------- */
.hud-alerts { display: flex; flex-wrap: wrap; justify-content: center; align-content: flex-start; gap: 8px; min-width: 0; }
.hud-alerts .chip {
  display: inline-flex; align-items: center; gap: 8px; margin: 0; min-height: 44px; padding: 0 16px 0 12px;
  border: 0; border-radius: 16px; font: inherit; font-family: var(--round); font-weight: 800; font-size: 15px;
  cursor: pointer; box-shadow: var(--lift); color: #fff; background: var(--danger);
}
.hud-alerts .chip.hidden { display: none; }
.hud-alerts .chip::after { content: none; }
.hud-alerts .chip.flag.cold { background: var(--frost); color: #fff; }
.hud-alerts .chip.offer { background: var(--indigo); color: #fff; }
.hud-alerts .chip.flag.attack { background: #b3261e; animation: pulse-attack 1.4s ease-in-out infinite; }

/* --- toolbar: bottom centre, round buttons, Stock raised in the middle ---------------------- */
.hud-tools {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(10px + var(--safe-b));
  display: flex; align-items: flex-end; gap: 6px; padding: 6px 10px;
  background: var(--paper); border-radius: 26px; box-shadow: var(--lift);
}
.tool {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  width: 64px; height: 58px; padding: 0; border: 0; border-radius: 18px; background: transparent;
  color: var(--ink); font: inherit; font-family: var(--round); cursor: pointer;
}
.tool:active { background: var(--paper-2); }
.tool .ico { width: 26px; height: 26px; }
.tool-label { font-size: 11px; font-weight: 800; letter-spacing: 0.2px; }
.tool.main {
  width: 76px; height: 76px; margin-top: -26px; border-radius: 50%;
  background: var(--paper); box-shadow: var(--lift), inset 0 0 0 4px var(--paper-2);
}
.tool.main .ico { width: 32px; height: 32px; }
.tool.hidden { display: none; }
.tool .badge {
  position: absolute; top: 2px; right: 8px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px;
  background: var(--indigo); color: #fff; font-size: 11px; font-weight: 800; line-height: 18px;
}
.tool .badge:empty { display: none; }
.tool .needs-badge { background: var(--warn); }
.tool .needs-badge.urgent { background: var(--danger); }

/* the performance readout (perf.js) stays clear of the toolbar */
.perf { max-width: calc(50% - 240px); }
@media (max-width: 900px) { .perf { bottom: calc(84px + var(--safe-b)); max-width: calc(100% - 24px); } }

/* The side panel (wide screens) is a floating card under the stats; the toolbar centres itself in
   the room to its left while it is open. */
@media (min-width: 760px) {
  /* as tall as what it holds, no taller (2026-11-10: a three-line "Build here?" filled the
     whole right side and hid the outline being placed); a long sheet scrolls inside */
  #sheet {
    top: calc(132px + var(--safe-t)); right: calc(12px + var(--safe-r)); bottom: auto;
    max-height: calc(100% - 144px - var(--safe-t) - var(--safe-b));
    width: 340px; border: 0; border-radius: 20px; box-shadow: var(--lift);
  }
  /* centred in the room left of the panel, but never over the minimap (236 px + half the bar) */
  body:has(#sheet:not(.hidden)) .hud-tools { left: max(calc((100% - 364px) / 2), 436px); }
  body:has(#sheet:not(.hidden)) .perf { right: calc(364px + var(--safe-r)); bottom: calc(92px + var(--safe-b)); }
}

/* iPad portrait: the toolbar sits bottom right, clear of the minimap, and the side panel stops
   above it */
@media (max-width: 900px) {
  .stat { min-width: 64px; padding: 0 8px; font-size: 15px; }
  .hud-tools { left: auto; right: calc(12px + var(--safe-r)); transform: none; }
  body:has(#sheet:not(.hidden)) .hud-tools { left: auto; }
}
@media (min-width: 760px) and (max-width: 900px) {
  #sheet { max-height: calc(100% - 228px - var(--safe-t) - var(--safe-b)); }
}

/* Phones (not a target, kept working): one compact time row, stats in a strip under it, the
   toolbar without words, the minimap and toasts lifted above it. */
@media (max-width: 559px) {
  #hud { grid-template-columns: 1fr; gap: 6px; padding: calc(6px + var(--safe-t)) calc(8px + var(--safe-r)) 0 calc(8px + var(--safe-l)); }
  .hud-time { flex-direction: row; flex-wrap: wrap; align-items: center; min-width: 0; padding: 6px 8px; gap: 4px 8px; border-radius: 14px; }
  .time-top { gap: 6px; }
  .dial { width: 44px; height: 22px; border-bottom-width: 2px; }
  .dial .orb { width: 10px; height: 10px; left: -5px; top: -5px; transform: translateX(-15px); }
  .time-col .time { font-size: 17px; }
  .time-col .period { display: none; }
  .date { font-size: 12px; }
  .hud-time .speeds { flex-basis: 100%; }
  .hud-time .btn.speed { min-height: 36px; }
  .hud-alerts { order: 3; justify-content: flex-start; }
  .hud-stats { order: 2; gap: 6px; }
  .stat-grid { grid-template-columns: repeat(5, auto); gap: 3px; padding: 4px; flex: 1; min-width: 0; overflow: hidden; }
  .stat-people { grid-column: auto; }
  .stat { min-width: 0; height: 34px; padding: 0 6px; gap: 3px; font-size: 13px; border-radius: 9px; }
  .stat .ico { width: 16px; height: 16px; }
  .morale-badge { height: 42px; padding: 0 8px 0 4px; gap: 4px; border-radius: 12px; font-size: 13px; }
  .morale-badge .ring { width: 34px; height: 34px; }
  .morale-badge .ring .ico { width: 28px; height: 28px; }
  .morale-badge .ring .ico::after { inset: 4px; }
  .hud-tools { left: auto; right: calc(8px + var(--safe-r)); transform: none; gap: 2px; padding: 4px 6px; border-radius: 20px; }
  .tool { width: 46px; height: 46px; }
  .tool-label { display: none; }
  .tool.main { width: 54px; height: 54px; margin-top: -12px; }
  .minimap { bottom: calc(72px + var(--safe-b)); }
  #toast { bottom: calc(max(80px, var(--mini-h, 0px) + 20px) + 64px + var(--safe-b)); }
}

/* the morale badge is a button: a tap opens the happiness sheet (panels.js, happiness.js) */
button.morale-badge { border: 0; font-family: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button.morale-badge:active { transform: translateY(1px); }

/* --- weather ahead (rules.forecast): the chip by the date and the sheet's rows --------------- */
.ico-wx-clear { --i: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='4.2'/><path d='M12 2.5v2.5M12 19v2.5M2.5 12H5M19 12h2.5M5.3 5.3l1.8 1.8M16.9 16.9l1.8 1.8M5.3 18.7l1.8-1.8M16.9 7.1l1.8-1.8'/></svg>"); }
.ico-wx-overcast { --i: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M7 17.5a4 4 0 0 1-.4-8A5.5 5.5 0 0 1 17 8.8a4.5 4.5 0 0 1 .5 8.7z'/></svg>"); }
.ico-wx-rain { --i: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M7 15a4 4 0 0 1-.4-8A5.5 5.5 0 0 1 17 6.3a4.5 4.5 0 0 1 .5 8.7z'/><path d='M8.5 19l-1 2M12.5 19l-1 2M16.5 19l-1 2'/></svg>"); }
.ico-wx-snow { --i: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M7 15a4 4 0 0 1-.4-8A5.5 5.5 0 0 1 17 6.3a4.5 4.5 0 0 1 .5 8.7z'/><path d='M8 19h.01M12 21h.01M16 19h.01'/></svg>"); }
.ico-wx-fog { --i: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M4 8h16M3 12h14M6 16h15M9 20h8'/></svg>"); }
.forecast-chip {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 44px; margin: 0;
  padding: 0 12px; border: 0; border-radius: 14px; background: var(--paper-2); color: var(--ink-soft);
  font: inherit; cursor: pointer;
}
.forecast-chip .ico { width: 22px; height: 22px; }
.forecast-chip .ico:first-child { color: var(--ink); }
.forecast-chip .ico:not(:first-child) { opacity: 0.7; width: 18px; height: 18px; }
.info .row .ico { width: 20px; height: 20px; vertical-align: middle; }

/* the Town chip (rules.townLife; town.js): the rank's name and the standing, always shown while the rule is on */
.hud-alerts .chip.town { background: var(--paper-2); color: var(--ink); }
.forecast-chip.hidden { display: none; }
.forecast-slot:empty { display: none; }
