:root {
  color-scheme: dark;
  --case: #4b4d8f;
  --case-light: #7477bf;
  --case-dark: #232549;
  --case-edge: #12162c;
  --trim: #111616;
  --screen: #9cac77;
  --screen-ink: #182413;
  --screen-shadow: #435337;
  --key: #171c22;
  --key-light: #3a4148;
  --paper: #f4efd8;
  --green: #6eb35a;
  --orange: #cf7b3b;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 14px;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 36% 18%, rgba(244, 239, 216, 0.14), transparent 26%),
    linear-gradient(135deg, #ece9df 0%, #bec2b6 40%, #252927 100%);
  color: var(--paper);
  font-family: "Courier New", Courier, monospace;
}

button {
  font: inherit;
}

.app-layout {
  width: min(96vw, 980px);
  display: grid;
  grid-template-columns: minmax(230px, 300px) minmax(320px, 340px);
  align-items: center;
  justify-content: center;
  gap: clamp(24px, 7vw, 86px);
}

.menu-panel {
  align-self: start;
  margin-top: clamp(42px, 10vh, 92px);
  padding: 14px;
  border: 3px solid #1d241d;
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.09), rgba(0,0,0,0.18)),
    #2c342f;
  color: var(--paper);
  box-shadow:
    inset 0 2px 0 rgba(255,255,255,0.13),
    0 18px 42px rgba(0,0,0,0.28);
}

.menu-panel h1 {
  margin: 0 0 10px;
  color: #f5f1dc;
  font-size: clamp(1.35rem, 4vw, 2rem);
  line-height: 1;
  text-transform: uppercase;
}

.upgrade-list {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.menu-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px 2px;
  color: #d8d7c4;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.menu-section-mark {
  color: #9cac77;
}

.menu-stat {
  padding: 11px 12px 10px;
  border: 2px solid rgba(24, 36, 19, 0.72);
  border-radius: 6px;
  background: var(--screen);
  color: var(--screen-ink);
  box-shadow: inset 0 0 18px rgba(24,36,19,0.25);
}

.menu-stat span {
  display: block;
  margin-bottom: 5px;
  color: rgba(24, 36, 19, 0.72);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.menu-stat strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: clamp(1.65rem, 7vw, 2.7rem);
  line-height: 1;
}

.menu-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  margin-top: 10px;
  padding: 4px;
  border: 2px solid #1b211d;
  border-radius: 8px;
  background: #202720;
}

.menu-tab {
  min-width: 0;
  padding: 7px 3px 6px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: #aeb4a3;
  cursor: pointer;
  font-size: 0.65rem;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
}

.menu-tab.is-active,
.menu-tab[aria-selected="true"] {
  border-color: #101713;
  background: var(--screen);
  color: var(--screen-ink);
  box-shadow: inset 0 0 9px rgba(24,36,19,0.24);
}

.menu-tab:active {
  transform: translateY(1px);
}

.menu-panel-content[hidden] {
  display: none;
}

.nursery-panel,
.colony-panel {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.colony-panel {
  max-height: min(68vh, 620px);
  overflow-y: auto;
  padding-right: 2px;
  scrollbar-color: #697b54 #202720;
}

.nursery-goal-card,
.nest-card,
.nursery-yard-card,
.colony-placeholder {
  display: grid;
  gap: 5px;
  padding: 9px;
  border: 2px solid #1b211d;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.07), rgba(0,0,0,0.16)),
    #3a433c;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.11);
}

.nursery-goal-card strong {
  color: #f4efd8;
  font-size: 0.85rem;
  line-height: 1.15;
}

.nursery-goal-card p,
.colony-placeholder p,
.colony-note,
.nursery-timer,
.nursery-meta {
  margin: 0;
  color: #d8d7c4;
  font-size: 0.68rem;
  line-height: 1.2;
}

.nursery-goal-card .upgrade-button {
  margin-top: 2px;
}

.nursery-card-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 8px;
}

.nursery-card-heading strong {
  display: block;
  margin-top: 4px;
  color: #f4efd8;
  font-size: 1rem;
  line-height: 1;
}

