/* ===== E.D.I.T.H. MARVEL & X-MEN ARCADE HUB + UNIVERSAL CABINET FRAME + IRON MAN 2048 ===== */

/* 1. E.D.I.T.H. Arcade Hall Lobby */
.edith-hall {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 1040px;
  margin: 0 auto;
}

.edith-hero {
  position: relative;
  border-radius: 22px;
  padding: 16px;
  background:
    radial-gradient(ellipse 80% 70% at 12% 0%, rgba(168, 85, 247, 0.24), transparent 62%),
    radial-gradient(ellipse 75% 65% at 92% 10%, rgba(56, 189, 248, 0.22), transparent 60%),
    radial-gradient(ellipse 70% 55% at 50% 100%, rgba(239, 68, 68, 0.14), transparent 65%),
    var(--card);
  border: 1.5px solid rgba(168, 85, 247, 0.45);
  box-shadow: var(--card-shadow);
  overflow: hidden;
}
.dev.theme-bronwin:not(.bronwin-velvet) .edith-hero {
  background:
    radial-gradient(ellipse 75% 65% at 12% 0%, rgba(244, 114, 182, 0.30), transparent 62%),
    radial-gradient(ellipse 70% 60% at 92% 10%, rgba(168, 85, 247, 0.24), transparent 60%),
    var(--card);
  border-color: rgba(184, 92, 148, 0.55);
}
.dev.theme-bronwin.bronwin-sage .edith-hero {
  background:
    radial-gradient(ellipse 75% 65% at 12% 0%, rgba(65, 124, 96, 0.22), transparent 62%),
    radial-gradient(ellipse 70% 60% at 92% 10%, rgba(236, 174, 200, 0.34), transparent 60%),
    var(--card);
  border-color: rgba(65, 124, 96, 0.50);
}
.dev.theme-riley:not(.riley-dark) .edith-hero {
  background:
    radial-gradient(ellipse 75% 65% at 12% 0%, rgba(236, 72, 153, 0.20), transparent 62%),
    radial-gradient(ellipse 70% 60% at 92% 10%, rgba(56, 189, 248, 0.22), transparent 60%),
    var(--card);
  border-color: rgba(147, 51, 234, 0.44);
}

.edith-hero-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.edith-host-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1 1 260px;
}
.edith-hud-orb {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  padding: 2px;
  background: conic-gradient(#38BDF8 0deg 120deg, #A855F7 120deg 240deg, #EF4444 240deg 360deg);
  box-shadow: 0 0 22px rgba(168, 85, 247, 0.42);
  flex-shrink: 0;
}
.edith-hud-orb img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  background: #050811;
}
.edith-kicker {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--sky);
}
.edith-hall-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 900;
  line-height: 1.12;
  color: var(--wh);
  letter-spacing: -0.02em;
  margin-top: 2px;
}
.edith-hall-sub {
  font-size: 12.5px;
  color: var(--mut);
  margin-top: 3px;
}
.edith-hero-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.edith-stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--tile);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 800;
  color: var(--wh);
  box-shadow: var(--tile-shadow);
}
.edith-rnd-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 15px;
  border-radius: 13px;
  background: var(--pri);
  color: var(--pri-fg);
  border: 1px solid var(--pri-border);
  box-shadow: var(--pri-shadow);
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  transition: transform 0.12s ease;
}
.edith-rnd-btn:active { transform: scale(0.96); }

