/* 『ひだ、人口倍増計画』: the mayor's desk. Phone portrait first, two columns on wide screens.
   Built on css/kit.css (windows, chips, steppers, tabs, KPI cards, stamps). */
:root {
  --ink: #1f2a3a;
  --paper: #f6f1e6;
  --panel: #fffdf8;
  --line: #e2d9c6;
  --indigo: #23395b;
  --indigo2: #3a5a8a;
  --accent: #d0682e;
  --good: #2e8a56;
  --bad: #c0442a;
  --warn: #c98a1a;
  --dim: #6b7280;
  --shadow: 0 1px 2px rgba(30, 40, 60, 0.08), 0 6px 18px rgba(30, 40, 60, 0.08);
  --fs: 1;
}
html,
body {
  height: 100%;
  overflow: hidden;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "BIZ UDPGothic", "Hiragino Sans", "Yu Gothic", sans-serif;
  font-size: calc(15px * var(--fs));
}
.screen {
  position: fixed;
  inset: 0;
}
.hidden {
  display: none !important;
}
.num {
  font-variant-numeric: tabular-nums;
}
.mincho {
  font-family: "Zen Old Mincho", serif;
}

/* ---- title ---- */
#title {
  overflow-y: auto;
  display: grid;
  place-items: center;
  padding: 24px 16px 40px;
}
.title-art {
  position: fixed;
  inset: 0;
  background-image: linear-gradient(160deg, #cfdde0, #efe6d2);
  background-size: cover;
  background-position: center top;
  z-index: -1;
}
.title-box {
  max-width: 720px;
  width: 100%;
  text-align: center;
}
.kicker {
  color: var(--indigo2);
  letter-spacing: 0.2em;
  font-size: 0.85em;
  margin: 0 0 6px;
}
.logo {
  font-family: "Zen Old Mincho", serif;
  font-weight: 900;
  font-size: clamp(40px, 9vw, 72px);
  line-height: 1.12;
  margin: 0 0 12px;
  color: var(--indigo);
  text-shadow: 0 2px 0 #fff;
}
.lead {
  font-size: 1.05em;
  line-height: 1.8;
  margin: 0 0 18px;
}
.lead b {
  color: var(--accent);
  font-size: 1.2em;
}
.title-modes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 12px;
}
.mode {
  font: inherit;
  text-align: left;
  border: 2px solid var(--indigo);
  background: var(--panel);
  color: var(--ink);
  border-radius: 14px;
  padding: 12px 14px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.12s;
}
.mode:hover {
  transform: translateY(-2px);
}
.mode b {
  display: block;
  color: var(--indigo);
  font-size: 1.05em;
}
.mode span {
  display: block;
  font-size: 0.85em;
  color: var(--dim);
  margin-top: 3px;
}
.mode[data-goal="full"] {
  background: var(--indigo);
  color: #fff;
}
.mode[data-goal="full"] b {
  color: #fff;
}
.mode[data-goal="full"] span {
  color: #d8e0ee;
}
.title-points {
  list-style: none;
  padding: 0;
  margin: 16px 0;
  display: grid;
  gap: 6px;
  text-align: left;
}
.title-points li {
  background: rgba(255, 253, 248, 0.9);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 0.9em;
  box-shadow: var(--shadow);
}
.title-points b {
  color: var(--indigo);
}
.disclaimer {
  font-size: 0.75em;
  color: #6a5a3a;
  background: #fff6e2;
  border: 1px solid #ecd9a8;
  border-radius: 10px;
  padding: 8px 12px;
  line-height: 1.6;
  text-align: left;
}
@media (max-width: 560px) {
  .title-modes {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---- app frame ---- */
#app {
  display: flex;
  flex-direction: column;
}
.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: var(--indigo);
  color: #fff;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
  z-index: 3;
}
.tb-date {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 7.5em;
}
.tb-date b {
  font-family: "Zen Old Mincho", serif;
  font-size: 1.15em;
}
.tb-date .chip {
  align-self: flex-start;
}
.tb-kpis {
  flex: 1;
  display: grid;
  grid-template-columns: 1.7fr repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.kpi {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 4px 10px;
  min-width: 0;
  cursor: pointer;
}
.kpi .l {
  font-size: 0.72em;
  color: #c8d3e6;
  display: block;
  white-space: nowrap;
}
.kpi .v {
  font-size: 1.15em;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.kpi .d {
  font-size: 0.75em;
  margin-left: 4px;
}
.kpi .d.up {
  color: #9fe0b4;
}
.kpi .d.down {
  color: #ffb4a0;
}
.kpi .bar {
  height: 5px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  margin-top: 3px;
  overflow: hidden;
  position: relative;
}
.kpi .bar i {
  position: absolute;
  inset: 0 auto 0 0;
  background: linear-gradient(90deg, #f0b46a, #e07a3c);
  border-radius: 999px;
}
.kpi .bar u {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 2px;
  background: #fff;
}
.tb-menu {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.3);
}
.tabs {
  display: flex;
  gap: 2px;
  padding: 0 12px;
  background: #e9e1cf;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.tabs button {
  font: inherit;
  border: none;
  background: none;
  padding: 9px 14px;
  cursor: pointer;
  color: #5a5a4a;
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}
.tabs button.on {
  color: var(--indigo);
  font-weight: 700;
  border-bottom-color: var(--accent);
  background: var(--paper);
}
.tabs button .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--bad);
  display: inline-block;
}
#desk-view {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px 120px;
  -webkit-overflow-scrolling: touch;
}