.nest-visual {
  min-height: 42px;
  display: grid;
  place-items: center;
  border: 2px dashed rgba(156,172,119,0.58);
  border-radius: 6px;
  background:
    radial-gradient(ellipse at 50% 112%, rgba(24,36,19,0.58) 0 22%, transparent 23%),
    #303931;
  color: #9cac77;
}

.nest-visual span {
  font-size: 1.35rem;
  font-weight: 800;
  opacity: 0.7;
}

.nest-visual.has-egg {
  border-style: solid;
  background:
    radial-gradient(ellipse at 50% 112%, rgba(24,36,19,0.65) 0 22%, transparent 23%),
    #303931;
}

.egg-shape {
  width: 23px;
  height: 29px;
  border: 2px solid #141b13;
  border-radius: 52% 48% 48% 52% / 62% 62% 38% 38%;
  background: linear-gradient(135deg, #e3d99d, #9cac77 72%);
  box-shadow: inset 3px 3px 0 rgba(255,255,255,0.2), 2px 3px 0 rgba(24,36,19,0.44);
}

.nursery-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-template-rows: repeat(15, minmax(0, 1fr));
  gap: 1px;
  aspect-ratio: 12 / 15;
  padding: 3px;
  border: 2px solid rgba(24,36,19,0.72);
  border-radius: 4px;
  background: var(--screen);
  box-shadow: inset 0 0 12px rgba(24,36,19,0.27);
}

.nursery-cell {
  position: relative;
  min-width: 0;
  min-height: 0;
  background: rgba(24,36,19,0.08);
}

.nursery-cell:nth-child(odd) {
  background: rgba(24,36,19,0.14);
}

.nursery-cell.is-body::after,
.nursery-cell.is-head::after {
  content: "";
  position: absolute;
  inset: 16%;
  background: #29391f;
}

.nursery-cell.is-head::after {
  inset: 8%;
  background: #182413;
}

.nursery-cell.is-head::before {
  content: "";
  position: absolute;
  z-index: 1;
  width: 2px;
  height: 2px;
  top: 32%;
  left: 33%;
  background: #9cac77;
  box-shadow: 4px 0 0 #9cac77;
}

.nursery-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: #b6b8a2;
  font-size: 0.6rem;
  text-transform: uppercase;
}

.nursery-meta span:last-child {
  color: #9cac77;
  text-align: right;
}

.hatchling-list {
  display: grid;
  gap: 4px;
}

.hatchling-row {
  display: grid;
  gap: 3px;
  color: #d8d7c4;
  font-size: 0.62rem;
}

.hatchling-row-heading {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.hatchling-row-heading span:last-child {
  color: #9cac77;
}

.growth-bar {
  height: 5px;
  overflow: hidden;
  border: 1px solid #111712;
  border-radius: 99px;
  background: #252d26;
}

.growth-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #839f5f, #d9e5a5);
}

.colony-placeholder {
  min-height: 132px;
  align-content: center;
  justify-items: center;
  text-align: center;
}

.colony-placeholder strong {
  color: #f4efd8;
  font-size: 3rem;
  line-height: 0.9;
}

.colony-note {
  padding: 2px 4px;
  color: #b6b8a2;
  text-align: center;
}

.colony-income-summary {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 7px;
  border: 1px solid rgba(156,172,119,0.42);
  border-radius: 5px;
  color: #b6b8a2;
  font-size: 0.62rem;
  text-transform: uppercase;
}

.colony-income-summary strong {
  color: #d9e5a5;
  font-weight: 800;
}

.habitat-list {
  display: grid;
  gap: 6px;
}

.habitat-card {
  display: grid;
  gap: 4px;
  padding: 8px 9px 7px;
  border: 2px solid #1b211d;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.07), rgba(0,0,0,0.16)),
    #3a433c;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.11);
}

.habitat-card.is-locked {
  border-color: #252d26;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.03), rgba(0,0,0,0.22)),
    #303730;
}

.habitat-card-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 8px;
}

.habitat-name {
  display: block;
  margin-top: 4px;
  color: #f4efd8;
  font-size: 0.98rem;
  line-height: 1;
}

.habitat-state {
  color: #9cac77;
}

.habitat-card.is-locked .habitat-state,
.habitat-card.is-locked .habitat-name {
  color: #8b9184;
}

.habitat-stats {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: #d8d7c4;
  font-size: 0.68rem;
}

