:root {
  --ink: #f2eedb;
  --muted: #aab8a0;
  --deep: #0b1d18;
  --panel: rgba(18, 43, 33, 0.8);
  --panel-border: rgba(218, 203, 154, 0.22);
  --violet: #6d9270;
  --hot: #dc7458;
  --saffron: #f2bf57;
  --lime: #bedb69;
  --mint: #8bc998;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--deep);
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--deep); }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    linear-gradient(135deg, rgba(4, 22, 17, 0.93), rgba(14, 39, 27, 0.86)),
    url("assets/monsoon-courtyard.png") center / cover fixed;
}

button { font: inherit; }

.page-noise {
  position: fixed;
  z-index: 0;
  inset: 0;
  pointer-events: none;
  opacity: 0.14;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.13'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1240px, 100%);
  margin: 0 auto;
  padding: clamp(28px, 5vw, 68px) clamp(18px, 3.8vw, 42px) 24px;
}

.site-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: clamp(28px, 4vw, 46px);
}

.eyebrow,
.card-label,
.overlay-kicker {
  margin: 0;
  color: var(--muted);
  font-size: 0.67rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  line-height: 1.4;
}

.eyebrow { color: #b8ce95; }

.eyebrow-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin: 0 7px 1px 0;
  border-radius: 50%;
  background: var(--saffron);
  box-shadow: 0 0 0 4px rgba(242, 191, 87, 0.13), 0 0 16px rgba(242, 191, 87, 0.52);
}

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

h1 {
  margin: 8px 0 2px;
  color: #fff;
  font-size: clamp(2.45rem, 6vw, 5.2rem);
  font-weight: 950;
  letter-spacing: -0.07em;
  line-height: 0.86;
  text-wrap: balance;
}

h1 span {
  color: var(--saffron);
  text-shadow: 0 0 28px rgba(242, 191, 87, 0.2);
}

.tagline {
  margin: 12px 0 0 2px;
  color: #c9d5c1;
  font-size: 0.94rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.header-badge {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 198px;
  margin-top: 6px;
  padding: 13px 16px;
  border: 1px solid rgba(240, 191, 87, 0.35);
  border-radius: 15px;
  color: #e0e6cf;
  background: rgba(24, 66, 43, 0.66);
  font-size: 0.73rem;
  line-height: 1.4;
}

.header-badge strong { color: var(--saffron); }
.badge-icon { color: var(--saffron); font-size: 1.4rem; }

.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 285px;
  align-items: stretch;
  gap: clamp(18px, 3vw, 36px);
}

.game-column { min-width: 0; }

.game-stage {
  position: relative;
  width: 100%;
  min-height: 410px;
  overflow: hidden;
  border: 1px solid rgba(224, 207, 156, 0.42);
  border-radius: clamp(18px, 2.5vw, 28px);
  background: #183629 url("assets/monsoon-courtyard.png") center / cover;
  box-shadow:
    0 28px 70px rgba(2, 14, 8, 0.48),
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    0 0 44px rgba(229, 175, 80, 0.12);
  aspect-ratio: 20 / 19;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: auto;
  touch-action: none;
}

.canvas-shine {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(113deg, rgba(255, 248, 218, 0.11), transparent 20%, transparent 75%, rgba(227, 164, 70, 0.08));
  mix-blend-mode: soft-light;
}

.game-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  display: flex;
  width: min(80%, 390px);
  align-items: center;
  flex-direction: column;
  padding: 30px 28px 26px;
  border: 1px solid rgba(236, 221, 162, 0.35);
  border-radius: 21px;
  text-align: center;
  background: linear-gradient(145deg, rgba(14, 54, 36, 0.88), rgba(8, 30, 23, 0.89));
  box-shadow: 0 18px 55px rgba(2, 14, 8, 0.52), inset 0 1px 0 rgba(255,255,255,0.1);
  backdrop-filter: blur(10px);
  transform: translate(-50%, -50%);
  transition: opacity 180ms ease, transform 180ms ease, visibility 180ms ease;
}

.game-overlay.is-hidden {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -45%);
}

.overlay-kicker { color: var(--saffron); }

.game-overlay h2 {
  margin: 9px 0 9px;
  color: #fff;
  font-size: clamp(1.55rem, 3vw, 2rem);
  font-weight: 900;
  letter-spacing: -0.04em;
}

.game-overlay > p:not(.overlay-kicker) {
  max-width: 30ch;
  margin-bottom: 20px;
  color: #d4ddc8;
  font-size: 0.89rem;
  line-height: 1.55;
}