/* ---- panels ---- */
.grid2 {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 12px 14px;
  margin-bottom: 14px;
}
.panel h2 {
  font-family: "Zen Old Mincho", serif;
  font-size: 1.1em;
  color: var(--indigo);
  margin: 0 0 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.panel h2 small {
  font-family: "BIZ UDPGothic", sans-serif;
  font-weight: 400;
  color: var(--dim);
  font-size: 0.75em;
  margin-left: auto;
}
.panel h3 {
  font-size: 0.95em;
  margin: 10px 0 6px;
  color: #3a4a5a;
}
.muted {
  color: var(--dim);
  font-size: 0.85em;
}
.small {
  font-size: 0.85em;
}

/* the month's report */
.report-flow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin: 8px 0;
}
.report-flow div {
  background: #f6f2e8;
  border-radius: 10px;
  padding: 6px 8px;
  text-align: center;
}
.report-flow b {
  display: block;
  font-size: 1.3em;
  font-variant-numeric: tabular-nums;
}
.report-flow small {
  color: var(--dim);
}
.report-flow .p b {
  color: var(--good);
}
.report-flow .n b {
  color: var(--bad);
}
.headline {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.headline .big {
  font-size: 1.9em;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--indigo);
}
.headline .delta {
  font-weight: 700;
  font-size: 1.05em;
}
.headline .delta.up {
  color: var(--good);
}
.headline .delta.down {
  color: var(--bad);
}
.causes {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
}
.causes li {
  padding: 6px 0 6px 26px;
  position: relative;
  border-top: 1px dashed var(--line);
  font-size: 0.9em;
  line-height: 1.5;
}
.causes li::before {
  content: attr(data-n);
  position: absolute;
  left: 0;
  top: 6px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--indigo);
  color: #fff;
  font-size: 0.75em;
  display: grid;
  place-items: center;
}

/* an advisor's word */
.advisor {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: #eef3f9;
  border: 1px solid #cfdcec;
  border-radius: 14px;
  padding: 10px 12px;
  margin-bottom: 14px;
}
.advisor img,
.advisor .ph {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  flex: 0 0 auto;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px #cfdcec;
  background: #dfe7f1;
  display: grid;
  place-items: center;
  font-weight: 700;
  color: var(--indigo);
}
.advisor .who {
  font-size: 0.8em;
  color: var(--indigo2);
  font-weight: 700;
}
.advisor p {
  margin: 2px 0 0;
  line-height: 1.65;
}

