@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@400;500;600;700;800&display=swap');
:root {
  --ink: #263e37;
  --muted: #7c8880;
  --green: #355e4d;
  --cream: #fffdf6;
}
.graphics-status {
  position: absolute;
  top: 82px;
  left: 50%;
  transform: translateX(-50%);
  max-width: min(470px, 85vw);
  padding: 10px 16px;
  border-radius: 10px;
  background: #fffdf6ee;
  color: #355e4d;
  font-size: 12px;
  text-align: center;
  pointer-events: none;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  overflow: hidden;
  background: #d9dfc2;
  color: var(--ink);
  font-family: 'DM Sans', sans-serif;
}
button,
a {
  -webkit-tap-highlight-color: transparent;
}
button {
  font: inherit;
  cursor: pointer;
}
canvas {
  touch-action: none;
  cursor: grab;
  display: block;
  width: 100vw;
  height: 100dvh;
  outline: none;
}
header {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 88px;
  display: flex;
  align-items: center;
  padding: 0 38px;
  gap: 36px;
  pointer-events: none;
}
.brand {
  font-family: Manrope, sans-serif;
  font-weight: 800;
  font-size: 32px;
  letter-spacing: -2px;
  text-decoration: none;
  color: var(--ink);
  pointer-events: auto;
}
.brand-dot {
  color: #d68149;
  font-size: 12px;
  margin-left: 5px;
}
.location {
  font-size: 10px;
  letter-spacing: 1.8px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}