.habitat-income {
  color: #9cac77;
  text-align: right;
}

.habitat-unlock {
  min-height: 1.1em;
  margin: 0;
  color: #b6b8a2;
  font-size: 0.62rem;
  line-height: 1.2;
}

.habitat-milestones {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 7px;
  color: #7d8578;
  font-size: 0.59rem;
}

.habitat-milestone.is-earned {
  color: #d9e5a5;
}

.habitat-place-button {
  min-height: 25px;
}

.upgrade-card {
  display: grid;
  gap: 4px;
  padding: 8px 9px 7px;
  border: 2px solid #1b211d;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.07), rgba(0,0,0,0.16)),
    #3a433c;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.11);
}

.upgrade-card.is-maxed {
  border-color: #697b54;
}

.upgrade-card-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 8px;
}

.upgrade-label,
.upgrade-level {
  display: block;
  color: #b6b8a2;
  font-size: 0.62rem;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
}

.upgrade-card-heading strong {
  display: block;
  margin-top: 4px;
  color: #f4efd8;
  font-size: 0.98rem;
  line-height: 1;
}

.upgrade-level {
  padding-top: 2px;
  color: #9cac77;
  white-space: nowrap;
}

.upgrade-card p {
  min-height: 1.1em;
  margin: 0;
  color: #d8d7c4;
  font-size: 0.7rem;
  line-height: 1.2;
}

.upgrade-next {
  color: #9cac77 !important;
}

.upgrade-select {
  width: 100%;
  min-height: 28px;
  padding: 3px 8px;
  border: 2px solid #101713;
  border-radius: 5px;
  background: var(--screen);
  color: var(--screen-ink);
  font: 800 0.72rem/1 "Courier New", Courier, monospace;
  cursor: pointer;
}

