:root {
  color-scheme: light;
  --ink: #183c2e;
  --ink-soft: #52675d;
  --paper: #f6f1df;
  --paper-bright: #fffdf4;
  --leaf: #2f7353;
  --leaf-dark: #24533e;
  --lime: #cbdc6e;
  --line: rgba(24, 60, 46, .15);
  --shadow: 0 20px 55px rgba(28, 57, 43, .12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 7% 0%, rgba(202, 221, 116, .22), transparent 28rem),
    linear-gradient(145deg, #f9f5e7 0%, #edf2e5 100%);
}

button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }

a {
  color: inherit;
  text-decoration: none;
}

.site-header {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 24px 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 43px;
  height: 43px;
  display: grid;
  place-items: center;
  border-radius: 50% 47% 52% 44%;
  color: #f8f3df;
  background: var(--ink);
  font: 800 13px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  transform: rotate(-5deg);
}

.brand > span:last-child { display: grid; gap: 1px; }
.brand strong { font-size: 18px; letter-spacing: -.03em; }
.brand small { color: var(--ink-soft); font-size: 11px; letter-spacing: .04em; }

nav { display: flex; align-items: center; gap: 8px; }

.nav-link {
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 244, .64);
  font-size: 12px;
  font-weight: 750;
  transition: transform .18s ease, background .18s ease;
}

.nav-link:hover { transform: translateY(-1px); background: var(--paper-bright); }
.nav-link-muted { color: var(--ink-soft); background: transparent; }

.page-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.intro {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 32px;
  padding: 30px 0 28px;
}

.eyebrow, .section-kicker {
  margin: 0 0 7px;
  color: var(--leaf);
  font: 800 10px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .16em;
}

h1, h2, h3, p { margin-top: 0; }

h1 {
  max-width: 720px;
  margin-bottom: 12px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(36px, 5vw, 66px);
  font-weight: 500;
  line-height: .98;
  letter-spacing: -.045em;
}

.intro > div:first-child > p:last-child {
  max-width: 590px;
  margin-bottom: 0;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.65;
}

.level-chip {
  width: 92px;
  height: 92px;
  flex: 0 0 auto;
  display: grid;
  place-content: center;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--paper-bright);
  box-shadow: var(--shadow);
}

.level-chip span { font: 800 9px/1 ui-monospace, monospace; letter-spacing: .13em; }
.level-chip strong { margin-top: 3px; font: 500 37px/1 Georgia, serif; }

.game-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(310px, .76fr);
  gap: 18px;
  align-items: start;
}

.stage-card, .care-panel {
  border: 1px solid var(--line);
  border-radius: 26px;
  background: rgba(255, 253, 244, .87);
  box-shadow: var(--shadow);
}

.stage-card { padding: 18px; }
.care-panel { padding: 20px; }

.card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 2px 3px 16px;
}

.card-heading.compact { padding-bottom: 18px; }
.card-heading h2 { margin: 0; font: 600 21px/1.15 Georgia, serif; }

.save-status {
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .02em;
}

.canvas-wrap {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  background: #7aa58f;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 720 / 520;
}

.death-panel {
  position: absolute;
  inset: 0;
  padding: 24px;
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
  color: #fffdf4;
  background: rgba(18, 46, 35, .84);
  backdrop-filter: blur(6px);
}

.death-panel[hidden] { display: none; }
.death-panel strong { font: 500 clamp(23px, 4vw, 35px)/1.1 Georgia, serif; }
.death-panel span { max-width: 390px; margin: 9px 0 20px; color: rgba(255, 253, 244, .75); font-size: 13px; }

.button {
  border: 0;
  border-radius: 999px;
  padding: 11px 18px;
  cursor: pointer;
  font-weight: 800;
}

.button-primary { color: #fffdf4; background: var(--leaf); }

.message {
  min-height: 47px;
  margin: 13px 0;
  padding: 12px 15px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(47, 115, 83, .14);
  border-radius: 13px;
  color: #315746;
  background: #eff3e6;
  font-size: 12px;
  font-weight: 650;
}

.message-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border: 2px solid var(--paper-bright);
  border-radius: 50%;
  background: #6c9e62;
  box-shadow: 0 0 0 3px rgba(108, 158, 98, .18);
}

.movement-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 2px 3px 0;
}

.movement-row > div:first-child { display: grid; gap: 3px; }
.movement-row strong { font-size: 12px; }
.movement-row small { color: var(--ink-soft); font-size: 10px; }

.d-pad {
  display: grid;
  grid-template-columns: repeat(4, 36px);
  gap: 5px;
}

.d-pad button {
  width: 36px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink);
  background: var(--paper-bright);
  cursor: pointer;
  font-weight: 900;
}

.alive-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 750;
}

.alive-indicator i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #6ea15e;
  box-shadow: 0 0 0 3px rgba(110, 161, 94, .14);
}

.resources {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: rgba(239, 243, 230, .58);
}

.resources > div {
  min-width: 0;
  padding: 11px 9px;
  display: grid;
  gap: 3px;
  text-align: center;
}