.live-dot {
  width: 6px;
  height: 6px;
  background: #52715a;
  border-radius: 50%;
  display: inline-block;
}
.version {
  opacity: 0.5;
}
.icon-btn {
  margin-left: auto;
  border: 1px solid #8d9b7c66;
  background: #fffdf6b3;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  pointer-events: auto;
  color: var(--ink);
}
.panel {
  background: #fffdf6ed;
  border: 1px solid #fff9;
  border-radius: 14px;
  box-shadow: 0 8px 32px #344a2910;
  backdrop-filter: blur(12px);
}
.profile {
  position: absolute;
  left: 32px;
  top: 110px;
  width: 278px;
  padding: 24px;
}
.eyebrow {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1.8px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.eyebrow span {
  font-size: 8px;
  color: var(--muted);
  letter-spacing: 1px;
}
h1 {
  font:
    600 30px/1.15 Manrope,
    sans-serif;
  letter-spacing: -1.1px;
  margin: 17px 0 13px;
}
p {
  font-size: 12px;
  line-height: 1.8;
  color: #77847a;
  margin: 0;
}
.profile-bottom {
  border-top: 1px solid #e7e9df;
  margin-top: 23px;
  padding-top: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.avatar {
  background: #e6e9d5;
  width: 34px;
  height: 36px;
  border-radius: 12px;
  color: #5f7058;
  display: grid;
  place-items: center;
  font-weight: 700;
}
strong {
  font-size: 12px;
}
small {
  display: block;
  font-size: 9px;
  color: var(--muted);
  margin-top: 3px;
}
.balance {
  margin-left: auto;
  text-align: right;
}
.balance small {
  letter-spacing: 1px;
  font-size: 8px;
}
.balance strong {
  font-size: 19px;
}
.task {
  position: absolute;
  left: 32px;
  bottom: 92px;
  width: 278px;
  padding: 22px;
}
.task h2 {
  font:
    700 17px Manrope,
    sans-serif;
  margin: 17px 0 9px;
}
.task p {
  font-size: 11px;
}
.progress {
  height: 4px;
  background: #e6e9df;
  border-radius: 9px;
  overflow: hidden;
  margin: 18px 0 13px;
}
.progress i {
  display: block;
  height: 100%;
  background: #79916a;
  width: 0;
  transition: width 0.2s;
}
.task-foot {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: var(--muted);
}
.shift {
  position: absolute;
  top: 110px;
  right: 32px;
  width: 280px;
  padding: 20px;
}
.shift-stats {
  display: flex;
  justify-content: space-between;
  margin: 19px 0 12px;
}
.shift-stats strong {
  display: block;
  font-size: 23px;
  margin-top: 4px;
}
.shift p {
  font-size: 11px;
}
.interaction {
  position: absolute;
  bottom: 100px;
  left: 57%;
  transform: translateX(-50%);
  background: var(--cream);
  padding: 12px 22px 12px 12px;
  box-shadow: 0 6px 24px #223c2722;
  display: flex;
  gap: 12px;
  align-items: center;
  border-radius: 12px;
  pointer-events: none;
}
.interaction strong {
  font-size: 12px;
}
.interaction span {
  display: block;
  font-size: 10px;
  color: var(--muted);
  margin-top: 4px;
}
kbd {
  font:
    10px 'DM Sans',
    sans-serif;
  padding: 5px 7px;
  border: 1px solid #a3ad9866;
  border-bottom-width: 2px;
  border-radius: 5px;
  background: #fff9;
  color: #4e6255;
}
.interaction kbd {
  font-size: 16px;
  padding: 8px 11px;
}
footer {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 64px;
  padding: 0 35px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(transparent, #d9dfc2dd);
  pointer-events: none;
}
.controls {
  display: flex;
  gap: 20px;
  font-size: 10px;
  color: #5a6c58;
}
.controls span {
  display: flex;
  align-items: center;
  gap: 7px;
}
.world-status {
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: 9px;
  letter-spacing: 1px;
}
.single {
  border-left: 1px solid #8a997c66;
  padding-left: 12px;
  color: #73816d;
  font-size: 8px;
}
#toast {
  position: absolute;
  top: 90px;
  left: 57%;
  transform: translateX(-50%) translateY(-12px);
  opacity: 0;
  transition: 0.25s;
  background: #314f40;
  color: #fffdf6;
  border-radius: 10px;
  padding: 13px 22px;
  font-size: 12px;
  pointer-events: none;
  max-width: 450px;
  text-align: center;
}
#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.scrim {
  position: absolute;
  inset: 0;
  background: #263c3655;
  backdrop-filter: blur(5px);
  display: grid;
  place-items: center;
  padding: 20px;
}
.dialog {
  position: relative;
  background: var(--cream);
  border-radius: 20px;
  width: 470px;
  max-width: 100%;
  max-height: 90dvh;
  overflow: auto;
  padding: 34px;
  box-shadow: 0 24px 100px #19332533;
}
.close {
  position: absolute;
  top: 13px;
  right: 17px;
  background: none;
  border: 0;
  font-size: 25px;
  color: #879383;
}
.dialog h2 {
  font:
    700 26px Manrope,
    sans-serif;
  letter-spacing: -0.7px;
  margin: 14px 0;
}
.dialog p {
  font-size: 13px;
}
.option {
  display: block;
  width: 100%;
  text-align: left;
  background: #f0f2e7;
  border: 1px solid #e0e5d5;
  border-radius: 12px;
  margin-top: 13px;
  padding: 17px;
  color: var(--ink);
}
.option:hover {
  background: #e4ead9;
  border-color: #a9ba98;
}
.option strong {
  font-size: 14px;
}
.option small {
  font-size: 11px;
  line-height: 1.7;
  margin-top: 5px;
}
.primary {
  width: 100%;
  border: 0;
  background: var(--green);
  color: white;
  padding: 14px;
  border-radius: 10px;
  font-weight: 600;
  margin-top: 20px;
}
.primary:hover {
  background: #254b3b;
}
.secondary {
  background: none;
  border: 1px solid #c6cfbd;
  color: var(--green);
}
.dialog .metrics {
  display: flex;
  gap: 30px;
  margin: 24px 0;
}
.metrics strong {
  font-size: 28px;
}
.hint {
  margin-top: 18px !important;
  font-size: 11px !important;
}
.touch-pad,
.touch-action {
  display: none;
}
[hidden] {
  display: none !important;
}
@media (max-width: 850px) {
  header {
    padding: 0 20px;
    height: 70px;
  }
  .version {
    display: none;
  }
  .profile {
    top: 80px;
    left: 16px;
    width: 215px;
    padding: 17px;
  }
  .profile h1 {
    font-size: 24px;
  }
  .profile p {
    font-size: 10px;
  }
  .task {
    left: 16px;
    bottom: 80px;
    width: 215px;
    padding: 17px;
  }
  .shift {
    right: 16px;
    top: 80px;
    width: 220px;
  }
  .shift-stats strong {
    font-size: 18px;
  }
  .interaction {
    left: 60%;
    bottom: 88px;
  }
  footer {
    padding: 0 20px;
  }
  .controls {
    gap: 10px;
  }
  .world-status {
    font-size: 8px;
  }
}
@media (pointer: coarse) {
  .touch-pad {
    display: block;
    position: absolute;
    bottom: 85px;
    left: 20px;
    text-align: center;
  }
  .touch-pad button {
    width: 42px;
    height: 42px;
    border: 1px solid #fff9;
    background: #fffdf6bb;
    border-radius: 10px;
    color: var(--ink);
    touch-action: none;
    margin: 2px;
  }
  .touch-action {
    display: block;
    position: absolute;
    bottom: 92px;
    right: 20px;
    background: var(--green);
    color: white;
    border: 0;
    padding: 15px;
    border-radius: 12px;
  }
  .task {
    display: none;
  }
  .controls {
    display: none;
  }
  .interaction {
    bottom: 155px;
    left: 60%;
  }
}
@media (max-width: 550px) {
  .profile {
    width: 185px;
  }
  .profile h1 {
    font-size: 20px;
  }
  .profile #welcome {
    display: none;
  }
  .profile-bottom {
    margin-top: 14px;
    padding-top: 12px;
  }
  .shift {
    width: 170px;
    padding: 14px;
  }
  .shift-stats {
    gap: 6px;
  }
  .shift-stats strong {
    font-size: 16px;
  }
  .shift small {
    font-size: 7px;
  }
  .location {
    font-size: 8px;
    letter-spacing: 1px;
    gap: 5px;
  }
  .brand {
    font-size: 27px;
  }
  header {
    gap: 20px;
  }
  .task {
    width: 185px;
  }
  .world-status {
    margin-left: auto;
  }
  .controls {
    font-size: 8px;
    gap: 7px;
  }
  .controls kbd {
    font-size: 8px;
    padding: 4px;
  }
}

