:root {
  --gold: #f1b842;
  --gold-soft: #ffe29a;
  --ink: #07111f;
  --panel: #0d1420;
  --panel-2: #121e2d;
  --text: #f7f1df;
  --muted: #aab7c9;
  --red: #ff4a43;
  --blue: #79ceff;
  --green: #5cff9a;
  --scale: 1;
  --stage-w: 390px;
  --ui-font: "Trebuchet MS", "Arial Black", Arial, Helvetica, sans-serif;
  --radius-sm: 8px;
  --radius-md: 12px;
  --gap: 8px;
}

* { box-sizing: border-box; }

* {
  scrollbar-width: none;
}

*::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  background:
    radial-gradient(circle at 16% 22%, rgba(35, 88, 126, .24), transparent 28%),
    radial-gradient(circle at 84% 18%, rgba(241, 184, 66, .14), transparent 25%),
    linear-gradient(90deg, #020711 0%, #07111f 50%, #020711 100%);
  color: var(--text);
  font-family: var(--ui-font);
  overflow-x: hidden;
  overflow-y: hidden;
  display: grid;
  place-items: start center;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

button,
input { font: inherit; }

button {
  cursor: pointer;
  color: inherit;
}

.app-shell {
  width: 390px;
  height: 844px;
  min-height: 0;
  position: absolute;
  left: 50%;
  top: 0;
  margin-left: -195px;
  transform: scale(var(--scale));
  transform-origin: top center;
  background: #020711;
  overflow: hidden;
  box-shadow: 0 0 50px rgba(0, 0, 0, .75);
}

.app-shell::before,
.app-shell::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 54px;
  z-index: 1;
  pointer-events: none;
  opacity: .72;
}

.app-shell::before {
  left: 0;
  background: linear-gradient(90deg, rgba(26, 74, 113, .36), rgba(26, 74, 113, 0));
}

.app-shell::after {
  right: 0;
  background: linear-gradient(270deg, rgba(241, 184, 66, .18), rgba(241, 184, 66, 0));
}

.screen {
  display: none;
  min-height: 0;
  height: 100%;
  position: relative;
  padding: 0;
}

.screen.active { display: block; }

.home-screen {
  background: #07111f;
  min-height: 0;
  height: 100%;
  display: none;
  place-items: start center;
}

.home-screen.active { display: grid; }

.poster-stage {
  width: 100%;
  height: 100%;
  min-height: 0;
  position: relative;
  overflow: hidden;
  background: #020711;
  font-size: 16px;
}

.home-screen.active .poster-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 5% 24%, rgba(72, 155, 219, .24), transparent 32%),
    radial-gradient(ellipse at 94% 20%, rgba(255, 207, 84, .18), transparent 30%),
    linear-gradient(90deg, rgba(0,0,0,.42), transparent 15%, transparent 85%, rgba(0,0,0,.38));
  mix-blend-mode: screen;
}

.home-screen.active .poster-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  opacity: .42;
  background: linear-gradient(115deg, transparent 0 28%, rgba(255, 232, 151, .18) 31%, transparent 35% 100%);
  transform: translateX(-80%);
  animation: poster-sweep 5.8s ease-in-out 1.2s infinite;
}

.hero-spec {
  position: absolute;
  inset: 0 0 59.4% 0;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: -10% 0 auto 0;
  width: 100%;
  height: 118%;
  object-fit: cover;
  object-position: center 18%;
  transform: scale(1.018);
  animation: museum-drift 12s ease-in-out infinite alternate;
}

.hero-spec::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 83% 36%, rgba(89, 187, 255, .14), transparent 24%),
    radial-gradient(circle at 28% 15%, rgba(255, 214, 86, .2), transparent 32%),
    linear-gradient(90deg, rgba(0, 0, 0, .34), rgba(0, 0, 0, .04) 46%, rgba(0, 0, 0, .14)),
    linear-gradient(180deg, rgba(0, 0, 0, 0) 54%, rgba(2, 7, 17, .88));
}

.game-logo { display: none; }

.hero-title {
  position: absolute;
  left: 18px;
  top: 8px;
  z-index: 3;
  text-align: center;
  text-transform: uppercase;
  line-height: .86;
  letter-spacing: 0;
  filter: drop-shadow(0 .34em .28em rgba(0,0,0,.88));
  animation: title-rise .7s cubic-bezier(.2,.8,.2,1) both;
}

