/* Hallmark · macrostructure: Spherical World Workbench · genre: game · theme: Terminal · anchor hue: green · nav: N9 · footer: Ft2
 * audience: indie founders · use: walk a shared company world · tone: square, simple, multiplayer
 * pre-emit critique: P5 H5 E4 S5 R5 V5 */
@import url("./tokens.css");
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: clip;
  overflow-x: clip;
}
body {
  background: var(--color-paper);
  color: var(--color-ink);
  font-family: var(--font-body);
  font-size: var(--text-body);
}
button,
input {
  font: inherit;
  border-radius: 0;
}
button {
  cursor: pointer;
  min-height: 44px;
  border: var(--rule-width) solid var(--color-rule);
  background: var(--color-surface);
  color: var(--color-ink);
  padding: var(--space-sm) var(--space-md);
  white-space: nowrap;
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}
button:active:not(:disabled) {
  transform: translateY(2px);
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
canvas:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 3px;
}
a {
  color: inherit;
  text-decoration: none;
}
[hidden] {
  display: none !important;
}
.hud-bar {
  height: 64px;
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  padding: var(--space-sm) var(--space-md);
  border-bottom: 2px solid var(--color-rule);
  position: relative;
  z-index: 5;
  background: var(--color-paper);
  color: var(--color-ink);
}
.wordmark {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--text-body);
  font-weight: 700;
  min-height: 44px;
  white-space: nowrap;
}
.brand-square {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 3px solid var(--color-accent);
  box-shadow: 4px 4px 0 var(--color-rule);
}
.connection {
  font-size: var(--text-sm);
  color: var(--color-muted);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.connection:before {
  content: "";
  width: 6px;
  height: 6px;
  background: var(--color-error);
}
.connection.connected:before {
  background: var(--color-accent);
}
.online {
  color: var(--color-muted);
  font-size: var(--text-sm);
}
.hud-actions {
  margin-left: auto;
  display: flex;
  gap: var(--space-sm);
}
.hud-actions button {
  font-size: var(--text-sm);
  padding: var(--space-sm) var(--space-md);
}
#join-open {
  background: var(--color-accent);
  color: var(--color-accent-ink);
  border-color: var(--color-accent);
}
#game {
  height: calc(100dvh - 64px);
  position: relative;
  overflow: clip;
}
#arena {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  image-rendering: pixelated;
  outline-offset: -3px;
}
.world-label {
  position: absolute;
  top: var(--space-md);
  left: var(--space-md);
  display: flex;
  gap: var(--space-sm);
  align-items: center;
  padding: var(--space-sm) var(--space-md);
  background: var(--color-paper);
  color: var(--color-ink);
  font-size: var(--text-sm);
  pointer-events: none;
  border: 2px solid var(--color-rule);
}
.world-label > span:last-child {
  color: var(--color-muted);
  margin-left: var(--space-sm);
}
.server-dot {
  width: 6px;
  height: 6px;
  background: var(--color-accent);
}
.ranking {
  position: absolute;
  right: var(--space-md);
  top: var(--space-md);
  width: 248px;
  border: 2px solid var(--color-rule);
  background: var(--color-paper);
  color: var(--color-ink);
  padding: var(--space-md);
  z-index: 4;
  display: none;
}
.ranking.open {
  display: block;
}
.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.panel-heading h2 {
  font-size: var(--text-body);
  margin: 0;
  letter-spacing: 1px;
}
.panel-heading button {
  padding: var(--space-xs);
  width: 44px;
  border: 0;
  font-size: 20px;
  background: var(--color-paper);
  color: var(--color-ink);
}
.ranking ol {
  list-style: none;
  margin: var(--space-sm) 0 0;
  padding: 0;
  max-height: min(440px, 45vh);
  overflow-y: auto;
}
.ranking li {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  border-top: 1px solid var(--color-rule);
  min-height: 40px;
}
.ranking .position {
  color: var(--color-muted);
  width: 16px;
  flex-shrink: 0;
}
.ranking .avatar {
  width: 22px;
  height: 22px;
}
.ranking .avatar img {
  width: 18px;
  height: 18px;
}
.ranking .leader-name {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ranking .leader-score {
  font-size: var(--text-sm);
}
.ranking .me {
  color: var(--color-accent);
}
.ranking p {
  color: var(--color-muted);
  font-size: 10px;
  line-height: 1.6;
  margin-bottom: 0;
}
.avatar {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  background: var(--color-paper-2);
  color: var(--color-ink);
  font-weight: 700;
  font-size: var(--text-lg);
}
.avatar img {
  width: 26px;
  height: 26px;
  object-fit: contain;
  image-rendering: pixelated;
}
.company-dock {
  position: absolute;
  bottom: var(--space-md);
  left: var(--space-md);
  width: min(960px, calc(100% - 32px));
  background: var(--color-paper);
  color: var(--color-ink);
  border: 2px solid var(--color-rule);
  padding: var(--space-md);
  box-shadow: 6px 6px 0 var(--color-world-ink);
  z-index: 3;
}
.dock-top {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}
.company-identity {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex: 1;
  min-width: 0;
}
.company-identity > div {
  min-width: 0;
}
.company-identity h1 {
  font: 700 var(--text-body) var(--font-body);
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.company-identity > div > span {
  font-size: 10px;
  color: var(--color-muted);
  display: block;
  margin-top: var(--space-xs);
}
.cash {
  text-align: right;
  flex-shrink: 0;
}
.cash span {
  display: block;
  color: var(--color-muted);
  font-size: 10px;
}
.cash strong {
  font-size: 20px;
  display: block;
  margin-top: var(--space-xs);
}
#click-button {
  background: var(--color-accent);
  color: var(--color-accent-ink);
  border-color: var(--color-accent);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: var(--space-md);
}
kbd {
  font: 10px var(--font-body);
  border: 1px solid currentColor;
  padding: 2px 4px;
  white-space: nowrap;
}
.upgrades {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-sm);
  margin-top: var(--space-md);
}
.upgrade {
  display: block;
  background: var(--color-surface);
  color: var(--color-ink);
  border: 1px solid var(--color-rule);
  text-align: left;
  min-width: 0;
  padding: var(--space-sm);
  min-height: 60px;
  white-space: normal;
}
.upgrade-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--text-sm);
  font-weight: 700;
}
.upgrade-title > span:first-child {
  white-space: nowrap;
}
.owned {
  color: var(--color-muted);
  font-size: 10px;
  flex-shrink: 0;
}
.upgrade-bottom {
  display: flex;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
  font-size: 10px;
  color: var(--color-muted);
}
.upgrade-bottom strong {
  color: var(--color-ink);
}
.upgrade.can-buy {
  border-color: var(--color-accent);
}
.upgrade.can-buy .upgrade-bottom strong {
  color: var(--color-accent);
}
.dock-bottom {
  display: flex;
  gap: var(--space-md);
  align-items: center;
  margin-top: var(--space-sm);
  font-size: 10px;
  color: var(--color-muted);
}
.dock-bottom > button {
  font-size: 10px;
  border: 0;
  background: var(--color-paper);
  color: var(--color-muted);
  padding: var(--space-xs) var(--space-sm);
  min-height: 28px;
}
.dock-bottom #share {
  margin-left: auto;
}
.dock-bottom #near-hint {
  color: var(--color-accent);
}
.walk-hint {
  position: absolute;
  left: var(--space-md);
  bottom: 220px;
  background: var(--color-paper);
  color: var(--color-muted);
  padding: var(--space-sm) var(--space-md);
  font-size: 10px;
  display: flex;
  gap: var(--space-sm);
  align-items: center;
  pointer-events: none;
}
.walk-hint > span {
  opacity: 0.5;
}
#touch-controls {
  display: none;
  position: absolute;
  bottom: 280px;
  right: var(--space-md);
  z-index: 2;
  text-align: center;
}
#touch-controls button {
  padding: 0;
  width: 44px;
  font-size: 20px;
  background: var(--color-paper);
  color: var(--color-ink);
  opacity: 0.9;
}
#touch-controls > div {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}
#game-error {
  position: absolute;
  left: var(--space-md);
  bottom: 260px;
  max-width: min(480px, calc(100% - 32px));
  background: var(--color-paper);
  color: var(--color-error);
  border: 2px solid var(--color-error);
  padding: var(--space-sm);
  font-size: var(--text-sm);
  z-index: 8;
}
dialog {
  width: min(416px, calc(100vw - 32px));
  padding: var(--space-lg);
  border: 2px solid var(--color-rule);
  background: var(--color-paper);
  color: var(--color-ink);
  box-shadow: 8px 8px 0 var(--color-world-ink);
}
dialog::backdrop {
  background: oklch(19% 0.014 155 / 0.55);
}
.dialog-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.dialog-top button {
  border: 0;
  padding: 0;
  width: 44px;
  font-size: 24px;
  background: var(--color-paper);
  color: var(--color-muted);
}
dialog h2 {
  font: 700 var(--text-display) var(--font-display);
  margin: var(--space-md) 0;
  letter-spacing: -1px;
}
dialog p {
  font-size: var(--text-sm);
  line-height: 1.7;
  color: var(--color-muted);
}
dialog label {
  display: block;
  margin-top: var(--space-lg);
  margin-bottom: var(--space-sm);
  font-size: var(--text-sm);
}
dialog input {
  width: 100%;
  height: 48px;
  border: 2px solid var(--color-rule);
  background: var(--color-surface);
  color: var(--color-ink);
  padding: var(--space-sm) var(--space-md);
}
dialog input::placeholder {
  color: var(--color-muted);
}
dialog input[aria-invalid="true"] {
  border-color: var(--color-error);
}
#join-help {
  font-size: 10px;
  min-height: 34px;
}
#join-help.error {
  color: var(--color-error);
}
#join-button {
  width: 100%;
  background: var(--color-accent);
  color: var(--color-accent-ink);
  border-color: var(--color-accent);
  font-weight: 700;
}
#browse {
  width: 100%;
  margin-top: var(--space-sm);
  border: 0;
  background: var(--color-paper);
  color: var(--color-muted);
}
dialog small {
  display: block;
  text-align: center;
  font-size: 9px;
  color: var(--color-muted);
  margin-top: var(--space-md);
  line-height: 1.5;
}
@media (hover: hover) {
  button:not(:disabled):hover {
    border-color: var(--color-accent);
  }
  #join-button:hover,
  #click-button:hover {
    background: var(--color-ink);
    color: var(--color-accent-ink);
  }
}
@media (max-width: 900px) {
  .connection {
    display: none;
  }
  .hud-bar {
    gap: var(--space-md);
  }
  .company-dock {
    width: calc(100% - 32px);
  }
  .walk-hint {
    bottom: 216px;
  }
  .dock-bottom #near-hint {
    display: none;
  }
}
@media (max-width: 600px) {
  .hud-bar {
    height: 56px;
    gap: var(--space-sm);
    padding: var(--space-xs) var(--space-sm);
  }
  #game {
    height: calc(100dvh - 56px);
  }
  .wordmark {
    font-size: 10px;
  }
  .brand-square {
    width: 12px;
    height: 12px;
  }
  .online {
    display: none;
  }
  .hud-actions {
    gap: var(--space-xs);
  }
  .hud-actions button {
    padding: var(--space-xs) var(--space-sm);
    font-size: 10px;
  }
  #home span {
    display: none;
  }
  .world-label {
    top: var(--space-sm);
    left: var(--space-sm);
    padding: var(--space-sm);
    font-size: 9px;
  }
  .world-label > span:last-child {
    margin-left: 0;
  }
  .company-dock {
    left: var(--space-sm);
    bottom: var(--space-sm);
    width: calc(100% - 16px);
    padding: var(--space-sm);
    box-shadow: 4px 4px 0 var(--color-world-ink);
  }
  .company-identity h1 {
    font-size: 10px;
  }
  .company-identity > div > span {
    font-size: 9px;
  }
  .company-identity .avatar {
    width: 26px;
    height: 26px;
  }
  .company-identity .avatar img {
    width: 22px;
    height: 22px;
  }
  .dock-top {
    flex-wrap: wrap;
    gap: var(--space-sm);
  }
  .cash strong {
    font-size: 16px;
  }
  .cash span {
    font-size: 9px;
  }
  #click-button {
    width: 100%;
    justify-content: space-between;
    min-height: 44px;
    margin-top: var(--space-xs);
  }
  .upgrades {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-xs);
    margin-top: var(--space-sm);
  }
  .upgrade {
    min-height: 54px;
  }
  .upgrade-title {
    font-size: 10px;
  }
  .upgrade-bottom {
    font-size: 9px;
    margin-top: var(--space-xs);
  }
  .dock-bottom {
    gap: var(--space-sm);
    flex-wrap: wrap;
    margin-top: var(--space-xs);
    font-size: 9px;
  }
  .dock-bottom #rank {
    display: none;
  }
  .dock-bottom button {
    padding: var(--space-xs);
    font-size: 9px;
  }
  .walk-hint {
    display: none;
  }
  #touch-controls {
    display: block;
    bottom: 294px;
    right: var(--space-sm);
  }
  .ranking {
    right: var(--space-sm);
    top: var(--space-sm);
    max-width: calc(100% - 16px);
  }
  #game-error {
    bottom: 300px;
    left: var(--space-sm);
  }
  .hud-actions #join-open {
    max-width: 112px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}