.upgrade-button {
  min-height: 27px;
  border: 2px solid #07090c;
  border-radius: 999px / 72%;
  background: linear-gradient(180deg, #d9e5a5, #839f5f);
  color: #10180e;
  box-shadow:
    inset 0 2px 0 rgba(255,255,255,0.23),
    inset 0 -4px 6px rgba(0,0,0,0.28),
    0 2px 0 #050607;
  cursor: pointer;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
  text-transform: uppercase;
}

.upgrade-button:disabled {
  background: linear-gradient(180deg, #737a6a, #4b5148);
  color: #c2c6b7;
  cursor: not-allowed;
  filter: saturate(0.6);
}

.upgrade-button:not(:disabled):active {
  transform: translateY(2px);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.12),
    inset 0 -2px 6px rgba(0,0,0,0.34),
    0 0 0 #050607;
}

.phone-shell {
  position: relative;
  width: min(94vw, 340px);
  min-height: min(96vh, 760px);
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 10px;
  padding: 18px 19px 20px;
  border: 3px solid var(--case-edge);
  border-radius: 86px 76px 34px 34px / 58px 58px 28px 28px;
  background:
    radial-gradient(circle at 26% 18%, rgba(255,255,255,0.42), transparent 23%),
    linear-gradient(100deg, rgba(255,255,255,0.18), transparent 18% 78%, rgba(0,0,0,0.32)),
    linear-gradient(180deg, var(--case-light), var(--case) 54%, #34376d);
  box-shadow:
    inset 8px 0 14px rgba(255,255,255,0.13),
    inset -10px 0 18px rgba(0,0,0,0.34),
    inset 0 -12px 28px rgba(0,0,0,0.24),
    0 24px 70px rgba(0,0,0,0.5);
}

.phone-shell::before {
  content: "";
  position: absolute;
  top: -20px;
  right: 40px;
  width: 25px;
  height: 72px;
  border: 3px solid #111;
  border-radius: 12px 12px 8px 8px;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.17), transparent 42%, rgba(0,0,0,0.42)),
    linear-gradient(180deg, #39383d, #121316);
  box-shadow: inset 0 9px 0 rgba(255,255,255,0.07);
  z-index: -1;
}

.phone-shell::after {
  content: "";
  position: absolute;
  top: 32px;
  right: 34px;
  width: 19px;
  height: 19px;
  border: 3px solid #141722;
  border-radius: 50%;
  background:
    radial-gradient(circle at 57% 43%, #e9d9b6 0 12%, #1b1d25 13% 30%, #a59f88 31% 42%, #272a31 43%);
  box-shadow: 0 1px 2px rgba(255,255,255,0.25);
}

.phone-top {
  display: grid;
  justify-items: center;
  gap: 7px;
  padding-top: 2px;
}

.speaker-slot {
  width: 56px;
  height: 22px;
  display: block;
  border-radius: 14px;
  background:
    radial-gradient(ellipse at center, #111 0 24%, transparent 25%) 6px 7px / 12px 12px repeat-x;
  filter: drop-shadow(0 1px 0 rgba(255,255,255,0.2));
}

.phone-brand {
  min-width: 144px;
  padding: 4px 10px 3px;
  border-radius: 6px 6px 2px 2px;
  background: #101416;
  color: #eef1e6;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1;
  text-align: center;
  letter-spacing: 0;
}

.screen-frame {
  padding: 10px 9px 11px;
  border: 3px solid #111517;
  border-radius: 13px 13px 24px 24px / 11px 11px 20px 20px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.08), rgba(0,0,0,0.2)),
    #121617;
  box-shadow:
    inset 0 2px 0 rgba(255,255,255,0.1),
    0 4px 6px rgba(0,0,0,0.23);
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: 6px;
}

.status-strip div {
  min-width: 0;
  padding: 5px 4px 4px;
  border: 2px solid rgba(24, 36, 19, 0.58);
  border-radius: 4px;
  background: var(--screen);
  color: var(--screen-ink);
  text-align: center;
  box-shadow: inset 0 0 10px rgba(24,36,19,0.24);
}

.stat-label {
  display: block;
  margin-bottom: 1px;
  color: rgba(24, 36, 19, 0.75);
  font-size: clamp(0.48rem, 2.1vw, 0.58rem);
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
}

.status-strip strong {
  display: block;
  min-height: 1.2em;
  overflow: hidden;
  font-size: clamp(0.82rem, 4vw, 1.08rem);
  line-height: 1;
  letter-spacing: 0;
  text-shadow: 1px 1px 0 rgba(255,255,255,0.14);
}

.status-strip [hidden] {
  display: none;
}

.grid-select {
  display: block;
  width: 100%;
  min-height: 1.45rem;
  padding: 1px 2px;
  border: 1px solid rgba(24, 36, 19, 0.78);
  border-radius: 3px;
  background: rgba(231, 225, 197, 0.35);
  color: var(--screen-ink);
  font: 800 clamp(0.68rem, 3vw, 0.82rem)/1 "Courier New", Courier, monospace;
  cursor: pointer;
}

.grid-select[hidden] {
  display: none;
}

.screen-bezel {
  position: relative;
  padding: 7px;
  border: 2px solid rgba(24,36,19,0.72);
  border-radius: 5px;
  background: var(--screen);
  box-shadow:
    inset 0 0 0 3px rgba(255,255,255,0.08),
    inset 0 0 24px rgba(24,36,19,0.32);
}

canvas {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid rgba(24,36,19,0.52);
  border-radius: 3px;
  background: var(--screen);
  image-rendering: pixelated;
}

.screen-overlay {
  position: absolute;
  inset: 10px;
  display: grid;
  place-items: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 120ms ease;
}

.screen-overlay.visible {
  opacity: 1;
}

.screen-overlay p {
  margin: 0;
  padding: 7px 10px 6px;
  border: 2px solid var(--screen-ink);
  border-radius: 4px;
  background: rgba(156, 172, 119, 0.9);
  color: var(--screen-ink);
  font-size: clamp(0.9rem, 4.5vw, 1.42rem);
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
  box-shadow: 3px 3px 0 rgba(24,36,19,0.34);
}

.screen-hint {
  min-height: 1.15rem;
  margin: 7px 4px 0;
  color: rgba(231, 225, 197, 0.78);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity 120ms ease;
}

.screen-hint.is-visible {
  opacity: 1;
}

.personalization-screen {
  position: absolute;
  inset: 10px;
  z-index: 2;
  overflow: auto;
  padding: 12px 10px 10px;
  border: 2px solid var(--screen-ink);
  border-radius: 3px;
  background:
    linear-gradient(rgba(156, 172, 119, 0.94), rgba(156, 172, 119, 0.94)),
    var(--screen);
  color: var(--screen-ink);
  box-shadow: inset 0 0 18px rgba(24,36,19,0.2);
  font-size: clamp(0.62rem, 2.8vw, 0.76rem);
}

.snakebird-screen {
  position: absolute;
  inset: 10px;
  z-index: 2;
  padding: 12px 10px 10px;
  border: 2px solid var(--screen-ink);
  border-radius: 3px;
  background:
    linear-gradient(rgba(156, 172, 119, 0.94), rgba(156, 172, 119, 0.94)),
    var(--screen);
  color: var(--screen-ink);
  box-shadow: inset 0 0 18px rgba(24,36,19,0.2);
  font-size: clamp(0.62rem, 2.8vw, 0.76rem);
}

.snakebird-levels {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
  margin-top: 16px;
}

.snakebird-level-button {
  min-height: 42px;
  border: 2px solid var(--screen-ink);
  border-radius: 4px;
  background: rgba(24,36,19,0.12);
  color: var(--screen-ink);
  font: 800 0.9rem/1 "Courier New", Courier, monospace;
  cursor: pointer;
  box-shadow: 2px 2px 0 rgba(24,36,19,0.28);
}

.snakebird-level-button.is-selected,
.snakebird-level-button.is-cleared {
  background: var(--screen-ink);
  color: var(--screen);
}

.snakebird-level-button.is-locked {
  opacity: 0.4;
  cursor: not-allowed;
}

.snakebird-level-button:active:not(:disabled) {
  transform: translate(1px, 1px);
}

.snakebird-picker-status {
  min-height: 2.3em;
  margin: 14px 0 0;
  font-size: 0.64rem;
  line-height: 1.35;
  text-align: center;
}

.personalization-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 7px;
  border-bottom: 2px dashed rgba(24,36,19,0.58);
  font-size: 0.58rem;
  letter-spacing: 0.08em;
}