.hero-title::after {
  content: "";
  display: block;
  width: 82%;
  height: 3px;
  margin: 7px auto 0;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(255, 232, 151, .92), transparent);
  box-shadow: 0 0 12px rgba(241, 184, 66, .6);
  animation: title-glow 2.6s ease-in-out infinite alternate;
}

.hero-title span {
  display: block;
  font-family: Impact, "Arial Black", var(--ui-font);
  font-weight: 900;
}

.hero-title .museum {
  color: #f4f1e8;
  font-size: 44px;
  text-shadow: 0 .035em 0 #b8b4aa, 0 .075em .08em rgba(0,0,0,.95), 0 0 .4em rgba(255,255,255,.15);
}

.hero-title .heist {
  color: var(--gold);
  font-size: 60px;
  text-shadow: 0 .035em 0 #7b4b0e, 0 .09em .08em rgba(0,0,0,.88), 0 0 .32em rgba(255,197,64,.22);
  animation: heist-shine 3.8s ease-in-out infinite;
}

.hero-title .puzzle {
  color: #f6f6f6;
  font-size: 16px;
  letter-spacing: .38em;
  margin-left: .36em;
  line-height: 1.25;
}

.thief-hero {
  position: absolute;
  right: -10px;
  bottom: 0;
  width: 40%;
  z-index: 2;
  filter: drop-shadow(0 .7em .5em rgba(0, 0, 0, .8));
  animation: kai-watch 4.2s ease-in-out infinite;
}

.home-menu {
  position: absolute;
  left: 12px;
  top: 170px;
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 8px;
  width: 256px;
  animation: menu-rise .72s cubic-bezier(.2,.8,.2,1) .12s both;
}

.home-menu .gold {
  grid-column: 1 / -1;
}

.asset-button {
  min-height: 48px;
  padding: 6px 9px;
  border: 0;
  background: url("assets/button-dark.png") center / 100% 100% no-repeat;
  display: flex;
  align-items: center;
  gap: 7px;
  text-align: left;
  text-transform: uppercase;
  font-weight: 900;
  letter-spacing: 0;
  text-shadow: 0 2px 2px rgba(0, 0, 0, .7);
  font-size: 10.5px;
  white-space: normal;
  overflow: hidden;
  filter: drop-shadow(0 5px 8px rgba(0,0,0,.42));
  transition: transform .12s ease, filter .12s ease;
  position: relative;
  isolation: isolate;
}

.asset-button::after {
  content: "";
  position: absolute;
  inset: 3px 5px;
  border-radius: 8px;
  background: linear-gradient(105deg, transparent 0 35%, rgba(255,255,255,.18) 42%, transparent 50% 100%);
  transform: translateX(-130%);
  opacity: .8;
  z-index: -1;
}

.home-screen.active .asset-button::after {
  animation: button-gleam 4.6s ease-in-out infinite;
}

.home-menu .asset-button:nth-child(2)::after { animation-delay: .35s; }
.home-menu .asset-button:nth-child(3)::after { animation-delay: .55s; }
.home-menu .asset-button:nth-child(4)::after { animation-delay: .75s; }
.home-menu .asset-button:nth-child(5)::after { animation-delay: .95s; }

.asset-button:hover {
  transform: translateY(-1px);
  filter: drop-shadow(0 7px 10px rgba(0,0,0,.5)) drop-shadow(0 0 8px rgba(241,184,66,.16));
}

.asset-button:active {
  transform: translateY(1px) scale(.985);
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.55));
}

