:root {
  --ink: #203c36;
  --muted: #77837a;
  --green: #26775a;
  --lime: #d9ec88;
  --paper: #f6f7ef;
  --border: #dce1d5;
  --orange: #e7a746;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button {
  font: inherit;
  cursor: pointer;
  color: inherit;
  border: 0;
  background: none;
  touch-action: manipulation;
}
button:focus-visible,
canvas:focus-visible {
  outline: 3px solid #e7a746;
  outline-offset: 4px;
}
button:disabled {
  opacity: 0.4;
  cursor: default;
}
button:hover:not(:disabled) {
  filter: brightness(0.96);
}
[hidden] {
  display: none !important;
}
#app {
  max-width: 1600px;
  margin: auto;
  padding: 0 5%;
}
.topbar {
  height: 110px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  font-size: 14px;
  letter-spacing: 1.8px;
  line-height: 1.25;
  font-weight: 500;
  padding: 0;
}
.brand b {
  font-weight: 850;
}
.brand-icon {
  background: var(--green);
  border-radius: 13px;
  color: white;
  font-size: 34px;
  letter-spacing: -5px;
  width: 49px;
  height: 49px;
  line-height: 49px;
  padding-left: 11px;
  position: relative;
  font-weight: bold;
}
.brand-icon span {
  font-size: 20px;
  position: absolute;
  right: 7px;
  bottom: -1px;
  color: var(--lime);
}
nav {
  display: flex;
  gap: 38px;
  font-size: 13px;
  font-weight: 600;
}
.top-actions {
  display: flex;
  gap: 20px;
  align-items: center;
}
.coin-pill {
  background: #eeefe4;
  border: 1px solid #e4e5d7;
  border-radius: 30px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 18px;
  font-size: 14px;
}
.coin {
  color: #c9972f;
  font-size: 21px;
}
.icon-button {
  width: 43px;
  height: 43px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: #fff9;
  font-size: 22px;
}
.icon-button svg {
  width: 20px;
  height: 20px;
}
main {
  display: grid;
  grid-template-columns: 40% 60%;
  min-height: 580px;
  align-items: center;
  padding: 30px 0 12px;
  position: relative;
}
.home-copy {
  padding: 30px 0 35px;
  z-index: 2;
}
.eyebrow {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.8px;
  display: flex;
  align-items: center;
  gap: 9px;
  line-height: 1.7;
}
.live-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #6eaa6d;
  box-shadow: 0 0 0 4px #6eaa6d16;
  flex-shrink: 0;
}
h1 {
  font-size: clamp(40px, 4.3vw, 70px);
  font-weight: 750;
  letter-spacing: -3.4px;
  line-height: 1.08;
  margin: 25px 0 22px;
}
h1 em {
  color: var(--green);
  font-style: normal;
}
.intro {
  font-size: 15px;
  line-height: 1.8;
  color: var(--muted);
  margin: 0 0 30px;
}
.home-play {
  max-width: 320px;
}
.primary {
  background: var(--green);
  color: white;
  border-radius: 13px;
  padding: 19px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  font-size: 17px;
  font-weight: bold;
  box-shadow: 0 6px 0 #19513e;
  min-height: 62px;
  width: 100%;
  transition: transform 0.15s;
}
.primary:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #19513e;
}
.play-symbol {
  font-size: 14px;
  opacity: 0.85;
}
.continue-note {
  font-size: 9px;
  font-weight: bold;
  letter-spacing: 1.4px;
  color: #90978a;
  text-align: center;
  margin-top: 21px;
}
.continue-note span {
  margin: 0 6px;
}
.home-stats {
  display: flex;
  gap: 28px;
  margin-top: 42px;
}
.home-stats > div {
  border-right: 1px solid var(--border);
  padding-right: 26px;
}
.home-stats > div:last-child {
  border: 0;
  padding: 0;
}
.home-stats strong {
  display: block;
  font-size: 25px;
  letter-spacing: -1px;
  margin-bottom: 7px;
}
.home-stats span {
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
}
#scene-wrap {
  position: relative;
  min-width: 0;
  height: 545px;
}
#scene {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  outline: none;
}
.scene-badge {
  position: absolute;
  top: 20px;
  left: 26px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 9px;
  font-weight: bold;
  letter-spacing: 1.5px;
  z-index: 1;
  border: 1px solid #dde3d8;
  border-radius: 25px;
  padding: 10px 14px;
  background: #f6f7efaa;
}
.scene-bottom {
  position: absolute;
  bottom: 10px;
  left: 26px;
  right: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--muted);
  pointer-events: none;
}
.view-label {
  font-size: 8px;
  letter-spacing: 1px;
}
.view-label span {
  margin-left: 9px;
}
#home-bottom {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 22px;
  margin: 20px 0 35px;
}
.daily-card,
.mode-card {
  border: 1px solid var(--border);
  border-radius: 18px;
  display: flex;
  align-items: center;
  text-align: left;
  padding: 24px 26px;
  gap: 20px;
  background: #eef1e5;
}
.daily-card .eyebrow {
  font-size: 8px;
  color: #7d876f;
  letter-spacing: 1.4px;
}
.daily-icon {
  font-size: 31px;
  width: 64px;
  height: 64px;
  background: #e3eabd;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6a7941;
}
.daily-card h3,
.mode-card h3 {
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -0.5px;
  margin: 6px 0;
}
.daily-card h3 span {
  font-weight: 400;
  font-size: 19px;
  margin-left: 9px;
}
.daily-card p,
.mode-card p {
  font-size: 11px;
  color: var(--muted);
  margin: 7px 0 0;
}
.badge {
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 1.2px;
  border-radius: 20px;
  padding: 7px 10px;
  border: 1px solid #cbd5b8;
  margin-left: auto;
}
.mode-card {
  background: transparent;
}
.mode-icon {
  font-size: 35px;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #bb8752;
  background: #f0e9db;
  border-radius: 18px;
}
.mode-card > span:last-child {
  margin-left: auto;
  font-size: 21px;
}
footer {
  display: flex;
  gap: 24px;
  align-items: center;
  padding: 25px 0;
  border-top: 1px solid var(--border);
  font-size: 8px;
  color: #879085;
  letter-spacing: 1.2px;
}
footer button {
  font-size: 10px;
  letter-spacing: 0;
}
footer > span:first-child {
  font-weight: 800;
  color: #5d7366;
}
.footer-right {
  margin-left: auto;
  font-size: 7px;
}
.footer-right span {
  font-size: 16px;
  color: var(--green);
  margin-left: 12px;
}
#game-panel {
  padding: 15px 20px 20px 0;
}
#game-panel h1 {
  font-size: 43px;
  letter-spacing: -1.8px;
  margin: 14px 0;
}
#game-panel .intro {
  font-size: 13px;
  margin-bottom: 22px;
  max-width: 330px;
}
.text-button {
  font-size: 11px;
  color: var(--muted);
  padding: 0;
  margin-bottom: 28px;
}
.mission-stats {
  display: flex;
  gap: 34px;
  margin-bottom: 24px;
}
.mission-stats span {
  display: block;
  font-size: 8px;
  letter-spacing: 1.5px;
  color: var(--muted);
  font-weight: bold;
  margin-bottom: 7px;
}
.mission-stats strong {
  font-size: 31px;
  font-weight: 600;
  letter-spacing: -1px;
}
.dispatch-card {
  display: flex;
  gap: 13px;
  padding: 16px;
  background: #eaf0df;
  border-radius: 15px;
  max-width: 365px;
}
.avatar {
  position: relative;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  background: #dcb78d;
  border: 4px solid #536e55;
  border-radius: 50%;
  display: grid;
  place-items: center;
}
.avatar span {
  font-size: 28px;
  line-height: 1;
  color: #364438;
}
.avatar i {
  position: absolute;
  width: 10px;
  height: 5px;
  background: #536e55;
  bottom: 4px;
  right: -5px;
  border-radius: 5px;
}
.dispatch-card b {
  font-size: 11px;
}
.dispatch-card p {
  font-size: 11px;
  line-height: 1.55;
  color: #6d7b65;
  margin: 6px 0 0;
}
#selected-controls {
  margin: 20px 0 10px;
  min-height: 71px;
}
#selected-name {
  font-size: 10px;
  color: var(--muted);
}
#selected-controls > div {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 9px;
}
.small-button {
  padding: 12px 18px;
  border-radius: 22px;
  background: #e6ecde;
  font-size: 12px;
}
.tools {
  display: flex;
  gap: 10px;
  margin-top: 19px;
}
.tools button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 12px 13px;
  min-width: 66px;
  font-size: 9px;
  font-weight: 600;
}
.tools svg {
  width: 21px;
  height: 21px;
}
dialog {
  border: 1px solid #dde3d5;
  border-radius: 26px;
  padding: 40px;
  width: min(560px, 94vw);
  max-height: 88dvh;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 30px 100px #203c3640;
}
dialog::backdrop {
  background: #203c3655;
  backdrop-filter: blur(6px);
}
.modal-close {
  position: absolute;
  right: 16px;
  top: 16px;
  width: 32px;
  height: 32px;
}
dialog h2 {
  font-size: 33px;
  letter-spacing: -1.5px;
  margin: 12px 0;
}
dialog p {
  font-size: 13px;
  line-height: 1.8;
  color: var(--muted);
}
dialog .primary {
  font-size: 15px;
  margin: 24px 0 8px;
  min-height: 52px;
  padding: 15px 20px;
}
dialog .eyebrow {
  margin-top: 8px;
}
.level-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 9px;
  margin-top: 24px;
}
.level-grid button {
  height: 62px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff9;
  font-weight: 600;
  font-size: 17px;
}
.level-grid button.completed {
  background: #e2edce;
  border-color: #cbdcac;
}
.level-grid small {
  display: block;
  font-size: 9px;
  color: #bb9739;
  margin-top: 5px;
}
.modal-tabs {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin: 20px 0;
}
.modal-tabs button {
  border: 1px solid var(--border);
  padding: 8px 10px;
  border-radius: 20px;
  font-size: 10px;
}
.modal-tabs .active {
  background: var(--green);
  color: white;
}
.mode-option {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  padding: 18px 0;
  text-align: left;
}
.mode-option strong {
  font-size: 16px;
}
.mode-option small {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 5px;
}
.mode-option > span:last-child {
  font-size: 23px;
}
.stars {
  font-size: 52px;
  color: #d8b04d;
  letter-spacing: 8px;
  text-align: center;
  margin: 20px 0;
}
.victory-icon {
  display: block;
  font-size: 45px;
  text-align: center;
  color: var(--green);
}
.win-details {
  display: flex;
  gap: 15px;
  justify-content: center;
  text-align: center;
}
.win-details div {
  background: #eaf0df;
  border-radius: 14px;
  padding: 18px 25px;
}
.win-details strong {
  font-size: 25px;
  display: block;
}
.win-details span {
  font-size: 10px;
  color: var(--muted);
}
.setting {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.setting input {
  width: 40px;
  height: 23px;
  accent-color: var(--green);
}
.collection-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.cosmetic {
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  text-align: center;
}
.cosmetic-art {
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 38px;
}
.cosmetic b {
  font-size: 13px;
  display: block;
  padding: 12px 0 0;
}
.cosmetic button {
  background: var(--green);
  color: white;
  border-radius: 20px;
  padding: 9px 15px;
  margin: 13px;
  font-size: 10px;
}
.achievement {
  display: flex;
  gap: 16px;
  align-items: center;
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}
.achievement > span {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #e8ecd9;
  font-size: 23px;
}
.achievement b {
  font-size: 13px;
}
.achievement p {
  margin: 3px 0;
  font-size: 11px;
}
#toast {
  position: fixed;
  bottom: 25px;
  left: 50%;
  transform: translate(-50%, 20px);
  max-width: 90vw;
  border-radius: 25px;
  background: #203c36;
  color: white;
  padding: 13px 22px;
  font-size: 12px;
  box-shadow: 0 6px 25px #203c3630;
  opacity: 0;
  pointer-events: none;
  transition: 0.2s;
  z-index: 5;
}
#toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}
.hint-mark {
  color: var(--green);
}
#hint-overlay {
  position: absolute;
  top: 65px;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 20px;
  background: #fff9;
  padding: 9px 15px;
  font-size: 11px;
  white-space: nowrap;
  pointer-events: none;
}
@media (min-width: 1500px) {
  main {
    min-height: 670px;
  }
  #scene-wrap {
    height: 630px;
  }
}
@media (max-width: 1000px) {
  #app {
    padding: 0 4%;
  }
  nav {
    gap: 20px;
  }
  main {
    grid-template-columns: 42% 58%;
  }
  h1 {
    font-size: 48px;
    letter-spacing: -2px;
  }
  .home-stats {
    gap: 15px;
  }
  .home-stats > div {
    padding-right: 14px;
  }
  .home-stats span {
    font-size: 8px;
  }
  #scene-wrap {
    height: 500px;
  }
  .scene-badge {
    left: 8px;
  }
  .scene-bottom {
    left: 8px;
    font-size: 9px;
  }
  .view-label {
    display: none;
  }
  .daily-card,
  .mode-card {
    padding: 20px 16px;
    gap: 14px;
  }
  .badge {
    display: none;
  }
}
@media (max-width: 700px) {
  #app {
    padding: 0 20px;
  }
  .topbar {
    height: 85px;
  }
  .brand {
    font-size: 11px;
    gap: 9px;
    letter-spacing: 1.2px;
  }
  .brand-icon {
    width: 39px;
    height: 39px;
    line-height: 39px;
    font-size: 28px;
    padding-left: 8px;
  }
  .brand-icon span {
    font-size: 16px;
    right: 6px;
  }
  .top-actions {
    gap: 10px;
  }
  .coin-pill {
    padding: 6px 12px;
    font-size: 12px;
  }
  .coin {
    font-size: 19px;
  }
  nav {
    display: none;
  }
  .icon-button {
    width: 37px;
    height: 37px;
  }
  main {
    display: flex;
    flex-direction: column;
    padding: 0;
    min-height: 0;
    gap: 0;
  }
  .home-copy {
    padding: 34px 0 0;
    width: 100%;
    text-align: center;
  }
  .home-copy > .eyebrow {
    justify-content: center;
    font-size: 8px;
  }
  h1 {
    font-size: 47px;
    line-height: 1.05;
    letter-spacing: -2.7px;
    margin: 18px 0 13px;
  }
  .intro {
    font-size: 12px;
    line-height: 1.7;
    margin-bottom: 20px;
  }
  .home-play {
    max-width: 300px;
    margin: auto;
  }
  .primary {
    font-size: 15px;
    min-height: 53px;
    padding: 16px 20px;
    border-radius: 12px;
  }
  .continue-note {
    font-size: 8px;
    margin-top: 16px;
  }
  .home-stats {
    display: none;
  }
  #scene-wrap {
    width: calc(100% + 30px);
    height: 355px;
    margin-top: -5px;
  }
  .scene-badge {
    top: 22px;
    left: 23px;
    font-size: 7px;
    padding: 8px 10px;
  }
  .scene-bottom {
    bottom: 15px;
    left: 23px;
    right: 23px;
    font-size: 8px;
    justify-content: center;
  }
  #home-bottom {
    grid-template-columns: 1fr;
    margin: 0 0 24px;
    gap: 12px;
    width: 100%;
  }
  .daily-card,
  .mode-card {
    border-radius: 15px;
    padding: 17px;
    gap: 16px;
  }
  .daily-icon,
  .mode-icon {
    width: 46px;
    height: 46px;
    font-size: 26px;
    border-radius: 13px;
  }
  .daily-card h3,
  .mode-card h3 {
    font-size: 16px;
  }
  .daily-card p,
  .mode-card p {
    font-size: 10px;
  }
  .daily-card .eyebrow {
    font-size: 7px;
  }
  .mode-card {
    padding: 12px 17px;
  }
  footer {
    padding: 20px 0;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
  }
  footer > span:first-child {
    width: 100%;
    text-align: center;
    font-size: 7px;
  }
  .footer-right {
    display: none;
  }
  body.playing .topbar {
    height: 72px;
  }
  body.playing main {
    position: relative;
  }
  #game-panel {
    display: contents;
  }
  .text-button {
    align-self: flex-start;
    margin: 18px 0 10px;
    font-size: 10px;
  }
  #level-tier {
    align-self: flex-start;
    font-size: 8px;
    margin-top: 0;
  }
  #game-panel h1 {
    font-size: 31px;
    align-self: flex-start;
    margin: 8px 0 6px;
    letter-spacing: -1px;
  }
  #game-panel .intro {
    align-self: flex-start;
    font-size: 11px;
    margin: 0 0 12px;
    max-width: 100%;
  }
  .mission-stats {
    align-self: flex-start;
    gap: 30px;
    margin: 0;
  }
  .mission-stats span {
    font-size: 7px;
    margin-bottom: 5px;
  }
  .mission-stats strong {
    font-size: 24px;
  }
  .dispatch-card {
    order: 4;
    width: 100%;
    max-width: 100%;
    padding: 11px 13px;
    margin-top: 0;
  }
  .avatar {
    width: 34px;
    height: 34px;
    border-width: 3px;
  }
  .avatar span {
    font-size: 24px;
  }
  .dispatch-card b {
    font-size: 10px;
  }
  .dispatch-card p {
    font-size: 10px;
    margin-top: 3px;
  }
  .playing #scene-wrap {
    height: 330px;
    order: 2;
    margin-top: 8px;
  }
  .playing .scene-badge {
    display: none;
  }
  .playing .scene-bottom {
    bottom: 10px;
  }
  #selected-controls {
    order: 3;
    width: 100%;
    min-height: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 0 10px;
  }
  #selected-controls > div {
    margin: 0;
    gap: 5px;
  }
  #selected-name {
    font-size: 9px;
    max-width: 140px;
  }
  .small-button {
    font-size: 10px;
    padding: 10px 13px;
  }
  .tools {
    order: 5;
    justify-content: center;
    width: 100%;
    margin: 15px 0 23px;
    gap: 12px;
  }
  .tools button {
    width: 70px;
    padding: 10px 12px;
    font-size: 9px;
  }
  .playing footer {
    display: none;
  }
  dialog {
    padding: 30px 23px;
    border-radius: 22px;
  }
  dialog h2 {
    font-size: 29px;
  }
  .level-grid {
    gap: 7px;
  }
  .level-grid button {
    height: 55px;
  }
  .win-details div {
    padding: 16px 20px;
  }
}
@media (max-width: 380px) {
  #app {
    padding: 0 15px;
  }
  h1 {
    font-size: 42px;
  }
  .playing #scene-wrap {
    height: 310px;
  }
  .mission-stats {
    gap: 24px;
  }
  .dispatch-card p {
    font-size: 9px;
  }
  .home-copy {
    padding-top: 26px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}

body {
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}