/* the inbox: cards waiting for a decision */
.inbox-head {
  display: flex;
  align-items: baseline;
  gap: 4px 8px;
  margin: 2px 0 8px;
  flex-wrap: wrap;
}
.inbox-head h2 {
  margin: 0;
}
.cardlist {
  display: grid;
  gap: 10px;
}
.mcard {
  font: inherit;
  text-align: left;
  width: 100%;
  background: #fff;
  border: 1px solid var(--line);
  border-left: 6px solid var(--indigo2);
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition:
    transform 0.1s,
    box-shadow 0.1s;
  color: inherit;
}
.mcard:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(30, 40, 60, 0.14);
}
.mcard .row1 {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  font-size: 0.78em;
  color: var(--dim);
}
.mcard .t {
  font-weight: 700;
  margin: 4px 0 2px;
  line-height: 1.45;
}
.mcard .sub {
  font-size: 0.85em;
  color: #4a5a6a;
  line-height: 1.5;
}
.mcard .meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 0.78em;
  color: var(--dim);
  margin-top: 6px;
}
.mcard .meta b {
  color: var(--ink);
}
.mcard.ev-rare {
  border-left-color: var(--bad);
}
.mcard.ev-uncommon {
  border-left-color: var(--warn);
}
.mcard.ev-common {
  border-left-color: #4a7ab0;
}
.mcard.done {
  opacity: 0.55;
}
.sev {
  font-weight: 700;
  border-radius: 6px;
  padding: 0 6px;
  color: #fff;
}
.sev.rare {
  background: var(--bad);
}
.sev.uncommon {
  background: var(--warn);
}
.sev.common {
  background: #4a7ab0;
}
.tag {
  border-radius: 6px;
  padding: 0 6px;
  background: #eef0f3;
  color: #4a5a6a;
}
.tag.dist {
  background: #f4ead6;
  color: #7a5a2a;
}
.tag.fic {
  background: #fdecea;
  color: #a0442a;
}
.tag.hist {
  background: #ecf0fa;
  color: #3a4a8a;
}
.empty-note {
  text-align: center;
  color: var(--dim);
  background: #fbf8f1;
  border: 2px dashed var(--line);
  border-radius: 12px;
  padding: 16px;
  font-size: 0.9em;
}
.submit-meter {
  margin-left: auto;
  font-size: 0.8em;
  color: var(--dim);
}
.submit-meter b {
  color: var(--accent);
  font-size: 1.2em;
}

/* the big next-month button */
.nextbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(
    180deg,
    rgba(246, 241, 230, 0),
    rgba(246, 241, 230, 0.96) 35%
  );
  display: flex;
  justify-content: center;
  pointer-events: none;
}
.nextbar button {
  pointer-events: auto;
  font: inherit;
  font-weight: 700;
  font-size: 1.08em;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 12px 34px;
  box-shadow: 0 6px 20px rgba(208, 104, 46, 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
}
.nextbar button small {
  font-weight: 400;
  opacity: 0.9;
  font-size: 0.75em;
}
.nextbar button:disabled {
  opacity: 0.6;
  cursor: default;
}

/* ---- the card window ---- */
.cardwin .win {
  width: min(820px, 96vw);
}
.cardwin .win-body {
  padding-top: 0;
}
.card-hist {
  margin: 0 -16px 10px;
  padding: 10px 16px;
  background: #eef1f8;
  border-bottom: 1px solid #d6dcec;
  font-size: 0.86em;
  line-height: 1.6;
}
.card-hist .lab {
  font-weight: 700;
  color: #3a4a8a;
}
.card-news {
  margin: 0 -16px 10px;
  padding: 10px 16px;
  border-bottom: 1px solid #f0d0c4;
  background: #fdf3ef;
  font-size: 0.92em;
  line-height: 1.7;
}
.card-news.rare {
  background: #fde9e4;
  border-bottom-color: #efb8a8;
}
.card-title {
  font-family: "Zen Old Mincho", serif;
  font-size: 1.25em;
  color: var(--indigo);
  margin: 4px 0 6px;
  line-height: 1.45;
}
.facts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 6px;
  margin: 8px 0;
}
.facts div {
  background: #f6f2e8;
  border-radius: 10px;
  padding: 6px 10px;
}
.facts small {
  display: block;
  color: var(--dim);
  font-size: 0.75em;
}
.facts b {
  font-variant-numeric: tabular-nums;
}
.chance {
  height: 6px;
  background: #e8e2d4;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 4px;
}
.chance i {
  display: block;
  height: 100%;
  background: var(--good);
}
.why {
  font-size: 0.8em;
  color: var(--dim);
  margin: 4px 0 8px;
}
.choices {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}
.choice {
  font: inherit;
  text-align: left;
  border: 2px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  color: inherit;
  transition:
    border-color 0.12s,
    background 0.12s;
}
.choice:hover:not(:disabled) {
  border-color: var(--indigo2);
  background: #f6f9fd;
}
.choice:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.choice .ch-top {
  display: flex;
  gap: 8px;
  align-items: baseline;
  flex-wrap: wrap;
}
.choice .ch-top b {
  font-size: 1.02em;
}
.choice .ch-top .cost {
  margin-left: auto;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}