.asset-button.gold { background-image: url("assets/button-gold.png"); color: #15100b; text-shadow: 0 1px 0 rgba(255, 255, 255, .35); }
.asset-button img { width: 27px; height: 27px; object-fit: contain; flex: 0 0 auto; position: relative; z-index: 1; }
.asset-button span { display: block; min-width: 0; line-height: 1.02; overflow: hidden; text-overflow: ellipsis; position: relative; z-index: 1; }
.asset-button small { color: inherit; opacity: .86; display: block; font-size: 8px; margin-top: 2px; text-transform: none; white-space: nowrap; font-weight: 900; letter-spacing: .01em; }
.asset-button span b { display: block; font-size: 12px; line-height: 1.02; }
.home-menu .asset-button:not(.gold) {
  justify-content: center;
  gap: 5px;
}

.home-menu .asset-button:not(.gold) span {
  text-align: center;
}

.continue-btn {
  justify-content: flex-start;
  min-height: 52px;
  padding-left: 17px;
  animation: continue-pulse 2.8s ease-in-out infinite;
}

.continue-btn img { width: 31px; height: 31px; margin-right: 2px; }
.continue-btn span b { font-size: 13px; letter-spacing: .01em; }
.continue-btn small { font-size: 8.8px; opacity: .82; margin-top: 3px; }

.daily-card {
  position: absolute;
  right: 16px;
  bottom: 28px;
  z-index: 3;
  width: 104px;
  min-height: 122px;
  padding: 10px 8px;
  color: var(--text);
  display: block;
  animation: daily-float 3.8s ease-in-out infinite;
}

.daily-card img { width: 38%; display: block; margin: .25em auto; filter: drop-shadow(0 0 10px rgba(241,184,66,.35)); animation: relic-pulse 2.4s ease-in-out infinite alternate; }
.daily-card span, .daily-card strong, .daily-card b { display: block; text-align: center; text-transform: uppercase; font-size: 10px; line-height: 1.08; }
.daily-card b { color: #ff4a43; }

.image-panel {
  background: linear-gradient(180deg, rgba(13, 21, 33, .94), rgba(5, 10, 18, .96));
  border: .12em solid rgba(241, 184, 66, .85);
  border-radius: .55em;
  box-shadow: inset 0 0 1.1em rgba(255, 217, 93, .08), 0 .45em .9em rgba(0, 0, 0, .55);
  padding: 18px;
}

.reference-game-panel {
  position: absolute;
  left: 6px;
  top: 342px;
  width: calc(100% - 12px);
  height: 302px;
  background: rgba(6, 10, 17, .96);
  border: .16em solid rgba(202, 215, 231, .7);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 0 1em rgba(0, 0, 0, .75), 0 0 22px rgba(241,184,66,.12), inset 0 0 1.8em rgba(255,255,255,.04);
}

.preview-hud {
  height: 40px;
  display: grid;
  grid-template-columns: 21% 37% 31% 8%;
  gap: .25em;
  padding: .18em .4em .12em;
  border-bottom: .1em solid rgba(202, 215, 231, .35);
}

.preview-hud > div {
  border-right: .1em solid rgba(202, 215, 231, .25);
  padding: .25em .5em;
  text-align: center;
}

.preview-hud span {
  display: block;
  color: var(--text);
  font-size: 8px;
  font-weight: 800;
  text-transform: uppercase;
}

.preview-hud strong {
  display: block;
  color: var(--gold);
  font-size: 18px;
  line-height: 1.05;
}

.preview-hud div:nth-child(2) strong {
  color: var(--text);
  font-size: 8px;
  margin-top: .55em;
  text-transform: none;
}

.alarm-bars {
  display: block;
  height: .86em;
  margin: .75em auto 0;
  width: 88%;
  background: linear-gradient(90deg, #f0352d 0 15%, #ff8b34 15% 38%, #ffe45d 38% 60%, #5be278 60% 78%, #213244 78%);
  box-shadow: inset 0 0 0 .08em rgba(255,255,255,.35);
}

.round-gear {
  border: 0;
  background: rgba(13, 20, 31, .9);
  border-radius: .7em;
  padding: .28em;
  min-width: 32px;
  min-height: 32px;
}

.round-gear img { width: 100%; height: 100%; object-fit: contain; }

.preview-board {
  height: 200px;
  position: relative;
  background: #171923;
}

.board-art {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #080c14;
}

.board-bg-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
}

.preview-sprite {
  position: absolute;
  width: 5.4%;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 .25em .22em rgba(0,0,0,.7));
}

.preview-sprite.kai { left: 31%; top: 45%; }
.preview-sprite.guard-a { left: 43%; top: 44%; }
.preview-sprite.guard-b { left: 70%; top: 58%; }
.preview-sprite.artifact { left: 74%; top: 38%; width: 6.3%; }
.preview-sprite.key { left: 44%; top: 73%; width: 4.6%; }

.preview-toolbar {
  height: 62px;
  display: flex;
  gap: .4em;
  align-items: stretch;
  padding: .5em .6em;
  border-top: .1em solid rgba(202, 215, 231, .35);
}

.poster-stage .preview-toolbar .tool-btn {
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
  height: 100%;
  padding: .25em .12em;
  font-size: 7px;
  line-height: 1.05;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .15em;
  overflow: hidden;
  background: rgba(9, 16, 27, .95);
  border: .1em solid rgba(202, 215, 231, .55);
  border-radius: .45em;
  text-align: center;
}

.poster-stage .preview-toolbar .tool-btn img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.poster-stage .preview-toolbar .tool-btn span {
  display: block;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.poster-stage .preview-toolbar .tool-btn b {
  top: .1em;
  right: .45em;
  font-size: 1.15em;
}

.feature-spec {
  position: absolute;
  left: 0;
  right: 0;
  top: 652px;
  bottom: 0;
  padding: 8px 6px 0;
  background: radial-gradient(circle at 50% -20%, rgba(22, 82, 128, .24), transparent 52%), #020711;
}

.feature-spec h2 {
  margin: 0 0 8px;
  color: var(--gold);
  text-transform: uppercase;
  text-align: center;
  font-size: 18px;
  line-height: 1;
}

.feature-cards {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  height: 128px;
}

.feature-cards article {
  min-width: 0;
  border: .1em solid rgba(241, 184, 66, .78);
  border-radius: 8px;
  background: rgba(5, 10, 18, .92);
  overflow: hidden;
  text-align: center;
  padding-bottom: .42em;
  display: grid;
  grid-template-rows: 52% auto 1fr;
  align-items: start;
}

.feature-cards img {
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  object-fit: contain;
  display: block;
  padding: .55em .55em 0;
}

.feature-cards strong {
  display: block;
  color: var(--gold);
  font-size: 8px;
  text-transform: uppercase;
  padding: .45em .2em .2em;
  line-height: 1.05;
}

.feature-cards span {
  display: block;
  font-size: 7px;
  line-height: 1.16;
  padding: 0 .38em;
}

.feature-spec p {
  position: absolute;
  left: 1.6%;
  right: 1.6%;
  bottom: 6px;
  margin: 0;
  text-align: center;
  color: #d8dbe2;
  font-weight: 800;
  text-transform: uppercase;
  font-size: 8px;
}

.feature-spec b { color: var(--gold); }

@keyframes museum-drift {
  from { transform: scale(1.018) translate3d(-3px, -2px, 0); }
  to { transform: scale(1.04) translate3d(4px, 2px, 0); }
}

@keyframes title-rise {
  from { opacity: 0; transform: translateY(-10px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes menu-rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes title-glow {
  from { opacity: .65; box-shadow: 0 0 8px rgba(241, 184, 66, .42); }
  to { opacity: 1; box-shadow: 0 0 18px rgba(241, 184, 66, .82); }
}

@keyframes heist-shine {
  0%, 100% { filter: brightness(1) saturate(1); }
  45% { filter: brightness(1.08) saturate(1.08); }
  55% { filter: brightness(1.18) saturate(1.12); }
}

@keyframes kai-watch {
  0%, 100% { transform: translateY(0) scale(1); filter: drop-shadow(0 .7em .5em rgba(0, 0, 0, .8)) drop-shadow(0 0 0 rgba(103, 205, 255, 0)); }
  50% { transform: translateY(-4px) scale(1.012); filter: drop-shadow(0 .78em .55em rgba(0, 0, 0, .82)) drop-shadow(0 0 12px rgba(103, 205, 255, .28)); }
}

@keyframes button-gleam {
  0%, 58%, 100% { transform: translateX(-130%); }
  72% { transform: translateX(130%); }
}

@keyframes continue-pulse {
  0%, 100% { filter: drop-shadow(0 5px 8px rgba(0,0,0,.42)) drop-shadow(0 0 0 rgba(241,184,66,0)); }
  50% { filter: drop-shadow(0 6px 10px rgba(0,0,0,.52)) drop-shadow(0 0 10px rgba(241,184,66,.28)); }
}

@keyframes daily-float {
  0%, 100% { transform: translateY(0); box-shadow: inset 0 0 1.1em rgba(255, 217, 93, .08), 0 .45em .9em rgba(0, 0, 0, .55); }
  50% { transform: translateY(-3px); box-shadow: inset 0 0 1.3em rgba(255, 217, 93, .12), 0 .62em 1.05em rgba(0, 0, 0, .62), 0 0 16px rgba(241, 184, 66, .16); }
}

@keyframes relic-pulse {
  from { transform: scale(1); }
  to { transform: scale(1.06); }
}

@keyframes poster-sweep {
  0%, 62%, 100% { transform: translateX(-80%); opacity: 0; }
  70% { opacity: .42; }
  88% { transform: translateX(80%); opacity: 0; }
}

.menu-screen {
  background: linear-gradient(rgba(4, 9, 18, .82), rgba(4, 9, 18, .92)), url("assets/home-museum.webp") center / cover no-repeat;
  padding: 16px;
}

.screen-header {
  display: grid;
  grid-template-columns: 64px 1fr 64px;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.screen-header h1 {
  margin: 0;
  color: var(--gold);
  font-size: 22px;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: .05em;
  text-shadow: 0 .08em .08em rgba(0,0,0,.9);
}

.icon-btn,
.tool-btn {
  border: 0;
  min-height: 48px;
  padding: 8px 12px;
  background: url("assets/button-dark.png") center / 100% 100% no-repeat;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text);
}

.level-list {
  display: grid;
  gap: .68em;
  padding-bottom: .8em;
  height: calc(100% - 72px);
  overflow-y: auto;
  padding-right: .25em;
  scrollbar-width: none;
}

.chapter-row {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 4px 2px -2px;
  padding: 0 8px;
  color: var(--gold);
  text-transform: uppercase;
  font-weight: 900;
  letter-spacing: .04em;
  text-shadow: 0 2px 2px rgba(0,0,0,.85);
}

.chapter-row span {
  font-size: 15px;
}

.chapter-row b {
  color: var(--gold-soft);
  font-size: 10px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(241, 184, 66, .38);
  background: rgba(5, 10, 18, .62);
}

.level-card {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 72px;
  border: 1px solid rgba(241, 184, 66, .72);
  border-radius: 12px;
  width: 100%;
  color: var(--text);
  text-align: left;
  background: linear-gradient(90deg, rgba(13, 22, 34, .96), rgba(9, 15, 25, .9));
  box-shadow: inset 0 0 1em rgba(255, 213, 93, .06), 0 .35em .8em rgba(0,0,0,.55);
  padding: 10px 12px;
  overflow: hidden;
}

.level-card:disabled {
  opacity: .72;
  filter: saturate(.65);
}

.level-card img { width: 48px; height: 48px; object-fit: contain; }
.level-card strong {
  display: block;
  color: var(--gold);
  font-size: 15px;
  line-height: 1.02;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.level-card span span {
  display: block;
  color: #dce8ff;
  font-size: 12px;
  line-height: 1.05;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.level-card b {
  display: grid;
  justify-items: end;
  gap: 2px;
  color: var(--gold-soft);
  font-size: 12px;
  text-shadow: 0 .08em .1em rgba(0,0,0,.8);
  line-height: 1.05;
  min-width: 54px;
}

.level-card b em {
  font-style: normal;
  color: var(--gold);
  font-size: 10px;
  letter-spacing: .08em;
}

.level-card.rating-perfect-heist {
  border-color: rgba(255, 226, 154, .98);
  box-shadow: inset 0 0 1.15em rgba(255, 213, 93, .12), 0 .35em .8em rgba(0,0,0,.55), 0 0 14px rgba(241, 184, 66, .12);
}

.level-card.rating-clean-heist {
  border-color: rgba(121, 206, 255, .82);
}

.level-card.rating-new b em {
  color: #79ceff;
}

.game-screen {
  padding: 4px;
  background: #030711;
  display: none;
}

.game-screen.active {
  display: grid;
  grid-template-rows: 64px auto 116px;
  gap: 8px;
  align-content: start;
}

.hud {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) 104px 48px;
  gap: 8px;
  align-items: stretch;
  min-width: 0;
}

.hud > div,
.hud .icon-btn {
  min-height: 0;
  padding: 8px;
  background: rgba(9, 16, 27, .94);
  border: 1px solid rgba(186, 205, 230, .35);
  border-radius: .48em;
  box-shadow: inset 0 0 18px rgba(255, 255, 255, .04);
}

.hud-gear {
  display: grid;
  place-items: center;
  width: 48px;
  min-width: 48px;
  padding: 8px;
}

.hud-gear img {
  width: 72%;
  height: 72%;
  object-fit: contain;
}

.hud span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.hud strong {
  display: block;
  color: var(--gold);
  font-size: 29px;
  line-height: 1.05;
}

.hud .objective strong {
  color: var(--text);
  font-size: 11px;
  margin-top: .28em;
  line-height: 1.05;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

meter {
  width: 100%;
  height: .72em;
  margin-top: .75em;
  accent-color: var(--red);
}

.board-wrap {
  min-height: 0;
  position: relative;
  display: grid;
  place-items: start center;
}

#game-canvas {
  width: 100%;
  max-height: 100%;
  aspect-ratio: 16 / 25;
  border-radius: .58em;
  border: .14em solid rgba(241, 184, 66, .7);
  background: #161922;
  touch-action: none;
}

#game-canvas.action-kick {
  animation: board-kick .24s ease-out;
}

@keyframes board-kick {
  0% { transform: translateY(0) scale(1); }
  36% { transform: translateY(-3px) scale(1.006); }
  68% { transform: translateY(1px) scale(.998); }
  100% { transform: translateY(0) scale(1); }
}

.toast {
  position: absolute;
  left: 50%;
  top: 12px;
  transform: translateX(-50%);
  min-width: 180px;
  max-width: 88%;
  padding: 9px 14px;
  border-radius: 99px;
  background: rgba(6, 10, 18, .88);
  border: 1px solid rgba(241, 184, 66, .7);
  color: var(--gold-soft);
  font-weight: 800;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .16s ease;
}

.toast.show { opacity: 1; }

.play-hint {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%) translateY(8px);
  width: min(320px, 86%);
  min-height: 34px;
  display: grid;
  place-items: center;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(241, 184, 66, .62);
  background: rgba(5, 10, 18, .88);
  box-shadow: 0 8px 18px rgba(0,0,0,.52), inset 0 0 16px rgba(255, 213, 93, .06);
  color: #fff7dc;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.15;
  text-align: center;
  text-shadow: 0 1px 2px rgba(0,0,0,.9);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}

.play-hint.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.game-controls {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  min-height: 0;
  height: 116px;
  align-self: stretch;
  padding: 8px 2px 6px;
  border-top: 1px solid rgba(241, 184, 66, .18);
  background: linear-gradient(180deg, rgba(5, 9, 17, .35), rgba(3, 6, 12, .78));
}

.tool-btn {
  min-height: 0;
  height: 96px;
  padding: 10px 4px 8px;
  font-size: 8px;
  position: relative;
  display: grid;
  grid-template-rows: 1fr auto;
  align-items: end;
  justify-items: center;
  overflow: hidden;
  border-radius: 8px;
  line-height: 1;
  letter-spacing: .01em;
  text-shadow: 0 1px 2px rgba(0,0,0,.95);
  filter: drop-shadow(0 4px 8px rgba(0,0,0,.5));
  transition: transform .12s ease, filter .12s ease;
}

.tool-btn::after {
  content: "";
  position: absolute;
  inset: 8px 7px auto;
  height: 32px;
  border-radius: 7px;
  background: linear-gradient(180deg, rgba(255, 216, 98, .13), rgba(255, 216, 98, 0));
  pointer-events: none;
}

.tool-btn:active {
  transform: translateY(1px) scale(.985);
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.55));
}

.tool-btn img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  align-self: center;
  margin-bottom: 2px;
  z-index: 1;
}

.tool-btn span {
  width: 100%;
  min-height: 18px;
  display: grid;
  place-items: center;
  color: #fff7dc;
  z-index: 1;
}

.tool-btn b {
  position: absolute;
  top: 8px;
  right: 7px;
  min-width: 17px;
  height: 17px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(5, 9, 17, .92);
  border: 1px solid rgba(255, 218, 111, .78);
  color: var(--gold-soft);
  font-size: 10px;
  line-height: 1;
  box-shadow: 0 2px 6px rgba(0,0,0,.55);
  z-index: 2;
}

.tool-btn.active {
  outline: 2px solid var(--gold);
  outline-offset: -3px;
  box-shadow: inset 0 0 18px rgba(255, 210, 75, .22);
}

.tool-btn.danger span { color: #ff948c; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: 176px;
  gap: 12px;
  height: calc(100% - 72px);
  overflow-y: auto;
  padding-right: 4px;
  align-content: start;
  scrollbar-width: none;
}

.info-card {
  min-height: 0;
  padding: 14px;
  text-align: center;
  background: rgba(6, 10, 18, .78);
  border: 1px solid rgba(241, 184, 66, .55);
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(0,0,0,.45), inset 0 0 18px rgba(255, 213, 93, .05);
  display: grid;
  grid-template-rows: 82px auto 1fr;
  align-items: start;
  justify-items: center;
  overflow: hidden;
}

.info-card img { width: 76px; height: 76px; object-fit: contain; }
.info-card h2 { margin: 8px 0 6px; color: var(--gold); font-size: 15px; line-height: 1.05; }
.info-card p { margin: 0; color: var(--text); font-size: 12px; line-height: 1.2; }

.daily-large {
  width: 100%;
  min-height: 360px;
  margin: 56px auto 0;
  text-align: center;
}

.daily-large img { width: 132px; height: 132px; object-fit: contain; }
.daily-large h2 { color: var(--gold); text-transform: uppercase; font-size: 24px; margin: 12px 0 8px; }
.daily-large p { font-size: 14px; margin: 0 0 20px; }
.daily-large .asset-button { width: 240px; margin: 16px auto 0; justify-content: center; font-size: 16px; }

.settings-list {
  width: 100%;
  margin: 40px auto 0;
  display: grid;
  gap: 16px;
  padding: 24px 18px;
}

.settings-list label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 56px;
  padding: 0 16px;
  font-weight: 800;
  text-transform: uppercase;
}