@media (max-width: 360px) {
  .wordmark span:last-child {
    font-size: 9px;
  }
  .hud-actions button {
    padding: var(--space-xs);
    font-size: 9px;
  }
  .hud-bar {
    gap: var(--space-xs);
  }
  .dock-bottom #total-earned {
    display: none;
  }
  .company-identity > div > span {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *:before,
  *:after {
    animation: none !important;
    transition: none !important;
  }
}

/* Centered company management; all purchases remain available while travelling. */
.company-dock {
  left: 50%;
  transform: translateX(-50%);
}
.upgrades {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.company-identity a {
  display: block;
  color: var(--color-muted);
  font-size: 11px;
  text-decoration: underline;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (max-width: 600px) {
  .company-dock {
    left: 50%;
  }
  .company-identity a {
    font-size: 9px;
  }
  .upgrades {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  #touch-controls {
    bottom: 355px;
  }
}
.walk-hint {
  bottom: 286px;
}
.company-identity h1 {
  cursor: default;
}

/* Full-width command center: twelve upgrades in four rows. */
.company-dock {
  width: calc(100% - 32px);
  max-width: none;
  padding: 12px;
}
.walk-hint {
  left: 50%;
  transform: translateX(-50%);
  bottom: var(--dock-clearance, 400px);
  white-space: nowrap;
}
.upgrades {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
.upgrade {
  min-height: 48px;
  padding: 8px;
}
.ranking {
  max-height: calc(100% - var(--dock-clearance, 400px) - 24px);
  overflow: auto;
}
.podium-1 .position {
  color: var(--color-accent);
  font-weight: 900;
}
.podium-2 .position,
.podium-3 .position {
  color: var(--color-ink);
  font-weight: 900;
}
@media (max-width: 600px) {
  .company-dock {
    width: calc(100% - 16px);
    padding: 8px;
  }
  .upgrade-title {
    font-size: 9px;
  }
  .upgrade-title > span:first-child {
    white-space: normal;
  }
  .owned {
    font-size: 8px;
  }
  .upgrade-bottom {
    font-size: 8px;
  }
  .walk-hint {
    display: none;
  }
  .ranking {
    max-height: 160px;
  }
  #touch-controls {
    bottom: var(--dock-clearance, 400px);
  }
  .hud-actions button {
    font-size: 9px;
    padding: 4px;
  }
  .hud-bar {
    gap: 4px;
  }
  .hud-actions {
    gap: 3px;
  }
  .upgrades {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.ranking .position {
  width: 30px;
  white-space: nowrap;
}

@media (max-width: 600px) {
  .wordmark span:last-child {
    display: none;
  }
  .wordmark {
    flex-shrink: 0;
  }
  .hud-actions {
    margin-left: auto;
  }
  .hud-actions #zoom-in,
  .hud-actions #zoom-out {
    width: 36px;
    min-width: 36px;
  }
}

/* Compact centered management with clear prices. */
.company-dock {
  width: min(1080px, calc(100% - 32px));
  box-shadow: none;
}
.upgrade-title {
  display: block;
  font-size: 12px;
  text-align: left;
}
.upgrade-detail {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
}
.upgrade-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  font-size: 10px;
  color: var(--color-muted);
}
.upgrade-price {
  font-size: 24px;
  line-height: 1.1;
  color: var(--color-ink);
  font-weight: 800;
}
.upgrade.can-buy .upgrade-price {
  color: var(--color-accent);
}
.connection {
  gap: 0;
  margin-right: -8px;
  font-size: 0;
}
.connection:before {
  background: var(--color-rule);
}
.connection.connected:before {
  background: var(--color-accent);
}
.websites-panel {
  position: absolute;
  top: 16px;
  right: 16px;
  width: min(330px, calc(100% - 32px));
  padding: 16px;
  border: 2px solid var(--color-rule);
  background: var(--color-paper);
  color: var(--color-ink);
  z-index: 9;
}
.websites-panel[hidden] {
  display: none;
}
.websites-panel h2 {
  font-size: 14px;
}
.websites-panel button {
  color: var(--color-ink);
  background: var(--color-surface);
}
#websites-list {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}
#websites-list button {
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (max-width: 600px) {
  .company-dock {
    width: calc(100% - 16px);
  }
  .upgrade-price {
    font-size: 19px;
  }
  .upgrade-title {
    font-size: 9px;
    min-height: 24px;
  }
  .upgrade-info {
    font-size: 8px;
  }
  .upgrade-detail {
    gap: 3px;
    margin-top: 3px;
  }
  .connection {
    display: inline-flex;
    margin-right: -4px;
  }
  .online {
    display: inline;
    font-size: 9px;
    white-space: nowrap;
  }
  .hud-actions #home {
    font-size: 0;
    width: 32px;
    padding: 0;
  }
  .hud-actions #home:after {
    content: "Sites";
    font-size: 9px;
  }
  .hud-actions #join-open {
    font-size: 9px;
  }
  .hud-actions button {
    padding: 4px;
  }
  .hud-actions #zoom-in,
  .hud-actions #zoom-out {
    width: 26px;
    min-width: 26px;
  }
  .hud-bar {
    gap: 4px;
  }
  .upgrade {
    padding: 6px;
  }
  .ranking {
    max-height: 140px;
  }
}