canvas:active {
  cursor: grabbing;
}

.city-map {
  position: fixed;
  right: 20px;
  bottom: 220px;
  width: 190px;
  padding: 12px;
  border-radius: 12px;
  background: #fffdf6ed;
  color: var(--ink);
  z-index: 3;
  font-size: 11px;
}
.city-map small {
  display: block;
  margin-top: 7px;
  font-size: 9px;
}
.district-grid {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  margin-top: 8px;
}
.district-grid button {
  min-height: 44px;
  background: #e5ddc5;
  border: 0;
  border-radius: 4px;
  color: var(--ink);
  cursor: pointer;
  font-size: 10px;
}
.district-grid button:disabled {
  cursor: default;
  opacity: 0.6;
}
#mapPlayer {
  position: absolute;
  width: 9px;
  height: 9px;
  background: #355e4d;
  border: 2px solid white;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
@media (max-width: 650px) {
  .city-map {
    right: 10px;
    width: 155px;
    padding: 8px;
  }
}

.zoom-controls {
  position: fixed;
  right: 20px;
  bottom: 160px;
  display: flex;
  gap: 4px;
  z-index: 3;
}
.zoom-controls button {
  min-width: 44px;
  min-height: 44px;
  border: 1px solid #8d9b7c66;
  border-radius: 8px;
  background: #fffdf6;
  color: var(--ink);
  cursor: pointer;
}

.history-btn {
  margin-left: auto;
  background: #fffdf6b3;
  border: 1px solid #8d9b7c66;
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--ink);
  font-size: 11px;
  pointer-events: auto;
}
header .icon-btn {
  margin-left: 0;
}
#retrySave {
  pointer-events: auto;
  border: 0;
  border-radius: 5px;
  background: #355e4d;
  color: white;
  padding: 4px 8px;
  font-size: 9px;
}
@media (max-width: 650px) {
  #saveStatus {
    max-width: 100px;
    letter-spacing: 0;
  }
  .world-status {
    gap: 6px;
  }
  .single {
    display: none;
  }
  .history-btn {
    font-size: 9px;
    padding: 7px;
  }
  .location {
    display: none;
  }
}