.primary-button,
.pause-button,
.control-button {
  border: 0;
  cursor: pointer;
  transition: transform 150ms ease, filter 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  gap: 20px;
  padding: 12px 13px 12px 19px;
  border-radius: 999px;
  color: #182213;
  background: #d6e37c;
  box-shadow: 0 10px 26px rgba(161, 201, 81, 0.26);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.015em;
}

.primary-button:hover { filter: brightness(1.07); transform: translateY(-2px); }
.primary-button:active { transform: translateY(1px) scale(0.98); }

.button-arrow {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  border-radius: 50%;
  color: #f6e4ad;
  background: #285039;
  font-size: 1rem;
}

.combo-pop {
  position: absolute;
  top: 18%;
  left: 50%;
  z-index: 3;
  opacity: 0;
  color: #ffe7a0;
  font-size: clamp(1rem, 2.5vw, 1.45rem);
  font-weight: 950;
  letter-spacing: -0.04em;
  pointer-events: none;
  text-shadow: 0 0 18px rgba(242, 191, 87, 0.85);
  transform: translate(-50%, 6px) scale(0.86);
}

.combo-pop.show { animation: combo-float 1.2s cubic-bezier(.18,.7,.23,1) forwards; }

@keyframes combo-float {
  0% { opacity: 0; transform: translate(-50%, 12px) scale(0.78); }
  18% { opacity: 1; transform: translate(-50%, 0) scale(1.04); }
  80% { opacity: 1; transform: translate(-50%, -32px) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -48px) scale(0.96); }
}

.desktop-hint {
  margin: 15px 0 0;
  color: #aebaa1;
  font-size: 0.73rem;
  font-weight: 650;
  text-align: center;
}

kbd {
  display: inline-flex;
  min-width: 19px;
  height: 19px;
  align-items: center;
  justify-content: center;
  margin: 0 1px;
  padding: 0 5px;
  border: 1px solid rgba(212, 222, 188, 0.25);
  border-bottom-color: rgba(212, 222, 188, 0.12);
  border-radius: 5px;
  color: #d9e2cc;
  background: rgba(194, 221, 164, 0.09);
  font-family: inherit;
  font-size: 0.62rem;
}

.game-sidebar {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 12px;
}

.score-card,
.mission-card,
.how-to-card {
  border: 1px solid var(--panel-border);
  border-radius: 17px;
  background: linear-gradient(145deg, rgba(25, 62, 43, 0.9), rgba(11, 37, 27, 0.88));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), 0 14px 30px rgba(2, 19, 11, 0.16);
}

.score-card-primary {
  position: relative;
  overflow: hidden;
  min-height: 150px;
  padding: 19px 20px;
  border-color: rgba(212, 224, 134, 0.34);
  background:
    radial-gradient(circle at 88% 15%, rgba(242, 191, 87, 0.2), transparent 7rem),
    linear-gradient(130deg, rgba(49, 82, 48, 0.95), rgba(17, 49, 34, 0.92));
}

.score-card-primary::after {
  position: absolute;
  right: -39px;
  bottom: -51px;
  width: 160px;
  height: 160px;
  border: 1px solid rgba(242, 191, 87, 0.18);
  border-radius: 50%;
  content: "";
}