.resources > div + div { border-left: 1px solid var(--line); }
.resources span { color: var(--ink-soft); font-size: 9px; font-weight: 700; }
.resources strong { display: flex; justify-content: center; align-items: baseline; gap: 4px; font-size: 17px; }
.resources strong i { color: #d5a43a; font-size: 9px; font-style: normal; }
.resources strong small { font-size: 9px; }

.meters { display: grid; gap: 13px; margin: 20px 1px; }
.meters label { display: grid; gap: 7px; }
.meters label > span { display: flex; justify-content: space-between; font-size: 10px; }
.meters b { font-weight: 800; }
.meters output { color: var(--ink-soft); font-size: 9px; font-weight: 700; }

progress {
  width: 100%;
  height: 7px;
  appearance: none;
  border: 0;
  border-radius: 99px;
  overflow: hidden;
  background: #dde4d6;
}

progress::-webkit-progress-bar { border-radius: 99px; background: #dde4d6; }
progress::-webkit-progress-value { border-radius: 99px; background: #d0a74a; transition: width .25s ease; }
progress::-moz-progress-bar { border-radius: 99px; background: #d0a74a; }
#happy::-webkit-progress-value { background: #79a5a0; }
#happy::-moz-progress-bar { background: #79a5a0; }
#clean::-webkit-progress-value { background: #769d5d; }
#clean::-moz-progress-bar { background: #769d5d; }

.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.action-button {
  min-height: 66px;
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--ink);
  background: var(--paper-bright);
  cursor: pointer;
  transition: transform .15s ease, border-color .15s ease, opacity .15s ease;
}

.action-button:hover:not(:disabled) { transform: translateY(-2px); border-color: rgba(47, 115, 83, .35); }
.action-button > span:last-child { min-width: 0; display: grid; gap: 2px; }
.action-button strong { font-size: 11px; }
.action-button small { overflow: hidden; color: var(--ink-soft); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }

.action-icon {
  width: 31px;
  height: 31px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 10px;
  font-weight: 900;
}

.action-feed { color: #5d6f2d; background: #e9efba; }
.action-clean { color: #356c68; background: #d6ebe8; }
.action-walk { color: #8a6221; background: #f1dfad; }
.action-shop { color: #6b4d82; background: #e8dded; }

.shop {
  margin-top: 20px;
  padding-top: 17px;
  border-top: 1px solid var(--line);
}

.shop-heading { display: flex; justify-content: space-between; align-items: end; margin-bottom: 8px; }
.shop-heading h3 { margin: 0; font: 600 17px/1 Georgia, serif; }
.shop-heading > span { color: var(--ink-soft); font-size: 8px; }

.shop-item {
  width: 100%;
  padding: 9px 3px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  background: transparent;
  cursor: pointer;
}

.shop-item > span { display: grid; gap: 2px; text-align: left; }
.shop-item strong { font-size: 11px; }
.shop-item small { color: var(--ink-soft); font-size: 8px; }
.shop-item b { font-size: 9px; }
.shop-item:hover:not(:disabled) strong { color: var(--leaf); }

.sus-button {
  width: 100%;
  margin-top: 14px;
  padding: 9px;
  border: 1px dashed rgba(24, 60, 46, .25);
  border-radius: 11px;
  color: var(--ink-soft);
  background: transparent;
  cursor: pointer;
  font: 800 9px/1 ui-monospace, monospace;
  letter-spacing: .08em;
}

button:focus-visible, a:focus-visible {
  outline: 3px solid rgba(47, 115, 83, .35);
  outline-offset: 3px;
}

button:disabled { cursor: not-allowed; opacity: .45; }
button.is-cooling { opacity: .58; }

footer {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 2px 38px;
  display: flex;
  justify-content: space-between;
  color: var(--ink-soft);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .05em;
}

.text-button {
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  cursor: pointer;
  font-size: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}

noscript {
  position: fixed;
  inset: auto 20px 20px;
  padding: 14px;
  border-radius: 12px;
  color: white;
  background: #7d3030;
  text-align: center;
}

@media (max-width: 900px) {
  .game-grid { grid-template-columns: 1fr; }
  .care-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; }
  .care-panel > .card-heading, .care-panel > .resources, .care-panel > .sus-button { grid-column: 1 / -1; }
  .meters { align-self: start; }
  .shop { margin-top: 20px; padding-top: 0; border-top: 0; }
}

@media (max-width: 620px) {
  .site-header, .page-shell, footer { width: min(100% - 24px, 1180px); }
  .site-header { padding-top: 15px; }
  .nav-link-muted { display: none; }
  .nav-link { padding: 9px 11px; }
  .intro { align-items: center; padding: 22px 1px 20px; }
  .intro > div:first-child > p:last-child { font-size: 13px; }
  .level-chip { width: 70px; height: 70px; }
  .level-chip strong { font-size: 28px; }
  .stage-card, .care-panel { border-radius: 19px; }
  .stage-card { padding: 10px; }
  .care-panel { display: block; padding: 16px; }
  .card-heading { padding: 8px 4px 12px; }
  .save-status { display: none; }
  .canvas-wrap { border-radius: 13px; }
  .movement-row { align-items: start; }
  .movement-row > div:first-child { display: none; }
  .d-pad { width: 100%; grid-template-columns: repeat(4, 1fr); }
  .d-pad button { width: 100%; height: 40px; }
  .shop { padding-top: 18px; border-top: 1px solid var(--line); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
