:root {
  --cream: #fffaf1;
  --cream-dark: #f1e9d9;
  --forest: #243f46;
  --forest-mid: #326773;
  --forest-light: #54969a;
  --orange: #d96b2b;
  --text: #1f2a24;
  --text-muted: #5a6b60;
  --panel-bg: rgba(255, 252, 245, 0.93);
  --shadow: 0 10px 32px rgba(28, 63, 74, 0.16), 0 1px 3px rgba(28, 63, 74, 0.10);
  --radius: 16px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
  --header-h: 6rem;
  --dock-h: 3.35rem;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100dvh;
  overflow: clip;
  font-family: var(--font);
  color: var(--text);
  background: var(--forest);
}

#app-root {
  position: relative;
  width: 100%;
  height: 100dvh;
  overflow: clip;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-columns: minmax(0, 1fr);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.hidden {
  display: none !important;
}

.site-header {
  position: relative;
  grid-row: 1;
  grid-column: 1;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.45rem 1rem 0.5rem;
  pointer-events: none;
  background: rgba(255, 252, 246, 0.96);
  border-bottom: 1px solid rgba(35, 66, 70, 0.14);
  box-shadow: 0 4px 18px rgba(25, 51, 61, 0.07);
}

.header-titles {
  pointer-events: auto;
  flex: 1;
  min-width: 0;
}

.header-actions {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  align-self: flex-start;
  gap: 0.5rem;
  flex-shrink: 0;
}

.sound-toggle {
  min-width: 44px;
  min-height: 36px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  box-shadow: var(--shadow);
}

.sound-toggle svg {
  display: block;
  width: 20px;
  height: 20px;
}

.sound-toggle[aria-pressed="true"] {
  color: var(--cream);
  background: var(--forest-mid);
}

.sound-toggle[aria-pressed="true"]:hover {
  background: var(--forest);
}

@media (max-width: 600px) {
  .header-actions { max-width: 116px; }
  .sound-toggle { min-width: 44px; font-size: 0.72rem; }
}

.main-title {
  margin: 0;
  font-size: clamp(1.15rem, 2.2vw, 1.75rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.08;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.5);
  color: var(--forest);
}

.header-status {
  margin: 0.35rem 0 0;
  font-size: 0.74rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--forest-mid);
  letter-spacing: 0.01em;
  overflow-wrap: anywhere;
}

.subtitle {
  margin: 0.1rem 0 0;
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

.progress-meta {
  margin: .25rem 0 0;
  font-size: .72rem;
  color: var(--text-muted);
}

#project-progress {
  font-size: .85rem;
  font-weight: 600;
  line-height: 1.3;
}