.choice p {
  margin: 4px 0;
  font-size: 0.86em;
  color: #4a5a6a;
  line-height: 1.55;
}
.effects {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}
.eff {
  font-size: 0.75em;
  border-radius: 6px;
  padding: 1px 6px;
  background: #eef0f3;
  white-space: nowrap;
}
.eff.good {
  background: #e3f3e8;
  color: #1f6a3e;
}
.eff.bad {
  background: #fbe6e0;
  color: #9a3420;
}
.eff.later::before {
  content: "⏳";
  margin-right: 2px;
}
.ch-note {
  font-size: 0.78em;
  color: var(--dim);
}
.resid {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78em;
}
.resid i {
  display: inline-block;
  height: 6px;
  width: 80px;
  background: #eee;
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}
.resid i::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--w);
  background: var(--c, var(--bad));
}

/* ---- charts ---- */
.chart {
  width: 100%;
  height: auto;
  display: block;
}
.chart text {
  font-family: "BIZ UDPGothic", sans-serif;
  font-size: 11px;
  fill: #6b7280;
}
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.8em;
  color: var(--dim);
  margin-top: 4px;
}
.legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 4px;
  vertical-align: -1px;
}
.bottle {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.bottle div {
  background: #f6f2e8;
  border-radius: 12px;
  padding: 8px 10px;
}
.bottle b {
  font-size: 1.3em;
  font-variant-numeric: tabular-nums;
}
.bottle small {
  display: block;
  color: var(--dim);
  font-size: 0.78em;
}
.bottle .lim {
  outline: 2px solid var(--bad);
  background: #fdf0ec;
}

/* metrics */
.mgroup {
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 8px;
  background: #fff;
}
.mgroup summary {
  cursor: pointer;
  padding: 8px 12px;
  font-weight: 700;
  display: flex;
  gap: 8px;
  align-items: center;
  list-style: none;
}
.mgroup summary::-webkit-details-marker {
  display: none;
}
.mgroup summary .avg {
  margin-left: auto;
  font-weight: 400;
  font-size: 0.85em;
  color: var(--dim);
}
.mrow {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 4.6em;
  gap: 8px;
  align-items: center;
  padding: 4px 12px;
  font-size: 0.86em;
  border-top: 1px solid #f1ece0;
}
.mrow .bar {
  height: 8px;
  background: #eee8da;
  border-radius: 999px;
  position: relative;
  overflow: hidden;
}
.mrow .bar i {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 999px;
  background: var(--c, var(--indigo2));
}
.mrow .bar u {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(0, 0, 0, 0.25);
}
.mrow .v {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.mrow .v small {
  display: block;
  font-size: 0.75em;
}
.mrow .v .up {
  color: var(--good);
}
.mrow .v .down {
  color: var(--bad);
}
.mrow .lab small {
  color: var(--dim);
  font-size: 0.78em;
  margin-left: 4px;
}

/* districts */
.map svg {
  width: 100%;
  height: auto;
}
.map .dist {
  cursor: pointer;
  transition: opacity 0.15s;
  stroke: #fff;
  stroke-width: 3;
}
.map .dist:hover {
  opacity: 0.85;
}
.map text {
  font-family: "BIZ UDPGothic", sans-serif;
  pointer-events: none;
}
.dcards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.dcard {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.dcard .ph {
  height: 84px;
  background-color: #dfe6dc;
  background-position: center;
  background-size: cover;
  position: relative;
}
.dcard .ph b {
  position: absolute;
  left: 10px;
  bottom: 6px;
  color: #fff;
  font-family: "Zen Old Mincho", serif;
  font-size: 1.3em;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}
.dcard .bd {
  padding: 8px 10px;
  font-size: 0.86em;
  line-height: 1.6;
}

/* election */
.vote-big {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.vote-gauge {
  flex: 1;
  min-width: 220px;
}
.gauge {
  position: relative;
  height: 22px;
  background: #e8e2d4;
  border-radius: 999px;
  overflow: hidden;
}
.gauge .range {
  position: absolute;
  top: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    rgba(46, 138, 86, 0.35),
    rgba(46, 138, 86, 0.75)
  );
}
.gauge .mid50 {
  position: absolute;
  left: 50%;
  top: -3px;
  bottom: -3px;
  width: 2px;
  background: var(--bad);
}
.cands {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.cand {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px;
  text-align: center;
  font-size: 0.85em;
}
.cand img,
.cand .ph {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  margin: 0 auto 4px;
  background: #dfe7f1;
}
.groups {
  display: grid;
  gap: 6px;
}
.groups .g {
  display: grid;
  grid-template-columns: 9em 1fr 3em;
  gap: 8px;
  align-items: center;
  font-size: 0.86em;
}
.groups .g i {
  display: block;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, #8fb4e0, var(--indigo2));
}

/* log */
.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}
.timeline li {
  display: grid;
  grid-template-columns: 6.5em 2em 1fr;
  gap: 6px;
  padding: 6px 0;
  border-top: 1px solid #f1ece0;
  font-size: 0.86em;
}
.timeline .when {
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}

/* report windows */
.mreport .win {
  width: min(760px, 96vw);
}
.yearbig {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.yearbig div {
  background: #f6f2e8;
  border-radius: 12px;
  padding: 8px 10px;
  text-align: center;
}
.yearbig b {
  display: block;
  font-size: 1.4em;
  font-variant-numeric: tabular-nums;
  color: var(--indigo);
}
.yearbig small {
  color: var(--dim);
}
.epi {
  list-style: none;
  padding: 0;
  margin: 0;
}
.epi li {
  padding: 6px 0 6px 14px;
  border-left: 3px solid var(--line);
  margin-left: 6px;
  position: relative;
  font-size: 0.9em;
}
.epi li::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 11px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--indigo2);
}

/* programmes (budget priorities) */
.progs {
  display: grid;
  gap: 8px;
}
.prog {
  display: grid;
  grid-template-columns: 2em minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
}
.prog .ic {
  font-size: 1.4em;
}
.prog small {
  display: block;
  color: var(--dim);
  font-size: 0.78em;
}
.lv {
  display: flex;
  gap: 3px;
}
.lv button {
  font: inherit;
  width: 34px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #f6f2e8;
  cursor: pointer;
  font-weight: 700;
  color: var(--dim);
}
.lv button.on {
  background: var(--indigo);
  color: #fff;
  border-color: var(--indigo);
}
.money-big {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.money-big div {
  background: #f6f2e8;
  border-radius: 12px;
  padding: 8px 10px;
}
.money-big b {
  display: block;
  font-size: 1.25em;
  font-variant-numeric: tabular-nums;
}
.money-big small {
  color: var(--dim);
  font-size: 0.78em;
}
.money-big .neg b {
  color: var(--bad);
}
.plist {
  list-style: none;
  padding: 0;
  margin: 0;
}
.plist li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 6px 0;
  border-top: 1px solid #f1ece0;
  font-size: 0.86em;
}
.plist small {
  color: var(--dim);
}

@media (max-width: 900px) {
  .grid2 {
    grid-template-columns: minmax(0, 1fr);
  }
  .tb-kpis {
    grid-template-columns: 1.5fr repeat(2, minmax(0, 1fr));
  }
  .tb-kpis .kpi.opt {
    display: none;
  }
}
@media (max-width: 560px) {
  .topbar {
    flex-wrap: wrap;
    padding: 8px 12px;
  }
  .tb-date {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
  }
  .tb-kpis {
    order: 3;
    flex-basis: 100%;
  }
  .tabs {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 5;
    justify-content: space-around;
    padding: 0 0 env(safe-area-inset-bottom);
    background: #fffdf8;
    border-top: 1px solid var(--line);
  }
  .tabs button {
    flex-direction: column;
    gap: 0;
    font-size: 0.68em;
    padding: 6px 4px;
    border-bottom: none;
    border-top: 3px solid transparent;
  }
  .tabs button.on {
    border-top-color: var(--accent);
    background: none;
  }
  .tabs button span {
    display: block;
  }
  .nextbar {
    bottom: 56px;
  }
  #desk-view {
    padding: 12px 12px 170px;
  }
  .report-flow,
  .yearbig,
  .money-big {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .dcards,
  .bottle {
    grid-template-columns: minmax(0, 1fr);
  }
  .cands {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .mrow {
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.8fr) 4.2em;
  }
}

/* ---- the time controls (under the top bar) ---- */
.timebar {
  background: #1a2c47;
  padding: 6px 16px;
  z-index: 3;
}
.tb-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
}
.tb-play {
  font: inherit;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 1.1em;
  cursor: pointer;
  flex: 0 0 auto;
  box-shadow: 0 2px 10px rgba(208, 104, 46, 0.55);
}
.tb-play.on {
  background: #fff;
  color: var(--indigo);
}
.tb-speed {
  display: flex;
  gap: 2px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 2px;
  flex: 0 0 auto;
}
.tb-speed button,
.tb-btn {
  font: inherit;
  font-size: 0.8em;
  border: none;
  background: none;
  color: #c8d3e6;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  white-space: nowrap;
}
.tb-speed button.on {
  background: #fff;
  color: var(--indigo);
}
.tb-btn {
  border: 1px solid rgba(255, 255, 255, 0.25);
}
.tb-btn.on {
  background: #2e8a56;
  border-color: #2e8a56;
  color: #fff;
}
.tb-track {
  flex: 1;
  min-width: 140px;
}
.tb-label {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 0.78em;
  margin-bottom: 3px;
  white-space: nowrap;
}
.tb-label span {
  color: #c8d3e6;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.tb-label small {
  color: #8fa0bc;
}
.tb-label a {
  color: #ffd2a8;
  cursor: pointer;
  text-decoration: underline;
}
.tb-bar {
  position: relative;
  height: 8px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  overflow: hidden;
}
.tb-bar s {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 2px;
  background: #8fb4e0;
  text-decoration: none;
}
.tb-bar i {
  position: absolute;
  inset: 0 auto 0 0;
  background: linear-gradient(90deg, #f0b46a, #e07a3c);
  border-radius: 999px;
}
.tb-bar i.held {
  background: repeating-linear-gradient(45deg, #c98a1a 0 8px, #e0a040 8px 16px);
}
.tb-next {
  font: inherit;
  font-weight: 700;
  border: none;
  background: var(--accent);
  color: #fff;
  border-radius: 10px;
  padding: 8px 16px;
  cursor: pointer;
}

/* ---- the decision of the month ---- */
.decide {
  background: #fff;
  border: 2px solid var(--indigo2);
  border-radius: 16px;
  padding: 12px 14px;
  margin-bottom: 14px;
  box-shadow: 0 8px 24px rgba(35, 57, 91, 0.16);
}
.decide.ev-rare {
  border-color: var(--bad);
}
.decide.ev-uncommon {
  border-color: var(--warn);
}
.decide .dh {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 0.85em;
}
.decide .dh b {
  font-family: "Zen Old Mincho", serif;
  font-size: 1.25em;
  color: var(--indigo);
}
.decide .dq {
  margin-left: auto;
  color: var(--dim);
}
.decide .card-title {
  margin: 6px 0 4px;
}
.decide p {
  margin: 4px 0 8px;
  font-size: 0.92em;
  line-height: 1.65;
}
.eopts {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}
.eopt {
  font: inherit;
  display: grid;
  grid-template-columns: 2em minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  gap: 2px 8px;
  align-items: center;
  text-align: left;
  border: 2px solid var(--line);
  background: #fbf9f4;
  border-radius: 12px;
  padding: 8px 10px;
  cursor: pointer;
  color: inherit;
}
.eopt:hover {
  border-color: var(--indigo2);
  background: #f3f7fd;
}
.eopt .ok {
  grid-row: 1 / 3;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--indigo);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
}
.eopt .oc {
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}
.eopt .resid {
  grid-column: 2 / 4;
}
.dfoot {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  margin-top: 8px;
  flex-wrap: wrap;
}
.btn.auto {
  background: #eef6f0;
  border-color: #a8d8b8;
  color: #1f6a3e;
}
.plans3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}
.plan {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
  background: #fbf9f4;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.plan.wild {
  background: linear-gradient(160deg, #fff6e6, #fdeee8);
  border: 2px dashed #d0682e;
}
.plan h3 {
  margin: 2px 0;
  font-size: 0.95em;
  line-height: 1.4;
}
.plan .sub {
  font-size: 0.8em;
  color: #4a5a6a;
  line-height: 1.5;
  margin: 0;
}
.plan .row1 {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  font-size: 0.72em;
}
.tag.wildtag {
  background: #d0682e;
  color: #fff;
  font-weight: 700;
}
.pmeta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.75em;
  color: var(--dim);
  align-items: center;
  margin-top: auto;
}
.pmeta b {
  color: var(--ink);
}
.lnk {
  font: inherit;
  border: none;
  background: none;
  color: var(--indigo2);
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
  margin-left: auto;
}
.pbtns {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.pbtns .btn {
  margin: 0;
  flex: 1;
  padding: 6px 6px;
}

/* ---- the town scene ---- */
.scene {
  position: relative;
  min-height: 190px;
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 14px;
  background: #cfdde0 center / cover;
  box-shadow: var(--shadow);
  display: flex;
  align-items: flex-end;
}
.scene-cap {
  width: 100%;
  padding: 30px 14px 10px;
  background: linear-gradient(
    180deg,
    rgba(20, 30, 50, 0),
    rgba(20, 30, 50, 0.75)
  );
  color: #fff;
}
.scene-pop {
  font-size: 2.2em;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}
.scene-pop small {
  font-size: 0.45em;
  margin-left: 2px;
}
.scene-pop span {
  font-size: 0.5em;
  margin-left: 10px;
  padding: 1px 8px;
  border-radius: 999px;
  vertical-align: middle;
}
.scene-pop span.up {
  background: #2e8a56;
}
.scene-pop span.down {
  background: #c0442a;
}
.scene-flow {
  font-size: 0.82em;
  opacity: 0.9;
}

/* ---- the record ---- */
.feed {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 520px;
  overflow-y: auto;
}
.feed li {
  display: grid;
  grid-template-columns: 3em 3.6em minmax(0, 1fr);
  gap: 6px;
  padding: 7px 0;
  border-top: 1px solid #f1ece0;
  font-size: 0.86em;
}
.feed .fm {
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}
.feed .fd {
  font-weight: 700;
  text-align: center;
  border-radius: 8px;
  padding: 1px 0;
  height: fit-content;
  font-variant-numeric: tabular-nums;
}
.feed .fd.up {
  background: #e3f3e8;
  color: #1f6a3e;
}
.feed .fd.down {
  background: #fbe6e0;
  color: #9a3420;
}
.feed small {
  display: block;
  color: var(--dim);
  font-size: 0.85em;
}
.feed .fi {
  display: block;
  margin-top: 3px;
  padding-left: 8px;
  border-left: 3px solid var(--line);
  font-size: 0.92em;
}
.feed .fi.event {
  border-left-color: var(--bad);
}
.feed .fi.policy {
  border-left-color: var(--indigo2);
}
.feed .fi.election {
  border-left-color: var(--accent);
  font-weight: 700;
}

/* ---- the town's state ---- */
.sbars {
  display: grid;
  gap: 6px;
}
.sb {
  display: grid;
  grid-template-columns: 6.5em 1fr 2.4em;
  gap: 8px;
  align-items: center;
  font-size: 0.88em;
}
.sb i {
  height: 10px;
  background: #eee8da;
  border-radius: 999px;
  overflow: hidden;
  display: block;
}
.sb i b {
  display: block;
  height: 100%;
  border-radius: 999px;
  transition: width 0.6s;
}
.sb em {
  font-style: normal;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

@media (max-width: 900px) {
  .plans3 {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 560px) {
  .timebar {
    padding: 6px 8px;
  }
  .tb-inner {
    flex-wrap: wrap;
    gap: 6px;
  }
  .tb-play {
    width: 36px;
    height: 36px;
  }
  .tb-track {
    order: 9;
    flex-basis: 100%;
  }
  .tb-speed button,
  .tb-btn {
    padding: 5px 6px;
    font-size: 0.75em;
  }
  .scene {
    min-height: 150px;
  }
  #desk-view {
    padding-bottom: 90px;
  }
}
