:root {
  font-family:
    Arial, "PingFang HK", "Noto Sans CJK TC", "Microsoft JhengHei", sans-serif;
  color: #17313b;
  background: #f3f1e8;
  font-synthesis: none;
  --ink: #17313b;
  --muted: #6c7774;
  --gold: #f4bf52;
  --line: #d7d9ce;
  --sea: #123d49;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
a {
  -webkit-tap-highlight-color: transparent;
}
button {
  font: inherit;
  cursor: pointer;
}
button:disabled {
  cursor: default;
  opacity: 0.45;
}
button:focus-visible,
a:focus-visible,
canvas:focus-visible {
  outline: 3px solid #ed9b23;
  outline-offset: 4px;
}
button {
  color: inherit;
}
a {
  color: inherit;
  text-decoration: none;
}
.mono,
.eyebrow,
.section-label span {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}
.brand {
  display: flex;
  gap: 13px;
  align-items: center;
  font-size: 29px;
  font-weight: 900;
  letter-spacing: -1.5px;
  line-height: 1.1;
}
.brand-logo {
  width: 64px;
  height: 64px;
  margin: -8px -4px -8px -8px;
  display: block;
}
.brand-question {
  color: #bb7d20;
}
.brand small {
  display: block;
  font:
    9px/1.9 Consolas,
    monospace;
  letter-spacing: 1.7px;
}
canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}
canvas:active {
  cursor: grabbing;
}
.map-corner {
  position: absolute;
  left: 20px;
  top: 18px;
  pointer-events: none;
  color: #abc3b5;
  font-size: 9px;
  line-height: 1.8;
  letter-spacing: 1px;
}
.map-corner span {
  color: #6d958f;
  font-size: 8px;
}
.field-status {
  position: absolute;
  left: 20px;
  bottom: 48px;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 9px;
  background: #112e37df;
  padding: 10px 12px;
  border: 1px solid #eec26745;
  border-radius: 4px;
  color: #e1c37f;
  font-size: 10px;
}
.field-status b {
  display: block;
  font-size: 11px;
  font-weight: 500;
  margin-top: 2px;
  color: #f0e8c8;
}
.field-boss {
  width: 47px;
  height: 55px;
  flex-shrink: 0;
}
.canvas-hint {
  position: absolute;
  bottom: 13px;
  left: 20px;
  right: 15px;
  pointer-events: none;
  color: #9ab6ad;
  font-size: 10px;
  letter-spacing: 0.4px;
}
.canvas-hint > span:first-child {
  color: #f2d17a;
  margin-right: 6px;
  font-size: 15px;
}
.boost-button {
  position: absolute;
  right: 18px;
  bottom: 45px;
  width: 78px;
  height: 78px;
  border: 1px solid #eec87f;
  border-radius: 50%;
  color: #f5d080;
  background: #183b45eb;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  box-shadow: 0 0 0 5px #eec87f0b;
  touch-action: none;
}
.boost-button > span {
  font: 23px/1 Arial;
}
.boost-button b {
  font-size: 11px;
  letter-spacing: 1px;
}
.boost-button small {
  font-size: 7px;
  letter-spacing: 0.4px;
}
.boost-button:not(:disabled):hover {
  background: #ecc36d;
  color: #14323b;
}
.boost-button:disabled {
  opacity: 0.7;
}
.legend-storm {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  border: 1.5px dashed #d2f4ff;
  border-radius: 50%;
}
.legend-field {
  width: 9px;
  height: 9px;
  border: 1px dashed #e7bb60;
  border-radius: 50%;
}
.map-scale {
  margin-left: auto;
  font-size: 8px;
}
.intro-card,
.pause-card,
.result-card {
  pointer-events: auto;
  background: #f7f4e9;
  border: 1px solid #f8eacd;
  border-radius: 5px;
  padding: 29px;
  width: 360px;
  box-shadow: 8px 10px 0 #051e2b35;
  max-height: 100%;
  overflow: auto;
}
.eyebrow {
  font-size: 9px;
  letter-spacing: 1.2px;
  font-weight: 600;
}
.intro-card .eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #687168;
}
.tiny-signal {
  display: inline-grid;
  place-items: center;
  vertical-align: -3px;
  width: 16px;
  height: 16px;
  border: 1px solid #b4a780;
  background: var(--gold);
}
.tiny-signal svg {
  width: 11px;
  height: 11px;
}
h1 {
  font-size: 44px;
  line-height: 1.22;
  margin: 21px 0 16px;
  letter-spacing: -2.5px;
  font-weight: 900;
}
h1 > span {
  color: #b98c36;
}
.intro-card > p {
  font-size: 12px;
  line-height: 1.95;
  color: #596961;
  margin-bottom: 18px;
}
.mission-note {
  font-size: 10px;
  border-top: 1px solid #d9d8c8;
  padding-top: 16px;
  margin-bottom: 18px;
  line-height: 1.8;
}
.mission-note > span {
  background: #eae6d7;
  padding: 4px 6px;
  margin-right: 5px;
  font-size: 9px;
}
.primary-button {
  background: var(--gold);
  border: 1px solid #d4a746;
  border-radius: 3px;
  min-height: 49px;
  width: 100%;
  text-align: left;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 800;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition:
    background 0.15s,
    transform 0.15s;
}
.primary-button:hover {
  background: #ffcd6a;
  transform: translateY(-1px);
}
.primary-button > span:last-child:not(:first-child) {
  font: 22px/1 Arial;
}
.primary-button > span:first-child {
  white-space: nowrap;
}
.intro-foot {
  display: flex;
  justify-content: space-between;
  margin-top: 14px;
  font-size: 8px;
  color: #778078;
}
.pause-card h2,
.result-card h2 {
  font-size: 29px;
  letter-spacing: -1px;
  margin: 18px 0 13px;
}
.pause-card p,
.result-card p {
  font-size: 12px;
  line-height: 1.8;
  color: #677269;
}
.text-button {
  background: transparent;
  border: 0;
  display: block;
  margin: 13px auto 0;
  text-decoration: underline;
  text-underline-offset: 4px;
  font-size: 11px;
  padding: 7px;
}
.share-status {
  font-size: 10px;
  display: block;
  text-align: center;
  color: #526555;
  min-height: 15px;
  margin-top: 5px;
}
.hidden {
  display: none !important;
}
.section-label {
  font-size: 11px;
  letter-spacing: 0.7px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.section-label span {
  font-size: 8px;
  color: #7b8577;
  letter-spacing: 0.3px;
}
.score {
  display: flex;
  align-items: baseline;
  font: bold 57px/1.25 Arial;
  letter-spacing: -2px;
  margin: 5px 0 6px;
  color: #9aa392;
}
.score .live {
  color: var(--ink);
}
.score small {
  font:
    12px Consolas,
    monospace;
  color: #7a8577;
  letter-spacing: 0;
  margin: 0 12px 0 3px;
}
.signal-row {
  border-top: 1px solid #ccd3c5;
  padding-top: 17px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.signal-icon {
  width: 38px;
  height: 42px;
  border: 1.5px solid #7b8d7a;
  border-radius: 3px;
  display: grid;
  place-items: center;
  background: #dce2d5;
}
/* HKO symbol from signals.js; fill follows the tile. */
.signal-icon svg {
  width: 76%;
  height: 76%;
}
.signal-icon path {
  fill: #4a654e;
}
.signal-icon.eight path {
  fill: #17313b;
}
.signal-icon.eight {
  background: var(--gold);
  color: #17313b;
  border-color: #c39134;
}
.signal-row > div {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.signal-row strong {
  font-size: 12px;
}
.signal-row > div > span {
  font-size: 9px;
  color: #7d887c;
}
.wind {
  margin-left: auto;
  font-size: 15px;
  text-align: right;
}
.wind small {
  font-size: 8px;
  display: block;
  margin-top: 3px;
  color: #7d887c;
}
.energy-label {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  margin: 22px 0 8px;
  color: #65735f;
}
.energy-track {
  height: 5px;
  border-radius: 2px;
  background: #d1d8c9;
  overflow: hidden;
}
.energy-track > div {
  height: 100%;
  width: 78%;
  background: #6f8c6c;
  transition: width 0.2s;
}
.energy-note {
  font-size: 8px;
  margin-top: 8px;
  color: #7d8876;
  letter-spacing: 0.3px;
}
.strength-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 17px;
  padding-top: 13px;
  border-top: 1px solid #ccd3c5;
}
.strength-row > span {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.strength-row > span:last-child {
  text-align: right;
}
.strength-row small {
  font-size: 8px;
  color: #7d887c;
}
.strength-row strong {
  font-size: 12px;
}
.strength-row b {
  font-size: 13px;
}
.field-status small {
  display: block;
  margin-top: 5px;
  color: #e0d9bd;
  font-size: 8px;
}
dialog {
  border: 1px solid #c3c7b7;
  padding: 32px;
  border-radius: 6px;
  max-width: 440px;
  width: calc(100% - 36px);
  background: #f7f4e9;
  color: var(--ink);
  box-shadow: 0 20px 100px #092c3750;
}
dialog::backdrop {
  background: #08212bb3;
  backdrop-filter: blur(3px);
}
dialog h2 {
  font-size: 29px;
  letter-spacing: -1px;
}
dialog p {
  font-size: 12px;
  line-height: 1.9;
  color: #53645a;
}
dialog .help-small {
  font-size: 9px;
  color: #83907e;
  margin: 20px 0;
}
.close-button {
  position: absolute;
  right: 12px;
  top: 9px;
  background: transparent;
  border: 0;
  font-size: 27px;
  color: #7f8978;
}
.close-button:hover {
  color: var(--ink);
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

#scale-bar {
  display: inline-block;
  height: 5px;
  border: solid currentColor;
  border-width: 0 1px 1px;
  margin-right: 5px;
  vertical-align: middle;
}

.sound-button {
  min-width: 44px;
  display: grid;
  place-items: center;
}
.sound-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.sound-button .speaker {
  fill: currentColor;
}
.sound-button .cross,
.sound-button.muted .waves {
  display: none;
}
.sound-button.muted .cross {
  display: inline;
}
.music-button .note-head {
  fill: currentColor;
}
.music-button .slash {
  display: none;
}
.music-button.muted .slash {
  display: inline;
}
.sound-button.muted {
  color: #8a9084;
}
.lang-button {
  min-width: 44px;
  font-weight: 800;
}

.ticker-label {
  background: #d6453a;
  color: #fff;
  padding: 2px 8px;
  border-radius: 2px;
  font-size: 12px;
  letter-spacing: 1px;
  flex-shrink: 0;
}
.ticker-time {
  color: var(--gold);
  font-size: 12px;
  flex-shrink: 0;
}
.ticker-text {
  animation: ticker-in 0.5s ease-out;
}
@keyframes ticker-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

/* Announcement strip over the map: click-through, top-centre */
.notice {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: min(560px, calc(100% - 24px));
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: #f7f4e9f2;
  border-left: 5px solid #2f7fb5;
  border-radius: 5px;
  padding: 10px 14px 10px 10px;
  box-shadow: 0 8px 30px #04182466;
  pointer-events: none;
  z-index: 3;
  animation: notice-in 0.35s ease-out;
}
.notice img {
  width: 58px;
  height: 58px;
  flex-shrink: 0;
  border-radius: 8px;
}
.notice .eyebrow {
  display: block;
  color: #2f7fb5;
  font-size: 9px;
  margin-bottom: 3px;
}
.notice strong {
  display: block;
  font-size: 14px;
  line-height: 1.45;
}
.notice p {
  margin: 4px 0 0;
  font-size: 11px;
  line-height: 1.6;
  color: #4f5f62;
}
@keyframes notice-in {
  from {
    opacity: 0;
    transform: translate(-50%, -12px);
  }
}

/* Intro mascot tip */
.mascot-tip {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 0 0 16px;
}
.mascot-tip img {
  width: 54px;
  height: 54px;
  flex-shrink: 0;
}
.mascot-tip p {
  position: relative;
  margin: 0;
  background: #fff;
  border: 1px solid #e3dcc4;
  border-radius: 10px;
  padding: 8px 11px;
  font-size: 11px;
  line-height: 1.6;
}
.mascot-tip p::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 50%;
  margin-top: -6px;
  border: 6px solid transparent;
  border-right-color: #e3dcc4;
  border-left: 0;
}
.mission-note b {
  font-weight: 600;
}

/* Result card */
.result-card {
  width: 400px;
}
.result-card[data-tier="office"],
.result-card[data-tier="commute"] {
  border-top: 5px solid #c76b4f;
}
.result-card[data-tier="pass"] {
  border-top: 5px solid #4f8a63;
}
.result-card[data-tier="bigWin"] {
  border-top: 5px solid var(--gold);
}
.result-card[data-tier="wfh"] {
  border-top: 5px solid #c9932f;
}
.result-card .eyebrow {
  color: #8a6a3c;
  font-size: 10px;
}
.result-card h2 {
  margin: 10px 0 8px;
  line-height: 1.3;
}
.result-held {
  display: flex;
  align-items: baseline;
  gap: 12px;
}
.result-held small {
  font-size: 12px;
  color: #6c7774;
}
.result-held strong {
  font: bold 64px/1.1 Arial;
  letter-spacing: -2px;
  color: #b68123;
}
.result-card[data-tier="office"] .result-held strong,
.result-card[data-tier="commute"] .result-held strong {
  color: #c76b4f;
}
.result-card[data-tier="pass"] .result-held strong {
  color: #4f8a63;
}
.result-card .result-outcome {
  color: var(--ink);
  font-size: 13px;
  margin: 6px 0 10px;
}
.result-card[data-tier="office"] {
  width: 540px;
}
.result-meme {
  float: right;
  width: 168px;
  height: auto;
  margin: 18px 0 10px 16px;
  border: 6px solid #fff;
  box-shadow: 0 6px 18px #0003;
  transform: rotate(-2deg);
}
.result-boss {
  display: flex;
  gap: 10px;
  align-items: center;
  background: #efe9d6;
  border-radius: 8px;
  padding: 6px 12px 6px 6px;
  margin-bottom: 14px;
}
.result-boss img {
  width: 50px;
  height: 59px;
  flex-shrink: 0;
}
.result-tip {
  margin: 12px 0 0;
  padding: 9px 12px;
  border-left: 4px solid var(--gold);
  background: #fbf3dc;
  font-size: 13px;
  line-height: 1.5;
}
.result-tip b {
  margin-right: 6px;
  color: #a36f12;
}
.result-tip #result-tip-title {
  font-weight: 800;
  margin-right: 4px;
}
.result-card .result-boss p {
  margin: 0;
  color: #3a2410;
  font-size: 12px;
  line-height: 1.6;
}
.result-actions {
  clear: both;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.result-actions .primary-button {
  min-height: 46px;
}
.secondary-button {
  background: var(--ink);
  color: #f3f1e8;
  border: 0;
  border-radius: 3px;
  font-weight: 800;
  font-size: 14px;
  min-height: 46px;
  padding: 10px 14px;
}
.secondary-button:hover {
  background: #23495a;
}
.share-row,
.share-tools {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 8px;
}
.share-tools {
  grid-template-columns: repeat(2, 1fr);
}
.share-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 6px 8px;
  border: 0;
  border-radius: 3px;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.share-brand.whatsapp {
  background: #25d366;
  color: #0b3d20;
}
.share-brand.instagram {
  background: linear-gradient(45deg, #f09433, #dc2743 50%, #bc1888);
}
.share-brand.threads {
  background: #000;
}
.share-brand:hover {
  filter: brightness(1.08);
}
.share-icon {
  width: 18px;
  height: 18px;
  flex: none;
  fill: currentColor;
}
/* Narrow phones: logo above the label so "Instagram" still fits. */
@media (max-width: 380px) {
  .share-brand {
    flex-direction: column;
    gap: 2px;
    padding: 6px 2px;
    font-size: 11px;
  }
}
.share-tools button {
  border: 1px solid #c9c6b4;
  background: #fff;
  border-radius: 3px;
  font-size: 11px;
  min-height: 34px;
  padding: 4px;
}
.share-tools button:hover {
  background: #f0ecdc;
}

/* Score card: held-until clock, day timeline, hourly average */
.timeline {
  position: relative;
  height: 6px;
  background: #d1d8c9;
  border-radius: 3px;
  margin: 4px 0 20px;
}
.timeline-fill {
  height: 100%;
  width: 0;
  border-radius: 3px;
  background: #9aa392;
}
.timeline-fill.held {
  background: var(--gold);
}
.timeline i {
  position: absolute;
  top: -3px;
  width: 2px;
  height: 12px;
  background: var(--ink);
  margin-left: -1px;
}
.timeline i b {
  position: absolute;
  top: 13px;
  left: 50%;
  transform: translateX(-50%);
  font:
    8px Consolas,
    monospace;
  color: #6c7774;
}
.milestone {
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 14px;
  color: #8a6a3c;
}
.signal-row > div > span.warned {
  color: #c4532f;
  font-weight: 700;
}
.average-row {
  margin-top: 14px;
}
.average-label {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: #65735f;
  margin-bottom: 6px;
}
.average-label b {
  font-size: 11px;
  color: var(--ink);
}
.average-track {
  position: relative;
  height: 6px;
  background: #d1d8c9;
  border-radius: 3px;
}
.average-track > div {
  height: 100%;
  width: 0;
  background: #4f7f8c;
  border-radius: 3px;
  transition: width 0.2s;
}
.average-track > div.below {
  background: #d08a4c;
}
.gale-mark {
  position: absolute;
  left: 42%;
  top: -3px;
  width: 2px;
  height: 12px;
  background: #c4532f;
}
.average-note {
  font-size: 9px;
  margin-top: 6px;
  color: #7d8876;
}
.average-note.below {
  color: #c4532f;
  font-weight: 700;
}

.forum-heading {
  padding: 12px 14px 10px;
  border-bottom: 1px solid #2c2f36;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.forum-board {
  font-size: 9px;
  color: #f4c54d;
  letter-spacing: 1px;
}
.forum-heading strong {
  font-size: 12px;
  line-height: 1.45;
}
.forum-heading small {
  font-size: 9px;
  color: #8b8f98;
}
.post {
  padding: 9px 14px;
  border-bottom: 1px solid #26292f;
}
.post.new {
  animation: ticker-in 0.4s ease-out;
}
.post.hot {
  background: #24221b;
}
.post-head {
  display: flex;
  gap: 7px;
  align-items: baseline;
  font-size: 9px;
  color: #8b8f98;
}
.post-head b {
  color: #6fb6e8;
  font-weight: 600;
}
.post-time {
  margin-left: auto;
}
.post p {
  margin: 4px 0 3px;
  font-size: 12px;
  line-height: 1.55;
}
.post-votes {
  font-size: 9px;
  color: #6f747d;
}
.forum-typing {
  font-size: 9px;
  color: #8b8f98;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
}
.forum-typing > span:first-child {
  font-size: 18px;
  line-height: 1;
}

/* Footer badge and cookie notice */
.learnmer-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
  font-size: 13px;
  color: var(--ink);
  white-space: nowrap;
}
.learnmer-badge b {
  color: #e5a43a;
}
.cookie-notice {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 20;
  max-width: 360px;
  background: #f7f4e9;
  border: 1px solid #c9c6b4;
  border-radius: 6px;
  box-shadow: 0 10px 40px #0004;
  padding: 14px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.cookie-notice p {
  margin: 0 0 4px;
  font-size: 12px;
  line-height: 1.6;
  width: 100%;
}
.cookie-notice .primary-button {
  width: auto;
  min-height: 38px;
  padding: 8px 18px;
}
.cookie-notice .text-button {
  margin: 0;
}

html.lang-en .brand-main {
  letter-spacing: -1px;
}
html.lang-en .brand {
  font-size: 20px;
}
html.lang-en h1 {
  letter-spacing: -1.5px;
}

/* ---- App shell: one screen, nothing scrolls but the panels ---------------- */
html,
body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}
body {
  background: #f3f1e8;
}
.app {
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
    env(safe-area-inset-bottom) env(safe-area-inset-left);
}
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  min-width: 0;
}
.brand {
  flex-shrink: 0;
  font-size: 22px;
}
.brand-logo {
  width: 48px;
  height: 48px;
  margin: -6px -4px -6px -6px;
}
.ticker {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--ink);
  color: #f3f1e8;
  border-radius: 4px;
  padding: 7px 12px;
  font-size: 13px;
  line-height: 1.45;
  min-height: 40px;
}
.ticker-text {
  min-width: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.topbar-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.icon-button {
  min-width: 40px;
  height: 40px;
  padding: 0 10px;
  border: 1px solid #aeb6ad;
  border-radius: 4px;
  background: transparent;
  font-size: 12px;
  display: grid;
  place-items: center;
}
.icon-button:hover {
  background: #e8e6dc;
}
.github-button svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}
.fullscreen-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.fullscreen-button .exit,
.fullscreen-button.active .enter {
  display: none;
}
.fullscreen-button.active .exit {
  display: inline;
}
.stage {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 12px;
  padding: 0 16px 16px;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.map-panel {
  position: relative;
  min-height: 0;
  border: 1px solid #214650;
  border-radius: 8px;
  overflow: hidden;
  background: var(--sea);
}
.map-viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.map-legend {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 9px 16px;
  color: #a8bdb2;
  font-size: 9px;
  letter-spacing: 0.5px;
  background: linear-gradient(#0c263000, #0c2630c0);
  pointer-events: none;
}
.map-legend > span {
  display: flex;
  align-items: center;
  gap: 6px;
}
.canvas-hint {
  left: 50%;
  right: auto;
  bottom: 7px;
  transform: translateX(-50%);
  white-space: nowrap;
  z-index: 1;
}
.field-status {
  bottom: 40px;
}
.boost-button {
  bottom: 40px;
  z-index: 2;
}
/* The announcement strip stays inside the part of the map no panel covers. */
.notice {
  top: calc(var(--safe-top, 0px) + 10px);
  left: calc((var(--safe-left, 0px) + 100% - var(--safe-right, 0px)) / 2);
  width: min(
    560px,
    calc(100% - var(--safe-left, 0px) - var(--safe-right, 0px) - 20px)
  );
}
.notice.low {
  top: auto;
  bottom: calc(var(--safe-bottom, 0px) + 10px);
}

/* Score card and forum stack in the sidebar; the forum takes what is left. */
.sidebar {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.score-card {
  flex-shrink: 0;
  max-height: 72%;
  overflow-y: auto;
  background: #eaece3;
  border: 1px solid #d6dace;
  border-radius: 6px;
  padding: 12px 16px 14px;
}
.score {
  font-size: 48px;
}
.status-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid #ccd3c5;
}
.day-clock {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.day-clock small {
  font:
    10px Consolas,
    monospace;
  color: #7b8577;
}
.day-clock strong {
  font:
    600 20px Consolas,
    monospace;
}
.day-clock button {
  width: 30px;
  height: 30px;
  border: 1px solid #aeb6ad;
  border-radius: 4px;
  background: transparent;
}
.status-text {
  margin-left: auto;
  font-size: 9px;
  line-height: 1.4;
  color: #6c7774;
  text-align: right;
  letter-spacing: 0.5px;
}
.panel-toggle,
.help-short {
  display: none;
}
.forum-card {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-radius: 6px;
  background: #1b1d22;
  color: #e6e6e6;
  overflow: hidden;
}
.forum-posts {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  list-style: none;
  margin: 0;
  padding: 0;
}
.forum-latest {
  display: none;
}
.intro-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #e3dfcf;
  font-size: 9px;
  line-height: 1.6;
  color: #8a9084;
}

/* Game cards float over everything; pause and result dim the screen. */
.game-overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) 16px
    max(16px, env(safe-area-inset-bottom));
}
.game-overlay:has(#intro-card:not(.hidden)) {
  justify-content: flex-start;
  padding-left: 56px;
}
.game-overlay:has(#pause-card:not(.hidden)),
.game-overlay:has(#result-card:not(.hidden)) {
  background: #071a24b8;
}
.game-overlay.hidden {
  display: none;
}

@media (min-width: 1500px) {
  .intro-card {
    width: 390px;
    padding: 34px;
  }
  h1 {
    font-size: 49px;
  }
}
@media (max-width: 1100px) {
  .stage {
    grid-template-columns: minmax(0, 1fr) 262px;
  }
  .intro-card {
    width: 320px;
    padding: 24px;
  }
  h1 {
    font-size: 38px;
  }
  .result-card {
    width: 360px;
  }
}

/* ---- Compact: phones and short landscape screens --------------------------
   The map fills the screen. The score card folds into a strip at the top and
   the forum into a pill at the bottom; each opens with its toggle. Panels say
   which edge they sit on with --dock, so game.js keeps Hong Kong and the
   storm in the clear part of the map. */
@media (max-width: 860px), (max-height: 520px) {
  .topbar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 6px 8px;
    padding: 6px 8px;
  }
  .help-long,
  .github-button {
    display: none;
  }
  .help-short {
    display: inline;
    font-weight: 800;
    font-size: 15px;
  }
  .brand-name {
    display: none;
  }
  .brand-logo {
    width: 38px;
    height: 38px;
    margin: -3px;
  }
  /* News: one line, no BREAKING tag; a headline that does not fit scrolls. */
  .ticker {
    overflow: hidden;
    font-size: 13px;
    line-height: 1.3;
    padding: 5px 10px;
    min-height: 0;
  }
  .ticker-label,
  .ticker-time {
    display: none;
  }
  .ticker-text {
    display: inline-block;
    flex: none;
    white-space: nowrap;
    overflow: visible;
  }
  .ticker-text.marquee {
    animation: marquee var(--marquee-time, 10s) linear infinite;
  }
  .topbar-actions {
    gap: 4px;
  }
  .icon-button {
    min-width: 34px;
    height: 34px;
    padding: 0 6px;
    font-size: 11px;
  }
  .stage {
    display: block;
    position: relative;
    padding: 0;
  }
  .map-panel {
    position: absolute;
    inset: 0;
    border: 0;
    border-radius: 0;
  }
  .sidebar {
    display: contents;
  }
  .map-corner,
  .map-legend,
  .canvas-hint {
    display: none;
  }
  .panel-toggle {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    padding: 0;
    flex-shrink: 0;
    border: 1px solid #aeb6ad;
    border-radius: 4px;
    background: transparent;
    font-size: 13px;
  }
  .panel-toggle span {
    transition: transform 0.2s;
  }
  .score-card.open .panel-toggle span,
  .forum-card.open .forum-toggle span {
    transform: rotate(180deg);
  }

  .score-card {
    --dock: top;
    position: absolute;
    z-index: 4;
    top: 8px;
    left: 8px;
    right: 8px;
    max-height: calc(100% - 16px);
    padding: 8px 10px;
    background: #eaece3f2;
    box-shadow: 0 6px 20px #04182455;
  }
  .score-card:not(.open) {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr) auto auto;
    grid-template-areas:
      "clock icon name held toggle"
      "avg avg avg energy energy";
    align-items: center;
    column-gap: 8px;
    row-gap: 7px;
  }
  .score-card:not(.open) :is(.status-head, .signal-row) {
    display: contents;
  }
  .score-card:not(.open)
    :is(
      .status-text,
      .day-clock small,
      .section-label .mono,
      .timeline,
      .milestone,
      .wind,
      .strength-row,
      .average-note,
      .energy-note
    ) {
    display: none;
  }
  .score-card:not(.open) .day-clock {
    grid-area: clock;
    gap: 6px;
  }
  .score-card:not(.open) .day-clock strong {
    font-size: 16px;
  }
  .score-card:not(.open) .day-clock button {
    width: 28px;
    height: 28px;
  }
  .score-card:not(.open) #signal-icon {
    grid-area: icon;
    width: 28px;
    height: 32px;
  }
  .score-card:not(.open) .signal-row > div {
    grid-area: name;
    min-width: 0;
    gap: 2px;
  }
  .score-card:not(.open) .signal-row > div > * {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .score-card:not(.open) .signal-row strong {
    font-size: 13px;
  }
  .score-card:not(.open) .signal-row > div > span {
    font-size: 11px;
  }
  .score-card:not(.open) .held-block {
    grid-area: held;
    text-align: right;
  }
  .score-card:not(.open) .section-label span {
    font-family: inherit;
    letter-spacing: 0;
  }
  .score-card:not(.open) .section-label,
  .score-card:not(.open) .section-label span,
  .forum-card .forum-board {
    font-size: 11px;
    letter-spacing: 0;
    justify-content: flex-end;
  }
  .score-card:not(.open) .score {
    font-size: 22px;
    line-height: 1.1;
    margin: 1px 0 0;
    letter-spacing: -0.5px;
    justify-content: flex-end;
  }
  .score-card:not(.open) #status-toggle {
    grid-area: toggle;
  }
  .score-card:not(.open) .average-row {
    grid-area: avg;
    margin: 0;
  }
  .score-card:not(.open) .energy-row {
    grid-area: energy;
  }
  .score-card:not(.open) :is(.average-label, .energy-label) {
    font-size: 11px;
    margin: 0 0 4px;
    gap: 6px;
  }
  .score-card:not(.open) .average-label b {
    font-size: 12px;
  }
  .score-card:not(.open) :is(.average-track, .energy-track) {
    height: 4px;
  }
  .score-card:not(.open) .gale-mark {
    top: -2px;
    height: 8px;
  }
  /* Open panels: nothing under 11px on a phone. */
  .score-card.open
    :is(
      .status-text,
      .day-clock small,
      .section-label,
      .section-label span,
      .milestone,
      .wind small,
      .average-label,
      .average-note,
      .energy-label,
      .energy-note,
      .signal-row span,
      .strength-row small,
      .timeline b
    ),
  .forum-card.open
    :is(
      .forum-heading small,
      .post-head,
      .post-head b,
      .post-no,
      .post-time,
      .post-votes,
      .forum-typing > span:last-child
    ) {
    font-size: 11px;
  }
  .score-card.open .status-head {
    position: sticky;
    top: -8px;
    background: #eaece3;
    z-index: 1;
  }

  /* The forum: newest post on a one-line bar; tap it for the thread. */
  .forum-card {
    --dock: bottom;
    position: absolute;
    z-index: 5;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 0;
    box-shadow: 0 -4px 16px #04182444;
  }
  .forum-card:not(.open) {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    padding: 0 4px 0 10px;
    height: 38px;
    cursor: pointer;
  }
  .forum-card:not(.open) .forum-heading {
    display: contents;
  }
  .forum-card:not(.open)
    :is(#thread-title, .forum-heading small, .forum-posts, .forum-typing) {
    display: none;
  }
  .forum-card:not(.open) .forum-latest {
    display: block;
    margin: 0;
    font-size: 13px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .forum-latest b {
    color: #6fb6e8;
    font-weight: 600;
    margin-right: 6px;
  }
  .forum-card.open {
    max-height: 62%;
    border-radius: 10px 10px 0 0;
  }
  .forum-card.open .forum-heading {
    padding-right: 52px;
  }
  .forum-toggle {
    border: 0;
    color: #e6e6e6;
  }
  .forum-card:not(.open) .forum-toggle {
    width: 28px;
    height: 28px;
  }
  .forum-card.open .forum-toggle {
    position: absolute;
    top: 8px;
    right: 8px;
    border: 1px solid #4a4f58;
  }

  .field-status {
    --dock: bottom;
    left: 8px;
    bottom: 48px;
    padding: 7px 9px;
    font-size: 11px;
    gap: 6px;
  }
  .field-status b {
    font-size: 12px;
  }
  .field-status small {
    font-size: 11px;
  }
  .field-boss {
    width: 37px;
    height: 44px;
  }
  .boost-button {
    --dock: bottom;
    right: 10px;
    bottom: 48px;
    width: 70px;
    height: 70px;
  }
  .boost-button b {
    font-size: 13px;
  }
  .boost-button > span {
    font-size: 20px;
  }
  .boost-button small {
    display: none;
  }
  .notice {
    padding: 8px 10px 8px 8px;
    gap: 8px;
  }
  .notice img {
    width: 42px;
    height: 42px;
  }
  .notice strong {
    font-size: 13px;
  }
  .notice p {
    font-size: 11px;
  }

  .game-overlay,
  .game-overlay:has(#intro-card:not(.hidden)) {
    justify-content: center;
    padding: max(10px, env(safe-area-inset-top)) 10px
      max(10px, env(safe-area-inset-bottom));
  }
  .game-overlay:has(#intro-card:not(.hidden)) {
    background: #071a2466;
  }
  .intro-card,
  .pause-card {
    width: 300px;
    padding: 22px;
  }
  .intro-card .eyebrow {
    font-size: 11px;
    letter-spacing: 0.7px;
  }
  h1 {
    font-size: 36px;
    margin: 16px 0 12px;
  }
  .intro-card > p {
    font-size: 13px;
    margin-bottom: 13px;
  }
  .mission-note {
    font-size: 11px;
    padding-top: 12px;
    margin-bottom: 14px;
  }
  .intro-foot {
    font-size: 11px;
    margin-top: 12px;
  }
  .primary-button {
    min-height: 44px;
    font-size: 13px;
  }
  .result-card,
  .result-card[data-tier="office"] {
    width: 100%;
    max-width: 360px;
    padding: 20px;
  }
  .result-card h2 {
    font-size: 24px;
  }
  .result-held strong {
    font-size: 50px;
  }
  .result-meme {
    width: 40%;
    margin: 14px 0 8px 10px;
  }
  .cookie-notice {
    left: 10px;
    right: 10px;
    bottom: 10px;
    max-width: none;
  }
}