/* 2. Unified Brophy House Trophy & Leaderboard Card */
.edith-trophy-card {
  border-radius: 20px;
  padding: 14px 15px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--card-shadow);
}
.edith-trophy-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 11px;
}
.edith-trophy-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
  color: var(--wh);
  display: flex;
  align-items: center;
  gap: 8px;
}
.edith-podium {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
}
@media (max-width: 520px) {
  .edith-podium { grid-template-columns: 1fr; }
}
.edith-house-tile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 15px;
  background: var(--tile);
  border: 1px solid var(--line);
  box-shadow: var(--tile-shadow);
  min-width: 0;
}
.edith-house-tile.is-lead {
  border-color: var(--sky);
  box-shadow: 0 0 0 1px var(--sky), var(--tile-shadow);
}
.edith-house-tile.is-me {
  background:
    radial-gradient(circle at 90% 10%, rgba(168, 85, 247, 0.16), transparent 60%),
    var(--tile);
}
.edith-house-av {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid var(--line-strong);
  flex-shrink: 0;
}
.edith-house-meta { min-width: 0; flex: 1; }
.edith-house-name {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 800;
  color: var(--wh);
  display: flex;
  align-items: center;
  gap: 5px;
}
.edith-house-sub {
  font-size: 11px;
  color: var(--mut);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.edith-house-pts {
  text-align: right;
  flex-shrink: 0;
}
.edith-house-pts b {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 900;
  color: var(--wh);
  display: block;
  line-height: 1;
}
.edith-house-pts span {
  font-size: 10px;
  font-weight: 800;
  color: var(--sky);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.edith-lb-details {
  margin-top: 10px;
  border-top: 1px solid var(--line);
  padding-top: 9px;
}
.edith-lb-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  font-size: 12px;
  font-weight: 800;
  color: var(--sky);
  padding: 2px 0;
  cursor: pointer;
}
.edith-lb-table-wrap {
  margin-top: 8px;
  overflow-x: auto;
}
.edith-lb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.edith-lb-table th {
  text-align: left;
  padding: 6px 8px;
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--mut);
  border-bottom: 1px solid var(--line);
}
.edith-lb-table td {
  padding: 7px 8px;
  border-bottom: 1px solid var(--line);
  color: var(--txt);
  font-weight: 700;
}
.edith-lb-table tr:last-child td { border-bottom: 0; }
.edith-lb-table td.num, .edith-lb-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.edith-lb-best { color: var(--sky) !important; font-weight: 900 !important; }

/* 3. Filter Bar & Marquee Cabinet Grid (scales cleanly to 10-16+ cabinets) */
.edith-filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.edith-filters {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 2px 0;
  scrollbar-width: none;
  flex: 1 1 auto;
}
.edith-filters::-webkit-scrollbar { display: none; }
.edith-fchip {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--tile);
  border: 1px solid var(--line);
  color: var(--txt);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.1s ease, border-color 0.14s ease;
}
.edith-fchip:hover { border-color: var(--line-strong); }
.edith-fchip.on {
  background: var(--pri);
  color: var(--pri-fg);
  border-color: var(--pri-border);
  box-shadow: var(--pri-shadow);
}

.edith-cab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
}
@media (max-width: 520px) {
  .edith-cab-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }
}

.edith-cab-card {
  --cab-accent: #38BDF8;
  --cab-accent2: #A855F7;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-radius: 18px;
  padding: 0;
  overflow: hidden;
  text-align: left;
  background: var(--tile);
  border: 1.5px solid color-mix(in srgb, var(--cab-accent) 44%, transparent);
  box-shadow:
    0 12px 26px rgba(0, 0, 0, 0.34),
    0 0 18px color-mix(in srgb, var(--cab-accent) 16%, transparent),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
  transition: transform 0.14s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  cursor: pointer;
}
.edith-cab-card:hover {
  transform: translateY(-2px);
  border-color: var(--cab-accent);
  box-shadow:
    0 16px 32px rgba(0, 0, 0, 0.42),
    0 0 24px color-mix(in srgb, var(--cab-accent) 30%, transparent);
}
.edith-cab-card:active { transform: scale(0.97); }
.dev.theme-bronwin:not(.bronwin-velvet) .edith-cab-card,
.dev.theme-riley:not(.riley-dark) .edith-cab-card {
  box-shadow:
    0 8px 18px rgba(92, 38, 82, 0.12),
    inset 0 1.5px 0 rgba(255, 255, 255, 0.80);
}

