:root {
  --safe-top: env(safe-area-inset-top);
  --safe-bottom: env(safe-area-inset-bottom);
  color-scheme: dark;
  font-family:
    ui-rounded,
    "SF Pro Rounded",
    "Avenir Next",
    system-ui,
    sans-serif;
  background: #1f2425;
  color: #eadbb4;
  touch-action: none;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  min-height: 100dvh;
  margin: 0;
  overflow: hidden;
  background: #252827;
}

body {
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  min-height: -webkit-fill-available;
}

button {
  border: 0;
  font: inherit;
}

.game-shell {
  position: fixed;
  inset: 0 0 calc(-1 * env(safe-area-inset-bottom)) 0;
  height: calc(100dvh + env(safe-area-inset-bottom));
  min-height: calc(100svh + env(safe-area-inset-bottom));
  background: #252827;
}

#game {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  touch-action: none;
}

.boot-intro {
  position: absolute;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  background: #020303;
  color: #eadbb4;
  opacity: 0;
  pointer-events: none;
}

.boot-intro.is-open {
  opacity: 1;
  pointer-events: auto;
}

.boot-intro.is-fading {
  animation: intro-fade-out 900ms ease forwards;
}

.intro-stage {
  position: relative;
  width: min(460px, 100vw);
  height: 100svh;
  overflow: hidden;
}

.intro-leader {
  position: absolute;
  left: max(3%, calc(50% - 158px));
  bottom: 20%;
  width: 28px;
  height: 48px;
  transform-origin: center bottom;
  animation: intro-leader-walk 2.1s 0.1s ease-in-out forwards;
}

.intro-leader span {
  position: absolute;
  display: block;
}

.intro-leader-shadow {
  left: 1px;
  bottom: -3px;
  width: 28px;
  height: 7px;
  border-radius: 50%;
  background: rgba(234, 219, 180, 0.16);
}

.intro-leader-leg {
  bottom: 3px;
  width: 7px;
  height: 17px;
  background: #171918;
}

.intro-leader-leg-a {
  left: 7px;
  animation: intro-leg-a 440ms steps(2, end) infinite;
}

.intro-leader-leg-b {
  right: 7px;
  animation: intro-leg-b 440ms steps(2, end) infinite;
}

.intro-leader-body {
  left: 6px;
  bottom: 17px;
  width: 16px;
  height: 22px;
  border: 2px solid #0a0b0b;
  background: #6d2f2c;
  box-shadow: inset -5px 0 0 rgba(0, 0, 0, 0.32);
}

.intro-leader-head {
  left: 8px;
  bottom: 39px;
  width: 12px;
  height: 10px;
  border: 2px solid #0a0b0b;
  background: #c79263;
}

.intro-leader-hat {
  left: 5px;
  bottom: 48px;
  width: 18px;
  height: 6px;
  border: 2px solid #0a0b0b;
  background: #263331;
  box-shadow: inset 7px 0 0 #a83f36;
}

.intro-leader-arm {
  right: 1px;
  bottom: 25px;
  width: 5px;
  height: 15px;
  background: #171918;
  animation: intro-arm 440ms steps(2, end) infinite;
}

/* Building — grounded at bottom, 5-wide façade */
.intro-bloc {
  position: absolute;
  left: 50%;
  bottom: 18%;
  display: grid;
  grid-template-columns: repeat(5, 18px);
  grid-auto-rows: 16px;
  gap: 3px;
  padding: 8px 7px 5px;
  border: 3px solid #0a0b0b;
  background: #706b5f;
  box-shadow:
    inset 0 8px 0 #8a5f45,
    0 0 0 2px rgba(234, 219, 180, 0.1);
  transform-origin: center bottom;
  opacity: 0;
  animation:
    intro-bloc-transform 7.2s 0s ease forwards,
    intro-bloc-walls 0.85s 3.05s ease-in forwards;
}

/* Dust puffs at building base after crumble */
.intro-bloc::before,
.intro-bloc::after {
  content: "";
  position: absolute;
  bottom: -6px;
  width: 32px;
  height: 28px;
  border-radius: 50%;
  background: rgba(175, 158, 122, 0.6);
  opacity: 0;
  animation: intro-dust-puff 1.2s 3.05s ease-out forwards;
}

.intro-bloc::before {
  left: -24px;
}

.intro-bloc::after {
  right: -24px;
}

/* Window cells — each span is one window */
.intro-bloc span {
  width: 16px;
  height: 11px;
  border: 2px solid #0a0b0b;
  background: #d6a741;
  transform-origin: center center;
  animation: intro-floor-collapse 1.05s 3.08s ease-in forwards;
}