@media (max-width: 860px) and (orientation: portrait) {
  .ticker {
    grid-row: 2;
    grid-column: 1 / -1;
    margin: 0 -8px -6px;
    border-radius: 0;
  }
  .brand-name {
    display: flex;
    flex-direction: column;
    font-size: 17px;
  }
  .brand small {
    font-size: 11px;
    letter-spacing: 1px;
  }
  html.lang-en .brand-name {
    font-size: 16px;
  }
}

/* Short landscape: the score card and the forum share a left column. */
@media (max-height: 520px) and (orientation: landscape) {
  .score-card {
    --dock: left;
    right: auto;
    width: 290px;
  }
  .score-card:not(.open) {
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    grid-template-areas:
      "clock clock held toggle"
      "icon name name name"
      "avg avg avg avg"
      "energy energy energy energy";
  }
  .score-card.open {
    width: 300px;
  }
  .forum-card.open {
    left: auto;
    width: 360px;
    max-height: calc(100% - 8px);
  }
  .field-status {
    display: none;
  }
  .boost-button {
    --dock: right;
  }
  .intro-card,
  .pause-card {
    width: min(560px, 100%);
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 22px;
    align-content: start;
  }
  .intro-card > *,
  .pause-card > * {
    grid-column: 1 / -1;
  }
  .intro-card h1 {
    grid-column: 1;
    grid-row: 2 / 4;
    margin-top: 10px;
    font-size: 32px;
  }
  .intro-card :is(p, .mission-note, .mascot-tip, .primary-button) {
    grid-column: 2;
  }
  .intro-card {
    grid-auto-flow: dense;
  }
  .intro-card :is(.intro-foot, .intro-brand) {
    grid-column: 1;
    align-self: end;
  }
  .intro-card .intro-foot {
    grid-row: 4;
  }
  .intro-card .intro-brand {
    grid-row: 5;
    margin-top: 0;
  }
  /* The result reads left to right: outcome, then tip and sharing. */
  .result-card,
  .result-card[data-tier="office"] {
    max-width: 760px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-auto-flow: dense;
    column-gap: 22px;
    align-content: start;
  }
  .result-card > * {
    grid-column: 1;
  }
  .result-card .eyebrow {
    grid-column: 1 / -1;
  }
  .result-card
    :is(.result-tip, .result-actions, .share-row, .share-tools, .share-status) {
    grid-column: 2;
  }
  .result-card
    :is(.result-tip, .result-actions, .share-row, .share-tools, .share-status) {
    align-self: start;
  }
  .result-card .result-tip {
    margin: 0 0 10px;
  }
  .result-card h2 {
    font-size: 21px;
  }
  .result-held strong {
    font-size: 40px;
  }
  .result-meme {
    display: none !important;
  }
}

@keyframes marquee {
  0%,
  18% {
    transform: none;
  }
  82%,
  100% {
    transform: translateX(var(--marquee, 0));
  }
}
@media (prefers-reduced-motion: reduce) {
  .ticker-text.marquee {
    animation: none;
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}