.edith-cab-marquee {
  position: relative;
  padding: 11px 11px 10px;
  background:
    linear-gradient(135deg,
      color-mix(in srgb, var(--cab-accent) 28%, #070B14) 0%,
      color-mix(in srgb, var(--cab-accent2) 22%, #0C1222) 100%);
  border-bottom: 1.5px solid color-mix(in srgb, var(--cab-accent) 55%, transparent);
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 66px;
}
.edith-cab-marquee::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(255, 255, 255, 0.03) 0px,
    rgba(255, 255, 255, 0.03) 1px,
    transparent 1px,
    transparent 3px
  );
  pointer-events: none;
}
.edith-cab-art {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  overflow: hidden;
  flex-shrink: 0;
  border: 1.5px solid color-mix(in srgb, var(--cab-accent) 75%, #FFFFFF);
  background: #070B14;
  display: grid;
  place-items: center;
  font-size: 22px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
  z-index: 1;
}
.edith-cab-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.edith-cab-art.contain img {
  width: 78%;
  height: 78%;
  object-fit: contain;
}
.edith-cab-mtxt {
  min-width: 0;
  flex: 1;
  z-index: 1;
}
.edith-cab-tag {
  display: inline-block;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(2, 6, 23, 0.65);
  color: #F8FAFC;
  border: 1px solid color-mix(in srgb, var(--cab-accent) 60%, transparent);
  margin-bottom: 3px;
}
.edith-cab-name {
  font-family: var(--font-display);
  font-size: 14.5px;
  font-weight: 900;
  line-height: 1.15;
  color: #FFFFFF;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.65);
}

.edith-cab-body {
  padding: 10px 11px 11px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  justify-content: space-between;
}
.edith-cab-desc {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--mut);
  line-height: 1.32;
}
.edith-cab-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 11px;
  font-weight: 800;
  color: var(--wh);
  padding-top: 6px;
  border-top: 1px solid var(--line);
}
.edith-cab-play {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--cab-accent) 20%, transparent);
  border: 1px solid color-mix(in srgb, var(--cab-accent) 55%, transparent);
  color: var(--wh);
  font-size: 10.5px;
  font-weight: 900;
  white-space: nowrap;
}
@media (max-width: 520px) {
  .edith-cab-marquee { padding: 9px 9px 8px; min-height: 58px; gap: 8px; }
  .edith-cab-art { width: 38px; height: 38px; border-radius: 10px; font-size: 19px; }
  .edith-cab-name { font-size: 13px; }
  .edith-cab-body { padding: 8px 9px 9px; }
}

/* Expansion Bay & Stark Hangar Preview Strip */
.edith-hangar-sec {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 12px 13px;
  border-radius: 18px;
  background: var(--tile);
  border: 1px dashed var(--line-strong);
}
.edith-hangar-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.edith-hangar-title {
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 900;
  color: var(--wh);
}
.edith-hangar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 8px;
}
@media (max-width: 520px) {
  .edith-hangar-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
}
.edith-hangar-card {
  --cab-accent: #38BDF8;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 9px;
  border-radius: 13px;
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid color-mix(in srgb, var(--cab-accent) 34%, transparent);
  opacity: 0.9;
}
.dev.theme-bronwin:not(.bronwin-velvet) .edith-hangar-card,
.dev.theme-riley:not(.riley-dark) .edith-hangar-card {
  background: rgba(255, 255, 255, 0.56);
}
.edith-hangar-art {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  overflow: hidden;
  flex-shrink: 0;
  background: #070B14;
  border: 1px solid color-mix(in srgb, var(--cab-accent) 60%, transparent);
  display: grid;
  place-items: center;
}
.edith-hangar-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.edith-hangar-art.contain img { width: 76%; height: 76%; object-fit: contain; }
.edith-hangar-info { min-width: 0; flex: 1; }
.edith-hangar-name {
  font-size: 11.5px;
  font-weight: 900;
  color: var(--wh);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.edith-hangar-tag {
  font-size: 9.5px;
  font-weight: 700;
  color: var(--mut);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.edith-hangar-pill {
  display: inline-block;
  margin-top: 2px;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 8.5px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: color-mix(in srgb, var(--cab-accent) 18%, transparent);
  border: 1px solid color-mix(in srgb, var(--cab-accent) 44%, transparent);
  color: var(--wh);
}
.edith-hangar-note {
  border-radius: 16px;
  padding: 11px 14px;
  background: var(--tile);
  border: 1px dashed var(--line-strong);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--mut);
}
.edith-hangar-note b { color: var(--wh); }

/* 4. Universal Cabinet Top Frame (Back to Hall + Quick Switch + Fullscreen) */
.edith-cab-frame {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 780px;
  margin: 0 auto;
}
.edith-cab-frame.is-fs {
  position: fixed;
  inset: 0;
  z-index: 55;
  max-width: none;
  margin: 0;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 12px calc(18px + env(safe-area-inset-bottom, 0px));
  background: var(--bg);
  background-image: var(--bg-grad);
  overflow-y: auto;
}
.edith-cab-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 15px;
  background: var(--card);
  border: 1px solid var(--line-strong);
  box-shadow: var(--tile-shadow);
  flex-wrap: wrap;
}
.edith-cab-topbar-l, .edith-cab-topbar-r {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}
.edith-tb-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 34px;
  padding: 0 11px;
  border-radius: 10px;
  background: var(--tile);
  border: 1px solid var(--line);
  color: var(--wh);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.1s ease, border-color 0.14s ease;
}
.edith-tb-btn:hover { border-color: var(--line-strong); }
.edith-tb-btn:active { transform: scale(0.95); }
.edith-tb-btn.pri {
  background: var(--pri);
  color: var(--pri-fg);
  border-color: var(--pri-border);
}
.edith-tb-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 800;
  color: var(--wh);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
  min-width: 0;
}
.edith-tb-badge img {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid #A855F7;
  flex-shrink: 0;
}
.edith-tb-badge span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.edith-cab-stage {
  min-width: 0;
  width: 100%;
}

