/* ===== Kfar Kama – crisis management mockup: game interface on top of the 3D village ===== */
:root {
  --panel: rgba(28, 33, 38, .84);
  --panel-2: rgba(44, 51, 58, .9);
  --ink: #f4efe4;
  --muted: #b9b2a4;
  --gold: #f2c14e;
  --line: rgba(255, 255, 255, .12);
  --c-safety: #e2483d;
  --c-infra: #ef8a2c;
  --c-social: #9a5fd6;
  --c-env: #3fa35b;
  --c-economy: #e2b23a;
  --c-heritage: #9a6a45;
}

/* the model viewer's own controls are not part of the game */
body.game #topbar, body.game #sidebar, body.game #info, body.game #add-hint { display: none !important; }
/* the viewer's display settings panel, opened from the ⚙ button in the HUD */
body.game #view-panel {
  position: fixed; top: auto; bottom: 150px; left: 14px; right: auto; z-index: 26; width: 300px;
  background: rgba(30, 35, 40, .96); color: var(--ink); border-radius: 14px; box-shadow: 0 12px 34px rgba(0, 0, 0, .45);
}
body.game #view-panel[hidden] { display: none; }
body.game #view-panel h3 { color: var(--ink); }
body.game #view-panel label, body.game #view-panel .note, body.game #view-panel small { color: var(--muted); }
body.game #view-panel select, body.game #view-panel button { background: rgba(255, 255, 255, .1); color: var(--ink); border-color: var(--line); }
#btn-settings, #btn-names, #btn-hoods, #btn-term, #btn-save {
  flex: none; width: 40px; height: 40px; border-radius: 11px; border: 1px solid var(--line); cursor: pointer;
  background: rgba(255, 255, 255, .08) !important; color: var(--ink); font-size: 19px;
}
#btn-names, #btn-hoods, #btn-term, #btn-save { font-size: 17px; }
#btn-term:hover, #btn-save:hover { background: rgba(255, 255, 255, .2) !important; }
#btn-settings:hover, #btn-settings.on, #btn-names:hover, #btn-names.on, #btn-hoods:hover, #btn-hoods.on { background: rgba(255, 255, 255, .2) !important; }
body.game #attribution { font-size: 10px; opacity: .7; }

body.game { font-family: "Segoe UI", "Rubik", system-ui, sans-serif; color: var(--ink); }