.intro-bloc span:nth-child(even) {
  background: #3f5f63;
}

.intro-bloc span:nth-child(3n) {
  background: #2a2820;
}

.intro-bloc span:nth-child(7n + 1) {
  background: #c49850;
}

/* Fall direction per column position */
.intro-bloc span:nth-child(5n + 1) { --fall-x: -20px; --fall-r: -22deg; }
.intro-bloc span:nth-child(5n + 2) { --fall-x: -9px;  --fall-r: -11deg; }
.intro-bloc span:nth-child(5n + 3) { --fall-x:  3px;  --fall-r:   6deg; }
.intro-bloc span:nth-child(5n + 4) { --fall-x: 14px;  --fall-r:  14deg; }
.intro-bloc span:nth-child(5n + 0) { --fall-x: 24px;  --fall-r:  24deg; }

/* Row stagger: top row falls first */
.intro-bloc span:nth-child(1),
.intro-bloc span:nth-child(2),
.intro-bloc span:nth-child(3),
.intro-bloc span:nth-child(4),
.intro-bloc span:nth-child(5) {
  animation-delay: 3.05s;
}

.intro-bloc span:nth-child(6),
.intro-bloc span:nth-child(7),
.intro-bloc span:nth-child(8),
.intro-bloc span:nth-child(9),
.intro-bloc span:nth-child(10) {
  animation-delay: 3.14s;
}

.intro-bloc span:nth-child(11),
.intro-bloc span:nth-child(12),
.intro-bloc span:nth-child(13),
.intro-bloc span:nth-child(14),
.intro-bloc span:nth-child(15) {
  animation-delay: 3.23s;
}

.intro-bloc span:nth-child(16),
.intro-bloc span:nth-child(17),
.intro-bloc span:nth-child(18),
.intro-bloc span:nth-child(19),
.intro-bloc span:nth-child(20) {
  animation-delay: 3.32s;
}

.intro-bloc span:nth-child(21),
.intro-bloc span:nth-child(22),
.intro-bloc span:nth-child(23),
.intro-bloc span:nth-child(24),
.intro-bloc span:nth-child(25) {
  animation-delay: 3.41s;
}

.intro-bloc span:nth-child(26),
.intro-bloc span:nth-child(27),
.intro-bloc span:nth-child(28),
.intro-bloc span:nth-child(29),
.intro-bloc span:nth-child(30) {
  animation-delay: 3.50s;
}

/* DomKom title rises from the rubble */
.intro-title {
  position: absolute;
  left: 50%;
  top: 48%;
  margin: 0;
  color: #eadbb4;
  font-size: clamp(46px, 16vw, 82px);
  font-weight: 950;
  line-height: 0.92;
  text-transform: uppercase;
  text-shadow:
    0 4px 0 #171918,
    0 0 26px rgba(168, 63, 54, 0.48);
  transform: translate(-50%, 24px) scale(0.88);
  opacity: 0;
  animation: intro-title-appear 1.2s 4.5s cubic-bezier(0.18, 0.88, 0.3, 1) forwards;
}

/* ---- Keyframes ---- */

/* Leader walks from far left to building entrance, fades inside */
@keyframes intro-leader-walk {
  0% {
    transform: translateX(0) scale(0.85);
    opacity: 0;
  }

  9% {
    opacity: 1;
  }

  72%,
  85% {
    transform: translateX(144px) scale(1.01);
    opacity: 1;
  }

  100% {
    transform: translateX(146px) scale(0.94);
    opacity: 0;
  }
}

@keyframes intro-leg-a {
  0%,
  100% {
    transform: translateX(-2px);
  }

  50% {
    transform: translateX(3px);
  }
}

@keyframes intro-leg-b {
  0%,
  100% {
    transform: translateX(3px);
  }

  50% {
    transform: translateX(-2px);
  }
}

@keyframes intro-arm {
  0%,
  100% {
    transform: rotate(8deg);
  }

  50% {
    transform: rotate(-12deg);
  }
}