.card-label { color: #aebba1; font-size: 0.61rem; }
.score-card-primary .card-label { color: #d8d9a7; }

.score-number {
  position: relative;
  z-index: 1;
  margin: 5px 0 0;
  color: #fff9df;
  font-size: 4.1rem;
  font-weight: 950;
  letter-spacing: -0.09em;
  line-height: 0.98;
}

.score-snake {
  position: absolute;
  right: 17px;
  bottom: 20px;
  display: flex;
  align-items: center;
  gap: 4px;
  transform: rotate(-16deg);
}

.score-snake span,
.score-snake i {
  display: block;
  width: 14px;
  height: 14px;
  border-radius: 5px 7px 7px 5px;
  background: #bad963;
  box-shadow: 0 4px 0 #547539;
}

.score-snake span:nth-child(2) { opacity: .8; }
.score-snake span:nth-child(3) { opacity: .62; }
.score-snake span:nth-child(4) { opacity: .45; }
.score-snake i { width: 19px; height: 17px; border-radius: 8px 10px 10px 8px; background: #e8ef9c; }

.score-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.compact-card { min-width: 0; padding: 15px 14px 13px; }
.compact-number { margin: 6px 0 0; color: #f2f0d9; font-size: 1.7rem; font-weight: 900; letter-spacing: -0.06em; line-height: 1; }
.heat-card { border-color: rgba(242, 191, 87, 0.28); background: linear-gradient(140deg, rgba(73, 67, 31, 0.86), rgba(40, 47, 27, 0.86)); }
.heat-card .compact-number { color: #f7d47a; }

.mission-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 15px;
  color: #d6dfca;
  font-size: 0.75rem;
  line-height: 1.5;
}

.mission-card p { margin: 3px 0 0; }
.mission-card strong { color: var(--saffron); }

.mission-icon {
  display: grid;
  width: 29px;
  height: 29px;
  flex: none;
  place-items: center;
  border-radius: 10px;
  color: #ffd369;
  background: rgba(242, 191, 87, 0.14);
  box-shadow: inset 0 0 0 1px rgba(242, 191, 87, 0.24);
  font-size: 1rem;
}

.pause-button {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 46px;
  border: 1px solid rgba(205, 218, 174, 0.27);
  border-radius: 13px;
  color: #e2ebd7;
  background: rgba(62, 109, 69, 0.27);
  font-size: 0.79rem;
  font-weight: 800;
}

.pause-button:not(:disabled):hover { border-color: rgba(218, 224, 134, 0.62); color: #eff6b7; background: rgba(191, 221, 120, .11); transform: translateY(-1px); }
.pause-button:disabled { cursor: not-allowed; opacity: .45; }
.pause-mark { font-size: 1rem; letter-spacing: -0.15em; }

.how-to-card { padding: 16px; }
.how-to-card ul { display: grid; gap: 8px; margin: 11px 0 0; padding: 0; list-style: none; }
.how-to-card li { color: #d0dac4; font-size: .73rem; font-weight: 650; }
.how-to-card li span { display: inline-block; width: 28px; color: #91ad7f; font-size: .61rem; font-weight: 900; letter-spacing: .09em; }

.mobile-controls { display: none; }

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-top: clamp(28px, 5vw, 52px);
  padding: 17px 0 0;
  border-top: 1px solid rgba(210, 218, 178, 0.16);
  color: #91a08c;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.site-footer i { display: inline-block; width: 6px; height: 6px; margin: 0 7px 1px 0; border-radius: 50%; background: var(--saffron); box-shadow: 0 0 8px var(--saffron); }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

button:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }

@media (max-width: 830px) {
  .game-layout { grid-template-columns: minmax(0, 1fr) 238px; gap: 18px; }
  .score-number { font-size: 3.4rem; }
  .score-card-primary { min-height: 136px; }
  .header-badge { display: none; }
}

@media (max-width: 700px) {
  .site-header { margin-bottom: 24px; }
  .game-layout { display: flex; flex-direction: column; }
  .game-sidebar { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .score-card-primary { grid-column: span 2; min-height: 128px; }
  .score-number { font-size: 3.5rem; }
  .mission-card { grid-column: span 2; }
  .pause-button { grid-column: span 2; }
  .how-to-card { display: none; }
  .desktop-hint { display: none; }
  .mobile-controls { display: grid; grid-template-columns: repeat(3, 58px); grid-template-rows: repeat(2, 50px); justify-content: center; gap: 7px; margin-top: 14px; }
  .control-button { display: grid; place-items: center; border: 1px solid rgba(215, 223, 188, 0.26); border-radius: 13px; color: #e2edd8; background: rgba(53, 102, 65, 0.42); font-size: 1rem; }
  .control-button:active { color: #1d2914; background: #d6e37c; transform: scale(.94); }
  .control-up { grid-column: 2; grid-row: 1; }
  .control-left { grid-column: 1; grid-row: 2; }
  .control-down { grid-column: 2; grid-row: 2; }
  .control-right { grid-column: 3; grid-row: 2; }
  .site-footer { flex-direction: column; gap: 9px; margin-top: 28px; font-size: .55rem; }
}

@media (max-width: 430px) {
  .app-shell { padding: 25px 14px 18px; }
  h1 { font-size: 2.55rem; }
  .tagline { font-size: .83rem; }
  .game-stage { min-height: 340px; border-radius: 18px; }
  .game-overlay { width: 84%; padding: 24px 18px 21px; }
  .game-overlay > p:not(.overlay-kicker) { font-size: .8rem; }
  .game-sidebar { gap: 8px; }
  .score-card-primary { padding: 16px; }
  .score-number { font-size: 3.1rem; }
  .compact-card { padding: 13px 12px; }
}

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