/* Keep the play area clear; open travel only when it is needed. */
.city-map summary {
  cursor: pointer;
  min-height: 32px;
  display: flex;
  align-items: center;
  font-weight: 700;
}
.city-map[open] summary {
  margin-bottom: 8px;
}
.scrim {
  z-index: 10;
}
@media (pointer: coarse), (max-width: 600px) {
  header {
    height: calc(52px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) max(12px, env(safe-area-inset-right)) 0
      max(12px, env(safe-area-inset-left));
    gap: 10px;
  }
  .brand {
    font-size: 25px;
  }
  .history-btn,
  .icon-btn {
    min-height: 44px;
  }
  .icon-btn {
    min-width: 44px;
  }
  .location,
  .task,
  .profile > .eyebrow,
  .profile h1,
  .profile > p,
  .profile .avatar,
  .controls {
    display: none;
  }
  .profile {
    top: calc(58px + env(safe-area-inset-top));
    left: max(12px, env(safe-area-inset-left));
    width: 165px;
    padding: 10px 12px;
    pointer-events: none;
  }
  .profile-bottom {
    margin: 0;
    padding: 0;
    border: 0;
    gap: 8px;
  }
  .panel {
    backdrop-filter: none;
  }
  .shift {
    top: calc(118px + env(safe-area-inset-top));
    left: max(12px, env(safe-area-inset-left));
    right: auto;
    width: min(285px, calc(100vw - 24px));
    padding: 10px 12px;
  }
  .shift-stats {
    margin: 8px 0;
  }
  .shift-stats strong {
    font-size: 17px;
  }
  .shift small {
    font-size: 9px;
  }
  #shiftTip {
    font-size: 11px;
    line-height: 1.4;
  }
  footer {
    height: calc(30px + env(safe-area-inset-bottom));
    padding: 0 12px env(safe-area-inset-bottom);
  }
  .world-status {
    width: 100%;
    justify-content: flex-end;
    font-size: 9px;
    letter-spacing: 0;
  }
  .touch-pad {
    display: block;
    position: fixed;
    left: max(10px, env(safe-area-inset-left));
    bottom: calc(36px + env(safe-area-inset-bottom));
    text-align: center;
    z-index: 4;
    user-select: none;
  }
  .touch-pad button {
    width: 52px;
    height: 52px;
    margin: 2px;
    border: 1px solid #fff9;
    border-radius: 14px;
    background: #fffdf6e6;
    color: var(--ink);
    font-size: 22px;
    touch-action: none;
  }
  .touch-pad button:active {
    background: #b9ceb4;
  }
  .touch-action {
    display: block;
    position: fixed;
    right: max(12px, env(safe-area-inset-right));
    bottom: calc(42px + env(safe-area-inset-bottom));
    min-height: 60px;
    min-width: 110px;
    border: 0;
    border-radius: 18px;
    padding: 14px;
    background: var(--green);
    color: white;
    touch-action: manipulation;
    z-index: 4;
  }
  .zoom-controls {
    right: max(12px, env(safe-area-inset-right));
    bottom: calc(116px + env(safe-area-inset-bottom));
  }
  .city-map {
    top: calc(58px + env(safe-area-inset-top));
    bottom: auto;
    right: max(12px, env(safe-area-inset-right));
    width: 155px;
    max-height: calc(100dvh - 230px);
    overflow: auto;
  }
  .city-map summary {
    min-height: 36px;
  }
  .interaction {
    bottom: calc(172px + env(safe-area-inset-bottom));
    left: 50%;
    width: max-content;
    max-width: calc(100vw - 24px);
    padding: 10px 12px;
  }
  .interaction kbd {
    display: none;
  }
  #toast {
    top: auto;
    bottom: calc(230px + env(safe-area-inset-bottom));
    left: 50%;
    width: calc(100vw - 32px);
  }
  .dialog {
    padding: 24px 18px;
    max-height: calc(100dvh - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  }
  .close {
    min-width: 44px;
    min-height: 44px;
    top: 4px;
    right: 4px;
  }
  .graphics-status {
    top: 45%;
    z-index: 5;
  }
}
@media (pointer: coarse) and (max-height: 500px) {
  .profile {
    width: 155px;
  }
  .shift {
    top: calc(106px + env(safe-area-inset-top));
    width: 230px;
  }
  .touch-pad button {
    width: 44px;
    height: 44px;
  }
  .interaction {
    bottom: calc(40px + env(safe-area-inset-bottom));
    max-width: calc(100vw - 410px);
  }
}