/* Single transform/opacity timeline for the building over full 7.2s */
@keyframes intro-bloc-transform {
  /* Rise up from ground and appear (0→0.8s) */
  0% {
    opacity: 0;
    transform: translateX(-50%) scaleY(0.18);
  }

  11% {
    opacity: 1;
    transform: translateX(-50%) scaleY(1);
  }

  /* Static — holds while leader walks (11%→30% = 0.79s→2.16s) */
  29% {
    opacity: 1;
    transform: translateX(-50%);
  }

  /* Shake as building trembles (30%→42% = 2.16s→3.02s) */
  32% {
    transform: translateX(calc(-50% - 7px)) rotate(-1deg);
  }

  35% {
    transform: translateX(calc(-50% + 9px)) rotate(1.2deg);
  }

  38% {
    transform: translateX(calc(-50% - 5px)) rotate(-0.8deg);
  }

  40% {
    transform: translateX(calc(-50% + 3px)) rotate(0.4deg);
  }

  42% {
    opacity: 1;
    transform: translateX(-50%) rotate(0);
  }

  /* Crumble: walls fade (handled by intro-bloc-walls animation on background/border).
     The container stays in place as spans fall out. */
  56% {
    opacity: 1;
    transform: translateX(-50%);
  }

  /* Container itself fades after spans are done */
  63% {
    opacity: 0;
    transform: translateX(-50%);
  }

  100% {
    opacity: 0;
    transform: translateX(-50%);
  }
}

/* Fades the building walls while window spans fly free */
@keyframes intro-bloc-walls {
  from {
    background: #706b5f;
    border-color: #0a0b0b;
    box-shadow: inset 0 8px 0 #8a5f45, 0 0 0 2px rgba(234, 219, 180, 0.1);
  }

  to {
    background: transparent;
    border-color: transparent;
    box-shadow: none;
  }
}

/* Window blocks fall straight down with slight sideways scatter */
@keyframes intro-floor-collapse {
  0% {
    opacity: 1;
    transform: translate(0, 0) rotate(0);
  }

  10% {
    opacity: 1;
    transform: translate(calc(var(--fall-x) * 0.1), -5px) rotate(calc(var(--fall-r) * 0.1));
  }

  to {
    transform: translate(var(--fall-x), 320px) rotate(var(--fall-r));
    opacity: 0;
  }
}

/* Dust clouds puff outward at building base */
@keyframes intro-dust-puff {
  0% {
    opacity: 0.75;
    transform: scale(0.4) translateY(6px);
  }

  35% {
    opacity: 0.45;
  }

  100% {
    opacity: 0;
    transform: scale(3.2) translateY(-18px);
  }
}

/* DomKom logo appears rising from the rubble */
@keyframes intro-title-appear {
  to {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
}

@keyframes intro-fade-out {
  to {
    opacity: 0;
  }
}

.start-menu {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: max(18px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom));
  background:
    linear-gradient(180deg, rgba(31, 36, 37, 0.72), rgba(31, 36, 37, 0.9)),
    radial-gradient(circle at 50% 24%, rgba(168, 63, 54, 0.25), transparent 42%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.start-menu.is-open {
  opacity: 1;
  pointer-events: auto;
}

.start-panel,
.how-to-panel {
  width: min(420px, calc(100vw - 28px));
  border: 2px solid #4d4339;
  border-radius: 8px;
  background: #2c302d;
  box-shadow: 0 6px 0 #171918;
}

.start-panel {
  display: grid;
  gap: 18px;
  padding: 18px;
}

.start-logo {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 14px 8px 10px;
  color: #eadbb4;
  text-align: center;
}

.start-star {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 3px solid #4d4339;
  border-radius: 50%;
  background: #a83f36;
  color: #d6a741;
  box-shadow: 0 4px 0 #171918;
  font-size: 28px;
  font-weight: 950;
}

.start-logo h1 {
  margin: 0;
  color: #eadbb4;
  font-size: 42px;
  font-weight: 950;
  line-height: 0.95;
  text-transform: uppercase;
}

.start-logo p {
  margin: 0;
  color: #c7b58f;
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
}

.start-actions {
  display: grid;
  gap: 10px;
}

.start-button {
  min-height: 48px;
  border: 2px solid #4d4339;
  border-radius: 8px;
  background: #c7b58f;
  color: #2d2822;
  box-shadow: 0 4px 0 #171918;
  font-size: 13px;
  font-weight: 950;
}

.start-button.is-primary {
  background: #d6a741;
}

.start-button:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #171918;
}

.start-button[hidden] {
  display: none;
}

.how-to-panel {
  position: absolute;
  left: 50%;
  top: max(52px, calc(env(safe-area-inset-top) + 52px));
  z-index: 32;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  max-height: min(72svh, 560px);
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 14px);
  transition:
    transform 150ms ease,
    opacity 150ms ease;
}

.how-to-panel.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0);
}