#project-progress.progress-dash {
  display: flex;
  flex: 0 1 490px;
  min-width: 340px;
  max-width: 490px;
  flex-direction: column;
  align-items: stretch;
  gap: .14rem;
  padding: .32rem .45rem .28rem;
}
.progress-compact-label { color: #9fb3bd; font-size: .62rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.progress-compact-gauges { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .2rem; }
.progress-compact-gauges .gauge { display: grid; grid-template-columns: 40px minmax(0, 1fr); grid-template-rows: auto auto; align-items: center; justify-items: start; column-gap: .35rem; text-align: left; }
.progress-compact-gauges .gauge svg { grid-row: 1 / span 2; width: 40px; height: 40px; filter: none; }
.progress-compact-gauges .gauge figcaption { align-items: flex-start; gap: 0; min-width: 0; }
.progress-compact-gauges .gauge-label { font-size: .6rem; }
.progress-compact-gauges .gauge-detail { display: none; }
.progress-compact-gauges .gauge-eta { font-size: .56rem; white-space: nowrap; }
.progress-compact-gauges .gauge-eta .digital { font-size: .78rem; }
.progress-compact-hint { color: #7f97a3; font-size: .55rem; text-align: right; }

.header-dash {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-start;
  gap: .45rem;
  margin-top: .25rem;
}

.progress-dash,
.usage-board {
  margin: 0;
  padding: .4rem .6rem;
  color: #dbe7ef;
  letter-spacing: 0;
  background: linear-gradient(160deg, #142229 0%, #0d171c 100%);
  border: 1px solid rgba(120, 190, 210, .22);
  border-radius: 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05), 0 6px 18px rgba(18, 38, 46, .25);
}

#project-progress[role="button"] {
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
#project-progress[role="button"] .progress-dialog-official { pointer-events: auto; }
#project-progress[role="button"] * { pointer-events: none; }
#project-progress[role="button"]:hover,
#project-progress[role="button"]:focus-visible { border-color: rgba(124, 242, 154, .58); outline: none; }
.progress-dialog-panel { width: min(780px, calc(100vw - 1.5rem)); max-height: min(88vh, 780px); }
.progress-dialog-panel .usage-dialog-head { position: sticky; top: 0; z-index: 2; background: #101f26; }
.progress-dialog-actions { display: flex; align-items: center; gap: .45rem; }
.progress-dialog-production { border: 1px solid rgba(124,242,154,.4); border-radius: 999px; background: transparent; color: #cde4db; cursor: pointer; padding: .35rem .65rem; }
.progress-dialog-metrics { padding: .2rem 1rem; }
.progress-dialog-gauges { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; }
.progress-dialog-digits { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; margin-top: .65rem; }
@media (max-width: 540px) {
  .progress-dialog-gauges, .progress-dialog-digits { grid-template-columns: 1fr; }
}
.progress-dialog-metrics .city-progress-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .55rem; }
.progress-dialog-metrics .city-progress-row { display: flex; flex-wrap: wrap; justify-content: space-between; padding: .65rem; border: 1px solid rgba(120,190,210,.18); border-radius: 10px; background: rgba(20,34,41,.65); font-size: .8rem; }
.progress-dialog-metrics .city-progress-row small { flex-basis: 100%; font-size: .68rem; }
.progress-dialog-official { padding: .6rem 1rem .2rem; }
#project-progress[role="button"]:focus-visible { box-shadow: 0 0 0 2px rgba(124, 242, 154, .35), 0 6px 18px rgba(18, 38, 46, .25); }
.city-progress-list { display: flex; flex-wrap: wrap; gap: .3rem .65rem; margin-top: .25rem; }
.city-progress-row { display: inline-flex; align-items: baseline; gap: .3rem; white-space: nowrap; font-size: .72rem; }
.city-progress-row small { color: var(--text-muted); font-size: .62rem; }
.city-progress-row[data-city="life1000"] b { color: #69c6c2; }
.city-progress-row[data-city="firma1000"] b { color: #d59ad7; }

.digital {
  font-family: "Cascadia Mono", "Consolas", "Courier New", ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: #e9fbff;
  text-shadow: 0 0 6px rgba(120, 230, 255, .55);
  letter-spacing: .02em;
}

.gauges {
  display: grid;
  grid-template-columns: repeat(3, max-content);
  justify-content: center;
  gap: .25rem .45rem;
}

.gauge {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .15rem;
  text-align: center;
}

.gauge svg {
  width: calc(74px * 1.125);
  height: calc(74px * 1.125);
  flex: none;
  filter: drop-shadow(0 0 5px var(--g));
}

.gauge-track { fill: none; stroke: rgba(255, 255, 255, .08); stroke-width: 7; }
.gauge-arc { fill: none; stroke: var(--g); stroke-width: 7; stroke-linecap: round; }
.gauge .tick { stroke: rgba(255, 255, 255, .14); stroke-width: 1.4; }
.gauge .tick.on { stroke: var(--g); }

.gauge-num {
  font-family: "Cascadia Mono", "Consolas", ui-monospace, monospace;
  font-weight: 700;
  fill: #f3fdff;
  text-anchor: middle;
}

.gauge-pct {
  font-family: "Segoe UI", system-ui, sans-serif;
  font-weight: 600;
  fill: var(--g);
  text-anchor: middle;
}

.gauge figcaption {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .08rem;
  min-width: 0;
}

.gauge-label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--g);
}

.gauge-detail {
  font-size: .68rem;
  color: #9fb3bd;
  white-space: nowrap;
}

.gauge-eta {
  font-size: .68rem;
  color: #9fb3bd;
}

.gauge-eta .digital { font-size: .95rem; }

.digit-stack {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .2rem .4rem;
  padding-top: .25rem;
  border-top: 1px solid rgba(255, 255, 255, .08);
}

.digit-tile {
  display: grid;
  grid-template-columns: auto auto;
  justify-content: start;
  align-items: baseline;
  column-gap: .4rem;
  min-width: 0;
}

.digit-label {
  grid-column: 1 / -1;
  font-size: .62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #7f97a3;
}

.digit-tile .digital { font-size: 1.05rem; }

.digit-unit {
  font-size: .72rem;
  color: #9fb3bd;
}

.usage-board {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: .3rem;
  min-width: 0;
  max-width: none;
  flex: 1 1 auto;
}

.usage-stats {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: .15rem 1rem;
  padding-right: 0;
  border-right: 0;
}

/* Dono 24/11: o painel de consumo ocupava metade do cabeçalho. Compacto = título + números; o resto abre no clique. */
.usage-board--compacto { cursor: pointer; flex: 0 1 auto; }
.usage-board--compacto .usage-body,
.usage-board--compacto .usage-machines,
.usage-board--compacto .usage-note,
.usage-board--compacto .usage-costline { display: none; }
.usage-board--compacto:hover,
.usage-board--compacto:focus-visible { border-color: #7cf29a; outline: none; }
.usage-board--compacto .usage-board-title::after {
  content: " — clique para ver os gráficos";
  font-weight: 400;
  color: #7f97a3;
}

.usage-board-title {
  margin: 0;
  font: 600 .72rem "Segoe UI", system-ui, sans-serif;
  letter-spacing: .02em;
  color: #cfe0e8;
}

.usage-machines {
  margin: .2rem 0 0;
  min-width: 0;
}

.usage-machines-svg {
  display: block;
  width: 100%;
  height: 70px;
}

.usage-machines-legend {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem .8rem;
  font: 9px "Segoe UI", system-ui, sans-serif;
  color: #9fb3bd;
}

.usage-machines-legend i {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: .3rem;
  border-radius: 2px;
}

.usage-stats .digit-label { font-size: .62rem; }
.usage-stats .digit-tile .digital { font-size: .95rem; }
.usage-stats .digit-unit { font-size: .68rem; }

.usage-body {
  display: flex;
  align-items: center;
  gap: .5rem;
  min-width: 0;
}

.usage-chart {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  height: calc(104px * 1.125);
  display: block;
}

.usage-chart-hit,
.usage-donut-hit {
  cursor: pointer;
  outline: none;
}

.usage-chart-hit:focus-visible,
.usage-donut-hit:focus-visible {
  outline: 2px solid #7cf29a;
  outline-offset: 2px;
}

.usage-chart .usage-chart-grid,
.usage-chart .grid { stroke: rgba(255, 255, 255, .09); stroke-width: 1; }
.usage-chart .usage-chart-axis,
.usage-chart .axis { font: 8px "Segoe UI", system-ui, sans-serif; fill: #9fb3bd; }

.usage-chart-path { filter: drop-shadow(0 0 4px rgba(79, 141, 255, .25)); }
.usage-chart-dot { stroke: rgba(13, 23, 28, .65); stroke-width: .6; }

.usage-chart--large { height: clamp(220px, 34vh, 420px); min-height: 180px; }
.usage-dialog-panel .usage-chart-axis { font-size: 8px; }

.production-chart-legend { display: flex; align-items: center; flex-wrap: wrap; gap: .35rem 1rem; margin: 0 0 .4rem; color: #c4d3da; font-size: .78rem; }
.production-chart-legend > span { display: inline-flex; align-items: center; gap: .4rem; white-space: nowrap; }
.production-chart-legend i { display: inline-block; width: 10px; height: 10px; flex: none; border-radius: 50%; }

@media (max-width: 600px) {
  .usage-chart--large { height: 190px; }
}

.usage-share {
  display: flex;
  align-items: center;
  gap: .35rem;
  flex: none;
}

.usage-donut { width: calc(64px * 1.125); height: calc(64px * 1.125); flex: none; }
.usage-donut--large { width: 120px; height: 120px; }
.usage-donut-num,
.donut-num { font: 700 calc(11px * 1.15) "Cascadia Mono", "Consolas", ui-monospace, monospace; fill: #f3fdff; text-anchor: middle; }
.usage-donut-sub,
.donut-sub { font: calc(7px * 1.15) "Segoe UI", system-ui, sans-serif; fill: #7f97a3; text-anchor: middle; }

.usage-expand-btn {
  display: none;
  margin-top: .35rem;
  padding: .38rem .65rem;
  font-size: .72rem;
  font-weight: 700;
  color: #e9fbff;
  background: linear-gradient(160deg, #1a3340 0%, #0f1c22 100%);
  border: 1px solid rgba(120, 190, 210, .35);
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(18, 38, 46, .35);
}

.usage-expand-btn:hover,
.usage-expand-btn:focus-visible {
  border-color: #7cf29a;
  outline: none;
}

body.usage-dialog-open { overflow: hidden; }
.usage-day-missing td { color: #ffb547; font-style: italic; text-align: center; }

.usage-dialog-shell {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: clamp(.5rem, 2vw, 1.25rem);
}

.usage-dialog-shell.hidden { display: none !important; }

.usage-dialog-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 16, 20, .72);
  backdrop-filter: blur(4px);
}

.usage-dialog-panel {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  max-height: 100%;
  min-width: 0;
  margin: 0;
  overflow: auto;
  padding: 1rem 1.1rem 1.25rem;
  color: #dbe7ef;
  background: linear-gradient(165deg, #142229 0%, #0a1216 100%);
  border: 1px solid rgba(120, 190, 210, .28);
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, .45);
}

.usage-dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .75rem;
}

.usage-dialog-title {
  margin: 0;
  font-size: 1.15rem;
  color: #f3fdff;
}

.usage-dialog-snapshot {
  margin: .25rem 0 0;
  font-size: .78rem;
  color: #9fb3bd;
}

.usage-dialog-close {
  flex: none;
  padding: .4rem .85rem;
  font-size: .8rem;
  font-weight: 700;
  color: #0f1c22;
  background: #7cf29a;
  border: none;
  border-radius: 999px;
  cursor: pointer;
}

.usage-dialog-close:hover,
.usage-dialog-close:focus-visible {
  background: #a8ffc0;
  outline: 2px solid #f3fdff;
  outline-offset: 2px;
}

.usage-dialog-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1.25rem;
  margin-bottom: .85rem;
  padding-bottom: .65rem;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.usage-dialog-charts {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 1rem;
  margin-bottom: .85rem;
}

.usage-dialog-legend ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: .35rem .5rem;
}

.usage-legend-toggle {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .28rem .45rem;
  font-size: .72rem;
  color: #c4d3da;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 8px;
  cursor: pointer;
}

.usage-legend-toggle.is-on { border-color: rgba(124, 242, 154, .55); }
.usage-legend-toggle:not(.is-on) { opacity: .55; }
.usage-legend-toggle i { width: 8px; height: 8px; border-radius: 2px; }
.usage-legend-cost { color: #ffd27a; }

.usage-dialog-table-wrap {
  overflow: auto;
  max-height: min(42vh, 320px);
  margin-bottom: .75rem;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 10px;
}

.usage-daily-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .72rem;
}

.usage-daily-table th,
.usage-daily-table td {
  padding: .35rem .45rem;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
  vertical-align: top;
}

.usage-daily-table thead th {
  position: sticky;
  top: 0;
  background: #1a2d36;
  font-weight: 700;
  color: #9fb3bd;
}

.usage-td-tokens { display: block; color: #e9fbff; font-family: "Cascadia Mono", "Consolas", ui-monospace, monospace; }
.usage-td-cost { display: block; font-size: .65rem; color: #ffd27a; }
.usage-td-muted { color: #6a7f8a; }

.usage-dialog-note {
  margin: 0;
  font-size: .68rem;
  line-height: 1.4;
  color: #7f97a3;
}

.usage-legend-wrap { min-width: 0; }
.usage-legend-key {
  margin: 0 0 .15rem;
  font-size: calc(.58rem * 1.15);
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #7f97a3;
}

.usage-legend {
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: calc(.68rem * 1.15);
  line-height: 1.25;
  color: #c4d3da;
}

.usage-legend li { display: flex; align-items: center; gap: .28rem; }
.usage-legend i { width: 7px; height: 7px; border-radius: 2px; flex: none; }
.usage-legend span { flex: 1; white-space: nowrap; }
.usage-legend b { font-family: "Cascadia Mono", "Consolas", ui-monospace, monospace; font-weight: 600; color: #e9fbff; }
.usage-legend b.cost-pct { color: #ffd27a; }

.usage-costline {
  margin: 0;
  font-size: .68rem;
  line-height: 1.35;
  color: #d5e4ea;
}

.usage-note {
  margin: 0;
  font-size: .68rem;
  line-height: 1.35;
  color: #7f97a3;
}

@media (min-width: 1501px) {
  .usage-costline { display: none; }
}

@media (max-width: 1500px) {
  .usage-share { display: none; }
}

@media (max-width: 1250px) {
  .usage-stats { gap: .1rem .7rem; }
  .usage-stats .digit-tile.is-optional { display: none; }
}

@media (max-width: 760px) {
  .header-status { font-size: .68rem; }
  .progress-meta { font-size: .68rem; }
  .header-dash { margin-top: .35rem; gap: .4rem; }
  .progress-dash { padding: .45rem .4rem; }
  #project-progress.progress-dash { padding: .35rem .4rem; }
  .progress-compact-gauges { gap: .1rem; }
  .city-progress-list { gap: .2rem .35rem; }
  .city-progress-row { font-size: .64rem; }
  .city-progress-row small { font-size: .56rem; }
  .gauges { display: grid; grid-template-columns: repeat(3, 1fr); gap: .2rem .15rem; }
  .gauge { flex-direction: column; gap: 0; text-align: center; }
  .gauge svg { width: 72px; height: 72px; }
  .gauge figcaption { min-width: 0; align-items: center; }
  .gauge-label { font-size: .72rem; }
  .gauge-detail { font-size: .64rem; white-space: normal; }
  .gauge-eta { font-size: .64rem; }
  .gauge-eta .digital { font-size: 1.15rem; }
  .digit-stack { grid-column: 1 / -1; display: flex; flex-wrap: wrap; justify-content: space-between; padding: .35rem 0 0; border-top: 1px solid rgba(255, 255, 255, .08); gap: .4rem; }
  .digit-label { font-size: .62rem; }
  .digit-tile .digital { font-size: 1.05rem; }
  .usage-board { display: none; }
  .usage-expand-btn { display: inline-flex; align-items: center; width: 100%; justify-content: center; }
  .header-dash { flex-wrap: wrap; }
  #project-progress.progress-dash { flex-basis: 100%; min-width: 0; max-width: none; }
  .progress-dialog-metrics .city-progress-list { grid-template-columns: 1fr; }
  .progress-compact-gauges .gauge { grid-template-columns: 36px minmax(0, 1fr); }
  .progress-compact-gauges .gauge svg { width: 36px; height: 36px; }
  .usage-dialog-charts { grid-template-columns: 1fr; }
}

.preview-badge {
  pointer-events: auto;
  padding: 0.3rem 0.65rem;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cream);
  background: var(--orange);
  border-radius: 999px;
  box-shadow: var(--shadow);
}

.webgl-message,
.data-missing {
  position: relative;
  z-index: 50;
  margin: 1rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  background: #fff8f0;
  border: 2px solid var(--orange);
}

.layout {
  position: relative;
  grid-row: 2;
  grid-column: 1;
  min-width: 0;
  min-height: 0;
  z-index: 1;
}

.canvas-wrap {
  position: absolute;
  inset: 0;
}

#city-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.canvas-hint {
  position: absolute;
  bottom: 0.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 12;
  padding: 0.35rem 0.85rem;
  font-size: 0.68rem;
  color: var(--cream);
  background: rgba(26, 52, 40, 0.72);
  border-radius: 999px;
  pointer-events: none;
  white-space: nowrap;
  max-width: calc(100% - 12rem);
  overflow: hidden;
  text-overflow: ellipsis;
}

.map-cam-pad {
  position: absolute;
  right: 0.75rem;
  bottom: 2.4rem;
  z-index: 14;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.28rem;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.map-cam-pad-row {
  display: flex;
  align-items: center;
  gap: 0.28rem;
}

.map-cam-pad .btn {
  min-width: 4.1rem;
  flex: 0 0 auto;
  background: rgba(255, 252, 245, 0.94);
  box-shadow: var(--shadow);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.map-cam-pad .btn-icon {
  min-width: 2.2rem;
}

body.walking .map-cam-pad {
  display: none;
}

.panel {
  position: absolute;
  z-index: 20;
  background: var(--panel-bg);
  border: 1px solid rgba(45, 90, 66, 0.28);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - var(--header-h) - var(--dock-h) - 1.5rem);
  overflow: hidden;
  pointer-events: auto;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.panel-right {
  top: 0.65rem;
  right: 0.5rem;
  width: 156px;
}

.panel.collapsed {
  transform: translateX(calc(-100% - 1rem));
  opacity: 0;
  pointer-events: none;
}

.panel-right.collapsed {
  transform: translateX(calc(100% + 1rem));
}

.panel-toggle {
  width: 100%;
  padding: 0.45rem 0.65rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-align: left;
  border: none;
  background: var(--forest-mid);
  color: var(--cream);
  cursor: pointer;
  flex-shrink: 0;
}

.panel-body {
  padding: 0.55rem;
  overflow-y: auto;
  flex: 1;
}

.panel-edge-toggle {
  position: absolute;
  z-index: 22;
  top: 0.65rem;
  padding: 0.6rem 0.45rem;
  font-size: 0.65rem;
  font-weight: 700;
  writing-mode: vertical-rl;
  border: 1px solid rgba(45, 90, 66, 0.35);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--panel-bg);
  color: var(--forest);
  cursor: pointer;
  box-shadow: var(--shadow);
}

#reopen-controls {
  right: 0;
  border-radius: var(--radius) 0 0 var(--radius);
  writing-mode: vertical-lr;
}

.control-group {
  display: flex;
  gap: 0.3rem;
  margin-bottom: 0.35rem;
}

.btn {
  flex: 1;
  padding: 0.4rem 0.35rem;
  font-size: 0.72rem;
  font-weight: 600;
  border: 1px solid rgba(45, 90, 66, 0.35);
  border-radius: 8px;
  background: #fff;
  color: var(--forest);
  cursor: pointer;
}

.btn:hover {
  background: var(--cream-dark);
}

.btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.btn-primary {
  width: 100%;
  margin-bottom: 0.35rem;
  background: var(--forest-mid);
  color: var(--cream);
  border-color: var(--forest);
}

.btn-primary:hover,
.btn-primary:focus-visible {
  background: var(--forest);
  color: #fff;
}

.btn-icon {
  flex: 0 0 auto;
  min-width: 2rem;
  padding: 0.4rem;
}

.mode-label {
  font-weight: 700;
  color: var(--orange);
  margin: 0 0 0.45rem;
  font-size: 0.78rem;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0.35rem 0;
  font-size: 0.75rem;
  cursor: pointer;
}

.day-phase {
  display: flex;
  gap: 0.28rem;
}

.day-phase .btn {
  flex: 1 1 0;
  min-width: 0;
}

.day-phase .btn[aria-pressed="true"] {
  background: var(--forest-mid);
  color: var(--cream);
  border-color: var(--forest);
}

.info-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  margin-top: 0.25rem;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 50%;
  border: 1px solid rgba(45, 90, 66, 0.35);
  background: #fff;
  color: var(--forest);
  cursor: help;
}

.detail-panel {
  position: fixed;
  top: calc(var(--header-h) + 0.5rem);
  right: 11rem;
  width: min(320px, calc(100vw - 2rem));
  max-height: calc(100dvh - var(--dock-h) - var(--header-h) - 2rem);
  overflow-y: auto;
  padding: 0.85rem 1rem;
  background: var(--panel-bg);
  border: 2px solid var(--forest-mid);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 35;
  pointer-events: auto;
}

.detail-close {
  position: absolute;
  top: 0.25rem;
  right: 0.4rem;
  border: none;
  background: transparent;
  font-size: 1.35rem;
  cursor: pointer;
  color: var(--forest);
}

.detail-panel h2 {
  margin: 0 1.5rem 0.4rem 0;
  font-size: 1rem;
  color: var(--forest);
}

.detail-panel dl {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.3rem 0.6rem;
  font-size: 0.8rem;
}

.detail-panel dt {
  font-weight: 600;
  color: var(--text-muted);
}

.detail-panel dd {
  margin: 0;
  word-break: break-word;
}

.detail-note {
  margin-top: 0.6rem;
  padding: 0.45rem;
  font-size: 0.72rem;
  background: #fff8f0;
  border-left: 3px solid var(--orange);
  border-radius: 4px;
}

.dock-legend {
  position: relative;
  grid-row: 3;
  grid-column: 1;
  z-index: 28;
  padding: 0.35rem 1rem 0.4rem;
  background: linear-gradient(0deg, rgba(244, 239, 228, 0.97) 0%, rgba(244, 239, 228, 0.88) 100%);
  border-top: 2px solid var(--cream-dark);
  pointer-events: auto;
}

.legend-items {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  margin-bottom: 0.15rem;
}

.legend-items span {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.72rem;
}

.legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, 0.12);
}

.footer-meta {
  margin: 0;
  font-size: 0.66rem;
  color: var(--text-muted);
  display: inline;
}

.footer-disclaimer {
  display: none;
}

.footer-disclaimer.hidden {
  display: none;
}

.dock-line2 {
  font-size: 0.68rem;
  color: var(--text);
  margin: 0;
  line-height: 1.35;
}

.preview-stats {
  font-size: 0.68rem;
  margin: 0;
  color: var(--text);
  display: inline;
}

.preview-stats strong {
  color: var(--forest);
}

@media (max-width: 900px) {
  .panel-right {
    max-height: 42dvh;
  }

  .panel-right.collapsed {
    transform: translateY(calc(100% + 2rem));
    opacity: 0;
  }

  .detail-panel {
    right: 0.5rem;
    left: 0.5rem;
    width: auto;
  }
}

.btn-walk {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  width: 100%;
  margin-bottom: 0.4rem;
  padding: 0.38rem 0.45rem;
  font-size: 0.68rem;
  font-weight: 700;
  background: linear-gradient(135deg, #fff8f0 0%, #ffe8d4 100%);
  border-color: var(--orange);
  color: var(--forest);
}

.walk-dock-btn {
  position: absolute;
  z-index: 25;
  left: 0.75rem;
  bottom: 0.8rem;
  width: 212px;
  min-height: 46px;
  padding: 0.5rem 0.7rem;
  box-shadow: var(--shadow);
  font-size: 0.78rem;
}

body.walking .canvas-hint {
  display: none;
}

@media (max-width: 600px) {
  .walk-dock-btn {
    width: 168px;
    font-size: 0.72rem;
    left: 0.5rem;
  }
  .walk-hud {
    max-width: calc(100% - 4rem);
  }
}

.btn-walk:hover,
.btn-walk:focus-visible {
  background: #fff3e6;
  border-color: var(--forest-mid);
}

.btn-walk-avatar {
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: contain;
}

.walk-hud {
  position: absolute;
  top: 0.65rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 14;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: max-content;
  max-width: min(560px, calc(100% - 2rem));
  padding: 0.6rem 0.9rem;
  background: linear-gradient(135deg, rgba(9, 24, 39, 0.92), rgba(16, 48, 62, 0.88));
  border-radius: 18px;
  border: 1px solid rgba(103, 235, 240, 0.3);
  box-shadow: 0 8px 32px rgba(0, 12, 25, 0.24);
  backdrop-filter: blur(12px);
  pointer-events: none;
}

.walk-hud-avatar {
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: contain;
}

.walk-hud-text {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  min-width: 0;
}

.walk-hud-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--cream);
}

.walk-hud-hint {
  font-size: 0.65rem;
  color: rgba(226, 244, 250, 0.86);
  line-height: 1.5;
}

.walk-flight-status {
  font-size: 0.68rem;
  color: #63eee8;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

body.usage-dialog-open .walk-pad,
body.usage-dialog-open .walk-hud {
  visibility: hidden;
}

@media (max-width: 600px) {
  .walk-hud { top: 3.4rem; padding: 0.5rem 0.65rem; }
  .walk-hud-hint { font-size: 0.6rem; }
  .walk-pad { bottom: 3.6rem; }
}

.aim-hint {
  position: absolute;
  left: 50%;
  top: calc(50% + 1.35rem);
  transform: translateX(-50%);
  z-index: 14;
  margin: 0;
  padding: 0.2rem 0.55rem;
  font-size: 0.68rem;
  color: rgba(244, 239, 228, 0.92);
  background: rgba(26, 52, 40, 0.55);
  border-radius: 6px;
  pointer-events: none;
  max-width: min(92vw, 22rem);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.walking .aim-hint {
  bottom: 0.6rem;
  top: auto;
}

.walk-crosshair {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  z-index: 13;
  border: 1px solid rgba(244, 239, 228, 0.55);
  border-radius: 50%;
  pointer-events: none;
  box-shadow: 0 0 0 1px rgba(26, 52, 40, 0.35);
}

@media (max-width: 600px) {
  :root {
    --header-h: 5.75rem;
    --dock-h: 7rem;
  }

  .canvas-hint {
    bottom: 6.4rem;
    font-size: 0.62rem;
    white-space: normal;
    text-align: center;
    width: min(90%, 23rem);
    max-width: calc(100% - 1.5rem);
  }

  .map-cam-pad {
    right: 0.5rem;
    bottom: 0.7rem;
  }

  .map-cam-pad .btn {
    min-width: 3.6rem;
    font-size: 0.66rem;
    padding: 0.32rem 0.28rem;
  }
}

.chrome-toggle {
  position: absolute;
  grid-row: 1 / -1;
  grid-column: 1;
  top: calc(var(--header-h) + 0.45rem);
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  min-height: 2rem;
  padding: 0.28rem 0.7rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--cream);
  background: var(--forest-mid);
  border: 1px solid rgba(255, 252, 245, 0.35);
  border-radius: 999px;
  box-shadow: var(--shadow);
  pointer-events: auto;
  cursor: pointer;
}

body.walking .chrome-toggle {
  top: auto;
  bottom: 0.85rem;
  left: auto;
  right: 0.55rem;
  transform: none;
}

html.chrome-start-collapsed,
html.chrome-collapsed {
  --header-h: 0px;
  --dock-h: 0px;
}

html.chrome-start-collapsed .site-header,
html.chrome-start-collapsed .dock-legend,
html.chrome-collapsed .site-header,
html.chrome-collapsed .dock-legend {
  display: none;
}

.walk-pad {
  position: absolute;
  left: 0.45rem;
  bottom: 4.7rem;
  z-index: 16;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.28rem;
  pointer-events: auto;
  touch-action: none;
}

.walk-pad-row {
  display: flex;
  align-items: center;
  gap: 0.28rem;
}

.walk-pad-btn {
  min-width: 2.85rem;
  min-height: 2.85rem;
  padding: 0.2rem;
  font-size: 1rem;
  line-height: 1;
  background: rgba(255, 252, 245, 0.94);
  box-shadow: var(--shadow);
  touch-action: none;
  user-select: none;
}

body:not(.walking) .walk-pad {
  display: none;
}