.settings-list input { width: 24px; height: 24px; accent-color: var(--gold); }

.settings-list .asset-button {
  justify-content: center;
  text-align: center;
  min-height: 56px;
  font-size: 12px;
}

.modal {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .72);
  z-index: 20;
  place-items: center;
  padding: 22px;
}

.modal.active { display: grid; }

.modal-card {
  width: 320px;
  display: grid;
  gap: 12px;
  text-align: center;
}

.modal-card h2 {
  margin: 0;
  color: var(--gold);
  text-transform: uppercase;
  font-size: 28px;
}

.modal-card img { width: 112px; height: 112px; object-fit: contain; margin: 0 auto; }
.modal-card p { margin: 0; color: var(--text); font-size: 14px; line-height: 1.25; }

.modal-card .asset-button {
  justify-content: center;
  min-height: 52px;
  font-size: 15px;
}

.guide-card {
  width: 332px;
  min-height: 394px;
  padding: 20px 18px 16px;
  text-align: center;
  overflow: hidden;
}

.guide-top {
  display: grid;
  justify-items: center;
  gap: 4px;
  margin-bottom: 8px;
}

.guide-top img {
  width: 92px;
  height: 92px;
  object-fit: contain;
  filter: drop-shadow(0 0 18px rgba(241,184,66,.28));
}