.how-to-list {
  display: grid;
  gap: 8px;
  min-height: 0;
  padding: 10px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.how-to-list article {
  padding: 9px;
  border: 2px solid #4d4339;
  border-radius: 8px;
  background: #c7b58f;
  color: #2d2822;
}

.how-to-list h3,
.how-to-list p {
  margin: 0;
}

.how-to-list h3 {
  font-size: 13px;
  font-weight: 950;
}

.how-to-list p {
  margin-top: 4px;
  font-size: 11px;
  font-weight: 850;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.tutorial-panel {
  position: absolute;
  left: 10px;
  right: 10px;
  top: calc(max(8px, env(safe-area-inset-top)) + 48px);
  z-index: 24;
  display: grid;
  gap: 10px;
  padding: 11px;
  border: 2px solid #4d4339;
  border-radius: 8px;
  background: #c7b58f;
  color: #2d2822;
  box-shadow: 0 5px 0 #171918;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-12px);
  transition:
    transform 150ms ease,
    opacity 150ms ease;
}

.tutorial-panel.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.tutorial-kicker,
.tutorial-panel h2,
.tutorial-panel p {
  margin: 0;
}

.tutorial-kicker {
  color: #74312d;
  font-size: 10px;
  font-weight: 950;
  text-transform: uppercase;
}

.tutorial-panel h2 {
  margin-top: 4px;
  color: #171918;
  font-size: 16px;
  font-weight: 950;
  line-height: 1.05;
}

#tutorialBody {
  margin-top: 5px;
  color: #3a332b;
  font-size: 11px;
  font-weight: 850;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.tutorial-actions {
  display: grid;
  grid-template-columns: minmax(0, 0.7fr) minmax(0, 1fr);
  gap: 8px;
}

.tutorial-button {
  min-height: 38px;
  padding: 7px 6px;
  border: 2px solid #4d4339;
  border-radius: 8px;
  background: #33413f;
  color: #eadbb4;
  box-shadow: 0 3px 0 #171918;
  font-size: 10px;
  font-weight: 950;
}

.tutorial-button.is-primary {
  background: #a83f36;
}

.tutorial-button:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #171918;
}

.tutorial-button:disabled {
  opacity: 0.62;
  filter: grayscale(0.35);
}

.news-ticker {
  position: absolute;
  top: max(8px, env(safe-area-inset-top));
  left: 10px;
  right: 10px;
  z-index: 5;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  min-height: 34px;
  border: 2px solid #4d4339;
  border-radius: 8px;
  background: #263331;
  box-shadow: 0 4px 0 #171918;
  overflow: hidden;
}

.ticker-label {
  align-self: stretch;
  display: grid;
  place-items: center;
  padding: 0 9px;
  background: #a83f36;
  color: #eadbb4;
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 0;
  text-transform: uppercase;
}

.ticker-track {
  min-width: 0;
  overflow: hidden;
}

.ticker-track p {
  width: max-content;
  margin: 0;
  padding-left: 100%;
  color: #eadbb4;
  font-size: 12px;
  font-weight: 850;
  line-height: 1;
  white-space: nowrap;
  animation: ticker-scroll 18s linear infinite;
}

@keyframes ticker-scroll {
  from {
    transform: translateX(0);
  }

  to {
    transform: translateX(-100%);
  }
}

.bottom-bar {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: max(6px, calc(env(safe-area-inset-bottom) * 0.35));
  z-index: 8;
  display: grid;
  grid-template-columns: 72px 54px minmax(0, 1fr);
  align-items: stretch;
  gap: 8px;
  --bottom-control-height: 68px;
}

.nav-button,
.resource-strip,
.icon-button,
.tier-tab,
.info-tab,
.room-card,
.resource-card,
.synergy-card {
  border: 2px solid #4d4339;
  border-radius: 8px;
  box-shadow: 0 4px 0 #171918;
}

.nav-button,
.tier-tab,
.info-tab {
  min-width: 0;
  min-height: 54px;
  background: #c7b58f;
  color: #2d2822;
  font-weight: 950;
}

.nav-button {
  display: grid;
  place-items: center;
  gap: 4px;
  padding: 6px 4px;
  font-size: 11px;
  line-height: 1;
}

.nav-button:active,
.nav-button.is-active,
.tier-tab.is-active,
.info-tab.is-active {
  transform: translateY(3px);
  background: #d6a741;
  box-shadow: 0 1px 0 #171918;
}

.nav-icon {
  width: 25px;
  height: 20px;
  border: 2px solid #26231f;
  image-rendering: pixelated;
}

.nav-icon.rooms {
  background:
    linear-gradient(90deg, #4f6f74 0 30%, transparent 30% 35%, #7f4d41 35% 65%, transparent 65% 70%, #667b52 70%),
    #bfb196;
}

.nav-icon.info {
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #33413f;
  color: #eadbb4;
  font-size: 16px;
  font-weight: 950;
  line-height: 1;
}

.resource-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: center;
  gap: 3px;
  min-width: 0;
  min-height: var(--bottom-control-height);
  padding: 4px;
  background: #33413f;
  color: #eadbb4;
  overflow: hidden;
  cursor: pointer;
  touch-action: manipulation;
}

.resource-strip:focus-visible {
  outline: 3px solid #d6a741;
  outline-offset: 3px;
}

.resource-strip span {
  display: grid;
  grid-template-rows: auto auto auto auto;
  place-items: center;
  gap: 1px;
  min-width: 0;
  min-height: 0;
  height: 100%;
  padding: 3px 2px;
  border: 2px solid #4d4339;
  border-radius: 6px;
  background: #263331;
  color: #eadbb4;
  line-height: 1;
  text-align: center;
  overflow: hidden;
}

.resource-strip b,
.resource-strip small,
.resource-strip strong,
.resource-strip em {
  display: block;
  max-width: 100%;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
}

.resource-strip b {
  color: #d6a741;
  font-size: 10px;
  font-weight: 950;
}

.resource-strip small {
  color: #c7b58f;
  font-size: clamp(6px, 1.65vw, 8px);
  font-weight: 850;
}

.resource-strip strong {
  color: #fff0c3;
  font-size: clamp(9px, 2.45vw, 12px);
  font-weight: 950;
}

.resource-strip em {
  font-style: normal;
  font-size: clamp(5px, 1.3vw, 7px);
  font-weight: 700;
  color: #7a7468;
  letter-spacing: 0.02em;
}

.resource-strip em[data-sign="pos"] {
  color: #7ec9a0;
}

.resource-strip em[data-sign="neg"] {
  color: #d67070;
}

.bottom-bar .nav-button,
.bottom-bar .resource-strip {
  height: var(--bottom-control-height);
}

.bottom-bar .nav-button.is-active {
  transform: none;
  box-shadow: 0 4px 0 #171918;
}

.bottom-bar .nav-button:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #171918;
}

