/* v38 mobile-game visual system: bright, chunky, readable and touch-first. */
:root {
  --toy-ink: #17333a;
  --toy-deep: #123c3b;
  --toy-panel: #185451;
  --toy-cream: #fff6dc;
  --toy-paper: #fffaf0;
  --toy-yellow: #ffd54d;
  --toy-orange: #ff9138;
  --toy-blue: #48b9e8;
  --toy-blue-dark: #247aa5;
  --toy-green: #63c568;
  --toy-purple: #8a64df;
  --toy-red: #ef5b5b;
  --toy-line: #173d43;
  --toy-shadow: rgba(5, 26, 28, .45);
}

button,
input,
select { font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif; letter-spacing: 0; }

button { border-width: 2px; font-weight: 800; }

#intro,
#lobby {
  background-color: #337b52;
  background-image: url("assets/map-refresh/grass-color-optimized.webp");
  background-size: 560px;
  background-blend-mode: soft-light;
}

#intro::before,
#lobby::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: rgba(5, 38, 34, .56);
  pointer-events: none;
}

/* Main menu */
#intro { place-items: center; }
.main-menu-panel { width: min(520px, calc(100vw - 28px)); text-align: center; }
.main-menu-brand { margin-bottom: 34px; padding: 0; border: 0; }
.main-menu-brand p { color: #aee8e0; font-size: 14px; text-shadow: 0 2px 0 #173b3d; }
.main-menu-brand h1 {
  color: var(--toy-yellow);
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 76px;
  text-shadow: 0 4px 0 #81552b, 0 10px 28px rgba(0, 0, 0, .45);
}
.main-menu-brand span { color: #fff8dd; font-size: 14px; font-weight: 800; text-shadow: 0 2px 0 rgba(0,0,0,.5); }
.main-menu-actions { gap: 9px; width: min(360px, 100%); margin-inline: auto; padding: 0; border: 0; }
.main-menu-actions button {
  min-height: 52px;
  padding: 0 18px;
  border: 2px solid var(--toy-line);
  border-radius: 7px;
  background: var(--toy-paper);
  color: var(--toy-ink);
  box-shadow: 0 5px 0 #a7c2ad, 0 9px 20px rgba(0,0,0,.24);
  text-align: center;
}
.main-menu-actions button:hover { padding-left: 18px; border-left-color: var(--toy-line); background: #ffffff; }
#enter-game {
  background: var(--toy-yellow) !important;
  box-shadow: 0 5px 0 #bf8127, 0 9px 20px rgba(0,0,0,.26) !important;
  font-size: 19px !important;
}
#menu-settings { background: #dff5ff; box-shadow: 0 5px 0 #4896b8, 0 9px 20px rgba(0,0,0,.22); }

/* Lobby shell */
#lobby {
  gap: 8px;
  padding: max(12px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
}

.lobby-header {
  flex: 0 0 66px;
  grid-template-columns: 46px minmax(120px, 1fr) auto auto;
  gap: 9px;
  height: 66px;
  padding: 7px 10px;
  border: 2px solid var(--toy-line);
  border-radius: 8px;
  background: rgba(18, 73, 70, .96);
  box-shadow: 0 4px 0 rgba(12, 43, 44, .8), 0 8px 22px rgba(0,0,0,.2);
}
.lobby-header #lobby-back {
  width: 40px;
  height: 40px;
  border-color: #bce2dc;
  background: #eafbf5;
  color: var(--toy-ink);
  box-shadow: 0 3px 0 #6fa9a1;
}
.lobby-header > div:first-of-type p { margin-bottom: 2px; color: #8ee6dd; font-size: 9px; }
.lobby-header h2 { color: #fff7dc; font-size: 20px; font-weight: 900; text-shadow: 0 2px 0 #0a393b; }
.header-leaderboard-button {
  min-width: 98px;
  height: 40px !important;
  border-color: #4d367f;
  background: var(--toy-purple);
  color: #fff;
  box-shadow: 0 3px 0 #4e3883;
}
.header-leaderboard-button::before { content: "\2605" !important; margin-right: 5px; color: #ffe477; }
.header-leaderboard-button:hover,
.header-leaderboard-button.active { border-color: #4d367f; background: #a17ced; color: #fff; }

.lobby-wallet {
  grid-template-columns: repeat(2, minmax(44px, auto));
  gap: 2px 6px;
  min-width: 128px;
  padding: 5px 8px;
  border: 2px solid #173d43;
  border-radius: 7px;
  background: #f9f2d8;
  color: var(--toy-ink);
}
.lobby-wallet strong { justify-content: center; color: var(--toy-ink); font-size: 14px; }
.lobby-wallet span { color: #486267; font-size: 9px; text-align: center; }
#lobby-coins::before { width: 14px; height: 14px; border-color: #fff0a5; background: #efad2e; box-shadow: inset 0 0 0 2px #ffc94a; }
#lobby-diamonds::before { width: 12px; height: 12px; border-color: #b9f5ff; background: #25a8dc; }

.lobby-tabs {
  display: grid;
  grid-template-columns: repeat(6, minmax(72px, 108px));
  justify-content: center;
  gap: 6px;
  flex: 0 0 54px;
  height: 54px;
  padding: 5px 7px;
  overflow-x: auto;
  border: 2px solid var(--toy-line);
  border-radius: 8px;
  background: rgba(17, 69, 67, .94);
  box-shadow: 0 4px 0 rgba(12, 43, 44, .72);
}
.lobby-tabs button,
.lobby-tabs .community-tab {
  display: grid;
  grid-template-columns: 20px auto;
  place-content: center;
  align-items: center;
  gap: 5px;
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 0 7px;
  border-color: transparent;
  background: rgba(255,255,255,.07);
  color: #dff7ed;
  font-size: 11px;
}
.lobby-tabs button::before { color: #9ce6dc; font-size: 16px; line-height: 1; }
.lobby-tabs [data-shop-tab="characters"]::before { content: "\263A"; }
.lobby-tabs [data-shop-tab="talents"]::before { content: "\2726"; }
.lobby-tabs [data-shop-tab="masteries"]::before { content: "\25C8"; }
.lobby-tabs [data-shop-tab="challenges"]::before { content: "\2691"; }
#lobby-hall-chat::before { content: "\25CF"; }
#lobby-friends::before { content: "\2665"; }
.lobby-tabs button:hover { color: #fff; background: rgba(255,255,255,.13); }
.lobby-tabs button.active {
  border-color: #8c681e;
  background: var(--toy-yellow);
  color: var(--toy-ink);
  box-shadow: inset 0 -3px rgba(177, 113, 25, .26);
}
.lobby-tabs button.active::before { color: #d36b2f; }
.community-tab b { background: var(--toy-red); color: #fff; }

.lobby-character-view {
  grid-template-columns: 106px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto 72px;
  column-gap: 12px;
  min-height: 0;
  padding: 4px 0 0;
}
.lobby-map-select { grid-column: 1; grid-row: 1 / -1; align-content: start; padding-top: 12px; }
.lobby-map-select button {
  min-height: 40px;
  border-color: var(--toy-line);
  background: #dff5e4;
  color: var(--toy-ink);
  box-shadow: 0 3px 0 #69a56d;
}
.lobby-map-select button::before { content: "\25C9 "; color: #3b9b5b; }
.lobby-map-select button.active { border-color: var(--toy-line); background: var(--toy-yellow); color: var(--toy-ink); }

.character-list { grid-column: 2; grid-row: 1; gap: clamp(8px, 1.6vw, 24px); padding: 12px clamp(4px, 2vw, 28px) 8px; }
.character-option {
  min-height: 220px;
  border: 2px solid rgba(219, 247, 233, .2);
  border-radius: 8px;
  background: rgba(10, 53, 49, .48);
  box-shadow: 0 5px 0 rgba(8, 42, 41, .58);
  overflow: hidden;
}
.character-option:hover { border-color: #81d5c2; background: rgba(20, 75, 66, .7); }
.character-option.active { border-color: #f8c938; background: rgba(69, 83, 44, .75); box-shadow: 0 5px 0 #936b24, 0 0 0 3px rgba(255,213,77,.15); }
.character-option.active::after {
  content: "\5DF2\9009";
  position: absolute;
  top: 7px;
  right: 7px;
  padding: 3px 7px;
  border-radius: 6px;
  background: var(--toy-yellow);
  color: var(--toy-ink);
  font-size: 9px;
  font-weight: 900;
}
.character-portrait { padding-top: 6px; }
.character-platform { border-color: #abd6ca; background: #2b5a55; }
.character-option.active .character-platform { border-color: #ffe777; background: #6a673a; }
.character-option-label { width: 100%; padding: 5px 4px 6px; background: rgba(8,42,40,.78); }
.character-option-label strong { color: #fff6dc; }
.character-option-label small { color: #b6dad0; }
.character-option.active .character-option-label { border: 0; background: #674f28; }

.character-summary {
  grid-column: 2;
  grid-row: 2;
  grid-template-columns: minmax(116px, 180px) minmax(240px, 620px);
  gap: 20px;
  min-height: 82px;
  padding: 10px 18px;
  border: 2px solid #5aa99b;
  border-radius: 8px;
  background: rgba(14, 67, 62, .96);
  box-shadow: 0 4px 0 #0b3937;
}
.character-identity p { color: #9cd8cc; }
.character-identity h1 { color: #fff3c5; font-family: "Microsoft YaHei", "PingFang SC", sans-serif; font-size: 28px; }
.character-skill-summary { border-left: 2px solid #edba42; padding-left: 16px; }
.detail-label { color: #a9d8d0; }
.character-skill-summary h3 { color: #dd692c; font-family: "Microsoft YaHei", "PingFang SC", sans-serif; }
.character-skill-summary p { color: #e5f0e8; font-weight: 700; }

.lobby-footer {
  grid-column: 2;
  grid-row: 3;
  grid-template-columns: minmax(170px, 230px) minmax(220px, 300px);
  grid-template-rows: 54px;
  gap: 10px;
  min-height: 72px;
  padding: 9px 0;
  border: 0;
  background: transparent;
}
#lobby-multiplayer,
#lobby-start { height: 54px; min-height: 54px; border-color: var(--toy-line); border-radius: 7px; }
#lobby-multiplayer { background: var(--toy-blue); color: #fff; box-shadow: 0 5px 0 var(--toy-blue-dark); }
#lobby-multiplayer small { color: #e7f9ff; }
#lobby-start { background: var(--toy-yellow); color: var(--toy-ink); box-shadow: 0 5px 0 #be7c25; font-size: 17px; }
#lobby-start:hover { background: #ffe16f; }
.lobby-talent-rail { display: none !important; }

/* Meta progression, rankings and community */
.lobby-meta-view { border: 2px solid var(--toy-line); border-radius: 8px; background: rgba(15, 62, 58, .94); box-shadow: 0 5px 0 rgba(8,42,41,.65); }
.shop-content { padding: 14px; }
.shop-item,
.leaderboard-card,
.social-list > li,
.room-directory-list li,
.room-players li {
  border: 2px solid #244c50;
  border-radius: 7px;
  background: var(--toy-paper);
  color: var(--toy-ink);
  box-shadow: 0 3px 0 rgba(9,38,40,.22);
}
.shop-item-heading h3,
.shop-item h3,
.leaderboard-card h3,
.social-list strong { color: var(--toy-ink); }
.shop-item p,
.shop-item small,
.leaderboard-card li,
.social-empty { color: #536b6c; }
.shop-item button { border-color: #286f89; background: var(--toy-blue); color: #fff; }
.shop-wallet-summary { border: 2px solid #9d7426; background: var(--toy-yellow); color: var(--toy-ink); }
.leaderboard-heading { background: #236f72; }
.leaderboard-heading h2 { color: #fff6dc; }
.leaderboard-modes button { background: #e9f4ec; color: #476164; }
.leaderboard-modes button.active { border-color: #9d7426; background: var(--toy-yellow); color: var(--toy-ink); }
.leaderboard-card li { border-bottom-color: #d6ded6; }

.social-drawer,
.multiplayer-panel {
  border: 3px solid var(--toy-line);
  border-radius: 8px;
  background: #eaf6e8;
  color: var(--toy-ink);
  box-shadow: 0 9px 0 rgba(8,42,41,.72), 0 24px 60px rgba(0,0,0,.48);
}
.social-heading,
.multiplayer-header { margin: -1px -1px 0; padding: 14px; border-radius: 6px 6px 0 0; background: var(--toy-blue); }
.social-heading h2,
.multiplayer-header h2 { color: #fff; font-family: "Microsoft YaHei", "PingFang SC", sans-serif; text-shadow: 0 2px 0 #276c88; }
.social-heading p,
.multiplayer-header p { color: #e4f8ff; }
.social-heading > button,
.multiplayer-header > button { border-color: #7b3d3d; background: var(--toy-red); color: #fff; }
.social-tabs button { background: #d7ebe2; color: #3c5e5f; }
.social-tabs button.active { border-color: #286f89; background: var(--toy-blue); color: #fff; }
.social-messages p { border-color: #8bb2ac; background: #fff; color: var(--toy-ink); }
.social-messages li.mine p { border-color: #4f9fba; background: #dff5ff; }
.room-directory,
.room-panel,
.room-chat { border-color: #8bb0aa; background: rgba(255,255,255,.46); }
.room-directory-list strong,
.room-players li,
.room-chat-messages li { color: var(--toy-ink); }
.room-directory-list small,
.room-phase { color: #577273; }
.room-actions button:last-child,
#room-create,
#room-code-join { border-color: #9d7426; background: var(--toy-yellow); color: var(--toy-ink); box-shadow: 0 3px 0 #bd812a; }
.room-actions #room-leave { border-color: #8a3d3d; background: #f08374; color: #fff; }

/* Dialogs */
#audio-settings,
#pause-overlay,
#game-over,
#result-overlay,
#name-entry { background: rgba(7, 29, 31, .76); backdrop-filter: blur(4px); }
.audio-settings-panel,
.pause-panel,
.end-panel,
.name-entry-panel {
  border: 4px solid var(--toy-blue-dark);
  border-radius: 8px;
  background: var(--toy-cream);
  color: var(--toy-ink);
  box-shadow: 0 7px 0 #155477, 0 24px 64px rgba(0,0,0,.48);
}
.audio-settings-heading { margin: -24px -24px 20px; padding: 12px 14px; border-radius: 4px 4px 0 0; background: var(--toy-blue); }
.audio-settings-heading h2 { color: #fff; text-shadow: 0 2px 0 #276c88; }
.audio-settings-heading button { border-color: #7b3d3d; background: var(--toy-red); color: #fff; }
.audio-settings-panel label,
.audio-settings-panel output,
.pause-panel h2,
.end-panel h2,
.name-entry-panel h2 { color: var(--toy-ink); }
.audio-settings-panel select,
.name-entry-panel input { border: 2px solid #73999a; background: #fff; color: var(--toy-ink); }
.audio-settings-actions button,
.pause-actions button,
.end-panel button,
.name-entry-panel button { border-color: #286f89; background: var(--toy-blue); color: #fff; box-shadow: 0 3px 0 #247aa5; }

/* In-run HUD and choice cards */
.health-panel,
.run-currency,
#timer,
#boss-panel,
#exploration-timer {
  border: 2px solid var(--toy-line);
  border-radius: 7px;
  background: rgba(255, 250, 232, .92);
  color: var(--toy-ink);
  box-shadow: 0 4px 0 rgba(10,45,47,.55), 0 8px 20px rgba(0,0,0,.22);
}
.health-heading strong,
.health-heading span,
.xp-heading,
.rhythm,
.run-currency b,
#timer { color: var(--toy-ink); }
.health-track,
.xp-track { border: 2px solid #29494d; border-radius: 5px; background: #b8c4ae; }
#health-fill { background: var(--toy-red); }
#xp-fill { background: var(--toy-blue); }
.run-diamond { background: #def7ff; }
.run-revive { background: #ffe8e2; }
.run-gold { background: #fff0b7; }
#audio-settings-button,
#sponsor-button { border-color: var(--toy-line); background: var(--toy-paper); color: var(--toy-ink); box-shadow: 0 3px 0 #879b8b; }

#level-up { background: rgba(6, 30, 31, .82); }
.choice-panel > p { color: #94ece2; text-shadow: 0 2px 0 #163e42; }
.choice-panel > h2 { color: #fff8dc; text-shadow: 0 3px 0 #163e42; }
.upgrade-option {
  border: 3px solid #31565a;
  border-radius: 8px;
  background: var(--toy-paper);
  color: var(--toy-ink);
  box-shadow: 0 6px 0 rgba(11,45,47,.7), 0 14px 28px rgba(0,0,0,.28);
}
.upgrade-option strong { color: var(--toy-ink); }
.upgrade-option .card-detail { color: #4b6567; }
.upgrade-option .card-icon { border: 2px solid #31565a; background: #dff4e7; }
.upgrade-option[data-kind="element"] { background: #e8f2ff; }
.upgrade-option[data-kind="evolution"],
.evolution-option { background: #f3e7ff; }
.upgrade-option[data-kind="relic"] { background: #e3f8ec; }
.upgrade-option[data-quality="mythic"] { background: #fff0c3; }
.upgrade-reroll { border-color: #4d367f; background: var(--toy-purple); color: #fff; box-shadow: 0 4px 0 #4e3883; }
.upgrade-grid.evolution-choice {
  grid-template-columns: repeat(2, minmax(0, 420px)) !important;
  justify-content: center;
}

@media (max-width: 900px) {
  .lobby-tabs { grid-template-columns: repeat(6, minmax(68px, 1fr)); }
  .character-list { gap: 8px; }
}

@media (max-width: 600px) {
  #intro { padding-inline: 18px; }
  .main-menu-brand { margin-bottom: 26px; }
  .main-menu-brand h1 { font-size: 58px; }

  #lobby { gap: 6px; padding: max(7px, env(safe-area-inset-top)) 8px max(7px, env(safe-area-inset-bottom)); }
  .lobby-header {
    flex-basis: 58px;
    grid-template-columns: 36px minmax(64px, 1fr) 60px minmax(94px, auto);
    gap: 4px;
    height: 58px;
    padding: 5px 6px;
  }
  .lobby-header #lobby-back { width: 34px; height: 34px; }
  .lobby-header h2 { font-size: 14px; }
  .header-leaderboard-button { width: 60px !important; min-width: 60px; height: 34px !important; padding: 0 4px !important; font-size: 9px !important; }
  .header-leaderboard-button::before { margin-right: 2px; }
  .lobby-wallet { min-width: 94px; padding: 4px 5px; gap: 0 4px; }
  .lobby-wallet strong { font-size: 12px; }
  .lobby-wallet span { max-width: 100px; font-size: 8px; }

  .lobby-tabs {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    flex-basis: 54px;
    width: 100%;
    height: 54px;
    gap: 3px;
    padding: 4px;
    overflow: visible;
  }
  .lobby-tabs button,
  .lobby-tabs .community-tab {
    grid-template-columns: 1fr;
    grid-template-rows: 18px 13px;
    gap: 1px;
    min-height: 42px;
    padding: 2px;
    font-size: 9px;
  }
  .lobby-tabs button::before { font-size: 15px; }
  .lobby-tabs .community-tab span { grid-row: 2; }
  .community-tab b { position: absolute; top: 1px; right: 2px; min-width: 14px; height: 14px; padding: 0 2px; font-size: 8px; }

  .lobby-character-view {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto 68px;
    row-gap: 6px;
    overflow-y: auto;
    padding-top: 0;
  }
  .lobby-map-select { grid-column: 1; grid-row: 1; grid-template-columns: 82px; justify-content: start; padding: 2px 2px 0; }
  .lobby-map-select button { min-height: 32px; font-size: 10px; }
  .character-list {
    grid-column: 1;
    grid-row: 2;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px 10px;
    width: min(338px, 100%);
    margin-inline: auto;
    padding: 2px;
  }
  .character-option { grid-template-rows: 100px 11px 38px; height: 151px; min-height: 151px; }
  .character-portrait { height: 100px; min-height: 0; }
  .character-option-label { padding-block: 3px 4px; }
  .character-option-label strong { font-size: 13px; }
  .character-option-label small { margin-top: 1px; font-size: 8px; }
  .character-option.active::after { top: 4px; right: 4px; padding: 2px 5px; font-size: 8px; }
  .character-summary {
    grid-column: 1;
    grid-row: 3;
    grid-template-columns: 82px minmax(0, 1fr);
    gap: 10px;
    min-height: 78px;
    padding: 8px 9px;
  }
  .character-identity h1 { font-size: 23px; }
  .character-skill-summary { padding-left: 10px; }
  .character-skill-summary h3 { margin-block: 2px; font-size: 14px; }
  .character-skill-summary p { font-size: 9px; }
  .lobby-footer {
    grid-column: 1;
    grid-row: 4;
    grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
    grid-template-rows: 54px;
    gap: 7px;
    min-height: 68px;
    padding: 5px 4px 9px;
  }
  #lobby-multiplayer,
  #lobby-start { width: 100%; min-width: 0; height: 54px; min-height: 54px; }
  #lobby-multiplayer span { font-size: 12px; }
  #lobby-multiplayer small { font-size: 8px; }
  #lobby-start { font-size: 15px; }

  .upgrade-grid.evolution-choice { grid-template-columns: minmax(0, 1fr) !important; }

  .lobby-meta-view { min-height: 0; }
  .shop-content { padding: 8px; }
  .audio-settings-panel { width: calc(100vw - 24px); padding: 20px; }
  .audio-settings-heading { margin: -20px -20px 18px; }
  .multiplayer-panel { padding: 12px; }
}

/* fix-v56: upgrade cards follow the tall reference-card composition. */
#level-up {
  align-items: flex-start !important;
  padding: max(22px, env(safe-area-inset-top)) 16px max(22px, env(safe-area-inset-bottom)) !important;
  background: rgba(248, 232, 173, .92) !important;
  backdrop-filter: blur(5px) saturate(.9) !important;
}
#level-up .choice-panel {
  width: min(560px, 100%) !important;
  max-height: calc(100vh - 44px) !important;
  margin: 0 auto;
  padding: 0 !important;
}
#level-up .choice-panel > p {
  margin: 0 0 5px !important;
  color: #5b8a4a !important;
  font-size: 14px !important;
  text-shadow: none !important;
}
#level-up .choice-panel > h2 {
  margin: 0 0 18px !important;
  color: #5b3218 !important;
  font-size: 30px !important;
  text-shadow: none !important;
}
#level-up .upgrade-grid,
#level-up .upgrade-grid.four-options,
#level-up .upgrade-grid.evolution-choice {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  width: 100% !important;
  gap: 10px !important;
}
#level-up .upgrade-option {
  display: grid !important;
  grid-template-columns: 86px minmax(0, 1fr) 66px !important;
  grid-template-rows: minmax(0, 1fr) !important;
  align-items: center !important;
  min-height: 152px !important;
  height: 152px !important;
  max-height: 152px !important;
  padding: 14px 16px !important;
  border: 3px solid #91602d !important;
  border-radius: 13px !important;
  background-color: #10251d !important;
  background-image: none !important;
  background-size: 100% 100% !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  background-blend-mode: screen !important;
  box-shadow: inset 0 0 0 1px rgba(255,240,173,.18), 0 5px 0 #70411d, 0 8px 16px rgba(35,28,12,.2) !important;
  text-align: left !important;
}
#level-up .upgrade-option::after {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(242,204,119,.52);
  border-radius: 8px;
  pointer-events: none;
}
#level-up .upgrade-option .card-icon {
  position: relative !important;
  left: auto !important;
  top: auto !important;
  z-index: 1;
  width: 70px !important;
  height: 70px !important;
  margin: 0 auto !important;
  border: 2px solid currentColor !important;
  border-radius: 50% !important;
  background: radial-gradient(circle, rgba(255,255,255,.14), rgba(255,255,255,.02)) !important;
  font-size: 34px !important;
  box-shadow: 0 0 16px currentColor, inset 0 0 12px rgba(255,255,255,.12) !important;
}
#level-up .upgrade-option .card-copy {
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 8px !important;
  z-index: 1;
}
#level-up .upgrade-option .card-quality {
  margin: 0 0 7px !important;
  color: #d6d9bf !important;
  font-size: 11px !important;
  text-shadow: none !important;
}
#level-up .upgrade-option strong {
  display: block !important;
  margin: 0 0 8px !important;
  color: #fff8d8 !important;
  font-size: 24px !important;
  line-height: 1.12 !important;
  text-shadow: none !important;
}
#level-up .upgrade-option .card-divider {
  display: block !important;
  width: 100% !important;
  height: 1px !important;
  margin: 0 0 8px !important;
  background: rgba(235,202,116,.62) !important;
}
#level-up .upgrade-option .card-detail {
  display: block !important;
  color: #cad7bd !important;
  font-size: 14px !important;
  line-height: 1.35 !important;
  text-shadow: none !important;
}
#level-up .upgrade-option .skill-star {
  position: relative !important;
  top: auto !important;
  right: auto !important;
  z-index: 1;
  width: 58px !important;
  height: 58px !important;
  margin: 0 auto !important;
}
#level-up .upgrade-option:not([data-kind="skill"]) .skill-star { display: none !important; }
#level-up .upgrade-option:not([data-kind="skill"]) { grid-template-columns: 86px minmax(0, 1fr) 0 !important; }
#level-up .upgrade-option[data-quality="standard"] { border-color: #789f64 !important; }
#level-up .upgrade-option[data-quality="strong"] { border-color: #4e98d0 !important; background-color: #102a3e !important; background-blend-mode: screen, multiply !important; }
#level-up .upgrade-option[data-quality="premium"] { border-color: #a76bc6 !important; background-color: #261b37 !important; background-blend-mode: screen, multiply !important; }
#level-up .upgrade-option[data-quality="mythic"] { border-color: #d3a13d !important; background-color: #3b2b16 !important; background-blend-mode: screen, multiply !important; }
#level-up .upgrade-option[data-quality="standard"] .card-icon { color: #b7e278 !important; }
#level-up .upgrade-option[data-quality="strong"] .card-icon { color: #72c8ff !important; }
#level-up .upgrade-option[data-quality="premium"] .card-icon { color: #df9cff !important; }
#level-up .upgrade-option[data-quality="mythic"] .card-icon { color: #ffd873 !important; }
#level-up .upgrade-option[data-quality="standard"] .card-quality,
#level-up .upgrade-option[data-quality="standard"] .card-detail { color: #b7e278 !important; }
#level-up .upgrade-option[data-quality="strong"] .card-quality,
#level-up .upgrade-option[data-quality="strong"] .card-detail { color: #72c8ff !important; }
#level-up .upgrade-option[data-quality="premium"] .card-quality,
#level-up .upgrade-option[data-quality="premium"] .card-detail { color: #df9cff !important; }
#level-up .upgrade-option[data-quality="mythic"] .card-quality,
#level-up .upgrade-option[data-quality="mythic"] .card-detail { color: #ffd873 !important; }
#level-up .upgrade-option[data-quality="standard"] strong { color: #f1f5da !important; }
#level-up .upgrade-option[data-quality="strong"] strong { color: #e7f6ff !important; }
#level-up .upgrade-option[data-quality="premium"] strong { color: #f8eaff !important; }
#level-up .upgrade-option[data-quality="mythic"] strong { color: #fff4ce !important; }
#level-up .upgrade-reroll { margin: 16px auto 0 !important; }

@media (max-width: 600px) {
  #level-up { padding-inline: 9px !important; }
  #level-up .choice-panel > h2 { font-size: 24px !important; margin-bottom: 12px !important; }
  #level-up .upgrade-option { grid-template-columns: 68px minmax(0, 1fr) 54px !important; min-height: 126px !important; height: 126px !important; max-height: 126px !important; padding: 10px 11px !important; }
  #level-up .upgrade-option:not([data-kind="skill"]) { grid-template-columns: 68px minmax(0, 1fr) 0 !important; }
  #level-up .upgrade-option .card-icon { width: 54px !important; height: 54px !important; font-size: 26px !important; }
  #level-up .upgrade-option strong { font-size: 19px !important; }
  #level-up .upgrade-option .card-detail { font-size: 11px !important; }
}

/* fix-v55 final card and lobby overrides */
#level-up { background: rgba(4, 8, 7, .42) !important; backdrop-filter: blur(2px) saturate(1) !important; }
.upgrade-option { grid-template-rows: auto minmax(46px, 1fr) auto !important; padding: 18px 16px 16px !important; }
.upgrade-option .card-icon { display: grid !important; position: absolute; left: 16px; top: 17px; width: 48px; height: 48px; margin: 0; border: 2px solid currentColor; border-radius: 50%; background: rgba(255,255,255,.08); color: #d7e3d5; font-size: 25px; line-height: 1; }
.upgrade-option .card-copy { min-width: 0; margin-left: 62px; }
.upgrade-option[data-kind="skill"] .card-copy { margin-right: 60px; }
.upgrade-option[data-quality="standard"] { border-color: rgba(220,231,221,.9) !important; }
.upgrade-option[data-quality="strong"] { border-color: rgba(111,181,244,.95) !important; }
.upgrade-option[data-quality="premium"] { border-color: rgba(216,154,240,.95) !important; }
.upgrade-option[data-quality="mythic"] { border-color: rgba(244,199,79,.98) !important; }
.upgrade-option[data-quality="standard"] .card-quality,
.upgrade-option[data-quality="standard"] .card-detail,
.upgrade-option[data-quality="standard"] strong { color: #dce7dd !important; }
.upgrade-option[data-quality="strong"] .card-quality,
.upgrade-option[data-quality="strong"] .card-detail,
.upgrade-option[data-quality="strong"] strong { color: #6fb5f4 !important; }
.upgrade-option[data-quality="premium"] .card-quality,
.upgrade-option[data-quality="premium"] .card-detail,
.upgrade-option[data-quality="premium"] strong { color: #d89af0 !important; }
.upgrade-option[data-quality="mythic"] .card-quality,
.upgrade-option[data-quality="mythic"] .card-detail,
.upgrade-option[data-quality="mythic"] strong { color: #f4c74f !important; }
.upgrade-option[data-kind="skill"] .skill-star { display: block !important; }
.upgrade-option:not([data-kind="skill"]) .skill-star { display: none !important; }
.lobby-header { position: relative; grid-template-columns: 46px minmax(0,1fr) auto auto !important; }
.header-leaderboard-button { position: absolute !important; left: 50% !important; top: 50% !important; transform: translate(-50%,-50%) !important; z-index: 2; }
.lobby-player-identity { min-width: 76px; max-width: 112px; overflow: visible !important; white-space: nowrap; text-align: right; }
.lobby-player-identity b, .lobby-player-identity small { display: block; overflow: visible !important; text-overflow: clip !important; white-space: nowrap; }
.leaderboard-card li[data-rank="1"] b { color: #e8b93f !important; }
.leaderboard-card li[data-rank="2"] b { color: #b7c4ca !important; }
.leaderboard-card li[data-rank="3"] b { color: #cf8b5a !important; }
.leaderboard-card li[data-rank="4"] b, .leaderboard-card li[data-rank="5"] b { color: #75c8df !important; }

@media (max-width: 360px) {
  .lobby-header { grid-template-columns: 34px minmax(54px, 1fr) 56px 90px; }
  .header-leaderboard-button { width: 56px !important; min-width: 56px; }
  .lobby-wallet { min-width: 90px; }
  .character-list { width: 320px; max-width: 100%; }
}

/* v39: identity and choice cards use information hierarchy rather than single-character marks. */
.lobby-player-identity {
  display: grid;
  grid-column: 1 / -1;
  justify-items: center;
  min-width: 0;
  line-height: 1.1;
}
.lobby-player-identity b {
  max-width: 100%;
  overflow: hidden;
  color: #17333a;
  font-size: 10px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lobby-player-identity small {
  color: #4e7070;
  font: 800 8px/1 ui-monospace, monospace;
}
.name-entry-status {
  min-height: 18px;
  margin: 7px 0 0;
  color: #b93838;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

#lobby-multiplayer {
  display: grid;
  place-content: center;
  gap: 2px;
}
#lobby-multiplayer::before {
  content: "\1F465" !important;
  display: block;
  margin: 0;
  font-size: 18px;
  line-height: 1;
}
#lobby-multiplayer small { display: none; }
#lobby-multiplayer span { font-size: 13px; }

.social-list > li > span:first-child > span {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.social-list > li > span:first-child > span > small {
  color: #6a8584;
  font: 800 9px/1 ui-monospace, monospace;
}

.upgrade-option {
  grid-template-rows: auto auto 1px minmax(0, 1fr);
  align-content: start;
  padding: 18px 24px;
  background: #173b38;
  text-align: center;
}
.upgrade-option[data-kind="element"] { background: #1b304b; }
.upgrade-option[data-kind="evolution"],
.evolution-option { background: #302344; }
.upgrade-option[data-kind="relic"] { background: #173e35; }
.upgrade-option[data-quality="mythic"] { background: #49371d; }
.upgrade-option .card-icon { display: none !important; }
.upgrade-option .card-quality {
  position: static;
  left: auto;
  right: auto;
  margin: 0 0 10px;
  color: #b4d7d1;
  font-size: 11px;
  line-height: 1.25;
}
.upgrade-option strong {
  margin: 0 56px 12px;
  color: #fff0c4;
  font-size: 24px;
  line-height: 1.18;
}
.upgrade-option .card-divider {
  display: block;
  width: auto;
  height: 1px;
  margin: 0 12px 14px;
  background: #e0b654;
}
.upgrade-option .card-detail {
  align-self: start;
  color: #d5e4de;
  font-size: 13px;
  line-height: 1.7;
}
.upgrade-option .skill-star { top: 13px; right: 13px; }

@media (max-width: 600px) {
  .lobby-player-identity b { font-size: 8px; }
  .lobby-player-identity small { font-size: 7px; }
  #lobby-multiplayer::before { font-size: 16px; }
  #lobby-multiplayer span { font-size: 12px; }
  .upgrade-option {
    grid-template-rows: auto auto 1px minmax(0, 1fr);
    padding: 15px 18px;
  }
  .upgrade-option strong { margin: 0 44px 9px; font-size: 19px; }
  .upgrade-option .card-quality { margin-bottom: 7px; font-size: 9px; }
  .upgrade-option .card-divider { margin: 0 6px 9px; }
  .upgrade-option .card-detail { font-size: 11px; line-height: 1.52; }
  .upgrade-option .skill-star { top: 9px; right: 9px; }
}

/* v40: centered rankings, separate identity/currency groups, and denser in-run choices. */
.lobby-header { position: relative; grid-template-columns: 46px minmax(120px, 1fr) auto auto; }
.header-leaderboard-button {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}
.header-leaderboard-button:hover { transform: translate(-50%, calc(-50% - 1px)); }
.lobby-player-identity {
  grid-column: auto;
  justify-self: end;
  min-width: 86px;
  padding: 5px 8px;
  border-left: 1px solid rgba(170, 225, 214, .28);
}
.lobby-player-identity b { color: #fff5d5; font-size: 12px; }
.lobby-player-identity small { color: #93d7cf; font-size: 9px; }
.lobby-wallet {
  display: grid;
  grid-template-columns: repeat(2, minmax(62px, auto));
  gap: 5px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
}
.lobby-wallet .lobby-currency {
  display: grid;
  grid-column: auto;
  grid-template-columns: minmax(34px, auto) 20px;
  align-items: center;
  gap: 3px;
  min-height: 34px;
  padding: 3px 4px 3px 7px;
  border: 2px solid #173d43;
  border-radius: 7px;
  background: #f9f2d8;
}
.lobby-wallet .lobby-currency strong { font-size: 12px; }
.lobby-wallet .lobby-currency button {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  min-height: 20px;
  padding: 0;
  border: 1px solid #255b61;
  border-radius: 50%;
  background: #36aeca;
  color: #fff;
  font: 900 15px/1 system-ui, sans-serif;
  box-shadow: 0 2px 0 #24768b;
}
.lobby-wallet .lobby-currency-coins button { background: #e7ad35; box-shadow: 0 2px 0 #a97621; }

.upgrade-grid,
.upgrade-grid.four-options { grid-auto-rows: 176px !important; }
.upgrade-option {
  height: 176px !important;
  min-height: 176px !important;
  max-height: 176px !important;
}
.upgrade-option { padding-block: 14px; }
.upgrade-option .card-quality { margin-bottom: 6px; }
.upgrade-option strong { margin-bottom: 8px; }
.upgrade-option .card-divider { margin-bottom: 8px; }

.skill-cancel-zone {
  top: auto !important;
  right: max(24px, calc(env(safe-area-inset-right) + 24px)) !important;
  bottom: max(190px, calc(env(safe-area-inset-bottom) + 190px));
  width: 78px;
  height: 78px;
}
.skill-cancel-zone span { font-size: 27px; }
.skill-cancel-zone strong { font-size: 9px; }

@media (max-width: 600px) {
  .lobby-header {
    flex-basis: 82px;
    grid-template-columns: 36px minmax(56px, 1fr) 56px 118px;
    grid-template-rows: 38px 30px;
    height: 82px;
    padding-bottom: 5px;
  }
  .lobby-header #lobby-back { grid-row: 1; }
  .lobby-header > div:first-of-type { grid-row: 1; }
  .header-leaderboard-button { top: auto; bottom: 2px; width: 74px !important; height: 29px !important; transform: translateX(-50%); }
  .header-leaderboard-button:hover { transform: translate(-50%, -1px); }
  .lobby-player-identity { grid-column: 3; grid-row: 1; min-width: 0; padding: 3px 4px; }
  .lobby-player-identity b { font-size: 9px; }
  .lobby-player-identity small { font-size: 7px; }
  .lobby-wallet { grid-column: 4; grid-row: 2; align-self: center; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px; }
  .lobby-wallet .lobby-currency { grid-column: auto; grid-template-columns: minmax(20px, 1fr) 16px; min-height: 28px; padding: 2px; }
  .lobby-wallet .lobby-currency strong { font-size: 9px; }
  .lobby-wallet .lobby-currency strong::before { width: 9px !important; height: 9px !important; margin-right: 2px; }
  .lobby-wallet .lobby-currency button { width: 16px; height: 16px; min-height: 16px; font-size: 12px; }
  .upgrade-grid,
  .upgrade-grid.four-options { grid-auto-rows: 132px !important; }
  .upgrade-option {
    height: 132px !important;
    min-height: 132px !important;
    max-height: 132px !important;
    padding: 10px 16px !important;
  }
  .upgrade-option strong { margin-bottom: 5px; font-size: 18px; }
  .upgrade-option .card-divider { margin-bottom: 5px; }
  .upgrade-option .card-detail { line-height: 1.35; }
  .skill-cancel-zone {
    right: max(18px, calc(env(safe-area-inset-right) + 18px)) !important;
    bottom: max(190px, calc(env(safe-area-inset-bottom) + 190px));
    width: 70px;
    height: 70px;
  }
}

/* v41: high-contrast run HUD and progression surfaces. */
#hud .health-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  border-color: rgba(202, 226, 198, .46);
  background: rgba(8, 25, 20, .93);
  color: #f7f1dc;
  box-shadow: 0 4px 0 rgba(3, 12, 9, .62), 0 10px 24px rgba(0, 0, 0, .28);
}
#hud .health-heading {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
  gap: 8px;
  margin: 0 10px 5px 0;
  padding-right: 0;
}
#hud #life-value {
  position: static;
  float: none;
  grid-column: 2;
  grid-row: 1;
  align-self: center;
  justify-self: end;
  margin: 0 0 5px;
  white-space: nowrap;
}
#hud .health-track,
#hud .xp-heading,
#hud .xp-track,
#hud .rhythm,
#hud .status-row {
  grid-column: 1 / -1;
}
#hud .health-heading strong,
#hud .health-heading span,
#hud .xp-heading,
#hud .xp-heading strong,
#hud .xp-heading span { color: #fff5dc; text-shadow: 0 1px 2px #000; }
#hud #health-value,
#hud #xp-value { font-weight: 900; }
#hud .health-track,
#hud .xp-track { border-color: #91afa3; background: #243a31; }
#hud #health-fill { background: #f06a62; box-shadow: inset 0 1px rgba(255,255,255,.42), 0 0 8px rgba(240,106,98,.34); }
#hud #xp-fill { background: #45c2e6; box-shadow: inset 0 1px rgba(255,255,255,.42), 0 0 8px rgba(69,194,230,.28); }
#hud #life-value { color: #ffe388; text-shadow: 0 1px 2px #000; }

.audio-settings-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* fix-v42: keep the in-run wallet, sponsor action, and HUD bars in stable lanes. */
#hud .run-economy {
  top: max(14px, env(safe-area-inset-top));
  right: max(18px, env(safe-area-inset-right));
}

#hud #sponsor-button {
  top: max(78px, calc(env(safe-area-inset-top) + 78px));
  right: max(18px, env(safe-area-inset-right));
}

#hud #summon-wu {
  top: max(126px, calc(env(safe-area-inset-top) + 126px));
  right: max(18px, env(safe-area-inset-right));
  bottom: auto;
}

#hud .mini-map {
  position: absolute;
  top: max(72px, calc(env(safe-area-inset-top) + 72px));
  left: max(18px, env(safe-area-inset-left));
  width: 180px;
  height: 130px;
  border: 2px solid #173f3d;
  border-radius: 6px;
  background: #3d743d;
  box-shadow: 0 3px 0 rgba(7, 28, 25, .76), 0 7px 18px rgba(0, 0, 0, .28), inset 0 0 0 1px rgba(237, 242, 205, .38);
  image-rendering: auto;
}

#hud .health-track {
  position: relative;
  height: 11px;
  padding: 0;
  overflow: hidden;
  isolation: isolate;
}

#hud #health-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  display: block;
  min-height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, #e64f50 0%, #ff7763 76%, #ffd09a 100%) !important;
  box-shadow: inset 0 1px rgba(255,255,255,.55), 0 0 8px rgba(240,80,75,.42);
  opacity: 1;
  visibility: visible;
  z-index: 1;
}

@media (max-width: 600px), (pointer: coarse) {
  #hud .run-economy {
    top: max(8px, env(safe-area-inset-top));
    right: max(8px, env(safe-area-inset-right));
  }

  #hud #sponsor-button {
    top: max(64px, calc(env(safe-area-inset-top) + 64px));
    right: max(8px, env(safe-area-inset-right));
  }

  #hud #summon-wu {
    top: max(106px, calc(env(safe-area-inset-top) + 106px));
    right: max(8px, env(safe-area-inset-right));
  }

  #hud .mini-map {
    top: max(58px, calc(env(safe-area-inset-top) + 58px));
    left: max(8px, env(safe-area-inset-left));
    width: 126px;
    height: 92px;
  }

  #hud .health-heading {
    gap: 5px;
    margin-right: 7px;
  }

  #hud #life-value {
    font-size: 9px;
  }

  #exploration-timer,
  #boss-panel {
    top: max(160px, calc(env(safe-area-inset-top) + 160px));
  }

  #event-banner {
    top: max(236px, calc(env(safe-area-inset-top) + 236px));
  }
}
.shop-wallet-summary,
.shop-wallet-summary.mastery-summary {
  border: 2px solid #3e817d;
  background: #173f3d;
  color: #eff8e9;
  box-shadow: inset 0 0 0 1px rgba(143, 213, 198, .13);
}
.shop-wallet-summary span { color: #a9d7cd; font-weight: 800; }
.shop-wallet-summary strong { color: #ffe07b; text-shadow: 0 1px 1px #071c19; }
.shop-wallet-summary small { color: #d3e5dc; }
.shop-item { display: flex; flex-direction: column; min-height: 0; }
.shop-item.shop-mastery { min-height: 126px; overflow: hidden; }
.shop-item p { color: #3e5a5c; }
.shop-item small { color: #617779; }
.shop-item button { position: static; order: initial; flex: 0 0 auto; margin-top: auto; transform: none; }
.shop-item button:disabled { border-color: #90a8a5; background: #c9d7d2; color: #556d6d; opacity: 1; box-shadow: none; }
.mastery-lock-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid #d2ddd5;
  color: #536b6c;
  font-size: 10px;
}
.mastery-lock-note b { color: #268fa1; font-size: 11px; }

/* v49: playful dark progression cards with clear contrast. */
#meta-shop {
  border-color: #316f69;
  background:
    linear-gradient(rgba(15, 64, 58, .9), rgba(9, 45, 43, .96)),
    repeating-linear-gradient(135deg, rgba(124, 201, 164, .055) 0 10px, transparent 10px 22px);
}

#meta-shop .shop-content {
  gap: 14px;
  padding: 16px;
}

#meta-shop .shop-section {
  padding: 4px 0 2px;
}

#meta-shop .shop-section > h3 {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  margin: 0 0 10px;
  padding: 0 14px;
  border: 2px solid #102f31;
  border-radius: 6px;
  background: #efb83e;
  color: #18383a;
  box-shadow: 0 3px 0 #805d22;
  font-size: 14px;
  font-weight: 900;
}

#meta-shop .shop-section:nth-of-type(3n + 2) > h3 { background: #63c4b2; box-shadow: 0 3px 0 #28776f; }
#meta-shop .shop-section:nth-of-type(3n) > h3 { background: #ef8d6a; box-shadow: 0 3px 0 #8e4936; }

#meta-shop .shop-item,
#meta-shop .shop-item.shop-mastery {
  min-height: 142px;
  padding: 14px;
  border: 2px solid #396f6b;
  border-radius: 7px;
  background: linear-gradient(180deg, #173f3d 0%, #102f30 100%);
  color: #f7f0d7;
  box-shadow: inset 0 1px rgba(255, 255, 255, .08), 0 4px 0 rgba(4, 27, 28, .66);
}

#meta-shop .shop-item-heading {
  padding-bottom: 9px;
  border-bottom: 1px solid rgba(148, 210, 193, .22);
}

#meta-shop .shop-item-heading h3,
#meta-shop .shop-item h3 {
  color: #fff4d2;
  font-size: 17px;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .34);
}

#meta-shop .shop-level {
  min-width: 38px;
  padding: 5px 7px;
  border: 1px solid #d99d35;
  border-radius: 5px;
  background: #513f24;
  color: #ffe081;
  text-align: center;
}

#meta-shop .shop-item p { margin: 10px 0 8px; color: #c8e3d8; font-size: 12px; }
#meta-shop .shop-item small { color: #9fc4ba; font-size: 11px; }
#meta-shop .talent-pips { gap: 6px; margin: 8px 0 10px; }
#meta-shop .talent-pips i {
  flex: 1 1 0;
  width: auto;
  height: 7px;
  border-color: #477873;
  border-radius: 2px;
  background: #0b292a;
}
#meta-shop .talent-pips i.filled { border-color: #f1c04e; background: #ffd65e; box-shadow: 0 0 7px rgba(255, 205, 73, .42); }

#meta-shop .shop-item button {
  min-height: 38px;
  border: 2px solid #174c59;
  border-radius: 6px;
  background: #3aa7b6;
  color: #fff;
  box-shadow: 0 3px 0 #17606d;
  font-weight: 900;
}

#meta-shop .shop-item button:hover:not(:disabled) { background: #55bec8; transform: translateY(-1px); }
#meta-shop .shop-item button:disabled {
  border-color: #385653;
  background: #263f3e;
  color: #849e96;
  box-shadow: 0 2px 0 #132c2c;
}

#meta-shop .mastery-lock-note {
  border-top-color: rgba(148, 210, 193, .22);
  color: #a9c9bf;
}
#meta-shop .mastery-lock-note b { color: #78d4c3; }

#meta-shop .shop-wallet-summary,
#meta-shop .shop-wallet-summary.mastery-summary {
  border: 2px solid #9d7426;
  border-radius: 7px;
  background: linear-gradient(180deg, #5a4724, #3f361f);
  box-shadow: inset 0 1px rgba(255,255,255,.1), 0 4px 0 rgba(26, 26, 15, .52);
}

#meta-shop .shop-wallet-summary span { color: #f4dfad; }
#meta-shop .shop-wallet-summary strong { color: #ffe070; }
#meta-shop .shop-wallet-summary small { color: #d6c89e; }

#meta-shop .shop-footer { padding: 10px 16px 14px; border-top-color: rgba(133, 193, 178, .2); }
#meta-shop #talent-reset { border-color: #9d553f; background: #7b3f35; color: #ffe1ce; box-shadow: 0 3px 0 #482821; }

@media (max-width: 600px) {
  #meta-shop .shop-content { gap: 11px; padding: 11px; }
  #meta-shop .shop-section-grid { grid-template-columns: 1fr; }
  #meta-shop .shop-item,
  #meta-shop .shop-item.shop-mastery { min-height: 134px; }
}

.lobby-header { grid-template-columns: 46px minmax(120px, 1fr) auto 104px; }
.lobby-wallet { grid-column: 3; }
.lobby-player-identity { grid-column: 4; }

@media (max-width: 600px) {
  .lobby-header { grid-template-columns: 36px minmax(48px, 1fr) 118px 66px; }
  .lobby-wallet { grid-column: 3; grid-row: 1; align-self: center; }
  .lobby-player-identity { grid-column: 4; grid-row: 1; }
  .audio-settings-actions { grid-template-columns: 1fr 1fr; }
  .shop-wallet-summary { grid-template-columns: 1fr auto; min-height: 76px; }
  .shop-wallet-summary small { grid-column: 1 / -1; }
  .shop-item.shop-mastery { min-height: 118px; }
}

/* v54 warm courtyard theme: one visual language across menus, lobby and dialogs. */
:root {
  --town-ink: #543217;
  --town-deep: #70421b;
  --town-wood: #a96022;
  --town-wood-dark: #6e3714;
  --town-paper: #fff1bd;
  --town-paper-light: #fff8d9;
  --town-gold: #ffc438;
  --town-orange: #ef8a22;
  --town-green: #91bf35;
  --town-teal: #3a9a91;
  --town-line: #743d16;
  --town-shadow: rgba(76, 41, 17, .38);
}

#intro,
#lobby,
#multiplayer-lobby,
#name-entry,
#audio-settings,
#pause-overlay,
#level-up,
#game-over,
#run-result,
#sponsor-overlay {
  background-color: #77bda9;
  background-image: linear-gradient(rgba(25, 87, 79, .08), rgba(255, 212, 93, .1));
  background-position: center;
  background-size: cover;
}

#intro::before,
#lobby::before {
  background: rgba(36, 83, 66, .14);
}

.main-menu-panel,
.multiplayer-panel,
.audio-settings-panel,
.name-entry-panel,
.end-panel,
.sponsor-panel,
.social-drawer {
  border: 4px solid var(--town-line);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--town-paper-light), var(--town-paper));
  color: var(--town-ink);
  box-shadow: inset 0 0 0 3px #d38a32, inset 0 0 0 6px rgba(255, 241, 183, .8), 0 9px 0 var(--town-wood-dark), 0 18px 42px var(--town-shadow);
}

.main-menu-panel {
  width: min(490px, calc(100vw - 28px));
  padding: 26px 42px 36px;
}

.main-menu-panel::before,
.multiplayer-panel::before,
.audio-settings-panel::before,
.name-entry-panel::before,
.end-panel::before {
  content: "";
  display: block;
  height: 13px;
  margin: -37px 18px 18px;
  border: 3px solid var(--town-line);
  border-radius: 5px;
  background: repeating-linear-gradient(90deg, #8c4e1d 0 42px, #b96a27 42px 84px);
  box-shadow: inset 0 2px rgba(255, 196, 85, .32), 0 4px 0 #5c2c11;
}

.main-menu-brand { margin-bottom: 22px; }
.main-menu-brand p { color: #5b8b37; text-shadow: none; }
.main-menu-brand h1 {
  color: #ffd43f;
  font-size: clamp(48px, 7vw, 72px);
  -webkit-text-stroke: 2px #6e3211;
  text-shadow: 0 4px 0 #d0731e, 0 8px 0 #6d3514, 0 13px 18px rgba(89, 43, 15, .3);
}
.main-menu-brand span { color: #805022; text-shadow: none; }

.main-menu-actions { width: min(340px, 100%); gap: 10px; }
.main-menu-actions button,
#room-create-open,
#room-create,
#room-code-join,
#room-ready,
#room-start,
#player-name-submit,
.end-panel button,
.name-entry-panel button,
.audio-settings-actions button,
.shop-item button,
#talent-reset {
  border-color: #884511;
  background: linear-gradient(#ffd35a, #f2a425);
  color: #623412;
  box-shadow: inset 0 2px rgba(255,255,255,.38), inset 0 -3px rgba(183, 83, 13, .22), 0 4px 0 #8d4918;
}
.main-menu-actions button:hover,
#room-create-open:hover,
#room-create:hover,
#room-code-join:hover,
#room-ready:hover,
#room-start:hover,
.shop-item button:hover { background: linear-gradient(#ffe476, #ffb330); }
#menu-settings,
#room-create-cancel,
#room-leave,
#multiplayer-close,
#audio-settings-close,
#social-close {
  border-color: #477a72 !important;
  background: linear-gradient(#d8efe5, #99c8b6) !important;
  color: #315c55 !important;
  box-shadow: inset 0 2px rgba(255,255,255,.42), 0 3px 0 #477a72 !important;
}

#lobby {
  background-color: #78bea6;
}
.lobby-header,
.lobby-tabs {
  border-color: var(--town-line);
  background: linear-gradient(#b96c2c, #8f4b1c);
  box-shadow: inset 0 2px rgba(255, 205, 104, .28), 0 4px 0 var(--town-wood-dark), 0 8px 20px var(--town-shadow);
}
.lobby-header h2 { color: #fff3b3; text-shadow: 0 2px 0 #713812; }
.lobby-header > div:first-of-type p { color: #ffe090; }
.lobby-player-identity { border-left-color: rgba(255, 222, 143, .42); }
.lobby-player-identity b { color: #fff4c5; }
.lobby-player-identity small { color: #d5f2cf; }
.header-leaderboard-button {
  border-color: #6d3c13;
  background: linear-gradient(#ffd75c, #ef9c25);
  color: #643714;
  box-shadow: 0 3px 0 #6d3c13;
}
.lobby-tabs button,
.lobby-tabs .community-tab { color: #fff1bf; background: rgba(255, 239, 184, .1); }
.lobby-tabs button::before { color: #d9f1ae; }
.lobby-tabs button.active {
  border-color: #744014;
  background: linear-gradient(#ffe069, #f2aa27);
  color: #623412;
}

.lobby-character-view,
.lobby-meta-view {
  padding: 12px;
  border: 3px solid var(--town-line);
  border-radius: 8px;
  background: rgba(255, 244, 199, .91);
  box-shadow: inset 0 0 0 3px rgba(221, 150, 56, .64), 0 5px 0 var(--town-wood-dark), 0 12px 28px var(--town-shadow);
}
.character-option {
  border-color: #9a642e;
  background: rgba(255, 250, 220, .8);
  box-shadow: 0 4px 0 #9d652c;
}
.character-option:hover { border-color: #5e9f70; background: #f4f7c8; }
.character-option.active {
  border-color: #7a4417;
  background: #ffe17b;
  box-shadow: 0 5px 0 #8a4c18, 0 0 0 3px rgba(255, 196, 47, .25);
}
.character-option-label { background: rgba(124, 69, 25, .88); }
.character-platform { border-color: #8b6938; background: #79ad71; }
.character-summary { border-color: #b77a35; background: rgba(255, 247, 214, .72); }
.character-summary h1,
.character-summary h3 { color: #693916; }
.character-summary p { color: #765531; }
.lobby-map-select button { border-color: #6c4a24; background: #cce69c; box-shadow: 0 3px 0 #6f8d3d; }
#lobby-start { background: linear-gradient(#ffd75a, #ee9620); color: #60300f; }
#lobby-multiplayer { border-color: #477a72; background: linear-gradient(#d6ed99, #8fbd38); color: #3e5f1f; box-shadow: 0 4px 0 #55772c; }

#meta-shop .shop-content,
.room-panel,
.room-directory,
.room-chat,
.multiplayer-create-row,
.room-code-form,
.friend-section,
.social-view {
  border-color: #aa7138;
  background: rgba(255, 249, 221, .88);
}
.shop-item,
.room-player,
.room-directory-item {
  border-color: #a9743d;
  background: #fff8da;
  color: var(--town-ink);
  box-shadow: 0 3px 0 rgba(134, 77, 28, .28);
}
.shop-item-heading h3,
.shop-item h3,
.room-panel-heading strong,
.multiplayer-header h2 { color: #6b3b17; text-shadow: none; }
.shop-item p,
.shop-item small,
.multiplayer-status,
.room-directory-heading,
.room-code-form span { color: #765b36; }

.multiplayer-header {
  border-color: #874a18;
  background: linear-gradient(#d97b2c, #a5571d);
}
.multiplayer-header p { color: #ffe5a1; }
.multiplayer-header h2 { color: #fff1b2; text-shadow: 0 2px 0 #743712; }
.multiplayer-panel input,
.multiplayer-panel select,
.name-entry-panel input,
.audio-settings-panel select,
.room-chat-form input,
.social-drawer input {
  border-color: #a36d35;
  background: #fffdf0;
  color: #55391e;
}

.choice-panel {
  padding: 18px;
  border: 4px solid var(--town-line);
  border-radius: 8px;
  background: rgba(255, 239, 184, .96);
  box-shadow: inset 0 0 0 3px #dc9234, 0 8px 0 var(--town-wood-dark), 0 16px 36px var(--town-shadow);
}
.choice-panel > p { color: #588443; text-shadow: none; }
.choice-panel > h2 { color: #6e3b14; text-shadow: none; }
.upgrade-option {
  border: 2px solid #995d28;
  background: #fff8d9;
  color: #56371b;
  box-shadow: 0 4px 0 #9e642c;
}
.upgrade-option strong { color: #6b3512; }
.upgrade-option .card-detail { color: #725538; }

.audio-settings-panel label,
.audio-settings-panel output,
.end-panel h2,
.end-panel p,
.name-entry-panel h2,
.name-entry-panel p { color: var(--town-ink); }
.result-stats > div { border-color: #a66d34; background: rgba(255, 250, 220, .75); }

@media (max-width: 600px) {
  .main-menu-panel { width: min(94vw, 430px); padding: 22px 18px 26px; }
  .main-menu-panel::before,
  .multiplayer-panel::before,
  .audio-settings-panel::before,
  .name-entry-panel::before,
  .end-panel::before { margin: -33px 12px 15px; height: 10px; }
  .main-menu-brand h1 { font-size: 50px; }
  .lobby-character-view,
  .lobby-meta-view { padding: 7px; }
  .character-option { min-height: 0; }
  .choice-panel { padding: 10px; }
}

/* v47: readable room forms and a usable room chat workspace. */
.multiplayer-status,
.room-directory-heading,
.room-code-form span {
  color: #466465;
  font-weight: 700;
}
.multiplayer-create-row input,
.multiplayer-create-row select,
.room-code-form input,
.room-chat-form input {
  border-color: #78a6a2;
  background: rgba(255, 255, 255, .94);
  color: #15373b;
  font-weight: 700;
  opacity: 1;
  text-shadow: none;
}
.multiplayer-create-row input,
.multiplayer-create-row select {
  min-height: 46px;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 15px;
  line-height: 1.3;
}
.multiplayer-create-row input::placeholder,
.room-code-form input::placeholder,
.room-chat-form input::placeholder {
  color: #526d6e;
  opacity: 1;
}
.multiplayer-create-row input:focus,
.room-code-form input:focus,
.room-chat-form input:focus {
  border-color: #178daf;
  outline: 3px solid rgba(28, 173, 204, .2);
}
.multiplayer-create-row #room-create-cancel {
  border-color: #9aaead;
  background: #dbe8e2;
  color: #355657;
  opacity: 1;
}
.multiplayer-create-row button {
  min-height: 46px;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  font-size: 15px;
  font-weight: 900;
  text-shadow: none;
}
.room-active .room-panel {
  grid-template-columns: minmax(360px, 440px) minmax(0, 1fr);
}
.room-active .room-chat {
  align-self: stretch;
  padding: 12px;
  border: 2px solid #79a6a1;
  border-radius: 6px;
  background: rgba(255, 255, 255, .72);
}
.room-active .room-chat-messages {
  min-height: 260px;
  max-height: 360px;
  margin: 0 0 10px;
  padding: 8px;
  border: 1px solid #c1d5ce;
  background: rgba(244, 250, 244, .9);
}
.room-active .room-chat-messages li {
  font-size: 14px;
  line-height: 1.5;
}
.room-active .room-chat-form {
  display: flex;
  width: 100%;
  gap: 8px;
}
.room-active .room-chat-form input { width: 100%; }
.room-active .room-chat-form button { flex: 0 0 72px; }

@media (max-width: 760px) {
  .room-active .room-panel { grid-template-columns: 1fr; }
  .room-active .room-chat { display: block; padding: 9px; }
  .room-active .room-chat-messages { min-height: 150px; max-height: 210px; }
}

/* v48: readable social surfaces, online directory, and phase-aware room layout. */
.social-heading .social-online {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, .5);
  border-radius: 5px;
  background: rgba(18, 79, 96, .48);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  text-shadow: 0 1px 1px rgba(0, 0, 0, .36);
}
.social-heading .social-online b { color: #fff4a6; font-size: 14px; }
.social-heading .social-online i { background: #a8ed63; box-shadow: 0 0 0 3px rgba(168, 237, 99, .2); }
.social-tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.social-tabs button {
  border: 2px solid #9bbab4;
  background: #d7ebe2;
  color: #294f52;
  font-size: 13px;
  font-weight: 900;
}
.social-tabs button.active { border-color: #286f89; background: var(--toy-blue); color: #fff; }
.friend-section h3,
.conversation-heading strong,
.online-directory-heading h3 { color: #294f52; font-weight: 900; }
.friend-search-form input,
.social-message-form input {
  border: 2px solid #7fa5a2;
  background: #fff;
  color: #17373a;
  font-weight: 700;
}
.friend-search-form input::placeholder,
.social-message-form input::placeholder { color: #5d7778; opacity: 1; }
.social-list > li > span:first-child > span > small { color: #4e6d70; }
.social-row-actions button[data-tone="quiet"] { border-color: #91aba7; background: #dceae4; color: #38585a; opacity: 1; }
.social-messages span { color: #466568; font-size: 10px; font-weight: 800; }
.social-status { color: #466568; font-size: 11px; font-weight: 800; }
.social-status[data-tone="ok"] { color: #23713f; }
.social-status[data-tone="error"] { color: #aa3939; }
.online-directory-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 46px;
  margin-bottom: 9px;
  padding: 0 4px;
  border-bottom: 2px solid #b5ccc5;
}
.online-directory-heading h3 { margin: 0; font-size: 15px; }
.online-directory-heading strong { color: #466568; font-size: 11px; }
.online-directory-heading b { color: #1e7187; font-size: 17px; }
.online-player-list { align-content: start; }
.social-message-player {
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-bottom: 1px solid currentColor;
  border-radius: 0;
  background: transparent;
  color: #126e8b;
  font: inherit;
  font-weight: 900;
  box-shadow: none;
}
.social-message-player:hover { color: #0a4960; background: transparent; }

.multiplayer-status[data-tone="ok"] { color: #287345; }
.multiplayer-status[data-tone="error"] { color: #a43d3d; }
.room-panel-heading span { color: #294f52; font-weight: 900; }
.room-panel-heading strong { color: #175f78; text-shadow: none; }
.room-active .room-phase { color: #8a5a00; font-size: 13px; font-weight: 900; }
.room-active .room-players li small { color: #8a5a00; font-weight: 900; }

.room-active[data-room-phase="lobby"] .room-panel {
  grid-template-columns: minmax(300px, 380px) minmax(480px, 1fr);
  grid-template-rows: auto auto minmax(300px, 1fr) auto;
  align-items: stretch;
  column-gap: 22px;
}
.room-active[data-room-phase="lobby"] .room-panel-heading { grid-column: 1 / -1; grid-row: 1; }
.room-active[data-room-phase="lobby"] .room-phase { grid-column: 1 / -1; grid-row: 2; }
.room-active[data-room-phase="lobby"] .room-players {
  grid-column: 1;
  grid-row: 3;
  align-content: start;
  min-height: 300px;
  padding: 10px;
  border: 2px solid #8bb0aa;
  border-radius: 6px;
  background: rgba(255, 255, 255, .48);
}
.room-active[data-room-phase="lobby"] .room-chat {
  grid-column: 2;
  grid-row: 3;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 300px;
}
.room-active[data-room-phase="lobby"] .room-chat-messages { height: auto; min-height: 0; max-height: none; }
.room-active[data-room-phase="lobby"] .room-actions {
  grid-column: 1 / -1;
  grid-row: 4;
  justify-content: flex-end;
  padding-top: 4px;
  border-top: 2px solid #bfd2cc;
}
.room-active[data-room-phase="lobby"] .room-actions #room-leave { margin-right: auto; }

@media (max-width: 760px) {
  .social-heading .social-online { padding-inline: 7px; font-size: 10px; }
  .social-tabs { gap: 4px; }
  .social-tabs button { min-width: 0; padding-inline: 4px; font-size: 11px; }
  .room-active[data-room-phase="lobby"] .room-panel {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto auto auto;
  }
  .room-active[data-room-phase="lobby"] .room-panel-heading,
  .room-active[data-room-phase="lobby"] .room-phase,
  .room-active[data-room-phase="lobby"] .room-players,
  .room-active[data-room-phase="lobby"] .room-chat,
  .room-active[data-room-phase="lobby"] .room-actions { grid-column: 1; grid-row: auto; }
  .room-active[data-room-phase="lobby"] .room-players { min-height: 0; padding: 7px; }
  .room-active[data-room-phase="lobby"] .room-chat-messages { min-height: 160px; max-height: 220px; }
}

/* v54 final theme lock for late room/social layout rules. */
.multiplayer-status,
.room-directory-heading,
.room-code-form span,
.online-directory-heading strong,
.room-panel-heading span,
.room-active .room-players li small { color: #765b36; }
.online-directory-heading b,
.room-panel-heading strong,
.social-message-player { color: #70421b; }
.room-active .room-phase { color: #8b531b; }
.room-active[data-room-phase="lobby"] .room-players {
  border-color: #aa7138;
  background: rgba(255, 249, 221, .76);
}
.room-active[data-room-phase="lobby"] .room-actions { border-top-color: #c99750; }

/* v54 button lock: chunky illustrated controls with a visible press depth. */
#intro button,
#lobby button,
#multiplayer-lobby button,
#name-entry button,
#audio-settings button,
#pause-overlay button,
#level-up button,
#game-over button,
#run-result button,
#sponsor-overlay button,
.social-drawer button {
  position: relative;
  border: 2px solid #754015;
  border-radius: 8px;
  color: #603513;
  font-weight: 900;
  letter-spacing: 0;
  text-shadow: 0 1px rgba(255, 244, 183, .72);
  box-shadow: inset 0 2px rgba(255,255,255,.4), inset 0 -3px rgba(165,75,11,.18), 0 4px 0 #804617;
  transition: transform .08s ease, filter .12s ease, box-shadow .08s ease;
}
#intro button:hover,
#lobby button:hover,
#multiplayer-lobby button:hover,
#name-entry button:hover,
#audio-settings button:hover,
#pause-overlay button:hover,
#level-up button:hover,
#game-over button:hover,
#run-result button:hover,
#sponsor-overlay button:hover,
.social-drawer button:hover { filter: brightness(1.06) saturate(1.04); transform: translateY(-1px); }
#intro button:active,
#lobby button:active,
#multiplayer-lobby button:active,
#name-entry button:active,
#audio-settings button:active,
#pause-overlay button:active,
#level-up button:active,
#game-over button:active,
#run-result button:active,
#sponsor-overlay button:active,
.social-drawer button:active {
  transform: translateY(3px);
  box-shadow: inset 0 2px rgba(255,255,255,.28), inset 0 -2px rgba(165,75,11,.16), 0 1px 0 #804617;
}
#intro button:disabled,
#lobby button:disabled,
#multiplayer-lobby button:disabled,
#level-up button:disabled,
.social-drawer button:disabled { filter: grayscale(.35); opacity: .55; transform: none; box-shadow: inset 0 1px rgba(255,255,255,.24), 0 2px 0 #8e775d; }

.main-menu-actions button {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 34px;
  align-items: center;
  min-height: 54px;
  padding: 0 12px;
  background: linear-gradient(#ffd663 0 48%, #f2a42b 52% 100%);
  color: #643413;
  font-size: 18px;
  text-align: center;
}
.main-menu-actions button::before {
  display: grid;
  place-items: center;
  grid-column: 1;
  width: 28px;
  height: 28px;
  color: #fff5c5;
  font: 900 20px/1 system-ui, sans-serif;
  text-shadow: 0 2px #9a4f16;
}
.main-menu-actions button::after { content: ""; grid-column: 3; }
#enter-game::before { content: "\25B6"; }
#menu-settings::before { content: "\2699"; color: #37685f; text-shadow: 0 1px #eafff5; }
#exit-game::before { content: "\21A9"; }
#menu-sponsor::before { content: "\2665"; }
#menu-settings { background: linear-gradient(#ddf3e8 0 48%, #9fcebd 52% 100%) !important; }

.lobby-tabs button,
.lobby-tabs .community-tab {
  min-height: 42px;
  border-color: #754015;
  background: linear-gradient(#c97834 0 48%, #a85822 52% 100%);
  color: #fff0b5;
  text-shadow: 0 1px #68320f;
  box-shadow: inset 0 2px rgba(255,218,143,.22), inset 0 -2px rgba(90,39,10,.18), 0 3px 0 #673411;
}
.lobby-tabs button.active {
  background: linear-gradient(#ffe26f 0 48%, #f2aa28 52% 100%);
  color: #633513;
  text-shadow: 0 1px #fff2ae;
  box-shadow: inset 0 2px rgba(255,255,255,.38), inset 0 -3px rgba(178,80,9,.2), 0 3px 0 #744014;
}
.lobby-tabs button::before { width: 20px; text-align: center; }

#lobby-start,
#lobby-multiplayer,
#room-create-open,
#room-create,
#room-code-join,
#room-ready,
#room-start,
#talent-reset,
.shop-item button,
.end-panel button,
.audio-settings-actions button,
#player-name-submit {
  min-height: 48px;
  background: linear-gradient(#ffd966 0 48%, #f1a127 52% 100%);
  font-size: 15px;
}
#lobby-start::before { content: "\25B6"; margin-right: 8px; color: #8b4c13; }
#lobby-multiplayer,
#room-create-open,
#room-code-join,
#room-ready {
  border-color: #506f25;
  background: linear-gradient(#d7ef75 0 48%, #8fc43e 52% 100%);
  color: #3f5e1e;
  box-shadow: inset 0 2px rgba(255,255,255,.4), inset 0 -3px rgba(54,99,21,.2), 0 4px 0 #537229;
}
#lobby-multiplayer::before { content: "\2637"; margin-right: 8px; }
#room-create-open::before { content: "+"; margin-right: 7px; font-size: 18px; }
#room-code-join::before { content: "\2192"; margin-right: 7px; }
#room-ready::before { content: "\2713"; margin-right: 7px; }
#room-start::before { content: "\25B6"; margin-right: 7px; }
#room-leave::before { content: "\21A9"; margin-right: 6px; }

.lobby-map-select button,
.header-leaderboard-button,
.lobby-wallet button,
.social-tabs button,
.room-character-option,
.room-directory-item button {
  background: linear-gradient(#fff2a8 0 48%, #eabd4f 52% 100%);
}
.lobby-header #lobby-back,
#multiplayer-close,
#social-close,
#audio-settings-close {
  background: linear-gradient(#e7f5ec 0 48%, #a8d1c1 52% 100%) !important;
  color: #315c55 !important;
}

#meta-shop .shop-item,
#meta-shop .shop-item.shop-mastery {
  border: 2px solid #a66b2f;
  background: linear-gradient(180deg, #fff9df, #f7e8b7);
  color: #573619;
  box-shadow: inset 0 1px rgba(255,255,255,.7), 0 4px 0 #99612a;
}
#meta-shop .shop-item h3,
#meta-shop .shop-item-heading h3 { color: #6b3a17; }
#meta-shop .shop-item p { color: #6e5132; }
#meta-shop .shop-item small { color: #806444; }
#meta-shop .shop-item-status { border-color: #b57b36; background: #f0cc6b; color: #674015; }

@media (max-width: 600px) {
  .main-menu-actions button { grid-template-columns: 30px minmax(0, 1fr) 30px; min-height: 50px; font-size: 16px; }
  .lobby-tabs button,
  .lobby-tabs .community-tab { min-height: 36px; }
  #lobby-start,
  #lobby-multiplayer { min-height: 46px; }
}

/* fix-v58: final reference-card layout. This block intentionally follows all legacy card rules. */
#level-up {
  align-items: flex-start !important;
  padding: max(22px, env(safe-area-inset-top)) 16px max(22px, env(safe-area-inset-bottom)) !important;
  background: rgba(248, 232, 173, .94) !important;
}
#level-up .choice-panel {
  width: min(560px, 100%) !important;
  max-height: calc(100vh - 44px) !important;
  margin: 0 auto !important;
  padding: 0 !important;
}
#level-up .choice-panel > p {
  margin: 0 0 5px !important;
  color: #59854a !important;
  font-size: 14px !important;
  text-align: center !important;
  text-shadow: none !important;
}
#level-up .choice-panel > h2 {
  margin: 0 0 16px !important;
  color: #513018 !important;
  font-size: 30px !important;
  text-align: center !important;
  text-shadow: none !important;
}
#level-up .upgrade-grid,
#level-up .upgrade-grid.four-options,
#level-up .upgrade-grid.evolution-choice {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  gap: 11px !important;
  width: 100% !important;
}
#level-up .upgrade-option {
  display: grid !important;
  grid-template-columns: 102px minmax(0, 1fr) 72px !important;
  grid-template-rows: 1fr !important;
  align-items: center !important;
  min-height: 156px !important;
  height: 156px !important;
  max-height: 156px !important;
  padding: 16px 18px !important;
  overflow: hidden !important;
  border: 3px solid #9d712e !important;
  border-radius: 14px !important;
  background-color: #11281f !important;
  background-image: none !important;
  background-repeat: no-repeat !important;
  background-position: center !important;
  background-size: 100% 100% !important;
  background-blend-mode: screen !important;
  box-shadow: 0 4px 0 #70421c, 0 9px 16px rgba(45, 29, 10, .22) !important;
  text-align: left !important;
}
#level-up .upgrade-option::after { display: none !important; }
#level-up .upgrade-option .card-icon {
  position: relative !important;
  inset: auto !important;
  display: grid !important;
  place-items: center !important;
  width: 82px !important;
  height: 82px !important;
  margin: 0 auto !important;
  border: 2px solid currentColor !important;
  border-radius: 50% !important;
  background: radial-gradient(circle, rgba(255,255,255,.15), rgba(255,255,255,.02) 60%) !important;
  box-shadow: 0 0 17px currentColor, inset 0 0 14px rgba(255,255,255,.12) !important;
  font-size: 37px !important;
  line-height: 1 !important;
  z-index: 1 !important;
}
#level-up .upgrade-option .card-copy {
  display: block !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 10px !important;
  align-self: center !important;
  z-index: 1 !important;
}
#level-up .upgrade-option .card-quality {
  display: block !important;
  margin: 0 0 7px !important;
  font-size: 12px !important;
  line-height: 1 !important;
  text-shadow: none !important;
}
#level-up .upgrade-option strong {
  display: block !important;
  margin: 0 0 10px !important;
  color: #fff9e0 !important;
  font-size: 25px !important;
  line-height: 1.12 !important;
  text-shadow: none !important;
}
#level-up .upgrade-option .card-divider {
  display: block !important;
  width: 100% !important;
  height: 1px !important;
  margin: 0 0 9px !important;
  background: rgba(237, 202, 113, .64) !important;
}
#level-up .upgrade-option .card-detail {
  display: block !important;
  margin: 0 !important;
  font-size: 14px !important;
  line-height: 1.3 !important;
  text-shadow: none !important;
}
#level-up .upgrade-option .skill-star {
  position: relative !important;
  inset: auto !important;
  display: block !important;
  width: 60px !important;
  height: 60px !important;
  margin: 0 auto !important;
  z-index: 1 !important;
}
#level-up .upgrade-option:not([data-kind="skill"]) { grid-template-columns: 102px minmax(0, 1fr) !important; }
#level-up .upgrade-option:not([data-kind="skill"]) .skill-star { display: none !important; }
#level-up .upgrade-option[data-quality="standard"] { border-color: #78a15c !important; background-color: #10271e !important; }
#level-up .upgrade-option[data-quality="strong"] { border-color: #4697d1 !important; background-color: #112d43 !important; }
#level-up .upgrade-option[data-quality="premium"] { border-color: #a467ca !important; background-color: #2c1f3c !important; }
#level-up .upgrade-option[data-quality="mythic"] { border-color: #d2a23d !important; background-color: #453118 !important; }
#level-up .upgrade-option[data-quality="standard"] .card-icon,
#level-up .upgrade-option[data-quality="standard"] .card-quality,
#level-up .upgrade-option[data-quality="standard"] .card-detail { color: #b6e578 !important; }
#level-up .upgrade-option[data-quality="strong"] .card-icon,
#level-up .upgrade-option[data-quality="strong"] .card-quality,
#level-up .upgrade-option[data-quality="strong"] .card-detail { color: #75c9ff !important; }
#level-up .upgrade-option[data-quality="premium"] .card-icon,
#level-up .upgrade-option[data-quality="premium"] .card-quality,
#level-up .upgrade-option[data-quality="premium"] .card-detail { color: #dfa0ff !important; }
#level-up .upgrade-option[data-quality="mythic"] .card-icon,
#level-up .upgrade-option[data-quality="mythic"] .card-quality,
#level-up .upgrade-option[data-quality="mythic"] .card-detail { color: #fff9e0 !important; }
#level-up .upgrade-option .card-detail { color: #fff9e0 !important; }
#level-up .upgrade-option .card-detail .card-number { color: currentColor; font-weight: 900; }
#level-up .upgrade-option[data-quality="standard"] .card-detail .card-number { color: #b6e578 !important; }
#level-up .upgrade-option[data-quality="strong"] .card-detail .card-number { color: #75c9ff !important; }
#level-up .upgrade-option[data-quality="premium"] .card-detail .card-number { color: #dfa0ff !important; }
#level-up .upgrade-option[data-quality="mythic"] .card-detail .card-number { color: #ffda76 !important; }

@media (max-width: 600px) {
  #level-up { padding-inline: 9px !important; }
  #level-up .choice-panel > h2 { margin-bottom: 12px !important; font-size: 24px !important; }
  #level-up .upgrade-option {
    grid-template-columns: 74px minmax(0, 1fr) 56px !important;
    min-height: 128px !important;
    height: 128px !important;
    max-height: 128px !important;
    padding: 11px 13px !important;
  }
  #level-up .upgrade-option:not([data-kind="skill"]) { grid-template-columns: 74px minmax(0, 1fr) !important; }
  #level-up .upgrade-option .card-icon { width: 60px !important; height: 60px !important; font-size: 28px !important; }
  #level-up .upgrade-option strong { margin-bottom: 7px !important; font-size: 20px !important; }
  #level-up .upgrade-option .card-quality { margin-bottom: 5px !important; font-size: 10px !important; }
  #level-up .upgrade-option .card-divider { margin-bottom: 7px !important; }
  #level-up .upgrade-option .card-detail { font-size: 11px !important; }
  #level-up .upgrade-option .skill-star { width: 48px !important; height: 48px !important; }
}