.personalization-heading strong {
  font-size: clamp(0.76rem, 3.4vw, 1rem);
  letter-spacing: 0;
}

.personalization-copy {
  margin: 9px 0 8px;
  font-size: 0.64rem;
}

.color-choice-group {
  margin-top: 8px;
}

.color-choice-label {
  display: block;
  margin-bottom: 5px;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.color-swatches {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.color-swatch {
  position: relative;
  min-height: 30px;
  padding: 3px;
  border: 2px solid var(--screen-ink);
  border-radius: 4px;
  background: var(--swatch);
  cursor: pointer;
  box-shadow: inset 0 2px 0 rgba(255,255,255,0.18), 2px 2px 0 rgba(24,36,19,0.28);
}

.color-swatch::after {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(255,255,255,0.22);
  pointer-events: none;
}

.color-swatch[aria-pressed="true"] {
  outline: 3px solid var(--screen-ink);
  outline-offset: 2px;
  transform: translate(-1px, -1px);
}

.personalization-back {
  width: 100%;
  margin-top: 14px;
  padding: 7px 5px 6px;
  border: 2px solid var(--screen-ink);
  border-radius: 4px;
  background: rgba(24,36,19,0.12);
  color: var(--screen-ink);
  font: 800 0.66rem/1 "Courier New", Courier, monospace;
  text-transform: uppercase;
  cursor: pointer;
}

.personalization-back:active,
.color-swatch:active {
  transform: translate(1px, 1px);
}

.broodline-screen { position: absolute; inset: 0; z-index: 4; padding: 18px; background: rgba(211, 218, 167, 0.97); color: var(--screen-ink); overflow: auto; }
.broodline-chain { display: grid; gap: 5px; margin: 12px 0; }
.broodline-card { display: flex; align-items: center; gap: 8px; padding: 7px; border: 2px solid var(--screen-ink); background: rgba(255,255,255,.18); font: 700 .64rem/1.1 "Courier New", monospace; text-align: left; cursor: pointer; }
.broodline-card.is-selected { background: var(--screen-ink); color: #dbe5ad; }
.broodline-card small { margin-left: auto; opacity: .75; }
.broodline-formation-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.controls {
  display: grid;
  align-content: start;
  gap: 10px;
  padding-top: 2px;
}

.phone-nav {
  width: min(72vw, 190px);
  height: 92px;
  justify-self: center;
  display: grid;
  grid-template-columns: 1fr 56px 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 7px 10px;
  align-items: center;
}

.nav-key,
.action-key,
.phone-key {
  border: 2px solid #07090c;
  color: var(--paper);
  background:
    linear-gradient(180deg, var(--key-light), var(--key));
  box-shadow:
    inset 0 2px 0 rgba(255,255,255,0.22),
    inset 0 -5px 7px rgba(0,0,0,0.38),
    0 3px 0 #050607;
}

.nav-key {
  width: 100%;
  min-height: 36px;
  cursor: pointer;
  line-height: 1;
  font-size: 1.05rem;
  transition: transform 90ms ease, box-shadow 90ms ease, filter 90ms ease;
}

.nav-up {
  grid-column: 2;
  grid-row: 1;
  height: 42px;
  border-radius: 34px 34px 13px 13px;
  transform: translateY(2px);
}

.nav-down {
  grid-column: 2;
  grid-row: 2;
  height: 42px;
  border-radius: 13px 13px 34px 34px;
  transform: translateY(-2px);
}

.nav-left,
.nav-right {
  height: 40px;
  border-radius: 28px 10px 10px 28px;
}

.nav-left {
  grid-column: 1;
  grid-row: 1 / 3;
  transform: rotate(-8deg);
}

.nav-right {
  grid-column: 3;
  grid-row: 1 / 3;
  border-radius: 10px 28px 28px 10px;
  transform: rotate(8deg);
}

.keypad {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px 9px;
  padding: 0 7px;
}

.minigame-keypad {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px 9px;
}

.action-key,
.phone-key {
  min-height: 31px;
  display: grid;
  place-items: center;
  border-radius: 999px / 72%;
  text-align: center;
  line-height: 1;
}

.minigame-key {
  cursor: pointer;
}

.minigame-key.is-locked {
  color: rgba(244, 239, 216, 0.34);
  background: linear-gradient(180deg, #62676b, #3c4145);
  filter: grayscale(1);
  cursor: not-allowed;
}

.minigame-key[data-minigame="0"] {
  grid-column: 2;
}

.action-key {
  padding: 6px 5px 5px;
  color: #f8f2df;
  font-size: clamp(0.64rem, 2.8vw, 0.8rem);
  font-weight: 800;
  text-transform: uppercase;
  cursor: pointer;
}

.action-key:first-child {
  background:
    linear-gradient(180deg, #9ed487, var(--green));
  color: #11190f;
}

.action-key:nth-child(3) {
  background:
    linear-gradient(180deg, #eeae68, var(--orange));
  color: #1d1308;
}

.phone-key {
  min-height: 27px;
  color: rgba(244, 239, 216, 0.92);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 0.74rem;
  font-weight: 800;
}

.grid-key {
  cursor: pointer;
}

.grid-key[aria-pressed="true"] {
  background:
    linear-gradient(180deg, #d9e5a5, #839f5f);
  color: #10180e;
}

.nav-key:active,
.nav-key.is-pressed,
.action-key:active,
.action-key.is-active {
  transform: translateY(3px);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.12),
    inset 0 -2px 6px rgba(0,0,0,0.34),
    0 1px 0 #050607;
  filter: brightness(1.18);
}

.nav-up:active,
.nav-up.is-pressed {
  transform: translateY(5px);
}

.nav-down:active,
.nav-down.is-pressed {
  transform: translateY(1px);
}

.nav-left:active,
.nav-left.is-pressed {
  transform: rotate(-8deg) translateY(3px);
}

.nav-right:active,
.nav-right.is-pressed {
  transform: rotate(8deg) translateY(3px);
}

@media (max-width: 430px) {
  body {
    padding: 8px;
  }

  .app-layout {
    width: min(95vw, 340px);
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .menu-panel {
    order: 2;
    width: 100%;
    margin-top: 0;
    padding: 12px;
  }

  .menu-panel h1 {
    margin-bottom: 9px;
  }

  .phone-shell {
    width: min(95vw, 340px);
    min-height: min(98vh, 740px);
    padding: 17px 16px 18px;
  }

  .keypad {
    gap: 7px 8px;
    padding-inline: 3px;
  }
}