.room-menu,
.info-menu {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: calc(max(10px, env(safe-area-inset-bottom)) + 70px);
  z-index: 7;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  max-height: min(62svh, 520px);
  border: 2px solid #4d4339;
  border-radius: 8px;
  background: #2c302d;
  box-shadow: 0 5px 0 #171918;
  overflow: hidden;
  transform: translateY(16px);
  opacity: 0;
  pointer-events: none;
  transition:
    transform 150ms ease,
    opacity 150ms ease;
}

.info-menu {
  grid-template-rows: auto auto minmax(0, 1fr);
}

.room-menu.is-open,
.info-menu.is-open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.room-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 10px 8px;
  border-bottom: 2px solid #4d4339;
  background: #c7b58f;
  color: #2d2822;
}

.kicker,
.room-menu h2 {
  margin: 0;
  line-height: 1;
}

.kicker {
  margin-bottom: 5px;
  color: #6f4d3c;
  font-size: 10px;
  font-weight: 950;
  text-transform: uppercase;
}

.room-menu h2 {
  font-size: 18px;
}

.icon-button {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  background: #a83f36;
  color: #eadbb4;
  font-size: 22px;
  font-weight: 950;
  line-height: 1;
}

.room-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 8px;
  background: #242826;
}

.info-tabs {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
  padding: 8px;
  background: #242826;
}

.tier-tab,
.info-tab {
  min-height: 36px;
  padding: 5px 3px;
  font-size: 10px;
}

.tier-tab:disabled {
  filter: grayscale(0.65);
  opacity: 0.55;
}

.room-list {
  display: grid;
  gap: 8px;
  padding: 8px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
}

.info-list {
  display: grid;
  grid-auto-rows: max-content;
  align-content: start;
  gap: 8px;
  padding: 8px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
}

.notification-stack {
  position: absolute;
  left: 10px;
  right: 10px;
  top: calc(max(8px, env(safe-area-inset-top)) + 42px);
  z-index: 9;
  display: grid;
  gap: 8px;
  pointer-events: none;
}