/* 5. Iron Man: Armour Mk 1 -> Mk 85 & Infinity Gauntlet 2048 Cabinet */
.im2048-cab {
  max-width: 456px;
  margin: 0 auto;
  padding: 12px 11px 13px;
  border-radius: 20px;
  background:
    radial-gradient(ellipse 90% 42% at 50% 0%, rgba(239, 68, 68, 0.24), transparent 64%),
    radial-gradient(ellipse 75% 40% at 88% 8%, rgba(56, 189, 248, 0.18), transparent 60%),
    linear-gradient(172deg, #16111D 0%, #090C15 58%, #101423 100%);
  border: 1.5px solid rgba(56, 189, 248, 0.52);
  box-shadow: 0 22px 46px rgba(0, 0, 0, 0.68), inset 0 1px 0 rgba(255, 255, 255, 0.16);
  color: #F8FAFC;
  user-select: none;
  -webkit-user-select: none;
}
.im2048-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
}
.im2048-hdr-l {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}
.im2048-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 900;
  color: #FFFFFF;
  line-height: 1.15;
}
.im2048-sub {
  font-size: 11px;
  font-weight: 700;
  color: #7DD3FC;
}
.im2048-hud {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin-top: 9px;
}
.im2048-stat {
  padding: 6px 8px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.78);
  border: 1px solid rgba(148, 163, 184, 0.26);
  text-align: center;
}
.im2048-stat-lbl {
  font-size: 9.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #94A3B8;
}
.im2048-stat-val {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 900;
  color: #FFFFFF;
}
.im2048-fam-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  padding: 5px 10px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(56, 189, 248, 0.24);
  font-size: 11px;
  font-weight: 700;
  color: #CBD5E1;
  flex-wrap: wrap;
}
.im2048-banter {
  margin-top: 8px;
  padding: 7px 10px;
  border-radius: 12px;
  background: rgba(30, 41, 59, 0.76);
  border: 1px solid rgba(239, 68, 68, 0.36);
  font-size: 11.5px;
  color: #E2E8F0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.im2048-banter-tag {
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(239, 68, 68, 0.24);
  border: 1px solid rgba(248, 113, 113, 0.52);
  color: #FCA5A5;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}
.im2048-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  max-width: 348px;
  margin: 10px auto;
  padding: 10px;
  border-radius: 18px;
  background: linear-gradient(160deg, rgba(15, 23, 42, 0.92), rgba(7, 10, 19, 0.96));
  border: 1.5px solid rgba(56, 189, 248, 0.42);
  box-shadow: inset 0 0 24px rgba(56, 189, 248, 0.10);
  touch-action: none;
  position: relative;
}
.im2048-grid.size-5 {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  max-width: 364px;
}
.im2048-grid.size-5 .im2048-mk { font-size: 11px; }
.im2048-grid.size-5 .im2048-lbl { font-size: 7.5px; }
.im2048-cell {
  aspect-ratio: 1;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4px;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: transform 0.12s ease, box-shadow 0.15s ease;
  overflow: hidden;
  position: relative;
}
.im2048-cell.im-slide {
  animation: imSlideIn 0.14s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.im2048-cell.im-merged {
  animation: imMergePop 0.22s cubic-bezier(0.22, 1.35, 0.36, 1);
}
.im2048-cell.im-spawned {
  animation: imSpawnIn 0.16s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.im2048-cell.im-targetable {
  cursor: pointer;
  box-shadow: 0 0 0 2px #FACC15, 0 0 14px rgba(250, 204, 21, 0.55);
}
.im2048-cell.im-swap-sel {
  box-shadow: 0 0 0 3px #38BDF8, 0 0 18px rgba(56, 189, 248, 0.85);
  transform: scale(1.05);
}
@keyframes imSlideIn {
  0% { transform: translate(var(--im-dx, 0px), var(--im-dy, 0px)); }
  100% { transform: translate(0, 0); }
}
@keyframes imMergePop {
  0% { transform: translate(var(--im-dx, 0px), var(--im-dy, 0px)) scale(0.86); }
  58% { transform: translate(0, 0) scale(1.13); }
  100% { transform: translate(0, 0) scale(1); }
}
@keyframes imSpawnIn {
  0% { transform: scale(0.35); opacity: 0.3; }
  100% { transform: scale(1); opacity: 1; }
}
.im2048-pwr-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  max-width: 364px;
  margin: 8px auto 0;
}
.im2048-pwr-btn {
  padding: 7px 6px;
  border-radius: 11px;
  background: rgba(15, 23, 42, 0.88);
  border: 1px solid rgba(125, 211, 252, 0.32);
  color: #E2E8F0;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.im2048-pwr-btn small { font-size: 9px; color: #94A3B8; font-weight: 700; }
.im2048-pwr-btn.ready {
  border-color: #38BDF8;
  background: linear-gradient(145deg, rgba(14, 165, 233, 0.24), rgba(15, 23, 42, 0.92));
  color: #FFFFFF;
}
.im2048-pwr-btn.armed {
  border-color: #FACC15;
  background: linear-gradient(145deg, rgba(234, 88, 12, 0.38), rgba(220, 38, 38, 0.32));
  box-shadow: 0 0 14px rgba(250, 204, 21, 0.45);
}
.im2048-pwr-btn:disabled { opacity: 0.45; cursor: default; }
.im2048-cell.empty {
  background: rgba(30, 41, 59, 0.42);
  border-color: rgba(148, 163, 184, 0.14);
}
.im2048-mk {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 13px;
  line-height: 1.05;
  color: #FFFFFF;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.55);
}
.im2048-num {
  font-size: 9.5px;
  font-weight: 800;
  opacity: 0.9;
  color: rgba(255, 255, 255, 0.92);
  margin-top: 2px;
}
.im2048-lbl {
  font-size: 8.5px;
  font-weight: 700;
  line-height: 1.05;
  color: rgba(248, 250, 252, 0.85);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.im2048-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  max-width: 344px;
  margin: 8px auto 0;
  flex-wrap: wrap;
}
.im2048-dpad {
  display: grid;
  grid-template-columns: repeat(3, 48px);
  gap: 5px;
}
.im2048-dir-btn {
  height: 42px;
  border-radius: 11px;
  background: rgba(30, 41, 59, 0.88);
  border: 1px solid rgba(125, 211, 252, 0.36);
  color: #F8FAFC;
  font-size: 16px;
  font-weight: 900;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.im2048-dir-btn:active { transform: scale(0.93); background: rgba(56, 189, 248, 0.25); }
.im2048-modes {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 9px;
}
.im2048-pill {
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.82);
  border: 1px solid rgba(148, 163, 184, 0.32);
  color: #CBD5E1;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}
.im2048-pill.on {
  background: linear-gradient(135deg, #DC2626, #0284C7);
  border-color: #7DD3FC;
  color: #FFFFFF;
}