/* ---------- top HUD ---------- */
#hud {
  position: fixed; top: 10px; left: 10px; right: 10px; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  padding: 8px 14px; border-radius: 14px;
  background: var(--panel); backdrop-filter: blur(6px);
  box-shadow: 0 6px 22px rgba(0, 0, 0, .25);
}
.hud-title { display: flex; flex-direction: column; line-height: 1.1; min-width: 110px; }
.hud-title b { font-size: 17px; }
.hud-title span { font-size: 12px; color: var(--muted); }
.hud-stat { display: flex; align-items: center; gap: 6px; font-size: 16px; }
.hud-stat small { color: var(--muted); font-size: 11px; }
.hud-stat .ico { font-size: 18px; }
.hud-stat.trust .bar { width: 110px; height: 9px; border-radius: 6px; background: rgba(255, 255, 255, .12); overflow: hidden; }
.hud-stat.trust .bar i { display: block; height: 100%; width: 50%; background: linear-gradient(90deg, #e2483d, #f2c14e 45%, #4fbf6a); background-size: 110px 100%; transition: width .5s; }
.flash-up { animation: flashUp .9s; } .flash-down { animation: flashDown .9s; }
@keyframes flashUp { 30% { color: #7ee08f; transform: scale(1.15); } }
@keyframes flashDown { 30% { color: #ff7a6e; transform: scale(1.15); } }

#hud-teams { display: flex; gap: 6px; margin-inline-start: auto; }
.team {
  display: flex; align-items: center; gap: 4px; padding: 4px 9px 4px 7px;
  border-radius: 20px; background: var(--panel-2); border: 1px solid var(--line);
  font-size: 13px; cursor: grab; user-select: none; white-space: nowrap;
}
.team b { font-size: 12px; background: rgba(255, 255, 255, .14); border-radius: 9px; padding: 0 6px; }
.team.none { opacity: .4; cursor: not-allowed; }
.team .out { font-size: 12px; margin-inline-start: 2px; }   /* some of this team is missing (flu...) */
.team:active { cursor: grabbing; }

#btn-end-turn {
  padding: 9px 18px; border: 0; border-radius: 11px; cursor: pointer;
  background: linear-gradient(#f6cf63, #e3a92c); color: #3b2a07; font-weight: 700; font-size: 15px;
  box-shadow: 0 3px 0 #a87a17;
}
#btn-end-turn:active { transform: translateY(2px); box-shadow: 0 1px 0 #a87a17; }
#btn-end-turn:disabled { filter: grayscale(.7); opacity: .6; cursor: default; }

/* ---------- issue list (right side, RTL start) ---------- */
#issues {
  position: fixed; top: 76px; right: 10px; width: 290px; max-height: calc(100vh - 110px); overflow: auto;
  z-index: 15; padding: 10px; border-radius: 14px; background: var(--panel); backdrop-filter: blur(6px);
}
#issues h2 { margin: 2px 4px 8px; font-size: 15px; }
#issues h2 span { color: var(--muted); font-weight: 400; }
#issues .hint { color: var(--muted); font-size: 11.5px; margin: 8px 4px 2px; line-height: 1.4; }
.issue {
  display: grid; grid-template-columns: 34px 1fr auto; gap: 8px; align-items: center;
  padding: 7px 8px; margin-bottom: 6px; border-radius: 10px; cursor: pointer;
  background: rgba(255, 255, 255, .05); border-inline-start: 4px solid var(--cat);
  transition: background .2s;
}
.issue:hover, .issue.drop { background: rgba(255, 255, 255, .13); }
.issue .ic { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 18px; background: var(--cat); }
.issue .t { font-size: 13px; font-weight: 600; line-height: 1.25; }
.issue .p { font-size: 11px; color: var(--muted); }
.issue .s { text-align: center; font-size: 11px; color: var(--muted); }
.issue .s .dots { letter-spacing: 1px; color: var(--cat); font-size: 13px; }
.issue.handled { opacity: .75; }
.issue.handled .s::after { content: "בטיפול"; display: block; color: #7ee08f; }
.issue.resolved { opacity: .45; text-decoration: line-through; }

/* ---------- map markers ---------- */
#markers, #edge-arrows { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
/* floating map elements sit at the corner and are moved by game.js with the translate property */
.marker, .place, .hood-bubble, .edge { left: 0; top: 0; will-change: translate; }
.marker {
  position: absolute; transform: translate(-50%, -100%); pointer-events: auto; cursor: pointer;
  display: flex; flex-direction: column; align-items: center;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .35));
}
.marker .mpin {
  width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-size: 21px;
  background: var(--urg, var(--cat)); border: 3px solid #fff; position: relative;
}
.marker .mpin::before {        /* pulse: faster and wider with urgency */
  content: ""; position: absolute; inset: -3px; border-radius: 50%; border: 3px solid var(--urg, var(--cat));
  animation: pulse var(--pulse, 2s) ease-out infinite;
}
.marker.sev2 .mpin { width: 48px; height: 48px; font-size: 24px; }
.marker.sev3 .mpin { width: 54px; height: 54px; font-size: 27px; border-color: #ffe08a; }
.marker.u-crit .mpin { box-shadow: 0 0 0 3px rgba(226, 52, 43, .35), 0 0 18px rgba(226, 52, 43, .7); }
.marker.u-crit .mpin::after {  /* a second, faster ring for a crisis */
  content: ""; position: absolute; inset: -3px; border-radius: 50%; border: 2px solid #fff;
  animation: pulse var(--pulse, 1s) ease-out infinite .4s;
}
.marker.u-calm .mpin::before { animation: none; opacity: 0; }   /* a team is on it: no pulse */
@keyframes pulse { from { transform: scale(1); opacity: .9; } to { transform: scale(1.9); opacity: 0; } }
.marker .stem { width: 3px; height: 16px; background: #fff; border-radius: 2px; }
.marker .timer {
  position: absolute; top: -6px; left: -8px; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 11px;
  background: #1f2328; color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--cat);
}
.marker .timer.urgent { background: #c0392b; border-color: #fff; animation: shake .6s infinite; }
@keyframes shake { 25% { transform: rotate(-8deg); } 75% { transform: rotate(8deg); } }
.marker .crew {
  position: absolute; bottom: 10px; right: -14px; width: 26px; height: 26px; border-radius: 50%;
  background: #2b6f3e; border: 2px solid #fff; display: grid; place-items: center; font-size: 14px;
}
.marker .label {
  margin-top: 3px; padding: 2px 8px; border-radius: 8px; font-size: 11.5px; white-space: nowrap;
  background: rgba(20, 24, 28, .82); color: #fff; opacity: 0; transition: opacity .2s;
  display: flex; flex-direction: column; align-items: center; line-height: 1.3; pointer-events: none;
}
.marker .label small { font-size: 10.5px; color: var(--urg, #ddd); font-weight: 600; }
.marker:hover .label, .marker.sel .label, .marker.drop .label { opacity: 1; }
body.show-names .marker .label { opacity: 1; }
body.show-names .marker:not(:hover):not(.sel) .label small { display: none; }

/* the model's name signs are replaced in the game by the quiet place icons below */
body.game .pin { display: none !important; }

/* quiet place icons: small and calm, the name only on hover (or with the names switch 🏷️) */
.place {
  position: absolute; transform: translate(-50%, -50%); pointer-events: auto; cursor: pointer; z-index: 1;
  display: flex; flex-direction: column; align-items: center;
}
.place .pdot {
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 13px;
  background: rgba(28, 33, 38, .55); border: 1.5px solid rgba(255, 255, 255, .7); opacity: .8;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .3); transition: transform .15s, opacity .15s;
}
.place:hover, .place.sel { z-index: 300000 !important; }
.place:hover .pdot, .place.sel .pdot { opacity: 1; transform: scale(1.25); background: rgba(28, 33, 38, .85); }
.place .ptip {
  position: absolute; top: 100%; margin-top: 4px; padding: 3px 9px; border-radius: 8px; white-space: nowrap;
  background: rgba(20, 24, 28, .88); color: #fff; font-size: 11.5px; line-height: 1.35; text-align: center;
  display: none; flex-direction: column; pointer-events: none;
}
.place .ptip small { font-size: 10.5px; color: #9fd3a8; }
.place:hover .ptip, .place.sel .ptip { display: flex; }
body.show-names .place .ptip { display: flex; background: rgba(20, 24, 28, .62); font-size: 11px; }
body.show-names .place:not(:hover):not(.sel) .ptip small { display: none; }
.marker.drop .mpin { transform: scale(1.2); box-shadow: 0 0 0 6px rgba(255, 255, 255, .45); }
.marker.resolved .mpin { background: #3c9a56; }
.marker.resolved .mpin::before { display: none; }
.marker.resolved { animation: bye 1.6s forwards; }
.marker.missed .mpin { background: #7a7f86; }
@keyframes bye { 60% { opacity: 1; transform: translate(-50%, -110%); } to { opacity: 0; transform: translate(-50%, -160%); } }

.edge {
  position: absolute; width: 38px; height: 38px; margin: -19px 0 0 -19px; border-radius: 50%;
  display: grid; place-items: center; font-size: 17px; background: var(--urg, var(--cat)); border: 2px solid #fff;
  pointer-events: auto; cursor: pointer; box-shadow: 0 2px 8px rgba(0, 0, 0, .35);
}
.edge.u-crit { animation: edgeBeat .8s ease-in-out infinite; box-shadow: 0 0 0 4px rgba(226, 52, 43, .35), 0 2px 8px rgba(0, 0, 0, .35); }
.edge.u-high { animation: edgeBeat 1.4s ease-in-out infinite; }
@keyframes edgeBeat { 50% { transform: scale(1.18); } }
.edge i { position: absolute; width: 0; height: 0; border: 8px solid transparent; border-left: 11px solid #fff; left: 100%; top: 50%; margin-top: -8px; transform-origin: -19px 50%; }

/* ---------- decision card ---------- */
#card {
  position: fixed; left: 14px; bottom: 34px; width: 400px; max-width: calc(100vw - 28px); z-index: 25;
  border-radius: 16px; overflow: hidden; background: var(--panel); backdrop-filter: blur(8px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .4); animation: rise .25s ease-out;
}
@keyframes rise { from { transform: translateY(20px); opacity: 0; } }
#card .head { display: flex; gap: 10px; align-items: center; padding: 12px 14px; background: var(--cat); }
#card .head .ic { font-size: 28px; }
#card .head h3 { margin: 0; font-size: 16px; line-height: 1.25; }
#card .head p { margin: 2px 0 0; font-size: 12px; opacity: .9; }
#card .head .x { margin-inline-start: auto; background: none; border: 0; color: #fff; font-size: 22px; cursor: pointer; }
#card .body { padding: 10px 14px 14px; }
#card .meta { display: flex; gap: 12px; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
#card .desc { font-size: 13.5px; line-height: 1.5; margin: 6px 0 10px; }
#card .advisor { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border-radius: 10px; background: rgba(255, 255, 255, .07); font-size: 12.5px; line-height: 1.45; margin-bottom: 10px; }
#card .advisor .av { font-size: 22px; }
#card .advisor b { display: block; color: var(--gold); font-size: 11.5px; }
.opt {
  display: block; width: 100%; text-align: start; margin-bottom: 7px; padding: 9px 11px; border-radius: 11px; cursor: pointer;
  background: rgba(255, 255, 255, .08); border: 1px solid var(--line); color: var(--ink); font: inherit; font-size: 13.5px;
}
.opt:hover:not(:disabled) { background: rgba(255, 255, 255, .16); border-color: var(--gold); }
.opt.hl { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(242, 193, 78, .35); }
.opt:disabled { opacity: .45; cursor: not-allowed; }
.opt .costs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 5px; font-size: 11.5px; }
.opt .costs span { padding: 1px 7px; border-radius: 8px; background: rgba(0, 0, 0, .3); }
.opt .costs .neg { color: #ff9a8f; } .opt .costs .pos { color: #8fe39f; }
#card .status { padding: 10px 12px; border-radius: 10px; background: rgba(60, 154, 86, .25); font-size: 13px; }

/* ---------- turn summary, toast, intro ---------- */
#summary[hidden], #card[hidden], #toast[hidden], #advisor-bubble[hidden] { display: none; }

/* ---------- HUD: mayor, time, council ---------- */
.hud-mayor { display: flex; align-items: center; gap: 8px; min-width: 0; }
.hud-mayor .avatar { width: 40px; height: 40px; border-radius: 50%; overflow: hidden; flex: none; border: 2px solid #fff;
  background: radial-gradient(circle at 50% 35%, #5b95e6, #2c5fa8 75%); }   /* the mayor: a generic silhouette */
.hud-mayor .avatar svg { width: 100%; height: 100%; display: block; }
.hud-mayor div, .hud-time { display: flex; flex-direction: column; line-height: 1.2; }
.hud-mayor b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 170px; }
.hud-mayor span, .hud-time span { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.hud-time b { font-size: 13.5px; white-space: nowrap; }
.hud-council { display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.hud-council b { color: var(--ink); }
.hud-council em { color: #ff8a7e; font-style: normal; font-weight: 700; }
.hud-council .dots, .legend i { display: flex; gap: 3px; }
.hud-council .dots i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; border: 1px solid rgba(255, 255, 255, .5); }
.vote-chip { color: #ffd47a; }

/* ---------- opening screens ---------- */
#intro { backdrop-filter: blur(5px) saturate(1.05); background: rgba(12, 14, 16, .38) !important; }
.intro-box { width: 520px !important; text-align: center; }
.intro-box.pop { animation: rise .35s ease-out; }
.intro-box h1 { font-size: 26px; margin-bottom: 8px; }
.intro-box p { font-size: 14.5px; line-height: 1.55; margin: 6px 0; }
.intro-box .lead { font-size: 16px; font-weight: 600; }
.intro-box .aside { color: var(--gold); font-style: italic; }
.intro-box .quip { font-size: 15px; color: #ffe2a0; margin: 10px 0 14px; }
.intro-box .row { justify-content: center; margin-top: 12px; }
.intro-box button { padding: 10px 18px; border-radius: 12px; border: 0; cursor: pointer; font-weight: 700; font-size: 15px; background: linear-gradient(#f6cf63, #e3a92c); color: #3b2a07; box-shadow: 0 3px 0 #a87a17; }
.intro-box button.alt { background: rgba(255, 255, 255, .12); color: var(--ink); box-shadow: none; }
.intro-box button.big { font-size: 17px; padding: 12px 26px; margin-top: 8px; }
.mayor-form { display: grid; gap: 9px; margin-top: 14px; text-align: start; }
.mayor-form label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.mayor-form input { padding: 9px 11px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, .08); color: var(--ink); font: inherit; font-size: 15px; }
.mayor-form input:focus { outline: 2px solid var(--gold); }
.mayor-form input[type=date] { cursor: pointer; }
.mayor-form input[type=date]::-webkit-calendar-picker-indicator { cursor: pointer; }
.mayor-form .err { color: #ff8a7e; min-height: 1.2em; margin: 0; font-size: 13px; }
.mayor-form button { justify-self: center; }
.chamber { width: 100%; max-width: 430px; margin: 4px auto 0; display: block; }
.chamber .seat { animation: seatIn .4s backwards cubic-bezier(.3, 1.6, .5, 1); transform-box: fill-box; }
.chamber .vote { animation: seatIn .3s backwards; transform-box: fill-box; transform-origin: center; }
@keyframes seatIn { from { opacity: 0; transform: translateY(14px) scale(.6); } }
.legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px; font-size: 13.5px; margin: 4px 0; }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.majority { font-weight: 700; font-size: 15px; }
.majority.ok, .tally .ok { color: #7ee08f; } .majority.no, .tally .no { color: #ff8a7e; }
.tally { font-size: 16px; margin-top: 4px; }
@media (max-width: 1150px) { .hud-council span:last-child { display: none; } .hud-mayor b { max-width: 110px; } }

/* ---------- advisors: portrait bar under the map ---------- */
#advisors {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 22;
  display: flex; gap: 10px; padding: 8px 12px 6px; border-radius: 18px;
  background: var(--panel); backdrop-filter: blur(6px); box-shadow: 0 8px 26px rgba(0, 0, 0, .3);
}
.adv { display: flex; flex-direction: column; align-items: center; gap: 4px; background: none; border: 0; padding: 0; cursor: pointer; color: var(--ink); font: inherit; width: 84px; }
.adv .frame {
  position: relative; width: 70px; height: 70px; border-radius: 16px; overflow: visible;
  border: 3px solid var(--ac); box-shadow: 0 3px 10px rgba(0, 0, 0, .35); transition: transform .2s, box-shadow .2s;
  background: #1c2126;
}
.adv img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.adv .frame { border-radius: 50% !important; }
/* the model viewer's stylesheet gives every button a pale hover background: not here */
.adv, .adv:hover, .adv:focus, #card .head .x:hover { background: none !important; box-shadow: none; outline: none; }
.hud-stat.trust .bar i { background-size: auto !important; }
.hud-teams-wrap { display: flex; flex-direction: column; align-items: center; gap: 2px; margin-inline-start: auto; }
.hud-teams-label { font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.hud-teams-wrap #hud-teams { margin: 0; }
/* HUD blocks keep their width; on a narrow screen the bar wraps to a second line instead of overlapping */
#hud { flex-wrap: wrap; row-gap: 6px; }
.hud-mayor, .hud-time, .hud-council, .hud-stat, .hud-teams-wrap, #btn-end-turn { flex: none; }
.hud-mayor > div { min-width: 0; }
.team .ti { font-size: 15px; }
/* the fiction notice: alone, quiet, readable */
/* nine advisors: a little tighter */
.adv { width: 76px; }
.adv .frame { width: 62px; height: 62px; }
#advisors { gap: 6px; }
.team .tn { font-size: 11.5px; }
#advisor-bubble { display: flex; gap: 10px; align-items: flex-start; }
#advisor-bubble[hidden] { display: none; }
#advisor-bubble .bub-face { width: 44px; height: 44px; border-radius: 50%; flex: none; border: 2px solid var(--ac); }
.adv .name { font-size: 11.5px; line-height: 1.15; text-align: center; color: var(--muted); }
.adv:hover .frame, .adv.speaking .frame { transform: translateY(-6px); box-shadow: 0 8px 18px rgba(0, 0, 0, .45), 0 0 0 3px rgba(255, 255, 255, .25); }
.adv.speaking .name { color: var(--ink); font-weight: 600; }
.adv .badge {
  position: absolute; top: -8px; left: -8px; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 11px;
  background: var(--ac); border: 2px solid #fff; color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center;
}
.adv .badge[hidden] { display: none; }
.adv.alert .badge { background: #c0392b; animation: shake .6s infinite; }
#advisor-bubble {
  position: fixed; bottom: 138px; z-index: 30; max-width: 340px; padding: 10px 14px; border-radius: 14px;
  background: #fbf6ea; color: #2a2620; font-size: 13.5px; line-height: 1.45; box-shadow: 0 10px 28px rgba(0, 0, 0, .35);
  border-top: 4px solid var(--ac); animation: rise .2s ease-out;
}
#advisor-bubble b { display: block; color: var(--ac); font-size: 12px; margin-bottom: 2px; filter: brightness(.8); }
#advisor-bubble::after {
  content: ""; position: absolute; bottom: -9px; left: var(--tail, 50%); margin-left: -9px;
  border: 9px solid transparent; border-bottom: 0; border-top-color: #fbf6ea;
}
#card .advisor-ref { font-size: 12px; color: var(--muted); margin-bottom: 9px; }
#card .advisor-ref b { color: var(--gold); }
/* room for the advisor bar */
#card { bottom: 150px !important; max-height: calc(100vh - 240px); overflow: auto; }
#toast { bottom: auto !important; top: 84px; }
#issues { max-height: calc(100vh - 250px) !important; }
@media (max-width: 1000px) {
  #hud { gap: 8px; padding: 6px 10px; flex-wrap: wrap; }
  .hud-stat.trust .bar { width: 60px; }
  .team { font-size: 11.5px; padding: 3px 7px; }
  #issues { width: 240px; top: 96px; }
  #card { width: 340px; }
}
#summary {
  position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: rgba(10, 12, 14, .45);
}
#summary .box, .intro-box {
  width: 460px; max-width: calc(100vw - 30px); max-height: 80vh; overflow: auto; padding: 18px 20px; border-radius: 18px;
  background: rgba(30, 35, 40, .97); box-shadow: 0 16px 50px rgba(0, 0, 0, .5); animation: rise .3s ease-out;
}
#summary h2, .intro-box h1 { margin: 0 0 10px; }
#summary ul { padding: 0; list-style: none; margin: 0 0 12px; }
#summary li { padding: 6px 8px; border-radius: 8px; margin-bottom: 4px; background: rgba(255, 255, 255, .06); font-size: 13.5px; }
#summary li.good { border-inline-start: 4px solid #4fbf6a; } #summary li.bad { border-inline-start: 4px solid #e2483d; } #summary li.new { border-inline-start: 4px solid var(--gold); }
#summary .row, .intro-box .row { display: flex; gap: 8px; }
#summary button, #btn-start {
  padding: 9px 16px; border-radius: 11px; border: 0; cursor: pointer; font-weight: 700; font-size: 14px;
  background: linear-gradient(#f6cf63, #e3a92c); color: #3b2a07;
}
#summary button.alt { background: rgba(255, 255, 255, .12); color: var(--ink); }
#intro { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(12, 14, 16, .55); }
#intro[hidden] { display: none; }
.intro-box ul { padding-inline-start: 18px; line-height: 1.55; font-size: 14px; }
.intro-box .small { color: var(--muted); font-size: 12px; }
#btn-start:disabled { opacity: .6; cursor: wait; }
#toast {
  position: fixed; bottom: 34px; left: 50%; transform: translateX(-50%); z-index: 45; padding: 10px 16px; border-radius: 12px;
  background: var(--panel); font-size: 14px; box-shadow: 0 6px 20px rgba(0, 0, 0, .35);
}

/* ---------- neighbourhoods: mood bubbles, panel ---------- */
.hud-stat.trust { cursor: pointer; }
.hud-stat.trust:hover b { text-decoration: underline dotted; }
.hood-bubble {
  position: absolute; transform: translate(-50%, -50%); pointer-events: auto; cursor: pointer; z-index: 2;
  display: flex; align-items: center; gap: 5px; padding: 3px 9px 3px 4px; border-radius: 16px; white-space: nowrap;
  background: rgba(22, 26, 30, .82); color: #fff; font-size: 12px; border: 2px solid var(--mc, #888);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .35);
}
.hood-bubble .hf { font-size: 18px; line-height: 1; }
.hood-bubble .hv { background: var(--mc, #888); color: #fff; border-radius: 9px; padding: 0 6px; font-size: 11.5px; }
.hood-bubble.angry { animation: angryBeat 1.1s ease-in-out infinite; }
body:not(.show-hoods) .hood-bubble.angry .hn { display: none; }     /* off the layer: just the angry face */
.hood-bubble:hover .hn { display: inline !important; }
@keyframes angryBeat { 50% { transform: translate(-50%, -50%) scale(1.15); box-shadow: 0 0 0 6px rgba(226, 52, 43, .3); } }

#hoods-panel {
  position: fixed; top: 76px; left: 10px; width: 340px; max-height: calc(100vh - 250px); overflow: auto; z-index: 16;
  padding: 10px; border-radius: 14px; background: var(--panel); backdrop-filter: blur(6px); box-shadow: 0 8px 26px rgba(0, 0, 0, .3);
  animation: rise .2s ease-out;
}
#hoods-panel[hidden] { display: none; }
#hoods-panel h3 { margin: 2px 4px 8px; font-size: 15px; display: flex; align-items: center; justify-content: space-between; }
#hoods-panel h3 .x { background: none; border: 0; color: var(--muted); font-size: 20px; cursor: pointer; line-height: 1; }
#hoods-panel .note { color: var(--muted); font-size: 11px; line-height: 1.45; margin: 8px 4px 0; }
.hood-row {
  width: 100%; display: grid; grid-template-columns: 24px 1fr 56px 26px 34px; gap: 6px; align-items: center;
  padding: 5px 6px; margin-bottom: 4px; border: 0; border-radius: 9px; cursor: pointer; text-align: start;
  background: rgba(255, 255, 255, .05); color: var(--ink); font: inherit; border-inline-start: 4px solid var(--mc);
}
.hood-row:hover { background: rgba(255, 255, 255, .13); }
.hood-row .f { font-size: 17px; }
.hood-row .nm { font-size: 12.5px; font-weight: 600; line-height: 1.2; display: flex; flex-direction: column; }
.hood-row .nm small { font-weight: 400; font-size: 10.5px; color: var(--muted); }
.hood-row .bar { height: 7px; border-radius: 4px; background: rgba(255, 255, 255, .12); overflow: hidden; }
.hood-row .bar i { display: block; height: 100%; background: var(--mc); }
.hood-row b { font-size: 13px; text-align: center; }
.hood-row .tr { font-size: 10.5px; color: var(--muted); text-align: center; }
.hood-row .tr.up { color: #7ee08f; } .hood-row .tr.down { color: #ff7a6e; }
.hood-chip { white-space: nowrap; }
.hood-line { font-size: 13px; color: var(--muted); }
.hood-line b { color: var(--ink); }

/* ---------- end of term: the term in review ---------- */
.intro-box.review, .intro-box.election { width: 760px !important; max-width: calc(100vw - 30px); max-height: calc(100vh - 40px); overflow: auto; text-align: start; }
.intro-box.election { width: 600px !important; }
.intro-box.review h3 { font-size: 15px; margin: 16px 0 6px; }
.intro-box.review .quip, .intro-box.review > button, .intro-box.election h1, .intro-box.election .lead { text-align: center; }
.intro-box.review > button { display: block; margin: 16px auto 2px; }
.rv-head { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 10px; border-radius: 14px; background: var(--gc); }
.rv-head h1 { margin: 0 !important; font-size: 24px; }
.rv-head .rv-grade { margin: 2px 0 0 !important; font-size: 17px; }
.rv-medal { font-size: 46px; line-height: 1; filter: drop-shadow(0 3px 6px rgba(0, 0, 0, .35)); }
.rv-head.g1 { --gc: linear-gradient(90deg, rgba(246, 207, 99, .35), rgba(246, 207, 99, .08)); }
.rv-head.g2 { --gc: linear-gradient(90deg, rgba(70, 190, 110, .32), rgba(70, 190, 110, .06)); }
.rv-head.g3 { --gc: linear-gradient(90deg, rgba(90, 150, 230, .3), rgba(90, 150, 230, .06)); }
.rv-head.g4 { --gc: linear-gradient(90deg, rgba(240, 150, 60, .3), rgba(240, 150, 60, .06)); }
.rv-head.g5 { --gc: linear-gradient(90deg, rgba(226, 70, 60, .32), rgba(226, 70, 60, .06)); }
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tile { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 9px 6px; border-radius: 12px; background: rgba(255, 255, 255, .07); text-align: center; }
.tile > span { font-size: 20px; }
.tile b { font-size: 17px; white-space: nowrap; }
.tile small { font-size: 11px; color: var(--muted); line-height: 1.3; }
.tile.ok { box-shadow: inset 0 -3px 0 rgba(90, 200, 120, .7); }
.tile.no { box-shadow: inset 0 -3px 0 rgba(230, 80, 70, .75); }
.intro-box em { font-style: normal; font-size: 11.5px; color: var(--muted); }
.intro-box em.up { color: #7ee08f; } .intro-box em.down { color: #ff7a6e; }
.trust-chart { width: 100%; height: auto; direction: ltr; background: rgba(255, 255, 255, .04); border-radius: 12px; }
.trust-chart .grid { stroke: rgba(255, 255, 255, .09); }
.trust-chart .fifty { stroke: #ffd36a; stroke-dasharray: 6 5; stroke-width: 1.5; }
.trust-chart .ax { fill: var(--muted); font-size: 11px; text-anchor: middle; }
.trust-chart .ax.end { text-anchor: end; }
.trust-chart .fifty-t { fill: #ffd36a; text-anchor: end; }
.trust-chart .end-v { fill: #fff; font-weight: 700; font-size: 13px; }
.rv-hoods { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 14px; }
.rv-hood { display: grid; grid-template-columns: 20px 1fr 90px 26px 34px; gap: 6px; align-items: center; font-size: 12.5px; }
.rv-hood .f { font-size: 16px; }
.rv-hood .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rv-hood b { text-align: center; }
.rv-hood .bar, .el-row .bar, .el-total .bar { position: relative; height: 9px; border-radius: 5px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.rv-hood .bar i { position: absolute; inset-block: 0; inset-inline-start: 0; border-radius: 5px; }
.rv-hood .bar i.was { background: rgba(255, 255, 255, .28); }
.rv-hood .bar i.now { background: var(--mc); height: 5px; top: 2px; }
.bar u { position: absolute; inset-block: -2px; inset-inline-start: 50%; width: 2px; background: #ffd36a; text-decoration: none; }
.rv-best { margin: 0; padding-inline-start: 20px; font-size: 13.5px; line-height: 1.7; }
.rv-best small { color: var(--muted); }
.go-hist { list-style: none; padding: 0 !important; margin: 8px 0; }

/* ---------- election night ---------- */
.el-rows { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; }
.el-row, .el-total { display: grid; grid-template-columns: 150px 1fr 44px; gap: 10px; align-items: center; font-size: 13px; }
.el-row { opacity: 0; animation: elIn .3s ease-out var(--d) forwards; }
.el-row .bar, .el-total .bar { height: 14px; border-radius: 7px; }
.el-row .bar i, .el-total .bar i { position: absolute; inset-block: 0; inset-inline-start: 0; width: 0; border-radius: 7px; animation: elFill 1s ease-out var(--d, 0s) forwards; }
.el-row.w .bar i { background: linear-gradient(90deg, #3aa55c, #6fd28a); }
.el-row.l .bar i { background: linear-gradient(90deg, #c2412f, #ee7a5f); }
.el-row b, .el-total b { text-align: center; }
.el-total { padding: 10px; border-radius: 12px; background: rgba(255, 255, 255, .08); font-size: 15px; font-weight: 700; animation: rise .35s ease-out; }
.el-total .bar { height: 20px; border-radius: 10px; }
.el-total.ok .bar i { background: linear-gradient(90deg, #e3a92c, #f6cf63); }
.el-total.no .bar i { background: linear-gradient(90deg, #8d2f24, #d65a45); }
#el-verdict { text-align: center; animation: rise .4s ease-out; }
#el-verdict h2 { margin: 14px 0 4px; font-size: 24px; }
@keyframes elIn { to { opacity: 1; } }
@keyframes elFill { to { width: var(--to); } }
@media (max-width: 700px) { .tiles { grid-template-columns: repeat(2, 1fr); } .rv-hoods { grid-template-columns: 1fr; } }

/* ---------- the 3D view stopped ---------- */
#gl-lost { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; background: rgba(10, 12, 14, .7); }
#gl-lost .box { width: 420px; max-width: calc(100vw - 30px); padding: 22px 24px; border-radius: 16px; background: var(--panel); color: var(--ink); text-align: center; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); }
#gl-lost h2 { margin: 0 0 10px; }
#gl-lost p { font-size: 14px; line-height: 1.55; margin: 6px 0; }
#gl-lost button { margin-top: 10px; padding: 10px 20px; border: 0; border-radius: 12px; cursor: pointer; font-weight: 700; font-size: 15px; background: linear-gradient(#f6cf63, #e3a92c); color: #3b2a07; }
#gl-lost .gl-help { text-align: start; font-size: 13.5px; line-height: 1.6; padding-inline-start: 20px; margin: 8px 0; }

/* ---------- loading screen ---------- */
body.game #loading { display: none !important; }          /* the model's own plain loading line */
#game-loading {
  position: fixed; inset: 0; z-index: 90; display: grid; place-items: center;
  background: radial-gradient(ellipse at 50% 35%, #2b3a44 0%, #161c21 70%); transition: opacity .6s ease;
}
#game-loading.done { opacity: 0; pointer-events: none; }
#game-loading .gl-card { width: 520px; max-width: calc(100vw - 40px); text-align: center; color: #f4efe4; }
.gl-logo { display: block; width: 100%; height: auto; filter: drop-shadow(0 8px 22px rgba(0, 0, 0, .45)); animation: glIn .9s ease-out both; }
@keyframes glIn { from { opacity: 0; transform: translateY(8px) scale(.97); } }
.gl-sub { margin: 10px 0 18px; font-size: 15px; letter-spacing: .3px; color: #d8d1c2; }
.gl-notice { margin: 16px auto 0; max-width: 440px; padding: 14px 16px; border-radius: 12px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .1); }
.gl-notice[hidden] { display: none; }
.gl-notice p { margin: 0; font-size: 13px; line-height: 1.6; color: #cfc8b9; }
.gl-tip { min-height: 1.5em; margin: 10px 0 0; font-size: 15px; font-weight: 600; color: #ffe2a0; }
.gl-joke { min-height: 1.4em; margin: 2px 0 0; font-size: 13px; color: #b9b2a4; }
.gl-bar { position: relative; height: 8px; border-radius: 4px; background: rgba(255, 255, 255, .12); overflow: hidden; }
.gl-bar i { position: absolute; inset-block: 0; inset-inline-start: 0; width: 0; border-radius: 4px; background: linear-gradient(90deg, #e3a92c, #f6cf63); transition: width 1.5s ease-out; }
.gl-bar::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .35), transparent); transform: translateX(-100%); animation: glShine 1.4s linear infinite; }
@keyframes glShine { to { transform: translateX(100%); } }
.gl-slow { font-size: 12.5px; color: #c9c2b4; margin-top: 10px; }
@media (prefers-reduced-motion: reduce) { .gl-logo, .gl-bar::after { animation: none; } }

/* ---------- save code ---------- */
.intro-box .save-code { width: 100%; box-sizing: border-box; margin: 6px 0; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, .08); color: var(--ink); font: 12px/1.4 ui-monospace, Consolas, monospace; direction: ltr; text-align: left; resize: none; word-break: break-all; }
.intro-box button.link { background: none; box-shadow: none; color: var(--gold); font-weight: 600; font-size: 13.5px; padding: 4px 6px; text-decoration: underline dotted; }
.intro-box .sc-line { border: 0; border-top: 1px solid var(--line); margin: 14px 0 8px; }
.intro-box .err { color: #ff8a7e; min-height: 1em; font-size: 13px; }

/* ---------- teams: tap a team, then a problem ---------- */
.team.armed { background: rgba(242, 193, 78, .3); border-color: var(--gold); box-shadow: 0 0 0 2px rgba(242, 193, 78, .45); }
body.arming .marker .mpin { box-shadow: 0 0 0 4px rgba(242, 193, 78, .55); }
body.arming .issue { outline: 1px dashed rgba(242, 193, 78, .6); }
.hud-teams-label .for-m { display: none; }

/* ======================================================================================================
   PHONES (body.m, set by game.js: under 760 px wide or under 500 px high; body.m-land: held sideways).
   Nothing is left out: the same parts, arranged for a small touch screen.
     --hud-b   bottom of the top bar      --dock-b  height from the bottom to the top of the button bar
     --adv-h   height of the advisors     --dock-w  width of the button bar
   ====================================================================================================== */
#dock[hidden] { display: none; }
body.m { -webkit-tap-highlight-color: transparent; touch-action: manipulation; overscroll-behavior: none; }
body.m button { touch-action: manipulation; }
body.m .hud-teams-label .for-desk { display: none; }
body.m .hud-teams-label .for-m { display: inline; }

/* -- top bar: three short rows -- */
body.m #hud {
  top: calc(5px + env(safe-area-inset-top)); left: calc(5px + env(safe-area-inset-left)); right: calc(5px + env(safe-area-inset-right));
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; align-items: center;
  grid-template-areas: "mayor mayor budget trust" "time time council council" "teams teams teams teams";
  gap: 5px 8px; padding: 6px 8px; border-radius: 13px;
}
body.m .hud-mayor { grid-area: mayor; gap: 7px; }
body.m .hud-mayor .avatar { width: 30px; height: 30px; border-width: 1.5px; }
body.m .hud-mayor b { font-size: 14px; max-width: none; }
body.m .hud-mayor span { font-size: 10.5px; overflow: hidden; text-overflow: ellipsis; }
body.m .hud-time { grid-area: time; min-width: 0; }
body.m .hud-time b { font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
body.m .hud-time span { font-size: 10px; white-space: normal; line-height: 1.25; }
body.m .hud-council { grid-area: council; align-items: flex-end; gap: 2px; font-size: 10px; }
body.m .hud-council span:last-child { display: block; }
body.m .hud-council .dots { gap: 2px; }
body.m .hud-council .dots i { width: 8px; height: 8px; }
body.m .hud-stat { gap: 4px; font-size: 14px; }
body.m .hud-stat:not(.trust) { grid-area: budget; }
body.m .hud-stat.trust { grid-area: trust; }
body.m .hud-stat .ico { font-size: 15px; }
body.m .hud-stat small { font-size: 9.5px; }
body.m .hud-stat.trust .bar { width: 40px; height: 7px; }
body.m .hud-teams-wrap { grid-area: teams; flex-direction: row; align-items: center; gap: 6px; margin: 0; min-width: 0; }
body.m .hud-teams-label { font-size: 10.5px; }
body.m #hud-teams { overflow-x: auto; scrollbar-width: none; min-width: 0; flex: 1; gap: 5px; padding: 2px 1px; }
body.m #hud-teams::-webkit-scrollbar { display: none; }
body.m .team { flex: none; font-size: 11.5px; padding: 4px 8px 4px 6px; min-height: 30px; box-sizing: border-box; cursor: pointer; }
body.m .team .ti { font-size: 14px; }
body.m .team .tn { font-size: 11px; }

/* -- the button bar above the advisors: turn, problems, tools -- */
body.m #dock {
  position: fixed; z-index: 23; display: flex; align-items: center; gap: 5px;
  left: calc(5px + env(safe-area-inset-left)); right: calc(5px + env(safe-area-inset-right)); bottom: calc(var(--adv-h, 90px) + 5px);
  padding: 5px; border-radius: 13px; background: var(--panel); backdrop-filter: blur(6px); box-shadow: 0 6px 20px rgba(0, 0, 0, .3);
}
body.m #dock #btn-end-turn { flex: none; padding: 0 12px; height: 38px; font-size: 14px; white-space: nowrap; }
body.m #btn-issues {
  flex: 1 1 auto; min-width: 0; height: 38px; padding: 0 10px; border-radius: 11px; border: 1px solid var(--line); cursor: pointer;
  background: rgba(255, 255, 255, .08) !important; color: var(--ink); font: inherit; font-size: 13.5px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 5px; white-space: nowrap; overflow: hidden;
}
body.m #btn-issues b { background: rgba(255, 255, 255, .16); border-radius: 9px; padding: 0 7px; font-size: 12.5px; }
body.m #btn-issues.urgent b { background: #c0392b; animation: shake .6s infinite; }
body.m #btn-issues.on { background: rgba(255, 255, 255, .22) !important; border-color: var(--gold); }
body.m #dock #btn-hoods, body.m #dock #btn-names, body.m #dock #btn-term, body.m #dock #btn-save, body.m #dock #btn-settings {
  width: 36px; height: 38px; border-radius: 10px; font-size: 16px; padding: 0;
}

/* -- advisors: a strip along the bottom edge that scrolls sideways -- */
body.m #advisors {
  left: 0; right: 0; bottom: 0; transform: none; border-radius: 15px 15px 0 0;
  padding: 7px calc(8px + env(safe-area-inset-right)) calc(4px + env(safe-area-inset-bottom)) calc(8px + env(safe-area-inset-left));
  gap: 2px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; scroll-snap-type: x proximity;
}
body.m #advisors::-webkit-scrollbar { display: none; }
body.m .adv { width: 58px; flex: none; scroll-snap-align: start; gap: 3px; padding-top: 6px; }
body.m .adv .frame { width: 44px; height: 44px; border-width: 2.5px; }
body.m .adv .name { font-size: 10px; }
body.m .adv .badge { top: -6px; left: -6px; min-width: 19px; height: 19px; font-size: 11px; }
body.m .adv:hover .frame { transform: none; }
body.m .adv.speaking .frame { transform: translateY(-3px); }

/* -- open problems: a sheet over the bar, opened with 📋 -- */
body.m #issues {
  display: none; top: auto; width: auto; z-index: 26;
  left: calc(5px + env(safe-area-inset-left)); right: calc(5px + env(safe-area-inset-right)); bottom: calc(var(--dock-b, 140px) + 6px);
  max-height: calc(100dvh - var(--hud-b, 120px) - var(--dock-b, 140px) - 18px) !important;
  background: rgba(30, 35, 40, .96); box-shadow: 0 -6px 26px rgba(0, 0, 0, .35); animation: rise .2s ease-out;
}
body.m.issues-open #issues { display: block; }
body.m .issue { padding: 9px 8px; }
body.m .issue .t { font-size: 13.5px; }

/* -- the problem card: a sheet from the bottom edge, over the bars -- */
body.m #card {
  left: 0; right: 0; bottom: 0 !important; width: auto; max-width: none; z-index: 35;
  max-height: min(74dvh, calc(100dvh - var(--hud-b, 120px) - 12px)) !important;
  border-radius: 18px 18px 0 0; padding-bottom: env(safe-area-inset-bottom);
  background: rgba(30, 35, 40, .97); box-shadow: 0 -10px 34px rgba(0, 0, 0, .45); overscroll-behavior: contain;
}
body.m #card .head { position: sticky; top: 0; z-index: 1; padding: 11px 12px; }
body.m #card .head .x { width: 40px; height: 40px; font-size: 26px; flex: none; }
body.m #card .body { padding: 10px 12px 14px; }
body.m #card .meta { flex-wrap: wrap; gap: 4px 12px; }
body.m .opt { padding: 11px 12px; font-size: 14px; }

/* -- the advisor's bubble: across the screen; over the card it moves under the top bar -- */
body.m #advisor-bubble { left: 8px !important; right: 8px; max-width: none; bottom: calc(var(--dock-b, 140px) + 8px); font-size: 13px; padding: 9px 12px; z-index: 36; }
body.m #advisor-bubble::after { display: none; }
body.m #advisor-bubble .bub-face { width: 38px; height: 38px; }
body.m.card-open #advisor-bubble { top: calc(var(--hud-b, 120px) + 6px); bottom: auto; border-top: 0; border-bottom: 4px solid var(--ac); }
body.m.issues-open #advisor-bubble { display: none; }

/* -- neighbourhoods, display settings, notes -- */
body.m #hoods-panel {
  top: calc(var(--hud-b, 120px) + 6px); left: calc(5px + env(safe-area-inset-left)); right: calc(5px + env(safe-area-inset-right)); width: auto;
  max-height: min(42dvh, calc(100dvh - var(--hud-b, 120px) - var(--dock-b, 140px) - 18px)); background: rgba(30, 35, 40, .95);
}
body.m .hood-row { padding: 8px 6px; }
body.m #hoods-panel h3 .x { width: 36px; height: 36px; font-size: 24px; }
body.m #view-panel {
  left: calc(5px + env(safe-area-inset-left)); right: calc(5px + env(safe-area-inset-right)); width: auto; z-index: 30;
  bottom: calc(var(--dock-b, 140px) + 6px); max-height: calc(100dvh - var(--hud-b, 120px) - var(--dock-b, 140px) - 18px); overflow: auto;
}
body.m #toast { top: calc(var(--hud-b, 120px) + 8px); max-width: calc(100vw - 30px); width: max-content; text-align: center; font-size: 13.5px; z-index: 46; }
body.m #attribution { display: none; }

/* -- map markers: a little smaller, easy to tap -- */
body.m .marker .mpin { width: 38px; height: 38px; font-size: 19px; }
body.m .marker.sev2 .mpin { width: 42px; height: 42px; font-size: 21px; }
body.m .marker.sev3 .mpin { width: 46px; height: 46px; font-size: 23px; }
body.m .marker .stem { height: 12px; }
body.m .place .pdot { width: 26px; height: 26px; }
body.m .edge { width: 34px; height: 34px; margin: -17px 0 0 -17px; font-size: 15px; }

/* -- full screens: opening, council, votes, summary, term review, elections -- */
body.m #intro, body.m #summary { padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); }
body.m #summary .box, body.m .intro-box { max-width: calc(100vw - 20px); max-height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); padding: 16px 14px; box-sizing: border-box; overscroll-behavior: contain; }
body.m .intro-box.review, body.m .intro-box.election { max-width: calc(100vw - 16px); max-height: calc(100dvh - 16px); }
body.m .intro-box h1 { font-size: 22px; }
body.m .intro-box p { font-size: 14px; }
body.m .intro-box .row, body.m #summary .row { flex-wrap: wrap; justify-content: center; }
body.m .mayor-form input { font-size: 16px; }                 /* 16 px: the phone does not zoom in on the field */
body.m .intro-box .save-code { font-size: 16px; }
body.m .el-row, body.m .el-total { grid-template-columns: 92px 1fr 40px; gap: 7px; font-size: 12px; }
body.m .rv-hood { grid-template-columns: 20px 1fr 64px 24px 32px; font-size: 12px; }
body.m .tile b { font-size: 15px; }
body.m .rv-head { gap: 10px; }
body.m .rv-head h1 { font-size: 19px; }
body.m .rv-medal { font-size: 36px; }
body.m #gl-lost .box { padding: 18px 16px; }
@media (max-width: 370px) { body.m #btn-issues span { display: none; } body.m #btn-issues { padding: 0 5px; gap: 3px; } }
@media (max-width: 380px) {
  body.m #dock #btn-end-turn { padding: 0 9px; font-size: 13px; }
  body.m #dock #btn-hoods, body.m #dock #btn-names, body.m #dock #btn-term, body.m #dock #btn-save, body.m #dock #btn-settings { width: 33px; }
}

/* -- held sideways: two rows on top, the button bar beside the advisors, card and lists at the sides -- */
body.m-land #hud {
  grid-template-columns: auto minmax(0, 1fr) auto auto auto;
  grid-template-areas: "mayor time council budget trust" "teams teams teams teams teams";
  gap: 3px 12px; padding: 4px 10px;
}
body.m-land .hud-time span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.m-land .team { min-height: 27px; padding: 2px 8px 2px 6px; }
body.m-land #dock { right: auto; bottom: calc(4px + env(safe-area-inset-bottom)); padding: 4px; }
body.m-land #btn-issues { flex: none; }
body.m-land #advisors {
  left: calc(var(--dock-w, 330px) + 12px + env(safe-area-inset-left)); right: calc(5px + env(safe-area-inset-right)); bottom: calc(4px + env(safe-area-inset-bottom));
  border-radius: 13px; padding: 3px 8px 3px;
}
body.m-land .adv { width: 50px; padding-top: 5px; }
body.m-land .adv .frame { width: 34px; height: 34px; border-width: 2px; }
body.m-land .adv .name { font-size: 9.5px; }
body.m-land #issues {
  right: calc(5px + env(safe-area-inset-right)); left: auto; width: 300px; top: calc(var(--hud-b, 80px) + 6px); bottom: calc(var(--adv-h, 60px) + 6px);
  max-height: none !important;
}
body.m-land #card {
  left: calc(5px + env(safe-area-inset-left)); right: auto; width: min(400px, 56vw); top: calc(var(--hud-b, 80px) + 6px); bottom: calc(var(--adv-h, 60px) + 6px) !important;
  max-height: none !important; border-radius: 15px;
}
body.m-land #advisor-bubble, body.m-land.card-open #advisor-bubble {
  left: auto !important; right: calc(8px + env(safe-area-inset-right)); top: auto; width: auto; max-width: min(380px, 40vw);
  bottom: calc(var(--adv-h, 60px) + 8px); border-top: 4px solid var(--ac); border-bottom: 0;
}
body.m-land #hoods-panel { right: auto; width: 340px; max-height: calc(100dvh - var(--hud-b, 80px) - var(--adv-h, 60px) - 18px); }
body.m-land #view-panel { right: auto; width: 320px; bottom: calc(var(--adv-h, 60px) + 6px); max-height: calc(100dvh - var(--hud-b, 80px) - var(--adv-h, 60px) - 18px); }