.notification {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 48px;
  padding: 8px;
  border: 2px solid #4d4339;
  border-radius: 8px;
  background: #c7b58f;
  color: #2d2822;
  box-shadow: 0 4px 0 #171918;
  animation: notification-in 160ms ease-out both;
}

.notification.is-warning {
  background: #d6a741;
}

.notification.is-danger {
  background: #a83f36;
  color: #eadbb4;
}

.notification.is-success {
  background: #9eaa83;
}

.notification-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 2px solid #4d4339;
  border-radius: 6px;
  background: #33413f;
  color: #eadbb4;
  font-size: 13px;
  font-weight: 950;
}

.notification-copy {
  min-width: 0;
  margin: 0;
  font-size: 11px;
  font-weight: 900;
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.event-choice,
.floor-confirm {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: calc(max(10px, env(safe-area-inset-bottom)) + 78px);
  z-index: 10;
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 2px solid #4d4339;
  border-radius: 8px;
  background: #c7b58f;
  color: #2d2822;
  box-shadow: 0 5px 0 #171918;
  transform: translateY(14px);
  opacity: 0;
  pointer-events: none;
  transition:
    transform 150ms ease,
    opacity 150ms ease;
}

.event-choice.is-open,
.floor-confirm.is-open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.event-kicker,
.event-choice h2,
.event-choice p,
.floor-confirm h2,
.floor-confirm p {
  margin: 0;
}

.event-kicker {
  color: #74312d;
  font-size: 10px;
  font-weight: 950;
  text-transform: uppercase;
}

.event-choice h2,
.floor-confirm h2 {
  margin-top: 4px;
  font-size: 16px;
  line-height: 1.05;
}

#eventDescription,
#floorConfirmDescription {
  margin-top: 5px;
  color: #3a332b;
  font-size: 11px;
  font-weight: 850;
  line-height: 1.2;
}

.event-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.event-action {
  min-height: 38px;
  padding: 7px 6px;
  border: 2px solid #4d4339;
  border-radius: 8px;
  background: #33413f;
  color: #eadbb4;
  box-shadow: 0 3px 0 #171918;
  font-size: 10px;
  font-weight: 950;
}

.event-action.is-primary {
  background: #74312d;
  color: #f3dfaa;
}

.event-action:disabled {
  opacity: 0.55;
  filter: grayscale(0.5);
}

.party-visit {
  position: absolute;
  left: 10px;
  right: 10px;
  top: calc(max(8px, env(safe-area-inset-top)) + 48px);
  z-index: 22;
  display: grid;
  grid-template-columns: 108px minmax(0, 1fr);
  gap: 10px;
  min-height: 106px;
  padding: 10px;
  border: 2px solid #4d4339;
  border-radius: 8px;
  background: #c7b58f;
  color: #2d2822;
  box-shadow: 0 5px 0 #171918;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-12px);
  transition:
    transform 160ms ease,
    opacity 160ms ease;
}

.party-visit.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.party-visit-scene {
  position: relative;
  min-height: 82px;
  border: 2px solid #4d4339;
  border-radius: 6px;
  background:
    linear-gradient(180deg, rgba(104, 118, 117, 0.2), transparent 42%),
    #33413f;
  overflow: hidden;
}

.party-road {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 24px;
  background: #2b2c29;
  border-top: 2px solid rgba(234, 219, 180, 0.22);
}

.party-road::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  top: 10px;
  height: 2px;
  background: repeating-linear-gradient(90deg, rgba(226, 210, 170, 0.42) 0 16px, transparent 16px 30px);
}

.party-mini-building {
  position: absolute;
  right: 10px;
  bottom: 22px;
  display: grid;
  grid-template-columns: repeat(3, 10px);
  gap: 3px;
  padding: 7px 5px 5px;
  border: 2px solid #26231f;
  background: #827a66;
  box-shadow: inset 0 5px 0 #5b4437;
}

.party-mini-building span {
  width: 8px;
  height: 7px;
  background: rgba(207, 166, 72, 0.54);
  border: 1px solid #26231f;
}

.party-leader-sprite {
  position: absolute;
  left: 5px;
  bottom: 18px;
  width: 26px;
  height: 44px;
  transform-origin: center bottom;
  animation: party-leader-walk 4.6s ease-in-out forwards;
}

.party-leader-sprite.is-politburo {
  filter: saturate(1.18);
}

.party-leader-sprite span {
  position: absolute;
  display: block;
}

.leader-shadow {
  left: 2px;
  bottom: -2px;
  width: 24px;
  height: 6px;
  border-radius: 50%;
  background: rgba(15, 14, 12, 0.34);
}