.upgrade:disabled {
  opacity: 1;
  color: var(--color-muted);
}
.upgrade:disabled .upgrade-price {
  color: var(--color-ink);
}

.website-input { position: relative; }
.website-input .avatar { position: absolute; left: 12px; top: 8px; width: 32px; height: 32px; pointer-events: none; }
.website-input input { padding-left: 56px; }

/* A fixed company workbench: identity first, then one aligned numeric strip. */
.company-dock { height: 374px; display: grid; grid-template-rows: 84px 1fr; gap: var(--space-md); padding: var(--space-md); }
.dock-top { display: grid; grid-template-columns: minmax(240px, 1fr) minmax(420px, 1.5fr) 148px; gap: var(--space-lg); align-items: center; }
.company-identity { min-width: 0; gap: var(--space-sm); }
.identity-details { min-width: 0; flex: 1; }
.company-title-row { display: flex; align-items: center; gap: var(--space-sm); min-width: 0; }
.company-identity h1 { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 0; font-size: 13px; }
.company-identity a { margin-top: var(--space-xs); font-size: 11px; }
.stats-strip { display: grid; grid-template-columns: minmax(120px, 1.2fr) minmax(120px, 1.2fr) minmax(72px, .8fr) 56px; gap: var(--space-md); align-items: end; min-width: 0; }
.stat { min-width: 0; display: flex; flex-direction: column; gap: var(--space-sm); }
.stat-label { color: var(--color-muted); font-size: 10px; white-space: nowrap; }
.stat strong { color: var(--color-ink); font-family: var(--font-numbers); font-weight: 600; font-variant-numeric: tabular-nums lining-nums; letter-spacing: -0.04em; font-size: 25px; line-height: 36px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-earned strong { color: var(--color-accent); }
.stat-earned strong, .stat-cash strong { font-size: 36px; }
.stat-rank strong { font-size: 25px; }
#click-button { width: 148px; min-height: 56px; margin: 0; justify-content: center; font-size: 12px; }
.upgrades { margin: 0; grid-template-rows: repeat(4, minmax(0, 1fr)); overflow: hidden; }
.upgrade { min-width: 0; height: 100%; }
.upgrade-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upgrade-price { min-width: 0; white-space: nowrap; font-family: var(--font-numbers); font-weight: 600; letter-spacing: -0.03em; font-variant-numeric: tabular-nums lining-nums; }
.world-capacity { position: absolute; top: var(--space-md); left: var(--space-md); padding: var(--space-sm); background: var(--color-paper); color: var(--color-muted); pointer-events: none; }
.spots-left { color: var(--color-accent); font-weight: 700; }
.ranking .leader-score { max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
img.brand-square { width: 24px; height: 24px; border: 0; box-shadow: none; object-fit: contain; }
.upgrade-title .owned { margin-left: var(--space-sm); font-size: 10px; color: var(--color-muted); }
.upgrade-title > span:first-child { white-space: nowrap; }
@media (max-width: 1050px) {
  .dock-top { grid-template-columns: minmax(200px, 1fr) minmax(340px, 1.5fr) 120px; gap: var(--space-md); }
  .stats-strip { grid-template-columns: minmax(96px, 1.1fr) minmax(96px, 1.1fr) minmax(64px, .9fr) 44px; gap: var(--space-sm); }
  .stat strong { font-size: 23px; }
  .stat-earned strong, .stat-cash strong { font-size: 30px; }
  #click-button { width: 120px; font-size: 11px; }
}
@media (max-width: 760px) {
  .company-dock { height: 410px; grid-template-rows: 108px 1fr; padding: var(--space-sm); gap: var(--space-sm); }
  .dock-top { grid-template-columns: minmax(0, 1fr) 104px; grid-template-rows: 44px 56px; gap: var(--space-sm); }
  .company-identity { grid-column: 1; grid-row: 1; }
  .company-identity h1 { font-size: 11px; }
  .company-identity a { font-size: 10px; margin: 0; }
  .company-title-row { gap: var(--space-xs); }
  .stats-strip { grid-column: 1 / -1; grid-row: 2; grid-template-columns: minmax(104px, 1.4fr) minmax(72px, 1fr) minmax(64px, 1fr) 42px; gap: var(--space-sm); }
  .stat { gap: var(--space-xs); }
  .stat-label { font-size: 9px; }
  .stat strong { font-size: 23px; line-height: 32px; }
  .stat-earned strong, .stat-cash strong { font-size: 32px; }
  .stat-rank strong { font-size: 23px; }
  #click-button { grid-column: 2; grid-row: 1; width: 104px; min-height: 44px; font-size: 10px; padding: var(--space-xs); }
  .upgrade-title { min-height: 0; font-size: 9px; }
  .upgrade-price { font-size: 20px; }
  .hud-actions #world-top { font-size: 0; width: 28px; }
  .hud-actions #world-top:after { content: 'Top'; font-size: 9px; }
  .online { display: none; }
  .world-capacity { top: var(--space-sm); left: var(--space-sm); font-size: 9px; }
  .ranking.open { z-index: 10; max-height: calc(100% - 24px); }
  .ranking ol { max-height: calc(100dvh - 180px); }
  img.brand-square { width: 16px; height: 16px; }
}

/* Cash and lifetime totals share emphasis; supporting stats stay quieter. */
.stats-strip { align-items: center; }
.stat { gap: 4px; }
.stat strong { font-size: 18px; line-height: 28px; letter-spacing: -0.025em; }
.stat-earned strong, .stat-cash strong { font-size: 40px; line-height: 44px; }
@media (max-width: 1050px) {
  .stat-earned strong, .stat-cash strong { font-size: 30px; line-height: 34px; }
}
.stat-label { font-size: 10px; }
.stat-earned .stat-label { color: var(--color-ink); }
.upgrade { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: 1fr 1fr; column-gap: 12px; align-items: center; padding: 10px 12px; }
.upgrade-title { grid-column: 1; grid-row: 1; align-self: end; }
.upgrade-detail { display: contents; }
.upgrade-info { grid-column: 1; grid-row: 2; align-self: start; padding-top: 5px; }
.upgrade-price { grid-column: 2; grid-row: 1 / 3; align-self: center; line-height: 1; font-size: 24px; }
@media (max-width: 760px) {
  .stat strong { font-size: 17px; line-height: 24px; }
  .stat-earned strong, .stat-cash strong { font-size: 30px; line-height: 34px; }
  .upgrade { padding: 8px 6px; column-gap: 4px; }
  .upgrade-title { white-space: normal; font-size: 9px; }
  .upgrade-price { font-size: 18px; }
  .upgrade-info { font-size: 9px; }
}

/* Mobile keeps the world visible and scrolls purchases in two compact rows. */
.zoom-controls { display: contents; }
@media (max-width: 760px) {
  .company-dock { height: 292px; grid-template-rows: 148px 122px; gap: 6px; padding: 8px; }
  .dock-top { grid-template-columns: minmax(0, 1fr); grid-template-rows: 42px 56px 38px; gap: 6px; }
  .company-identity { grid-column: 1; grid-row: 1; width: 100%; }
  .company-identity h1 { font-size: 12px; }
  .company-identity a { font-size: 11px; }
  .stats-strip { grid-column: 1; grid-row: 2; grid-template-columns: minmax(80px, 1fr) minmax(80px, 1fr) minmax(54px, .7fr) 32px; gap: 6px; }
  .stat-label { font-size: 9px; }
  .stat strong { font-size: 15px; line-height: 24px; }
  .stat-earned strong, .stat-cash strong { font-size: 28px; line-height: 32px; }
  #click-button { grid-column: 1; grid-row: 3; width: 100%; min-height: 38px; height: 38px; font-size: 11px; }
  .upgrades { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; grid-auto-rows: 58px; align-content: start; gap: 6px; height: 122px; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; touch-action: pan-y; scrollbar-width: thin; }
  .upgrade { min-height: 58px; height: 58px; padding: 8px 12px; column-gap: 12px; }
  .upgrade-title { font-size: 11px; white-space: nowrap; }
  .upgrade-info { font-size: 10px; }
  .upgrade-price { font-size: 23px; }
  .hud-actions #home { display: none; }
}
@media (max-width: 600px) {
  .hud-bar { height: 64px; gap: 4px; padding: 4px 8px; }
  #game { height: calc(100dvh - 64px); }
  .wordmark { min-width: 0; gap: 4px; font-size: 10px; }
  .wordmark span:last-child { display: inline-block; max-width: none; font-size: inherit; flex-shrink: 0; }
  .connection { display: none; }
  .hud-actions { display: flex; gap: 4px; align-items: center; flex-shrink: 0; }
  .hud-actions button { min-height: 44px; font-size: 9px; padding: 4px; }
  .zoom-controls { display: flex; flex-direction: column; gap: 2px; }
  .hud-actions #zoom-in, .hud-actions #zoom-out { width: 28px; min-width: 28px; min-height: 21px; height: 21px; padding: 0; font-size: 14px; }
  .hud-actions #join-open { font-size: 9px; }
}

/* Game gestures must not trigger text selection, image callouts or double-tap zoom. */
.hud-bar, #game, button {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
button { touch-action: manipulation; }
#touch-controls button { touch-action: none; }
#game img, .hud-bar img { -webkit-user-drag: none; }
input, textarea { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }

/* Website traffic stays secondary to company rank and earned credits. */
.rank-visits { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; white-space: nowrap; }
#website-clicks, .leader-clicks { color: var(--color-muted); font-size: 10px; }
.ranking .leader-name { display: grid; position: relative; gap: 3px; }
.ranking .leader-name a { padding-right: 8px; overflow: hidden; text-overflow: ellipsis; }
.ranking .leader-name .active-dot { position: absolute; right: 0; top: 4px; }
.ranking, .ranking ol { scrollbar-width: none; }
.ranking::-webkit-scrollbar, .ranking ol::-webkit-scrollbar { display: none; }
.dock-top { grid-template-columns: minmax(240px, 1fr) minmax(464px, 1.5fr) 148px; }
.stats-strip { grid-template-columns: minmax(120px, 1.2fr) minmax(120px, 1.2fr) minmax(72px, .8fr) 104px; }
@media (min-width: 761px) and (max-width: 1050px) {
  .dock-top { grid-template-columns: minmax(180px, 1fr) minmax(360px, 1.5fr) 120px; }
  .stats-strip { grid-template-columns: minmax(96px, 1.1fr) minmax(96px, 1.1fr) minmax(64px, .9fr) 80px; }
  .rank-visits { gap: 4px; }
  .stat-rank strong { font-size: 13px; }
  #website-clicks { font-size: 9px; }
}
@media (max-width: 760px) {
  .dock-top { grid-template-columns: minmax(0, 1fr); }
  .stats-strip { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 54px 80px; }
  .rank-visits { gap: 4px; }
  .stat-rank strong { font-size: 13px; }
  #website-clicks { font-size: 9px; }
}
@media (max-width: 360px) {
  .stat-earned strong, .stat-cash strong { font-size: 24px; line-height: 28px; }
  .stat-income strong { font-size: 13px; }
}