.guide-top span {
  color: var(--gold-soft);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .12em;
}

.guide-card h2 {
  margin: 4px 0 10px;
  color: var(--gold);
  font-size: 24px;
  line-height: 1;
  text-transform: uppercase;
  text-shadow: 0 2px 2px rgba(0,0,0,.9);
}

.guide-card p {
  min-height: 70px;
  margin: 0 auto 14px;
  color: #fff7dc;
  font-size: 14px;
  line-height: 1.25;
  max-width: 270px;
}

.guide-dots {
  display: flex;
  justify-content: center;
  gap: 7px;
  margin: 4px 0 16px;
}

.guide-dots i {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: rgba(170, 183, 201, .34);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.18);
}

.guide-dots i.active {
  width: 22px;
  background: var(--gold);
  box-shadow: 0 0 10px rgba(241,184,66,.42);
}

.guide-actions {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 10px;
}

.guide-actions .asset-button {
  min-height: 50px;
  justify-content: center;
}

body.high-contrast #game-canvas,
body.high-contrast .info-card,
body.high-contrast .hud > div {
  border-color: #fff4b7;
}

@media (min-width: 720px) {
  .game-screen.active {
    grid-template-columns: none;
    grid-template-rows: 64px auto 112px;
  }

  .hud {
    grid-column: 1 / -1;
  }

  .game-controls {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    align-content: stretch;
  }
}

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