.leader-leg {
  bottom: 3px;
  width: 6px;
  height: 15px;
  background: #26231f;
}

.leader-leg-a {
  left: 7px;
  animation: party-leg-a 520ms steps(2, end) infinite;
}

.leader-leg-b {
  right: 7px;
  animation: party-leg-b 520ms steps(2, end) infinite;
}

.leader-body {
  left: 6px;
  bottom: 15px;
  width: 14px;
  height: 20px;
  background: #463b34;
  border: 2px solid #26231f;
}

.leader-coat {
  left: 8px;
  bottom: 17px;
  width: 10px;
  height: 16px;
  background: #6d2f2c;
  box-shadow: inset -3px 0 0 rgba(38, 35, 31, 0.28);
}

.leader-head {
  left: 8px;
  bottom: 35px;
  width: 11px;
  height: 9px;
  background: #c79263;
  border: 2px solid #26231f;
}

.leader-hat {
  left: 6px;
  bottom: 43px;
  width: 15px;
  height: 5px;
  background: #263331;
  border: 2px solid #26231f;
  box-shadow: inset 6px 0 0 #a83f36;
}

.leader-arm {
  right: 2px;
  bottom: 22px;
  width: 5px;
  height: 14px;
  background: #26231f;
  animation: party-arm 520ms steps(2, end) infinite;
}

.party-visit-copy {
  min-width: 0;
  align-self: center;
}

.party-kicker,
.party-visit h2,
.party-visit p {
  margin: 0;
}

.party-kicker {
  color: #74312d;
  font-size: 10px;
  font-weight: 950;
  text-transform: uppercase;
}

.party-visit h2 {
  margin-top: 4px;
  color: #171918;
  font-size: 16px;
  font-weight: 950;
  line-height: 1.05;
}

#partyVisitBody {
  margin-top: 5px;
  color: #3a332b;
  font-size: 11px;
  font-weight: 850;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

@keyframes party-leader-walk {
  0% {
    transform: translateX(0) scale(0.9);
  }

  72%,
  100% {
    transform: translateX(50px) scale(1);
  }
}

@keyframes party-leg-a {
  0%,
  100% {
    transform: translateX(-2px);
  }

  50% {
    transform: translateX(3px);
  }
}

@keyframes party-leg-b {
  0%,
  100% {
    transform: translateX(3px);
  }

  50% {
    transform: translateX(-2px);
  }
}

@keyframes party-arm {
  0%,
  100% {
    transform: rotate(8deg);
  }

  50% {
    transform: rotate(-10deg);
  }
}

@keyframes notification-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.room-card {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 58px;
  gap: 8px;
  align-items: start;
  min-height: 84px;
  padding: 8px;
  background: #c7b58f;
  color: #2d2822;
  text-align: left;
}

.synergy-card {
  display: grid;
  gap: 6px;
  min-width: 0;
  min-height: 0;
  height: auto;
  padding: 9px;
  background: #c7b58f;
  color: #2d2822;
}

.resource-card {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  min-width: 0;
  min-height: 0;
  height: auto;
  padding: 9px;
  background: #c7b58f;
  color: #2d2822;
}

.resource-mark {
  display: grid;
  place-items: center;
  align-self: start;
  width: 34px;
  height: 34px;
  border: 2px solid #4d4339;
  border-radius: 6px;
  background: #33413f;
  color: #eadbb4;
  font-size: 14px;
  font-weight: 950;
}

.resource-copy {
  min-width: 0;
  max-width: 100%;
}

.resource-name,
.resource-use,
.resource-source,
.resource-generation,
.resource-amount {
  margin: 0;
}

.resource-name {
  font-size: 13px;
  font-weight: 950;
  line-height: 1.05;
}

.resource-use,
.resource-source,
.resource-generation {
  margin-top: 3px;
  color: #3a332b;
  font-size: 10px;
  font-weight: 850;
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.resource-source {
  color: #5b4437;
}

.resource-generation {
  color: #33413f;
  line-height: 1.25;
}

.resource-generation strong {
  color: #171918;
  font-weight: 950;
}

.resource-amount {
  grid-column: 1 / -1;
  justify-self: end;
  max-width: 100%;
  padding: 4px 5px;
  border: 2px solid #4d4339;
  border-radius: 6px;
  background: #33413f;
  color: #eadbb4;
  font-size: 10px;
  font-weight: 950;
  white-space: normal;
  overflow: visible;
  overflow-wrap: anywhere;
  text-align: center;
}

.info-action {
  cursor: pointer;
}

.info-action:disabled {
  opacity: 0.62;
  filter: grayscale(0.45);
}

.synergy-title,
.synergy-components,
.synergy-benefit {
  margin: 0;
}

.synergy-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  font-size: 13px;
  font-weight: 950;
  line-height: 1.05;
}

.synergy-title span:first-child {
  min-width: 0;
  overflow-wrap: anywhere;
}

.synergy-tier {
  flex: 0 0 auto;
  padding: 3px 5px;
  border: 2px solid #4d4339;
  border-radius: 6px;
  background: #33413f;
  color: #eadbb4;
  font-size: 9px;
}

.synergy-components {
  color: #5b4437;
  font-size: 10px;
  font-weight: 900;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.synergy-benefit {
  color: #3a332b;
  font-size: 10px;
  font-weight: 850;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.room-card.is-tutorial-target {
  background: #d6a741;
}

.room-card.is-unaffordable:not(.is-tutorial-target) {
  background: #b7a98a;
}

.room-card:disabled {
  opacity: 0.58;
  filter: grayscale(0.55);
}

.room-swatch {
  position: relative;
  width: 30px;
  height: 30px;
  border: 2px solid #26231f;
  background:
    linear-gradient(0deg, var(--room-floor) 0 28%, transparent 28%),
    linear-gradient(90deg, transparent 0 12%, var(--room-accent) 12% 30%, transparent 30% 42%, var(--room-trim) 42% 58%, transparent 58% 70%, var(--room-accent) 70% 88%, transparent 88%),
    var(--room-back, #bfb196);
  box-shadow:
    inset 0 4px 0 var(--room-roof, #875a4b),
    inset 0 6px 0 #26231f,
    inset -4px 0 0 rgba(38, 35, 31, 0.24),
    inset 0 -3px 0 rgba(38, 35, 31, 0.28);
  image-rendering: pixelated;
  overflow: hidden;
}

.room-swatch::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 11px;
  width: 7px;
  height: 7px;
  border: 1px solid #26231f;
  background: var(--room-accent, #4f6f74);
  box-shadow: 11px 0 0 var(--room-trim, #7f4d41);
}

.room-swatch::after {
  content: attr(data-sign);
  position: absolute;
  left: 3px;
  right: 3px;
  top: 4px;
  color: #eadbb4;
  font-size: 6px;
  font-weight: 950;
  line-height: 1;
  text-align: center;
  text-shadow: 1px 1px 0 #26231f;
}

.room-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.room-name,
.room-meta,
.room-function,
.room-cost {
  margin: 0;
}

.room-name {
  font-size: 13px;
  font-weight: 950;
  line-height: 1.12;
}

.room-meta,
.room-function,
.room-cost,
.room-lock {
  font-size: 10px;
  font-weight: 850;
  line-height: 1.2;
}

.room-meta {
  color: #5b4437;
}

.room-function {
  color: #3a332b;
  overflow-wrap: anywhere;
}

.room-cost {
  color: #74312d;
  font-weight: 950;
  overflow-wrap: anywhere;
}

.room-lock {
  align-self: center;
  justify-self: end;
  max-width: 100%;
  padding: 4px 5px;
  border: 2px solid #4d4339;
  border-radius: 6px;
  background: #33413f;
  color: #eadbb4;
}

@media (min-width: 720px) {
  .news-ticker {
    left: 18px;
    right: 18px;
  }

  .bottom-bar,
  .room-menu,
  .info-menu,
  .notification-stack,
  .party-visit,
  .event-choice,
  .floor-confirm,
  .tutorial-panel {
    left: 50%;
    right: auto;
    width: min(520px, calc(100vw - 24px));
    transform: translateX(-50%);
  }

  .event-choice,
  .floor-confirm,
  .tutorial-panel {
    transform: translateX(-50%) translateY(14px);
  }

  .event-choice.is-open,
  .floor-confirm.is-open,
  .tutorial-panel.is-open {
    transform: translateX(-50%) translateY(0);
  }

  .party-visit {
    transform: translate(-50%, -12px);
  }

  .tutorial-panel {
    transform: translateX(-50%) translateY(-12px);
  }

  .party-visit.is-open {
    transform: translate(-50%, 0);
  }

  .room-menu,
  .info-menu {
    transform: translate(-50%, 16px);
  }

  .room-menu.is-open,
  .info-menu.is-open {
    transform: translate(-50%, 0);
  }
}
