:root {
  --bg: #071019;
  --panel: rgba(255, 255, 255, 0.09);
  --panel-strong: rgba(255, 255, 255, 0.14);
  --line: rgba(255, 255, 255, 0.16);
  --text: #f7fbff;
  --muted: rgba(230, 240, 255, 0.68);
  --cyan: #57e6ff;
  --mint: #58f5a7;
  --coral: #ff7a90;
  --gold: #ffd36b;
  --ink: #101923;
  --shadow: 0 22px 80px rgba(0, 0, 0, 0.42);
}

/* Mobile adventure boss HUD and compact board hotfix: intentionally last. */
@media (max-width: 900px) {
  body.adventure-rpg-page .adventure-battle-panel .battle-hud {
    position: absolute !important;
    width: 126px !important;
    max-width: 126px !important;
    height: 30px !important;
    overflow: visible !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .hero-hud {
    left: 8px !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .monster-hud {
    right: 8px !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .battle-hud > div:first-child {
    position: static !important;
    display: block !important;
    height: 13px !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .battle-name {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    color: #f8fbff !important;
    font-size: 10px !important;
    line-height: 13px !important;
    text-align: center !important;
    white-space: nowrap !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .battle-hud strong {
    position: absolute !important;
    left: 0 !important;
    right: 0 !important;
    top: 15px !important;
    z-index: 2 !important;
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    color: #fff6df !important;
    font-size: 10px !important;
    line-height: 11px !important;
    text-align: center !important;
    white-space: nowrap !important;
    pointer-events: none !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .hp-track,
  body.adventure-rpg-page .adventure-battle-panel .hero-hud .hp-track,
  body.adventure-rpg-page .adventure-battle-panel .monster-hud .hp-track {
    position: relative !important;
    height: 13px !important;
    margin-top: 1px !important;
  }

  body.adventure-rpg-page .adventure-card-area .board,
  body.adventure-rpg-page .adventure-card-area .board[data-grade] {
    grid-auto-rows: min(var(--match-card-height, 46px), 46px) !important;
    gap: 6px !important;
  }

  body.adventure-rpg-page .adventure-card-area .card {
    height: min(var(--match-card-height, 46px), 46px) !important;
    min-height: 0 !important;
    padding: 3px 5px !important;
    font-size: min(var(--match-font-size, 17px), 17px) !important;
  }
}

@media (max-width: 520px) {
  body.adventure-rpg-page .adventure-battle-panel .battle-hud {
    width: 112px !important;
    max-width: 82px !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .battle-name,
  body.adventure-rpg-page .adventure-battle-panel .battle-hud strong {
    font-size: 9px !important;
  }

  body.adventure-rpg-page .adventure-card-area .board,
  body.adventure-rpg-page .adventure-card-area .board[data-grade] {
    grid-auto-rows: min(var(--match-card-height, 42px), 42px) !important;
    gap: 5px !important;
  }

  body.adventure-rpg-page .adventure-card-area .card {
    height: min(var(--match-card-height, 42px), 42px) !important;
    padding: 2px 4px !important;
    font-size: min(var(--match-font-size, 16px), 16px) !important;
  }
}

/* Mobile battle HP text alignment hotfix: real final override. */
@media (max-width: 900px) {
  body.adventure-rpg-page .adventure-battle-panel .battle-hud {
    height: 34px !important;
    max-height: 34px !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .battle-hud > div:first-child {
    height: 14px !important;
    line-height: 14px !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .battle-name {
    height: 14px !important;
    line-height: 14px !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .hp-track,
  body.adventure-rpg-page .adventure-battle-panel .hero-hud .hp-track,
  body.adventure-rpg-page .adventure-battle-panel .monster-hud .hp-track {
    height: 16px !important;
    margin-top: 1px !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .battle-hud strong,
  body.adventure-rpg-page .adventure-battle-panel .hero-hud strong,
  body.adventure-rpg-page .adventure-battle-panel .monster-hud strong {
    position: absolute !important;
    inset: 15px 0 auto 0 !important;
    z-index: 5 !important;
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    height: 16px !important;
    overflow: visible !important;
    color: #fff6df !important;
    font-size: 10px !important;
    font-weight: 900 !important;
    line-height: 16px !important;
    text-align: center !important;
    white-space: nowrap !important;
  }
}

@media (max-width: 520px) {
  body.adventure-rpg-page .adventure-battle-panel .battle-hud strong,
  body.adventure-rpg-page .adventure-battle-panel .hero-hud strong,
  body.adventure-rpg-page .adventure-battle-panel .monster-hud strong {
    font-size: 9px !important;
    line-height: 16px !important;
  }
}

/* Mobile adventure final pass: keep this at the end so older responsive rules cannot override it. */
@media (max-width: 900px) {
  html:has(body.adventure-rpg-page) {
    height: auto !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
  }

  .adventure-rpg-page {
    height: auto !important;
    min-height: 100dvh !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
  }

  .adventure-rpg-page .adventure-shell,
  .adventure-rpg-page .adventure-shell:has(.adventure-pressurebar.no-pressure) {
    display: grid !important;
    grid-template-rows: auto auto auto auto auto auto !important;
    gap: 5px !important;
    width: calc(100vw - 10px) !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 auto !important;
    padding-top: 5px !important;
  }

  .adventure-rpg-page .adventure-topbar {
    display: grid !important;
    grid-template-columns: 38px minmax(0, 1fr) 76px 76px !important;
    min-height: 54px !important;
    padding: 5px 7px !important;
    gap: 6px !important;
    align-items: center !important;
  }

  .adventure-rpg-page .adventure-back-button {
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    min-height: 34px !important;
    border-radius: 5px !important;
    font-size: 20px !important;
  }

  .adventure-rpg-page .adventure-title-block {
    min-width: 0 !important;
  }

  .adventure-rpg-page .adventure-title-block p {
    display: none !important;
  }

  .adventure-rpg-page .adventure-title-block h1 {
    overflow: hidden !important;
    color: #12345f !important;
    font-size: 18px !important;
    line-height: 1.05 !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  .adventure-rpg-page .adventure-hero-chip {
    display: grid !important;
    grid-template-columns: 30px minmax(0, 1fr) !important;
    column-gap: 4px !important;
    min-width: 74px !important;
    width: 74px !important;
    height: 38px !important;
    padding: 3px 5px !important;
    border: 1.5px solid #6da4ee !important;
    border-radius: 5px !important;
    background: linear-gradient(180deg, #ffffff, #e4f3ff) !important;
    box-shadow: 1px 1px 0 rgba(45, 102, 180, 0.16) !important;
  }

  .adventure-rpg-page .adventure-hero-avatar {
    width: 30px !important;
    height: 30px !important;
    border-radius: 4px !important;
  }

  .adventure-rpg-page .adventure-hero-avatar img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
  }

  .adventure-rpg-page .adventure-hero-chip span:not(.adventure-hero-avatar) {
    display: none !important;
  }

  .adventure-rpg-page .adventure-hero-chip strong {
    display: block !important;
    color: #12345f !important;
    font-size: 11px !important;
    line-height: 1 !important;
    white-space: nowrap !important;
  }

  .adventure-rpg-page .adventure-top-actions {
    display: grid !important;
    grid-template-columns: repeat(2, 34px) !important;
    gap: 4px !important;
    align-items: center !important;
    justify-content: end !important;
  }

  .adventure-rpg-page .adventure-icon-button.sound-toggle-button,
  .adventure-rpg-page .adventure-settings summary {
    display: grid !important;
    grid-template-rows: 18px 11px !important;
    place-items: center !important;
    width: 34px !important;
    height: 36px !important;
    min-width: 34px !important;
    min-height: 36px !important;
    padding: 2px 0 !important;
    border: 0 !important;
    border-radius: 4px !important;
    background: transparent !important;
    box-shadow: none !important;
    color: #12345f !important;
    font-size: 10px !important;
    font-weight: 900 !important;
    line-height: 1 !important;
  }

  .adventure-rpg-page .adventure-icon-button.sound-toggle-button::before {
    content: "" !important;
    display: block !important;
    width: 20px !important;
    height: 18px !important;
    background: url("data:image/svg+xml,%3Csvg width='24' height='22' viewBox='0 0 24 22' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4 9.2V12.8H7.4L12.5 17V5L7.4 9.2H4Z' stroke='%23153765' stroke-width='2' stroke-linejoin='round'/%3E%3Cpath d='M16 8C17.2 9.2 17.2 12.8 16 14' stroke='%23153765' stroke-width='2' stroke-linecap='round'/%3E%3Cpath d='M19 5.5C21.6 8.4 21.6 13.6 19 16.5' stroke='%23153765' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat !important;
  }

  .adventure-rpg-page .adventure-icon-button.sound-toggle-button.is-muted::before {
    background-image: url("data:image/svg+xml,%3Csvg width='24' height='22' viewBox='0 0 24 22' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4 9.2V12.8H7.4L12.5 17V5L7.4 9.2H4Z' stroke='%23153765' stroke-width='2' stroke-linejoin='round'/%3E%3Cpath d='M17 8L22 14' stroke='%23153765' stroke-width='2' stroke-linecap='round'/%3E%3Cpath d='M22 8L17 14' stroke='%23153765' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") !important;
  }

  .adventure-rpg-page .adventure-settings summary::before {
    content: "" !important;
    display: block !important;
    width: 20px !important;
    height: 20px !important;
    background: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M9.6 3.4L10.2 5.8C10.7 5.7 11.3 5.7 11.8 5.8L12.4 3.4H15.5L16.1 5.8C16.6 6 17.1 6.3 17.5 6.6L19.6 5.3L21.2 8L19.3 9.5C19.4 10 19.5 10.5 19.5 11C19.5 11.5 19.4 12 19.3 12.5L21.2 14L19.6 16.7L17.5 15.4C17.1 15.7 16.6 16 16.1 16.2L15.5 18.6H12.4L11.8 16.2C11.3 16.3 10.7 16.3 10.2 16.2L9.6 18.6H6.5L5.9 16.2C5.4 16 4.9 15.7 4.5 15.4L2.4 16.7L0.8 14L2.7 12.5C2.6 12 2.5 11.5 2.5 11C2.5 10.5 2.6 10 2.7 9.5L0.8 8L2.4 5.3L4.5 6.6C4.9 6.3 5.4 6 5.9 5.8L6.5 3.4H9.6Z' stroke='%23153765' stroke-width='1.8' stroke-linejoin='round' transform='translate(1 1)'/%3E%3Ccircle cx='12' cy='12' r='3.2' stroke='%23153765' stroke-width='1.8'/%3E%3C/svg%3E") center / contain no-repeat !important;
  }

  .adventure-rpg-page .adventure-settings summary::after {
    content: "ÉèÖÃ" !important;
    display: block !important;
    color: #12345f !important;
    font-size: 10px !important;
    font-weight: 900 !important;
    line-height: 1 !important;
  }

  .adventure-rpg-page .adventure-settings summary img {
    display: none !important;
  }

  .adventure-rpg-page .adventure-controlbar {
    display: grid !important;
    grid-template-columns: minmax(0, 1.28fr) minmax(68px, 0.5fr) minmax(68px, 0.5fr) 42px 32px !important;
    gap: 4px !important;
    min-height: 44px !important;
    padding: 4px !important;
    align-items: center !important;
  }

  .adventure-rpg-page .adventure-control-field,
  .adventure-rpg-page .adventure-control-button,
  .adventure-rpg-page .adventure-more-menu summary {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    min-width: 0 !important;
    min-height: 32px !important;
    height: 32px !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  .adventure-rpg-page .adventure-control-field span,
  .adventure-rpg-page .adventure-control-button span,
  .adventure-rpg-page .adventure-control-field small,
  .adventure-rpg-page .control-mirror,
  .adventure-rpg-page #difficultyBadge,
  .adventure-rpg-page #monsterWaveText {
    display: none !important;
  }

  .adventure-rpg-page .adventure-control-field select,
  .adventure-rpg-page .adventure-control-button select {
    display: block !important;
    appearance: auto !important;
    width: 100% !important;
    height: 32px !important;
    min-height: 32px !important;
    padding: 0 4px !important;
    border: 1.5px solid #6da4ee !important;
    border-radius: 5px !important;
    color: #12345f !important;
    background: linear-gradient(180deg, #ffffff, #e4f3ff) !important;
    box-shadow: 1px 1px 0 rgba(45, 102, 180, 0.14) !important;
    font-size: 11px !important;
    font-weight: 900 !important;
  }

  .adventure-rpg-page .adventure-more-menu summary,
  .adventure-rpg-page .adventure-help-button {
    display: grid !important;
    place-items: center !important;
    width: 100% !important;
    height: 32px !important;
    min-width: 0 !important;
    min-height: 32px !important;
    border: 1.5px solid #6da4ee !important;
    border-radius: 5px !important;
    color: #12345f !important;
    background: linear-gradient(180deg, #ffffff, #e4f3ff) !important;
    box-shadow: 1px 1px 0 rgba(45, 102, 180, 0.14) !important;
    font-size: 12px !important;
    font-weight: 900 !important;
  }

  .adventure-rpg-page .adventure-pressurebar {
    min-height: 26px !important;
    padding: 3px 8px !important;
  }

  .adventure-rpg-page .adventure-battle-panel {
    height: 134px !important;
    min-height: 134px !important;
    max-height: 134px !important;
    overflow: hidden !important;
  }

  .adventure-rpg-page .battle-map-title,
  .adventure-rpg-page .battle-message,
  .adventure-rpg-page .battle-rpg-panel,
  .adventure-rpg-page .mobile-battle-button,
  .adventure-rpg-page .hero-hud-progress,
  .adventure-rpg-page .battle-traits,
  .adventure-rpg-page .monster-hud .battle-traits {
    display: none !important;
  }

  .adventure-rpg-page .boss-challenge-button {
    display: inline-flex !important;
    position: absolute !important;
    top: 6px !important;
    left: 50% !important;
    right: auto !important;
    bottom: auto !important;
    transform: translateX(-50%) !important;
    z-index: 8 !important;
    width: 78px !important;
    min-width: 78px !important;
    min-height: 23px !important;
    padding: 0 6px !important;
    border: 1.5px solid #2e78df !important;
    border-radius: 5px !important;
    color: #12345f !important;
    background: linear-gradient(180deg, #fff8bd 0%, #ffd763 100%) !important;
    box-shadow: 1px 1px 0 rgba(33, 82, 156, 0.22) !important;
    font-size: 10px !important;
    font-weight: 900 !important;
  }

  .adventure-rpg-page .battle-hud {
    top: 7px !important;
    bottom: auto !important;
    width: clamp(108px, 33vw, 132px) !important;
    height: 30px !important;
    max-height: 30px !important;
    min-height: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    filter: none !important;
  }

  .adventure-rpg-page .hero-hud {
    left: 8px !important;
    right: auto !important;
    text-align: left !important;
  }

  .adventure-rpg-page .monster-hud {
    left: auto !important;
    right: 8px !important;
    text-align: right !important;
  }

  .adventure-rpg-page .battle-hud > div:first-child {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    height: 13px !important;
    min-height: 0 !important;
    margin: 0 0 1px !important;
    gap: 4px !important;
    padding: 0 1px !important;
  }

  .adventure-rpg-page .battle-name,
  .adventure-rpg-page .battle-hud strong {
    display: block !important;
    overflow: hidden !important;
    color: #f8fbff !important;
    font-size: 10px !important;
    font-weight: 900 !important;
    line-height: 1 !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  .adventure-rpg-page .hp-track,
  .adventure-rpg-page .hero-hud .hp-track,
  .adventure-rpg-page .monster-hud .hp-track {
    display: block !important;
    width: 100% !important;
    height: 11px !important;
    overflow: hidden !important;
    border: 1.5px solid #23315a !important;
    border-radius: 2px !important;
    background: linear-gradient(180deg, #3f496b 0%, #1e2b4c 48%, #111a32 100%) !important;
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.18),
      inset 0 -1px 0 rgba(0, 0, 0, 0.24) !important;
  }

  .adventure-rpg-page .hp-fill,
  .adventure-rpg-page .hero-fill,
  .adventure-rpg-page .monster-fill {
    display: block !important;
    height: 100% !important;
    border-radius: 1px !important;
    background: linear-gradient(180deg, #ff7a88 0%, #ff4c68 46%, #d71842 48%, #a71134 100%) !important;
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.42),
      inset 0 -1px 0 rgba(110, 0, 25, 0.3) !important;
  }

  .adventure-rpg-page .fighter {
    bottom: 7px !important;
    width: 74px !important;
    height: 74px !important;
  }

  .adventure-rpg-page .hero-fighter {
    left: 24% !important;
    right: auto !important;
    z-index: 3 !important;
  }

  .adventure-rpg-page .pet-fighter,
  .adventure-rpg-page .pet-fighter[data-pet-stage="1"],
  .adventure-rpg-page .pet-fighter[data-pet-stage="2"],
  .adventure-rpg-page .pet-fighter[data-pet-stage="3"] {
    left: 9% !important;
    right: auto !important;
    bottom: 9px !important;
    width: 48px !important;
    height: 48px !important;
    z-index: 2 !important;
  }

  .adventure-rpg-page .monster-fighter {
    left: auto !important;
    right: 13% !important;
    z-index: 3 !important;
  }

  .adventure-rpg-page .pet-battle-name {
    display: none !important;
  }

  .adventure-rpg-page .adventure-card-area {
    padding: 4px 7px 6px !important;
    grid-template-rows: 24px auto !important;
    overflow: hidden !important;
  }

  .adventure-rpg-page .adventure-card-head {
    min-height: 24px !important;
    height: 24px !important;
  }

  .adventure-rpg-page .adventure-card-head > div:first-child {
    display: none !important;
  }

  .adventure-rpg-page .adventure-card-stats {
    width: 100% !important;
    justify-content: center !important;
  }

  .adventure-rpg-page .adventure-card-stats span:first-child {
    display: inline-flex !important;
    min-height: 22px !important;
    color: #12345f !important;
    font-size: 15px !important;
    line-height: 1 !important;
  }

  .adventure-rpg-page .adventure-card-stats span:not(:first-child) {
    display: none !important;
  }

  .adventure-rpg-page .board-wrap {
    padding: 5px !important;
    overflow: hidden !important;
  }

  .adventure-rpg-page .adventure-rewardbar {
    min-height: 38px !important;
    height: auto !important;
    padding: 4px 6px !important;
  }

  .adventure-rpg-page .reward-drop-item img {
    width: 20px !important;
    height: 20px !important;
  }
}

@media (max-width: 520px) {
  .adventure-rpg-page .adventure-topbar {
    grid-template-columns: 34px minmax(0, 1fr) 70px 72px !important;
    gap: 4px !important;
    padding-inline: 5px !important;
  }

  .adventure-rpg-page .adventure-title-block h1 {
    font-size: 16px !important;
  }

  .adventure-rpg-page .adventure-controlbar {
    grid-template-columns: minmax(0, 1.18fr) minmax(60px, 0.48fr) minmax(60px, 0.48fr) 34px 30px !important;
    gap: 3px !important;
    padding: 3px !important;
  }

  .adventure-rpg-page .adventure-control-field select,
  .adventure-rpg-page .adventure-control-button select {
    height: 30px !important;
    min-height: 30px !important;
    padding-inline: 2px !important;
    font-size: 10px !important;
  }

  .adventure-rpg-page .adventure-more-menu summary,
  .adventure-rpg-page .adventure-help-button {
    height: 30px !important;
    min-height: 30px !important;
    font-size: 11px !important;
  }

  .adventure-rpg-page .adventure-battle-panel {
    height: 128px !important;
    min-height: 128px !important;
    max-height: 128px !important;
  }

  .adventure-rpg-page .boss-challenge-button {
    width: 72px !important;
    min-width: 72px !important;
    min-height: 22px !important;
    padding-inline: 4px !important;
    font-size: 9px !important;
  }

  .adventure-rpg-page .battle-hud {
    width: clamp(92px, 31vw, 116px) !important;
  }

  .adventure-rpg-page .battle-name,
  .adventure-rpg-page .battle-hud strong {
    font-size: 9px !important;
  }

  .adventure-rpg-page .fighter {
    bottom: 6px !important;
    width: 66px !important;
    height: 66px !important;
  }

  .adventure-rpg-page .hero-fighter {
    left: 23% !important;
  }

  .adventure-rpg-page .pet-fighter,
  .adventure-rpg-page .pet-fighter[data-pet-stage="1"],
  .adventure-rpg-page .pet-fighter[data-pet-stage="2"],
  .adventure-rpg-page .pet-fighter[data-pet-stage="3"] {
    left: 7% !important;
    bottom: 8px !important;
    width: 42px !important;
    height: 42px !important;
  }

  .adventure-rpg-page .monster-fighter {
    right: 10% !important;
  }

  .adventure-rpg-page .battle-hud {
    width: calc(50% - 14px) !important;
  }

  .adventure-rpg-page .hero-hud {
    left: 6px !important;
  }

  .adventure-rpg-page .monster-hud {
    right: 6px !important;
  }

  .adventure-rpg-page .bottom-tabbar {
    width: calc(100vw - 10px) !important;
    min-height: 44px !important;
    padding: 3px !important;
  }

  .adventure-rpg-page .tabbar-item {
    min-height: 36px !important;
    font-size: 10px !important;
  }
}

/* Mobile final alignment: desktop information order, compressed for narrow screens. */
@media (max-width: 900px) {
  html:has(body.adventure-rpg-page) {
    height: auto !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
  }

  .adventure-rpg-page {
    height: auto !important;
    min-height: 100dvh !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
  }

  .adventure-rpg-page .adventure-shell,
  .adventure-rpg-page .adventure-shell:has(.adventure-pressurebar.no-pressure) {
    display: grid !important;
    grid-template-rows: auto auto auto auto auto auto !important;
    gap: 5px !important;
    width: calc(100vw - 10px) !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 auto !important;
    padding-top: 5px !important;
    padding-bottom: 0 !important;
  }

  .adventure-rpg-page .adventure-topbar,
  .adventure-rpg-page .adventure-controlbar,
  .adventure-rpg-page .adventure-pressurebar,
  .adventure-rpg-page .adventure-battle-panel,
  .adventure-rpg-page .adventure-card-area,
  .adventure-rpg-page .adventure-rewardbar,
  .adventure-rpg-page .bottom-tabbar {
    border: 2px solid #2e78df !important;
    border-radius: 6px !important;
  }

  .adventure-rpg-page .adventure-topbar {
    grid-template-columns: 44px minmax(0, 1fr) auto auto !important;
    min-height: 56px !important;
    padding: 5px 7px !important;
    gap: 7px !important;
  }

  .adventure-rpg-page .adventure-title-block p {
    display: none !important;
  }

  .adventure-rpg-page .adventure-title-block h1 {
    font-size: clamp(20px, 5.6vw, 25px) !important;
    line-height: 1 !important;
    white-space: nowrap !important;
  }

  .adventure-rpg-page .adventure-back-button {
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
  }

  .adventure-rpg-page .adventure-resource-row {
    display: none !important;
  }

  .adventure-rpg-page .adventure-hero-chip {
    display: inline-flex !important;
    min-width: 72px !important;
    width: 72px !important;
    height: 38px !important;
    padding: 3px 5px !important;
    gap: 4px !important;
    border: 1.5px solid #6da4ee !important;
    border-radius: 6px !important;
    background: linear-gradient(180deg, #ffffff, #e3f2ff) !important;
  }

  .adventure-rpg-page .adventure-hero-avatar {
    display: block !important;
    flex: 0 0 auto !important;
    width: 30px !important;
    height: 30px !important;
    overflow: hidden !important;
    border: 1px solid #2e78df !important;
    border-radius: 4px !important;
    background: #e7f6ff !important;
  }

  .adventure-rpg-page .adventure-hero-avatar img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    transform: none !important;
  }

  .adventure-rpg-page .adventure-hero-chip span:not(.adventure-hero-avatar) {
    display: none !important;
  }

  .adventure-rpg-page .adventure-hero-chip strong {
    display: block !important;
    color: #12345f !important;
    font-size: 12px !important;
    line-height: 1 !important;
    white-space: nowrap !important;
  }

  .adventure-rpg-page .adventure-top-actions {
    display: grid !important;
    grid-template-columns: repeat(2, 34px) !important;
    gap: 4px !important;
    width: auto !important;
  }

  .adventure-rpg-page .adventure-icon-button.sound-toggle-button,
  .adventure-rpg-page .adventure-settings summary {
    display: grid !important;
    grid-template-rows: 18px 11px !important;
    width: 34px !important;
    height: 36px !important;
    min-width: 34px !important;
    min-height: 36px !important;
    padding: 2px 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    color: #12345f !important;
    font-size: 10px !important;
    line-height: 1 !important;
  }

  .adventure-rpg-page .adventure-icon-button.sound-toggle-button::before,
  .adventure-rpg-page .adventure-settings summary::before {
    width: 20px !important;
    height: 19px !important;
  }

  .adventure-rpg-page .adventure-settings summary::after {
    font-size: 10px !important;
  }

  .adventure-rpg-page .adventure-controlbar {
    grid-template-columns: minmax(0, 1fr) minmax(82px, 0.5fr) minmax(82px, 0.5fr) 58px 38px !important;
    align-items: center !important;
    gap: 5px !important;
    padding: 5px !important;
    min-height: 48px !important;
  }

  .adventure-rpg-page .adventure-control-field,
  .adventure-rpg-page .adventure-control-button {
    display: grid !important;
    grid-template-columns: 1fr !important;
    min-width: 0 !important;
    min-height: 36px !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  .adventure-rpg-page .adventure-control-field span,
  .adventure-rpg-page .adventure-control-button span,
  .adventure-rpg-page .adventure-control-field small,
  .adventure-rpg-page .control-mirror {
    display: none !important;
  }

  .adventure-rpg-page .adventure-control-field select {
    display: block !important;
    appearance: auto !important;
    width: 100% !important;
    height: 34px !important;
    min-height: 34px !important;
    padding: 0 6px !important;
    border: 1.5px solid #6da4ee !important;
    border-radius: 5px !important;
    color: #12345f !important;
    background: linear-gradient(180deg, #ffffff, #e4f3ff) !important;
    font-size: 12px !important;
    font-weight: 900 !important;
  }

  .adventure-rpg-page .adventure-more-menu summary {
    display: grid !important;
    place-items: center !important;
    min-width: 58px !important;
    height: 34px !important;
    min-height: 34px !important;
    padding: 0 8px !important;
    border: 1.5px solid #6da4ee !important;
    border-radius: 5px !important;
    background: linear-gradient(180deg, #ffffff, #e4f3ff) !important;
    color: #12345f !important;
    font-size: 13px !important;
    font-weight: 900 !important;
  }

  .adventure-rpg-page #guideTopBtn {
    width: 38px !important;
    height: 34px !important;
    min-width: 38px !important;
    min-height: 34px !important;
    padding: 0 !important;
    border-radius: 5px !important;
  }

  .adventure-rpg-page .adventure-pressurebar {
    min-height: 28px !important;
    padding: 4px 8px !important;
    grid-template-columns: auto minmax(86px, 1fr) auto !important;
    gap: 7px !important;
  }

  .adventure-rpg-page .adventure-pressurebar .monster-charge-head {
    font-size: 11px !important;
    gap: 4px !important;
    white-space: nowrap !important;
  }

  .adventure-rpg-page .adventure-pressurebar .pressure-track {
    min-width: 0 !important;
    height: 7px !important;
  }

  .adventure-rpg-page .adventure-battle-panel {
    height: clamp(132px, 27vw, 156px) !important;
    max-height: none !important;
    min-height: 132px !important;
  }

  .adventure-rpg-page .battle-map-title,
  .adventure-rpg-page .battle-message {
    display: none !important;
  }

  .adventure-rpg-page .battle-hud {
    top: 7px !important;
    width: calc(50% - 15px) !important;
    height: 30px !important;
    max-height: 30px !important;
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
  }

  .adventure-rpg-page .hero-hud {
    left: 8px !important;
  }

  .adventure-rpg-page .monster-hud {
    right: 8px !important;
  }

  .adventure-rpg-page .battle-hud > div:first-child {
    height: 13px !important;
    padding: 0 2px !important;
    margin: 0 0 1px !important;
    display: flex !important;
    justify-content: space-between !important;
    gap: 4px !important;
  }

  .adventure-rpg-page .battle-name,
  .adventure-rpg-page .battle-hud strong {
    color: #f8fbff !important;
    font-size: 10px !important;
    line-height: 1 !important;
  }

  .adventure-rpg-page .hp-track {
    height: 12px !important;
    border: 1.5px solid #23315a !important;
    border-radius: 2px !important;
    background: linear-gradient(180deg, #3f496b, #111a32) !important;
  }

  .adventure-rpg-page .fighter {
    bottom: 8px !important;
    width: clamp(66px, 17vw, 84px) !important;
    height: clamp(66px, 17vw, 84px) !important;
  }

  .adventure-rpg-page .hero-fighter {
    left: 17% !important;
  }

  .adventure-rpg-page .pet-fighter {
    left: 6% !important;
    bottom: 10px !important;
    width: clamp(46px, 12vw, 60px) !important;
    height: clamp(46px, 12vw, 60px) !important;
  }

  .adventure-rpg-page .monster-fighter {
    right: 14% !important;
  }

  .adventure-rpg-page .boss-challenge-button {
    display: inline-flex !important;
    top: 7px !important;
    right: 50% !important;
    bottom: auto !important;
    transform: translateX(50%) !important;
    min-width: 78px !important;
    min-height: 26px !important;
    padding: 0 9px !important;
    border: 1.5px solid #2e78df !important;
    border-radius: 5px !important;
    font-size: 11px !important;
  }

  .adventure-rpg-page .adventure-card-area {
    grid-template-rows: 26px auto !important;
    height: auto !important;
    min-height: 0 !important;
    padding: 3px 7px 7px !important;
    overflow: hidden !important;
  }

  .adventure-rpg-page .adventure-card-head {
    height: 26px !important;
    min-height: 26px !important;
    margin: 0 !important;
  }

  .adventure-rpg-page .adventure-card-head > div:first-child,
  .adventure-rpg-page .adventure-card-stats span:not(:first-child) {
    display: none !important;
  }

  .adventure-rpg-page .adventure-card-stats {
    width: 100% !important;
    justify-content: center !important;
  }

  .adventure-rpg-page .adventure-card-stats span:first-child {
    display: inline-flex !important;
    align-items: center !important;
    min-height: 24px !important;
    color: #12345f !important;
    font-size: 15px !important;
    font-weight: 900 !important;
  }

  .adventure-rpg-page .board-wrap {
    height: auto !important;
    min-height: 0 !important;
    padding: 6px !important;
    overflow: hidden !important;
    background: rgba(255, 255, 255, 0.5) !important;
  }

  .adventure-rpg-page .board,
  .adventure-rpg-page .board[data-grade] {
    height: auto !important;
    align-content: start !important;
    grid-template-columns: repeat(var(--match-columns, 3), minmax(0, 1fr)) !important;
    gap: var(--match-gap, 7px) !important;
  }

  .adventure-rpg-page .card {
    height: var(--match-card-height, 50px) !important;
    min-height: 0 !important;
    padding: 4px 6px !important;
    border: 1.5px solid #2e78df !important;
    border-radius: 5px !important;
    font-size: var(--match-font-size, 16px) !important;
    box-shadow: 2px 2px 0 rgba(35, 91, 172, 0.22) !important;
  }

  .adventure-rpg-page .adventure-rewardbar {
    height: 38px !important;
    min-height: 38px !important;
    padding: 3px 8px !important;
    gap: 6px !important;
  }

  .adventure-rpg-page .adventure-reward-left {
    min-width: 76px !important;
    font-size: 12px !important;
  }

  .adventure-rpg-page .adventure-reward-left img {
    width: 22px !important;
    height: 22px !important;
  }

  .adventure-rpg-page .adventure-reward-details {
    min-width: 0 !important;
    flex: 1 1 auto !important;
  }

  .adventure-rpg-page .adventure-reward-details summary {
    display: flex !important;
    justify-content: flex-end !important;
    gap: 5px !important;
    max-width: none !important;
    overflow: hidden !important;
    color: #12345f !important;
    font-size: 11px !important;
    white-space: nowrap !important;
  }

  .adventure-rpg-page .reward-label {
    flex: 0 0 auto !important;
  }

  .adventure-rpg-page .reward-drop-item {
    min-height: 24px !important;
    padding-left: 5px !important;
    gap: 3px !important;
    border-left: 1px solid rgba(46, 120, 223, 0.22) !important;
  }

  .adventure-rpg-page .reward-drop-item img {
    width: 20px !important;
    height: 20px !important;
  }

  .adventure-rpg-page .bottom-tabbar {
    position: static !important;
    left: auto !important;
    bottom: auto !important;
    transform: none !important;
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    width: min(430px, calc(100vw - 12px)) !important;
    min-height: 50px !important;
    margin: 3px auto 5px !important;
    padding: 3px !important;
  }

  .adventure-rpg-page .tabbar-item {
    grid-template-columns: auto !important;
    grid-template-rows: 22px 14px !important;
    min-height: 42px !important;
    gap: 1px !important;
    border-radius: 5px !important;
  }

  .adventure-rpg-page .tabbar-item img {
    width: 22px !important;
    height: 22px !important;
  }

  .adventure-rpg-page .tabbar-item strong {
    font-size: 11px !important;
    line-height: 1 !important;
  }
}

@media (max-width: 520px) {
  .adventure-rpg-page .adventure-shell {
    width: calc(100vw - 8px) !important;
    gap: 4px !important;
    padding-top: 4px !important;
  }

  .adventure-rpg-page .adventure-topbar {
    grid-template-columns: 40px minmax(0, 1fr) 68px 72px !important;
    padding: 5px 6px !important;
    min-height: 52px !important;
  }

  .adventure-rpg-page .adventure-title-block h1 {
    font-size: 18px !important;
  }

  .adventure-rpg-page .adventure-hero-chip {
    width: 68px !important;
    min-width: 68px !important;
  }

  .adventure-rpg-page .adventure-top-actions {
    grid-template-columns: repeat(2, 32px) !important;
  }

  .adventure-rpg-page .adventure-controlbar {
    grid-template-columns: minmax(124px, 1fr) minmax(70px, 0.48fr) minmax(70px, 0.48fr) 50px 34px !important;
    gap: 4px !important;
    padding: 4px !important;
  }

  .adventure-rpg-page .adventure-control-field select {
    height: 32px !important;
    min-height: 32px !important;
    font-size: 11px !important;
  }

  .adventure-rpg-page .adventure-more-menu summary {
    min-width: 50px !important;
    height: 32px !important;
    font-size: 12px !important;
  }

  .adventure-rpg-page #guideTopBtn {
    width: 34px !important;
    height: 32px !important;
    min-width: 34px !important;
  }

  .adventure-rpg-page .adventure-battle-panel {
    height: 132px !important;
  }

  .adventure-rpg-page .boss-challenge-button {
    top: 5px !important;
    min-width: 68px !important;
    min-height: 24px !important;
    font-size: 10px !important;
  }

  .adventure-rpg-page .battle-name {
    max-width: 58px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  .adventure-rpg-page .adventure-card-area {
    padding: 3px 5px 6px !important;
  }

  .adventure-rpg-page .board-wrap {
    padding: 5px !important;
  }

  .adventure-rpg-page .adventure-rewardbar {
    height: auto !important;
    min-height: 38px !important;
    align-items: center !important;
  }

  .adventure-rpg-page .adventure-reward-left {
    min-width: 58px !important;
  }

  .adventure-rpg-page .adventure-reward-left span {
    display: none !important;
  }

  .adventure-rpg-page .reward-label {
    display: none !important;
  }

  .adventure-rpg-page .reward-drop-item {
    font-size: 10px !important;
  }

  .adventure-rpg-page .reward-drop-item img {
    width: 18px !important;
    height: 18px !important;
  }
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  font-family: "Inter", "Noto Sans SC", system-ui, sans-serif;
  background:
    radial-gradient(circle at 8% 15%, rgba(87, 230, 255, 0.26), transparent 31%),
    radial-gradient(circle at 88% 10%, rgba(255, 122, 144, 0.22), transparent 32%),
    radial-gradient(circle at 76% 86%, rgba(88, 245, 167, 0.19), transparent 34%),
    linear-gradient(135deg, #071019 0%, #111729 48%, #06141a 100%);
  overflow-x: hidden;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.7), transparent 80%);
}

.admin-console-entry {
  position: absolute;
  right: 0;
  top: calc(100vh - 58px);
  z-index: 999;
  width: 54px;
  height: 30px;
  border: 2px solid rgba(18, 28, 45, 0.72);
  border-radius: 4px;
  color: rgba(255, 255, 255, 0.72);
  background: rgba(20, 30, 48, 0.72);
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
  opacity: 0.58;
  pointer-events: auto;
  box-shadow: 2px 2px 0 rgba(18, 28, 45, 0.42);
}

.admin-console-entry:hover {
  opacity: 0.9;
  transform: translate(-1px, -1px);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  position: relative;
  width: min(1480px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px 0;
}

.topbar,
.dashboard,
.control-panel,
.game-stage,
.panel-section,
.stat-card,
.result-panel {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.topbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 92px;
  padding: 18px 22px;
  border-radius: 28px;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 18px;
  color: #061014;
  font-size: 30px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--cyan), var(--mint) 52%, var(--gold));
  box-shadow: 0 14px 40px rgba(87, 230, 255, 0.28);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--cyan);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(26px, 3vw, 42px);
  line-height: 1.05;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 8px;
  font-size: clamp(22px, 2.2vw, 34px);
  letter-spacing: 0;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-right: 74px;
}

.admin-top-button {
  position: absolute !important;
  top: 14px !important;
  right: 14px !important;
  z-index: 1000 !important;
  display: inline-grid !important;
  place-items: center !important;
  width: 64px !important;
  min-width: 64px !important;
  height: 38px !important;
  min-height: 38px !important;
  padding: 0 !important;
  border: 2px solid rgba(7, 9, 18, 0.55) !important;
  border-radius: 6px !important;
  color: rgba(236, 247, 255, 0.72) !important;
  background: linear-gradient(180deg, rgba(74, 99, 135, 0.9), rgba(47, 67, 97, 0.92)) !important;
  box-shadow: 2px 2px 0 rgba(7, 9, 18, 0.68) !important;
  font-size: 13px !important;
  font-weight: 900 !important;
  opacity: 0.82 !important;
  pointer-events: auto !important;
}

.admin-top-button:hover {
  color: #fff6d0 !important;
  opacity: 1 !important;
  transform: translate(-1px, -1px) !important;
  box-shadow: 3px 3px 0 #070912 !important;
}

.mobile-battle-button {
  display: none;
}

.icon-button,
.primary-button {
  min-height: 46px;
  border-radius: 16px;
  color: var(--text);
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 48px;
  font-size: 24px;
  background: rgba(255, 255, 255, 0.12);
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
  font-weight: 800;
  background: linear-gradient(135deg, #27cfff, #5cf3a7);
  color: #051119;
  text-align: center;
  text-decoration: none;
  box-shadow: 0 16px 38px rgba(87, 230, 255, 0.22);
}

.export-record-button {
  background: linear-gradient(135deg, #8bd7ff, #7ca8ff);
}

.import-record-button {
  background: linear-gradient(135deg, #b8f7a1, #7ce0ff);
}

.clear-record-button {
  background: linear-gradient(135deg, #ff8aa8, #ffd36b);
}

.sound-toggle-button {
  background: linear-gradient(135deg, #ffe17a, #80f7ff);
}

.sound-toggle-button.is-muted {
  background: rgba(255, 255, 255, 0.14);
  color: rgba(238, 249, 255, 0.82);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.16);
}

.hidden-file-input {
  display: none;
}

.icon-button:hover,
.primary-button:hover,
.segment:hover,
.deck-item:hover {
  transform: translateY(-2px);
}

.dashboard {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 20px;
  margin-top: 20px;
  padding: 20px;
  border-radius: 32px;
}

.control-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
  border-radius: 24px;
  background: rgba(9, 20, 31, 0.72);
  box-shadow: none;
}

.panel-section {
  padding: 18px;
  border-radius: 20px;
  box-shadow: none;
}

.intro-panel {
  background:
    linear-gradient(135deg, rgba(87, 230, 255, 0.17), rgba(255, 211, 107, 0.1)),
    rgba(255, 255, 255, 0.08);
}

.level-badge {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  margin-bottom: 12px;
  color: #061119;
  font-size: 12px;
  font-weight: 900;
  background: var(--gold);
}

.intro-panel h2 {
  font-size: 24px;
}

.intro-panel p,
.upload-message {
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.6;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 14px;
}

.section-title strong {
  color: var(--text);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 6px;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.2);
}

.segment {
  min-height: 38px;
  border-radius: 12px;
  color: var(--muted);
  font-weight: 800;
  background: transparent;
  transition: 180ms ease;
}

.segment.active {
  color: #061119;
  background: var(--text);
}

.upload-zone {
  display: grid;
  place-items: center;
  min-height: 138px;
  padding: 18px;
  border: 1px dashed rgba(87, 230, 255, 0.42);
  border-radius: 18px;
  text-align: center;
  background: rgba(87, 230, 255, 0.08);
  cursor: pointer;
}

.upload-zone input {
  display: none;
}

.upload-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  margin-bottom: 10px;
  color: #061119;
  font-size: 24px;
  font-weight: 900;
  background: var(--cyan);
}

.upload-main,
.upload-sub {
  display: block;
}

.upload-main {
  font-weight: 900;
}

.upload-sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.deck-name-input {
  width: 100%;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 14px;
  margin-top: 12px;
  padding: 0 14px;
  color: var(--text);
  outline: 0;
  background: rgba(0, 0, 0, 0.23);
}

.upload-message {
  margin-top: 10px;
  font-size: 13px;
}

.deck-list {
  display: grid;
  gap: 9px;
}

.deck-series-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.deck-series-item {
  display: grid;
  gap: 4px;
  min-height: 58px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.06);
}

.deck-series-item.coral {
  background: linear-gradient(135deg, rgba(255, 118, 118, 0.28), rgba(255, 177, 94, 0.14));
}

.deck-series-item.sky {
  background: linear-gradient(135deg, rgba(74, 195, 255, 0.28), rgba(91, 139, 255, 0.14));
}

.deck-series-item.violet {
  background: linear-gradient(135deg, rgba(180, 128, 255, 0.3), rgba(255, 117, 214, 0.13));
}

.deck-series-item.mint {
  background: linear-gradient(135deg, rgba(81, 230, 166, 0.28), rgba(77, 222, 255, 0.12));
}

.deck-series-item.gold {
  background: linear-gradient(135deg, rgba(255, 214, 89, 0.28), rgba(255, 151, 86, 0.14));
}

.deck-series-item.active {
  border-color: rgba(255, 255, 255, 0.75);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.08), 0 12px 24px rgba(0, 0, 0, 0.18);
}

.deck-series-title {
  font-size: 13px;
  font-weight: 900;
}

.deck-series-sub {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.deck-grade-list {
  display: grid;
  gap: 9px;
}

.deck-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 10px 12px;
  color: var(--text);
  text-align: left;
  background: rgba(255, 255, 255, 0.07);
  transition: 180ms ease;
}

.deck-item.active {
  border-color: rgba(87, 230, 255, 0.7);
  background: rgba(87, 230, 255, 0.16);
}

.deck-title {
  display: block;
  font-size: 15px;
  font-weight: 900;
}

.deck-sub {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.game-stage {
  position: relative;
  min-height: 760px;
  border-radius: 26px;
  padding: 18px;
  overflow: hidden;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.05)),
    rgba(7, 16, 25, 0.6);
}

.game-stage::before {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: "";
  background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.08), transparent);
  transform: translateX(-70%);
  animation: stageSheen 8s ease-in-out infinite;
}

@keyframes stageSheen {
  0%,
  45% {
    transform: translateX(-80%);
  }
  70%,
  100% {
    transform: translateX(80%);
  }
}

.stats-row {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 12px;
}

.stat-card {
  min-height: 86px;
  border-radius: 18px;
  padding: 16px;
  box-shadow: none;
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
  line-height: 1;
}

.stat-card.accent {
  background: linear-gradient(135deg, rgba(255, 211, 107, 0.25), rgba(255, 122, 144, 0.16));
}

.pressure-card {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 229, 139, 0.22), rgba(240, 166, 61, 0.12)),
    rgba(255, 255, 255, 0.06);
}

.pressure-card strong {
  color: #fff2bf;
}

.pressure-track {
  height: 8px;
  margin-top: 10px;
  border: 2px solid #070912;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(7, 9, 18, 0.62);
}

.pressure-track span {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #5cf3a7, #ffe58b, #f0a63d);
  transition: width 180ms linear;
}

.pressure-card.danger {
  animation: pressurePulse 520ms steps(2, end) infinite;
}

.pressure-card.danger strong {
  color: #ff9ebc;
}

.pressure-card.danger .pressure-track span {
  background: linear-gradient(90deg, #ff5f7e, #ffd45f);
}

.monster-charge-panel {
  margin-top: 7px;
}

.monster-charge-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #d7e5ff;
  font-size: 11px;
  font-weight: 900;
}

.monster-charge-head strong {
  color: #fff2bf;
  font-size: 13px;
}

.monster-charge-panel .pressure-track {
  height: 9px;
  margin-top: 4px;
}

.monster-charge-panel.danger .monster-charge-head strong {
  color: #ff9ebc;
}

.monster-charge-panel.danger .pressure-track span {
  background: linear-gradient(90deg, #ff5f7e, #ffd45f);
}

.monster-charge-panel.danger {
  animation: pressurePulse 520ms steps(2, end) infinite;
}

@keyframes pressurePulse {
  0%,
  100% {
    box-shadow: 4px 4px 0 #070912;
  }
  50% {
    box-shadow: 4px 4px 0 #070912, 0 0 18px rgba(255, 95, 126, 0.58);
  }
}

.stage-header {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 28px 4px 18px;
}

.stage-header h2 {
  margin-bottom: 0;
}

.progress-ring {
  display: grid;
  place-items: center;
  width: 78px;
  height: 78px;
  border-radius: 50%;
  color: var(--text);
  font-weight: 900;
  background:
    radial-gradient(circle at center, #101923 58%, transparent 60%),
    conic-gradient(var(--mint) var(--progress, 0deg), rgba(255, 255, 255, 0.13) 0deg);
}

.board-wrap {
  position: relative;
  z-index: 1;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  background: rgba(0, 0, 0, 0.18);
}

.board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(134px, 1fr));
  gap: 12px;
  min-height: 470px;
  align-content: start;
}

.battle-panel {
  position: relative;
  z-index: 1;
  margin-top: 18px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 24px;
  padding: 10px;
  background:
    linear-gradient(135deg, rgba(87, 230, 255, 0.12), rgba(255, 122, 144, 0.09)),
    rgba(0, 0, 0, 0.22);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.battle-sky {
  position: relative;
  min-height: 260px;
  border-radius: 18px;
  overflow: hidden;
  image-rendering: pixelated;
  background:
    linear-gradient(to bottom, rgba(7, 16, 25, 0.08), rgba(7, 16, 25, 0.1)),
    var(--battle-map, url("assets/battle/battle-background.png")) center / cover no-repeat;
}

.battle-sky::after {
  position: absolute;
  inset: 0;
  content: "";
  pointer-events: none;
  background:
    linear-gradient(to bottom, rgba(255, 255, 255, 0.08), transparent 35%),
    radial-gradient(circle at 22% 68%, rgba(87, 230, 255, 0.2), transparent 22%),
    radial-gradient(circle at 82% 64%, rgba(255, 122, 144, 0.16), transparent 24%);
  mix-blend-mode: screen;
}

.battle-hud,
.battle-map-title,
.battle-combo,
.battle-message,
.monster-wave,
.battle-status-row {
  position: absolute;
  z-index: 3;
}

.battle-hud,
.battle-map-title,
.battle-combo,
.battle-message {
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(6, 13, 22, 0.76);
  backdrop-filter: blur(10px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
}

.battle-hud {
  top: 4px;
  width: min(260px, 38%);
  border-radius: 14px;
  padding: 10px;
}

.hero-hud {
  left: 14px;
}

.monster-hud {
  right: 14px;
  z-index: auto;
  text-align: right;
}

.monster-hud > div:first-child,
.monster-hud .battle-traits {
  position: relative;
  z-index: 5;
}

.monster-hud .hp-track {
  position: relative;
  z-index: 2;
}

.battle-hud > div:first-child {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-bottom: 8px;
}

.battle-name {
  display: block;
  grid-column: 1;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.hero-traits {
  grid-column: 1;
  margin: 2px 0 0;
}

.battle-hud strong {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  color: var(--text);
  font-size: 12px;
}

.battle-traits {
  display: block;
  margin: -2px 0 6px;
  color: #9af1ff;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0;
}

.monster-hud .battle-traits {
  width: max-content;
  margin: -2px 0 6px auto;
  text-align: right;
}

.hp-track {
  height: 12px;
  border: 2px solid rgba(255, 255, 255, 0.26);
  border-radius: 999px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.42);
}

.hp-fill {
  display: block;
  width: 100%;
  height: 100%;
  transition: width 420ms cubic-bezier(0.18, 0.82, 0.28, 1);
}

.hero-fill {
  background: linear-gradient(90deg, #57e6ff, #58f5a7);
}

.monster-fill {
  background: linear-gradient(90deg, #ff4f8b, #ffd36b);
}

.battle-map-title {
  top: 14px;
  left: 50%;
  min-width: 150px;
  border-radius: 999px;
  padding: 8px 18px;
  color: #061119;
  font-size: 14px;
  font-weight: 900;
  text-align: center;
  background: linear-gradient(135deg, #ffd36b, #58f5a7);
  transform: translateX(-50%);
}

.battle-status-row {
  left: 50%;
  bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: min(360px, calc(100% - 560px));
  transform: translateX(-50%);
}

.battle-combo {
  position: static;
  min-width: 76px;
  border-radius: 12px;
  padding: 8px 10px;
  color: #1a1208;
  font-size: 12px;
  font-weight: 900;
  text-align: center;
  background: linear-gradient(135deg, #ffd36b, #58f5a7);
  transform: none;
}

.battle-combo.hot {
  animation: comboPulse 620ms ease-in-out infinite alternate;
}

@keyframes comboPulse {
  from {
    box-shadow: 0 0 16px rgba(255, 211, 107, 0.3);
  }
  to {
    box-shadow: 0 0 28px rgba(255, 211, 107, 0.74);
  }
}

.battle-message {
  position: static;
  min-width: 190px;
  border-radius: 12px;
  padding: 9px 14px;
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
  text-align: center;
  transform: none;
}

.boss-challenge-button {
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: 5;
  min-height: 42px;
  border: 3px solid #070912;
  border-radius: 4px;
  padding: 8px 14px;
  color: #1a1208;
  font: inherit;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  background:
    linear-gradient(180deg, #ffef9b 0 48%, #f4a93f 48% 100%);
  box-shadow: 4px 4px 0 #070912;
}

.boss-challenge-button:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 #070912;
}

.reward-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  pointer-events: auto;
  background: rgba(7, 9, 18, 0.28);
}

.reward-overlay.hidden {
  display: none;
}

.ability-reward-panel {
  width: min(420px, calc(100% - 32px));
  border: 4px solid #070912;
  border-radius: 6px;
  padding: 12px 14px 14px;
  color: #fff4d0;
  text-align: center;
  background:
    linear-gradient(180deg, #4b3f74 0 50%, #2e3158 50% 100%);
  box-shadow: 8px 8px 0 #070912;
}

.reward-icon {
  position: relative;
  width: 48px;
  height: 48px;
  margin: 0 auto 8px;
  border: 4px solid #070912;
  border-radius: 4px;
  background:
    linear-gradient(180deg, #ffe98a 0 50%, #f5b33f 50% 100%);
  box-shadow:
    4px 4px 0 #070912,
    0 0 18px rgba(255, 212, 95, 0.42);
  image-rendering: pixelated;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 82%;
}

.reward-icon::before,
.reward-icon::after {
  position: absolute;
  content: "";
  image-rendering: pixelated;
}

.reward-icon.has-image {
  background-color: #18263d;
  background-size: contain;
}

.reward-icon.has-image::before,
.reward-icon.has-image::after {
  display: none;
}

.reward-weapon::before {
  left: 21px;
  top: 6px;
  width: 7px;
  height: 28px;
  background: #eaf6ff;
  box-shadow:
    -5px 5px 0 #9ad8ff,
    5px 5px 0 #9ad8ff,
    0 28px 0 #70421b,
    -7px 23px 0 #ffd45f,
    7px 23px 0 #ffd45f;
  transform: rotate(42deg);
}

.reward-armor::before {
  left: 11px;
  top: 8px;
  width: 26px;
  height: 32px;
  background:
    linear-gradient(90deg, #8df7b2 0 35%, #d9e7ff 35% 65%, #43bfdf 65% 100%);
  clip-path: polygon(50% 0, 92% 14%, 84% 70%, 50% 100%, 16% 70%, 8% 14%);
  box-shadow: inset 0 0 0 4px #070912;
}

.reward-stone::before {
  left: 10px;
  top: 16px;
  width: 30px;
  height: 18px;
  background:
    linear-gradient(135deg, #d9e7ff 0 35%, #8a9bb4 35% 68%, #5e6d84 68% 100%);
  clip-path: polygon(12% 30%, 38% 0, 84% 12%, 100% 52%, 72% 100%, 20% 88%, 0 54%);
  box-shadow:
    0 0 0 4px #070912,
    5px 5px 0 rgba(7, 9, 18, 0.35);
}

.reward-plate::before {
  left: 9px;
  top: 10px;
  width: 30px;
  height: 26px;
  border: 4px solid #070912;
  border-radius: 2px;
  background:
    linear-gradient(180deg, #d9e7ff 0 48%, #7f93ad 48% 100%);
  box-shadow:
    inset 8px 0 0 rgba(255, 255, 255, 0.28),
    inset -8px 0 0 rgba(7, 9, 18, 0.18);
}

.reward-special::before {
  left: 14px;
  top: 8px;
  width: 20px;
  height: 30px;
  background:
    linear-gradient(180deg, #9af1ff 0 45%, #a26bff 45% 100%);
  clip-path: polygon(50% 0, 92% 28%, 78% 100%, 22% 100%, 8% 28%);
  box-shadow:
    0 0 0 4px #070912,
    0 0 18px #9af1ff;
}

.reward-special::after {
  left: 21px;
  top: 3px;
  width: 7px;
  height: 7px;
  background: #fff4d0;
  box-shadow:
    -18px 20px 0 #fff4d0,
    18px 22px 0 #fff4d0;
}

.ability-reward-panel h3 {
  margin: 4px 0 8px;
  color: #ffd45f;
  font-size: 18px;
  text-shadow: 3px 3px 0 #080a10;
}

.ability-reward-panel p:not(.eyebrow) {
  margin: 0 0 12px;
  color: #d9e7ff;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.5;
}

.fighter {
  position: absolute;
  z-index: 2;
  bottom: 24px;
  width: 150px;
  height: 150px;
  transform-origin: 50% 100%;
  transition: filter 180ms ease, opacity 260ms ease;
}

.hero-fighter {
  left: 14%;
}

.pet-fighter {
  z-index: 1;
  left: 7%;
  bottom: 76px;
  width: 112px;
  height: 112px;
  overflow: visible;
  pointer-events: none;
}

.pet-fighter.hidden {
  display: none;
}

.pet-battle-sprite {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  background-position: center bottom;
  background-repeat: no-repeat;
  background-size: contain;
  filter: drop-shadow(0 10px 7px rgba(0, 0, 0, 0.38));
  image-rendering: pixelated;
  transform: scaleX(-1);
}

.pet-battle-name {
  position: absolute;
  left: 50%;
  top: 0;
  z-index: 8;
  max-width: 132px;
  transform: translateX(-50%);
  border: 3px solid #080a10;
  border-radius: 4px;
  padding: 3px 6px;
  color: #fff4d0;
  font-size: 10px;
  font-weight: 900;
  line-height: 1.1;
  text-align: center;
  white-space: nowrap;
  background: rgba(18, 25, 38, 0.94);
  box-shadow: 3px 3px 0 #080a10;
}

.pet-egg-guide-highlight {
  position: relative;
  z-index: 20;
  animation: petEggGuidePulse 900ms ease-in-out infinite alternate;
}

@keyframes petEggGuidePulse {
  from {
    box-shadow:
      0 0 0 4px #070912,
      0 0 0 8px rgba(255, 228, 112, 0.82),
      0 0 18px rgba(255, 235, 128, 0.75);
    transform: translateY(0);
  }
  to {
    box-shadow:
      0 0 0 4px #070912,
      0 0 0 12px rgba(107, 231, 255, 0.82),
      0 0 28px rgba(107, 231, 255, 0.85);
    transform: translateY(-2px);
  }
}

.pet-fighter.assist {
  z-index: 3;
  animation: petAssist 520ms cubic-bezier(0.18, 0.82, 0.28, 1);
}

.pet-fighter.guard {
  z-index: 3;
  animation: petGuard 620ms ease;
}

.monster-fighter {
  z-index: 4;
  right: 13%;
}

.monster-fighter.boss {
  width: 178px;
  height: 178px;
  right: 10%;
}

.sprite {
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  background-repeat: no-repeat;
  background-size: 400% 400%;
  filter: drop-shadow(0 12px 8px rgba(0, 0, 0, 0.38));
}

.hero-sprite {
  background-image: url("assets/battle/hero-sprite-sheet-cutout-v3.png?v=3");
  background-position: 0 0;
}

.monster-sprite {
  background-image: url("assets/battle/monster-sprite-sheet-cutout-v3.png?v=3");
  background-position: 0 0;
}

.hero-fighter.attack {
  animation: heroAttack 520ms cubic-bezier(0.18, 0.82, 0.28, 1);
}

.hero-fighter.attack .hero-sprite {
  background-position: 33.333% 33.333%;
}

.monster-fighter.attack {
  animation: monsterAttack 520ms cubic-bezier(0.18, 0.82, 0.28, 1);
}

.monster-fighter.attack .monster-sprite {
  background-position: 33.333% 33.333%;
}

.fighter.hurt {
  animation: fighterHurt 420ms ease;
}

.hero-fighter.hurt .hero-sprite {
  background-position: 0 66.666%;
}

.monster-fighter.hurt .monster-sprite {
  background-position: 0 66.666%;
}

.hero-fighter.victory .hero-sprite {
  background-position: 0 100%;
}

.monster-fighter.defeated .monster-sprite {
  background-position: 100% 100%;
}

.fighter.defeated {
  filter: grayscale(0.2) brightness(0.82);
  opacity: 0.86;
}

@keyframes heroAttack {
  0%,
  100% {
    transform: translateX(0) scale(1);
  }
  46% {
    transform: translateX(84px) scale(1.08);
  }
}

@keyframes monsterAttack {
  0%,
  100% {
    transform: translateX(0) scale(1);
  }
  46% {
    transform: translateX(-70px) scale(1.06);
  }
}

@keyframes petAssist {
  0%,
  100% {
    transform: translateX(0) scale(1);
  }
  46% {
    transform: translateX(108px) translateY(-8px) scale(1.1);
  }
}

@keyframes petGuard {
  0%,
  100% {
    filter: brightness(1);
    transform: translateX(0) scale(1);
  }
  35% {
    filter: brightness(1.75) saturate(1.25);
    transform: translateX(116px) scale(1.1);
  }
}

@keyframes fighterHurt {
  0%,
  100% {
    filter: brightness(1);
    transform: translateX(0);
  }
  25% {
    filter: brightness(2.2) saturate(1.4);
    transform: translateX(-8px);
  }
  50% {
    transform: translateX(8px);
  }
}

.battle-vfx {
  position: absolute;
  z-index: 4;
  width: 150px;
  height: 150px;
  image-rendering: pixelated;
  background-image: url("assets/battle/battle-vfx-sheet-cutout-v3.png?v=3");
  background-repeat: no-repeat;
  background-size: 400% 200%;
  pointer-events: none;
}

.battle-vfx.hidden {
  display: none;
}

.battle-vfx.slash {
  right: 23%;
  bottom: 82px;
  background-position: 0 0;
  animation: vfxSlash 560ms ease forwards;
}

.battle-vfx.slash.strong {
  width: 190px;
  height: 190px;
  right: 20%;
  bottom: 72px;
  filter: drop-shadow(0 0 18px rgba(87, 230, 255, 0.72));
}

.battle-vfx.fireball {
  left: 24%;
  bottom: 76px;
  background-position: 33.333% 0;
  animation: vfxFireball 620ms ease forwards;
}

.battle-vfx.victory {
  left: 47%;
  bottom: 78px;
  background-position: 66.666% 100%;
  animation: vfxVictory 680ms ease forwards;
}

@keyframes vfxSlash {
  0% {
    opacity: 0;
    transform: translateX(-32px) scale(0.72) rotate(-12deg);
  }
  45% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateX(20px) scale(1.18) rotate(8deg);
  }
}

@keyframes vfxFireball {
  0% {
    opacity: 0;
    transform: translateX(86px) scale(0.68);
  }
  30% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateX(-100px) scale(1.02);
  }
}

@keyframes vfxVictory {
  0% {
    opacity: 0;
    transform: translateY(18px) scale(0.7);
  }
  45% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(-14px) scale(1.2);
  }
}

.damage-number {
  position: absolute;
  z-index: 5;
  color: #fff7d1;
  font-size: 24px;
  font-weight: 900;
  text-shadow:
    2px 2px 0 #4b1520,
    0 0 14px rgba(255, 211, 107, 0.7);
  pointer-events: none;
  transform: translate(-50%, -50%);
  animation: damageFloat 820ms ease forwards;
}

.damage-number.combo {
  color: #8dffb0;
  text-shadow:
    2px 2px 0 #043522,
    0 0 16px rgba(88, 245, 167, 0.72);
}

.damage-number.pet {
  color: #9cf7ff;
  text-shadow:
    2px 2px 0 #07172d,
    0 0 16px rgba(83, 231, 255, 0.82);
}

.damage-number.danger {
  color: #ffb2c0;
  text-shadow:
    2px 2px 0 #3d0914,
    0 0 16px rgba(255, 79, 139, 0.72);
}

.damage-number.hidden {
  display: none;
}

@keyframes damageFloat {
  0% {
    opacity: 0;
    transform: translate(-50%, 0) scale(0.7);
  }
  22% {
    opacity: 1;
    transform: translate(-50%, -18px) scale(1.14);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -58px) scale(0.92);
  }
}

.card {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 108px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 18px;
  padding: 14px;
  color: var(--text);
  text-align: center;
  background:
    radial-gradient(circle at 20% 18%, rgba(255, 255, 255, 0.68), transparent 18%),
    linear-gradient(135deg, color-mix(in srgb, var(--card-a, #57e6ff) 86%, white 10%), var(--card-b, #5b7cff) 48%, var(--card-c, #9d6bff));
  box-shadow:
    0 18px 38px rgba(0, 0, 0, 0.3),
    0 0 24px color-mix(in srgb, var(--card-a, #57e6ff) 34%, transparent);
  isolation: isolate;
  overflow: hidden;
  transform-style: preserve-3d;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, opacity 250ms ease, filter 180ms ease;
}

.card::before {
  position: absolute;
  top: 10px;
  left: 10px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.86);
  font-size: 11px;
  font-weight: 900;
  line-height: 22px;
  content: attr(data-type);
  background: rgba(0, 0, 0, 0.22);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}

.card::after {
  position: absolute;
  inset: -45%;
  z-index: -1;
  content: "";
  background:
    linear-gradient(115deg, transparent 24%, rgba(255, 255, 255, 0.56) 42%, transparent 58%),
    radial-gradient(circle, rgba(255, 255, 255, 0.3), transparent 55%);
  opacity: 0.45;
  transform: translateX(-45%) rotate(12deg);
  animation: cardGlowSweep 5.6s ease-in-out infinite;
}

@keyframes cardGlowSweep {
  0%,
  42% {
    transform: translateX(-55%) rotate(12deg);
  }
  72%,
  100% {
    transform: translateX(55%) rotate(12deg);
  }
}

.card-text {
  max-width: 100%;
  overflow-wrap: normal;
  word-break: keep-all;
  hyphens: none;
  font-size: calc(clamp(20px, 2vw, 30px) * var(--text-scale, 1));
  font-weight: 900;
  line-height: 1.18;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.32);
}

.card.english .card-text {
  white-space: normal;
  overflow-wrap: normal;
  word-break: keep-all;
}

.card.chinese .card-text {
  overflow-wrap: anywhere;
}

.card.english {
  border-color: color-mix(in srgb, var(--card-a, #57e6ff) 58%, white 20%);
}

.card.chinese {
  border-color: color-mix(in srgb, var(--card-c, #ffd36b) 58%, white 20%);
}

.card:hover {
  filter: saturate(1.15) brightness(1.08);
  transform: translateY(-6px) rotateX(4deg) scale(1.02);
}

.card.selected {
  border-color: #ffffff;
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 255, 255, 0.8), transparent 23%),
    linear-gradient(135deg, var(--card-a, #57e6ff), var(--card-b, #58f5a7) 48%, var(--card-c, #ffd36b));
  box-shadow:
    0 22px 54px color-mix(in srgb, var(--card-a, #57e6ff) 34%, transparent),
    0 0 0 3px rgba(255, 255, 255, 0.16);
  transform: translateY(-8px) scale(1.04);
}

.card.mismatch {
  border-color: var(--coral);
  animation: shake 240ms ease;
}

.card.matched {
  pointer-events: none;
  opacity: 0;
  transform: scale(0.82);
}

.card.vanishing {
  pointer-events: none;
  animation: cardVanish 520ms cubic-bezier(0.18, 0.82, 0.28, 1) forwards;
}

@keyframes cardVanish {
  0% {
    opacity: 1;
    filter: saturate(1.25) brightness(1.1);
    transform: translateY(-8px) scale(1.04);
  }
  45% {
    opacity: 1;
    filter: saturate(1.65) brightness(1.45);
    transform: translateY(-10px) scale(1.12) rotate(1deg);
  }
  100% {
    opacity: 0;
    filter: blur(6px) saturate(1.8) brightness(1.8);
    transform: translateY(-18px) scale(0.18) rotate(-5deg);
  }
}

.particle {
  position: fixed;
  z-index: 20;
  border-radius: 999px;
  pointer-events: none;
  box-shadow:
    0 0 12px currentColor,
    0 0 24px currentColor;
  transform: translate(-50%, -50%);
  animation: particleBurst 760ms cubic-bezier(0.14, 0.72, 0.32, 1) forwards;
}

@keyframes particleBurst {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.35) rotate(0deg);
  }
  68% {
    opacity: 0.9;
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) scale(0.08) rotate(var(--spin));
  }
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  33% {
    transform: translateX(-7px);
  }
  66% {
    transform: translateX(7px);
  }
}

.result-panel {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 4;
  width: min(460px, calc(100% - 48px));
  padding: 28px;
  border-radius: 26px;
  text-align: center;
  transform: translate(-50%, -50%);
  overflow: hidden;
}

.result-panel.hidden {
  display: none;
}

.result-glow {
  position: absolute;
  inset: -80px;
  z-index: -1;
  background: radial-gradient(circle, rgba(88, 245, 167, 0.28), transparent 62%);
}

.result-panel p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.7;
}

@media (max-width: 1050px) {
  .dashboard {
    grid-template-columns: 1fr;
  }

  .control-panel {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .intro-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 20px, 1480px);
    padding: 10px 0;
  }

  .topbar,
  .stage-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .dashboard {
    padding: 10px;
    border-radius: 24px;
  }

  .control-panel,
  .stats-row {
    grid-template-columns: 1fr;
  }

  .game-stage {
    min-height: auto;
    padding: 12px;
  }

  .board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .card {
    min-height: 94px;
  }

  .battle-sky {
    min-height: 230px;
  }

  .battle-hud {
    width: calc(50% - 20px);
    padding: 8px;
  }

  .battle-map-title {
    top: 62px;
    min-width: 128px;
    padding: 7px 12px;
    font-size: 12px;
  }

  .battle-status-row {
    bottom: 10px;
    gap: 6px;
  }

  .battle-combo {
    min-width: 64px;
    padding: 7px 8px;
    font-size: 11px;
  }

  .battle-message {
    min-width: 180px;
    font-size: 12px;
  }

  .fighter {
    width: 112px;
    height: 112px;
    bottom: 32px;
  }

  .hero-fighter {
    left: 7%;
  }

  .pet-fighter {
    left: 1%;
    bottom: 76px;
    width: 82px;
    height: 82px;
  }

  .pet-battle-name {
    display: block;
    top: -14px;
    max-width: 96px;
    padding: 2px 5px;
    font-size: 8px;
  }

  .monster-fighter {
    right: 6%;
  }

  .battle-vfx {
    width: 118px;
    height: 118px;
  }

  .battle-vfx.slash {
    right: 18%;
    bottom: 82px;
  }

  .battle-vfx.fireball {
    left: 22%;
    bottom: 78px;
  }
}

/* Pixel RPG skin */
:root {
  --bg: #14161f;
  --panel: #26334a;
  --panel-strong: #344a68;
  --line: #0a0d14;
  --text: #fff4d0;
  --muted: #b9c7d8;
  --cyan: #6be7ff;
  --mint: #79f299;
  --coral: #ff6b65;
  --gold: #ffd45f;
  --ink: #101923;
  --pixel-shadow: #080a10;
  --shadow: 0 0 0 4px #070912, 8px 8px 0 #070912;
}

body {
  font-family: "Noto Sans SC", "Microsoft YaHei", "Courier New", monospace;
  background:
    linear-gradient(45deg, rgba(255, 255, 255, 0.025) 25%, transparent 25%) 0 0 / 18px 18px,
    linear-gradient(45deg, transparent 75%, rgba(255, 255, 255, 0.025) 75%) 0 0 / 18px 18px,
    linear-gradient(180deg, #171b2a 0%, #101727 48%, #1a1323 100%);
  image-rendering: pixelated;
}

body::before {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(180deg, transparent 0%, rgba(255, 212, 95, 0.08) 100%);
  background-size: 24px 24px, 24px 24px, 100% 100%;
  mask-image: none;
}

.topbar,
.dashboard,
.control-panel,
.game-stage,
.panel-section,
.stat-card,
.result-panel,
.adventure-end-panel,
.battle-panel {
  border: 4px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: none;
}

.topbar {
  min-height: 86px;
  padding: 16px;
  background:
    linear-gradient(180deg, #3a5577 0 48%, #2a3c59 48% 100%);
}

.brand-mark {
  width: 58px;
  height: 58px;
  border: 4px solid #070912;
  border-radius: 4px;
  color: #17110b;
  background:
    linear-gradient(180deg, #fff2a3 0 45%, #ffc045 45% 100%);
  box-shadow: 5px 5px 0 #070912;
}

.eyebrow {
  color: #9af1ff;
  font-size: 11px;
  text-shadow: 2px 2px 0 #080a10;
}

h1,
h2,
.deck-title,
.card-text,
.stat-card strong {
  text-shadow: 3px 3px 0 #080a10;
}

h1 {
  font-size: clamp(24px, 3vw, 38px);
}

h2 {
  font-size: clamp(20px, 2vw, 30px);
}

.icon-button,
.primary-button,
.segment,
.deck-series-item,
.deck-item,
.deck-name-input,
.upload-zone {
  border: 3px solid #070912;
  border-radius: 6px;
  box-shadow: 4px 4px 0 #070912;
}

.icon-button,
.primary-button {
  min-height: 44px;
}

.icon-button {
  background: #405a7d;
}

.primary-button {
  color: #1a1208;
  background:
    linear-gradient(180deg, #ffe58b 0 48%, #f0a63d 48% 100%);
  box-shadow: 4px 4px 0 #070912;
}

.icon-button:hover,
.primary-button:hover,
.segment:hover,
.deck-series-item:hover,
.deck-item:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 #070912;
}

.dashboard {
  background:
    linear-gradient(180deg, #1e2a3e 0 48%, #172238 48% 100%);
}

.control-panel {
  padding: 14px;
  background:
    linear-gradient(180deg, #22324b 0 50%, #1a263b 50% 100%);
  box-shadow: 6px 6px 0 #070912;
}

.panel-section {
  padding: 16px;
  background:
    linear-gradient(180deg, #334865 0 50%, #293b58 50% 100%);
  box-shadow: 4px 4px 0 #070912;
}

.intro-panel {
  background:
    linear-gradient(180deg, #5b4a80 0 50%, #3d3869 50% 100%);
}

.level-badge {
  height: 28px;
  border: 3px solid #070912;
  border-radius: 4px;
  color: #1b1206;
  background:
    linear-gradient(180deg, #ffe98a 0 50%, #ffbc4b 50% 100%);
  box-shadow: 3px 3px 0 #070912;
}

.section-title {
  color: #d9e7ff;
}

.segmented {
  gap: 6px;
  padding: 6px;
  border: 3px solid #070912;
  border-radius: 6px;
  background: #121827;
}

.segment {
  color: #d8e6ff;
  background: #263852;
  box-shadow: none;
}

.segment.active {
  color: #1a1208;
  background:
    linear-gradient(180deg, #8df7b2 0 48%, #3fcf7a 48% 100%);
}

.upload-zone {
  min-height: 126px;
  border-style: solid;
  background:
    linear-gradient(180deg, #213955 0 50%, #1b2b44 50% 100%);
}

.upload-icon {
  border: 3px solid #070912;
  border-radius: 4px;
  color: #101923;
  background:
    linear-gradient(180deg, #95f8ff 0 50%, #43bfdf 50% 100%);
}

.deck-name-input {
  color: var(--text);
  background: #111827;
}

.deck-item {
  min-height: 60px;
  color: var(--text);
  background:
    linear-gradient(180deg, #2d405d 0 50%, #243552 50% 100%);
}

.deck-item.active {
  border-color: #070912;
  background:
    linear-gradient(180deg, #2f7b8c 0 50%, #24606f 50% 100%);
}

.deck-item > span:last-child {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  align-self: center;
  border: 3px solid #070912;
  border-radius: 3px;
  background: #ffd45f;
  color: #15100a;
  font-size: 0;
  line-height: 1;
  margin-left: auto;
}

.deck-item > span:last-child::before {
  content: ">";
  font-size: 14px;
  font-weight: 900;
  transform: translateY(-1px);
}

.game-stage {
  background:
    linear-gradient(180deg, #202c42 0 50%, #172238 50% 100%);
}

.game-stage::before {
  display: none;
}

.stats-row {
  gap: 10px;
}

.stat-card {
  min-height: 78px;
  padding: 14px;
  background:
    linear-gradient(180deg, #415778 0 50%, #304665 50% 100%);
  box-shadow: 4px 4px 0 #070912;
}

.stat-card span {
  color: #d7e5ff;
}

.stat-card.accent {
  background:
    linear-gradient(180deg, #8c5a3b 0 50%, #6d3f34 50% 100%);
}

.stage-header {
  margin: 24px 4px 16px;
  padding: 14px;
  border: 4px solid #070912;
  border-radius: 8px;
  background:
    linear-gradient(180deg, #2f4261 0 50%, #253753 50% 100%);
  box-shadow: 4px 4px 0 #070912;
}

.progress-ring {
  width: 76px;
  height: 76px;
  border: 4px solid #070912;
  border-radius: 6px;
  background:
    linear-gradient(180deg, #192236 0 50%, #101827 50% 100%);
  box-shadow: inset 0 0 0 6px #263852;
}

.board-wrap {
  padding: 14px;
  border: 4px solid #070912;
  border-radius: 8px;
  background:
    linear-gradient(45deg, rgba(255, 255, 255, 0.04) 25%, transparent 25%) 0 0 / 16px 16px,
    linear-gradient(45deg, transparent 75%, rgba(255, 255, 255, 0.04) 75%) 0 0 / 16px 16px,
    #101827;
  box-shadow: inset 0 0 0 4px #263852;
}

.board-wrap[data-grade="1"] {
  background:
    linear-gradient(180deg, rgba(8, 20, 18, 0.18), rgba(7, 12, 22, 0.4)),
    url("assets/maps/grade1-morning-meadow.png") center / cover no-repeat;
  box-shadow:
    inset 0 0 0 4px rgba(38, 56, 82, 0.78),
    inset 0 0 46px rgba(255, 244, 172, 0.16);
}

.board-wrap[data-grade="2"] {
  background:
    linear-gradient(180deg, rgba(35, 22, 6, 0.1), rgba(44, 28, 8, 0.34)),
    url("assets/maps/grade2-windmill-wheatfield.png") center / cover no-repeat;
  box-shadow:
    inset 0 0 0 4px rgba(86, 64, 24, 0.76),
    inset 0 0 46px rgba(255, 210, 92, 0.16);
}

.board-wrap[data-grade="3"] {
  background:
    linear-gradient(180deg, rgba(6, 16, 28, 0.12), rgba(4, 10, 24, 0.38)),
    url("assets/maps/grade3-starlight-forest.png") center / cover no-repeat;
  box-shadow:
    inset 0 0 0 4px rgba(30, 67, 86, 0.76),
    inset 0 0 46px rgba(96, 206, 255, 0.14);
}

.board-wrap[data-grade="4"] {
  background:
    linear-gradient(180deg, rgba(7, 14, 26, 0.12), rgba(6, 8, 20, 0.42)),
    url("assets/maps/grade4-crystal-mine.png") center / cover no-repeat;
  box-shadow:
    inset 0 0 0 4px rgba(51, 59, 95, 0.78),
    inset 0 0 46px rgba(116, 198, 255, 0.14);
}

.board-wrap[data-grade="5"] {
  background:
    linear-gradient(180deg, rgba(26, 22, 9, 0.12), rgba(20, 16, 8, 0.38)),
    url("assets/maps/grade5-ancient-ruins.png") center / cover no-repeat;
  box-shadow:
    inset 0 0 0 4px rgba(86, 74, 42, 0.78),
    inset 0 0 46px rgba(242, 219, 128, 0.14);
}

.board-wrap[data-grade="6"] {
  background:
    linear-gradient(180deg, rgba(12, 5, 25, 0.12), rgba(8, 4, 18, 0.46)),
    url("assets/maps/grade6-darkmoon-castle.png") center / cover no-repeat;
  box-shadow:
    inset 0 0 0 4px rgba(64, 39, 103, 0.8),
    inset 0 0 46px rgba(184, 90, 255, 0.16);
}

.board {
  gap: 10px;
}

.board[data-grade="1"] {
  grid-template-columns: repeat(auto-fit, minmax(156px, 1fr));
  gap: 9px;
}

.card {
  min-height: 108px;
  border: 4px solid #070912;
  border-radius: 6px;
  padding: 28px 12px 12px;
  color: #fff6d6;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.1) 0 1px, transparent 1px 100%) 0 0 / 100% 8px,
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px 100%) 0 0 / 8px 100%,
    linear-gradient(180deg, #334867 0 48%, #243752 48% 100%);
  box-shadow:
    5px 5px 0 #070912,
    inset 0 0 0 3px rgba(255, 255, 255, 0.12),
    inset 0 -10px 0 rgba(0, 0, 0, 0.16);
  transform-style: flat;
}

.card::before {
  top: 8px;
  left: 8px;
  height: 24px;
  min-width: 30px;
  border: 3px solid #070912;
  border-radius: 3px;
  color: #101923;
  text-shadow: none;
  line-height: 18px;
  background:
    linear-gradient(180deg, #fff4a8 0 48%, var(--card-a, #57e6ff) 48% 100%);
  box-shadow: 3px 3px 0 #070912;
}

.card::after {
  inset: 12px;
  top: 38px;
  border: 3px solid color-mix(in srgb, var(--card-a, #57e6ff) 76%, white 8%);
  border-radius: 3px;
  opacity: 1;
  background:
    linear-gradient(135deg, transparent 0 44%, rgba(255, 255, 255, 0.08) 44% 56%, transparent 56% 100%),
    rgba(6, 13, 22, 0.18);
  transform: none;
  animation: none;
}

.card-loot-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 5;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 3px solid #070912;
  border-radius: 4px;
  background:
    linear-gradient(180deg, #fff8c9 0 48%, #f4b85e 48% 100%);
  box-shadow:
    3px 3px 0 #070912,
    inset 0 0 0 2px rgba(255, 255, 255, 0.28);
  pointer-events: none;
}

.card-loot-badge::after {
  position: absolute;
  inset: 3px;
  border: 1px solid rgba(7, 9, 18, 0.35);
  border-radius: 2px;
  content: "";
}

.card-loot-badge img {
  position: relative;
  z-index: 1;
  width: 24px;
  height: 24px;
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(1px 2px 0 rgba(7, 9, 18, 0.45));
}

.card.english {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.1) 0 1px, transparent 1px 100%) 0 0 / 100% 8px,
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px 100%) 0 0 / 8px 100%,
    linear-gradient(180deg, #33506d 0 48%, #243a58 48% 100%);
}

.card.chinese {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.1) 0 1px, transparent 1px 100%) 0 0 / 100% 8px,
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px 100%) 0 0 / 8px 100%,
    linear-gradient(180deg, #4a435f 0 48%, #352f4c 48% 100%);
}

.card[data-grade="1"] {
  aspect-ratio: 876 / 620;
  min-height: 122px;
  border: 0;
  border-radius: 10px;
  padding: 34px 18px 18px 26px;
  color: #2a421e;
  container-type: inline-size;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}

.card[data-grade="1"]::before {
  top: 19.2%;
  left: 13.6%;
  z-index: 3;
  display: grid;
  place-items: center;
  width: clamp(21px, 14.4cqw, 54px);
  height: clamp(21px, 14.4cqw, 54px);
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #31502c;
  font-size: clamp(8px, 4.2cqw, 16px);
  line-height: 1;
  transform: translate(-50%, -50%);
  background: transparent;
  box-shadow: none;
}

.card[data-grade="1"]::after {
  position: absolute;
  inset: -2px;
  z-index: 0;
  display: block;
  border: 0;
  border-radius: 10px;
  content: "";
  opacity: 0.78;
  background:
    url("assets/card-frames/grade1-grassland-button-alpha.png") center / 100% 100% no-repeat;
  transform: none;
  animation: none;
  pointer-events: none;
}

.card-text {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 48px;
  padding: 6px 6px;
  border: 3px solid rgba(7, 9, 18, 0.55);
  border-radius: 4px;
  font-size: calc(clamp(18px, 1.7vw, 26px) * var(--text-scale, 1));
  line-height: 1.05;
  overflow-wrap: normal;
  word-break: keep-all;
  hyphens: none;
  background: rgba(9, 15, 27, 0.34);
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.07),
    0 3px 0 rgba(7, 9, 18, 0.65);
}

.card.english .card-text {
  white-space: normal;
  overflow-wrap: normal;
  word-break: keep-all;
}

.card.chinese .card-text {
  overflow-wrap: anywhere;
}

.card[data-grade="1"] .card-text {
  z-index: 2;
  min-height: 48px;
  padding: 4px 10px 2px;
  border: 0;
  color: #10140c;
  background: transparent;
  box-shadow: none;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.92),
    0 2px 4px rgba(20, 28, 12, 0.18);
}

.card[data-grade="1"] .card-loot-badge {
  top: 19.4%;
  right: 13.8%;
  z-index: 3;
  width: clamp(19px, 11.2cqw, 42px);
  height: clamp(19px, 11.2cqw, 42px);
  border: 0;
  background: transparent;
  box-shadow: none;
  transform: translate(50%, -50%);
}

.card[data-grade="1"] .card-loot-badge::after {
  display: none;
}

.card[data-grade="1"] .card-loot-badge img {
  width: 68%;
  height: 68%;
  filter: drop-shadow(0 2px 2px rgba(80, 55, 10, 0.35));
}

.card:hover {
  filter: saturate(1.03) brightness(1.08);
  transform: translate(-3px, -3px);
  box-shadow:
    8px 8px 0 #070912,
    inset 0 0 0 3px rgba(255, 255, 255, 0.14),
    inset 0 -10px 0 rgba(0, 0, 0, 0.16);
}

.card.selected {
  border-color: #fff4d0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.16) 0 1px, transparent 1px 100%) 0 0 / 100% 8px,
    linear-gradient(90deg, rgba(255, 255, 255, 0.12) 0 1px, transparent 1px 100%) 0 0 / 8px 100%,
    linear-gradient(180deg, color-mix(in srgb, var(--card-a, #57e6ff) 45%, #405a78 55%) 0 48%, #253d58 48% 100%);
  box-shadow:
    0 0 0 4px #070912,
    0 0 0 8px #ffd45f,
    8px 8px 0 #070912;
  transform: translate(-4px, -4px);
}

.card[data-grade="1"].selected {
  background: transparent;
  filter: saturate(1.12) brightness(1.06);
  box-shadow: none;
  transform: translate(-4px, -4px) scale(1.02);
}

.card[data-grade="1"].selected::after {
  opacity: 0.9;
  filter:
    drop-shadow(3px 3px 0 rgba(7, 9, 18, 0.72))
    drop-shadow(0 0 10px rgba(255, 221, 91, 0.55));
}

.card.mismatch {
  border-color: #ff9d9d;
}

.card.vanishing {
  animation: pixelCardVanish 520ms steps(5, end) forwards;
}

@keyframes pixelCardVanish {
  0% {
    opacity: 1;
    transform: translate(-4px, -4px) scale(1);
  }
  40% {
    opacity: 1;
    filter: brightness(1.8);
    transform: translate(-4px, -10px) scale(1.08);
  }
  100% {
    opacity: 0;
    filter: brightness(2);
    transform: translate(0, -18px) scale(0.2);
  }
}

.particle {
  border-radius: 1px;
  image-rendering: pixelated;
  box-shadow:
    0 0 0 2px #070912,
    0 0 12px currentColor;
  animation-timing-function: steps(6, end);
}

.battle-panel {
  padding: 8px;
  background:
    linear-gradient(180deg, #30415f 0 50%, #24344f 50% 100%);
}

.battle-sky {
  border: 4px solid #070912;
  border-radius: 4px;
}

.battle-hud,
.battle-map-title,
.battle-combo,
.battle-message {
  border: 3px solid #070912;
  border-radius: 4px;
  background: #111827;
  box-shadow: 4px 4px 0 #070912;
  backdrop-filter: none;
}

.battle-map-title,
.battle-combo {
  color: #1a1208;
  background:
    linear-gradient(180deg, #ffe98a 0 50%, #f5b33f 50% 100%);
}

.battle-rpg-panel,
.monster-wave {
  position: absolute;
  z-index: 3;
  border: 3px solid #070912;
  border-radius: 4px;
  background: #111827;
  box-shadow: 4px 4px 0 #070912;
}

.battle-rpg-panel {
  left: 16px;
  bottom: 16px;
  top: auto;
  display: grid;
  grid-template-columns: minmax(138px, 1fr) auto;
  grid-template-rows: auto auto;
  column-gap: 7px;
  align-items: center;
  width: 286px;
  padding: 7px 8px;
}

.battle-rpg-panel .battle-combo {
  position: absolute;
  left: 12px;
  bottom: calc(100% + 8px);
  width: fit-content;
  min-width: 86px;
  padding: 6px 10px;
  font-size: 13px;
}

.rpg-line {
  grid-column: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #fff4d0;
  font-size: 12px;
  font-weight: 900;
}

.rpg-line {
  display: grid;
  grid-template-columns: auto 1fr;
  font-size: 11px;
}

.rpg-line strong {
  text-align: right;
}

.exp-track {
  grid-column: 1;
  height: 12px;
  border: 3px solid #070912;
  border-radius: 3px;
  margin: 6px 0;
  background: #070912;
}

.exp-fill {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #ffe98a, #79f299);
  transition: width 360ms ease;
}

.profile-battle-button {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: stretch;
  min-width: 48px;
  border: 3px solid #070912;
  border-radius: 4px;
  padding: 7px 6px;
  color: #1a1208;
  font: inherit;
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
  background:
    linear-gradient(180deg, #95f8ff 0 50%, #43bfdf 50% 100%);
  box-shadow: 4px 4px 0 #070912;
}

.restart-top-button {
  background:
    linear-gradient(180deg, #ffe98a 0 50%, #f5b33f 50% 100%);
}

.difficulty-top-button {
  background:
    linear-gradient(180deg, #d9f4ff 0 50%, #8bd7ff 50% 100%);
}

.guide-top-button {
  background:
    linear-gradient(180deg, #fff4a8 0 50%, #f7b542 50% 100%);
}

.stage-kicker {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.stage-kicker strong {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border: 2px solid #070912;
  border-radius: 4px;
  color: #1a1208;
  background: linear-gradient(180deg, #fff4b8 0 50%, #f2b94c 50% 100%);
  box-shadow: 2px 2px 0 #070912;
  font-size: 11px;
  line-height: 1;
  text-shadow: none;
}

.stage-kicker strong[data-difficulty="easy"] {
  background: linear-gradient(180deg, #ddffe8 0 50%, #8af0a4 50% 100%);
}

.stage-kicker strong[data-difficulty="hard"] {
  color: #fff4d0;
  background: linear-gradient(180deg, #ff8d8d 0 50%, #d93f5f 50% 100%);
}

.profile-battle-button:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 #070912;
}

.boss-challenge-button {
  border-radius: 4px;
  box-shadow: 4px 4px 0 #070912;
}

.ability-reward-panel {
  border-radius: 6px;
}

.monster-wave {
  top: 126px;
  right: 18px;
  min-width: 72px;
  padding: 5px 8px;
  color: #fff4d0;
  font-size: 11px;
  font-weight: 900;
  text-align: center;
}

.hero-fighter {
  left: clamp(205px, 24%, 270px);
}

@media (max-width: 1080px) {
  .battle-rpg-panel {
    width: 238px;
    grid-template-columns: minmax(132px, 1fr) auto;
  }

  .battle-status-row {
    width: min(300px, calc(100% - 500px));
  }

  .battle-message {
    min-width: 170px;
    padding-inline: 10px;
  }
}

.hero-profile-page,
.parent-report-page {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(7, 9, 18, 0.72);
}

.hero-profile-page.hidden,
.parent-report-page.hidden {
  display: none;
}

.profile-frame {
  width: min(960px, 100%);
  max-height: min(760px, calc(100vh - 48px));
  overflow: auto;
  border: 4px solid #070912;
  border-radius: 8px;
  padding: 18px;
  background:
    linear-gradient(45deg, rgba(255, 255, 255, 0.04) 25%, transparent 25%) 0 0 / 16px 16px,
    linear-gradient(180deg, #253753 0 50%, #1c2a43 50% 100%);
  box-shadow: 8px 8px 0 #070912;
}

.report-frame {
  width: min(1280px, 100%);
}

.parent-report-page {
  display: block;
  place-items: initial;
  overflow: auto;
  padding: 24px clamp(18px, 4vw, 42px) 42px;
  background:
    linear-gradient(45deg, rgba(255, 255, 255, 0.035) 25%, transparent 25%) 0 0 / 18px 18px,
    linear-gradient(180deg, #101827, #17243a 46%, #0c1220);
}

.parent-report-page .report-frame {
  max-height: none;
  min-height: calc(100vh - 66px);
  margin: 0 auto;
}

body.report-open {
  overflow: hidden;
}

.profile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.profile-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.profile-card {
  border: 4px solid #070912;
  border-radius: 6px;
  padding: 14px;
  background:
    linear-gradient(180deg, #364b69 0 50%, #293c5a 50% 100%);
  box-shadow: 4px 4px 0 #070912;
}

.profile-card h3 {
  margin: 0 0 12px;
  color: #fff4d0;
  text-shadow: 3px 3px 0 #080a10;
}

.hero-card {
  grid-column: span 3;
  display: grid;
  grid-template-columns: 120px 1fr;
  align-items: center;
  gap: 16px;
}

.profile-portrait {
  display: grid;
  place-items: center;
  width: 112px;
  height: 112px;
  border: 4px solid #070912;
  border-radius: 6px;
  background: #111827;
  overflow: hidden;
}

.profile-portrait .sprite {
  width: 132px;
  height: 132px;
  background-position: 0 0;
  transform: translateX(-14px);
}

.profile-stat,
.monster-log-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 34px;
  border-bottom: 2px solid rgba(7, 9, 18, 0.35);
  color: #d9e7ff;
  font-weight: 800;
}

.profile-stat strong,
.monster-log-row strong {
  color: #fff4d0;
}

.profile-item-line {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.profile-item-line.no-icon {
  gap: 0;
}

.profile-item-line img,
.ability-icon {
  width: 34px;
  height: 34px;
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(2px 2px 0 #070912);
}

.monster-log {
  grid-column: span 3;
}

.monster-log-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 18px;
}

.ability-list {
  display: grid;
  gap: 8px;
}

.ability-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 4px 10px;
  align-items: center;
  min-height: 48px;
  border: 3px solid #070912;
  border-radius: 4px;
  padding: 8px 10px;
  background:
    linear-gradient(180deg, rgba(7, 9, 18, 0.34) 0 50%, rgba(7, 9, 18, 0.16) 50% 100%);
  color: #9aa8bc;
  font-weight: 900;
}

.ability-row .ability-icon {
  grid-row: span 2;
}

.ability-row.unlocked {
  background:
    linear-gradient(180deg, rgba(255, 212, 95, 0.2) 0 50%, rgba(74, 231, 255, 0.12) 50% 100%);
  color: #fff4d0;
}

.ability-row strong {
  color: inherit;
}

.ability-row span {
  color: #d9e7ff;
  font-size: 12px;
  line-height: 1.45;
}

.hp-track {
  height: 14px;
  border: 3px solid #070912;
  border-radius: 3px;
}

.result-panel,
.adventure-end-panel {
  background:
    linear-gradient(180deg, #3f5576 0 50%, #2d3f60 50% 100%);
}

.adventure-end-panel {
  position: relative;
  overflow: hidden;
  padding: 22px;
  text-align: center;
}

.adventure-end-panel.hidden {
  display: none;
}

body.name-prompt-open {
  overflow: hidden;
}

body.name-prompt-open .adventure-end-panel {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 120;
  width: min(440px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  transform: translate(-50%, -50%);
  box-shadow:
    0 0 0 999vmax rgba(7, 9, 18, 0.66),
    10px 10px 0 #070912,
    0 0 30px rgba(255, 212, 95, 0.34);
}

body.name-prompt-open .adventure-end-panel::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 2px solid rgba(255, 244, 208, 0.18);
  pointer-events: none;
}

.adventure-end-panel h2 {
  color: #ffd45f;
}

.adventure-end-panel .deck-name-input {
  width: min(360px, 100%);
  margin: 12px auto 0;
  text-align: center;
}

.adventure-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 14px;
}

.leaderboard-list {
  display: grid;
  gap: 8px;
}

.leaderboard-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  border: 3px solid #070912;
  border-radius: 4px;
  padding: 7px 10px;
  background:
    linear-gradient(180deg, rgba(255, 244, 208, 0.12) 0 50%, rgba(7, 9, 18, 0.18) 50% 100%);
  color: #d9e7ff;
  font-weight: 900;
}

.leaderboard-row strong {
  color: #ffd45f;
}

.leaderboard-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leaderboard-row em {
  color: #9af1ff;
  font-style: normal;
  font-size: 12px;
}

.leaderboard-empty {
  min-height: 38px;
  display: grid;
  place-items: center;
  border: 3px dashed rgba(7, 9, 18, 0.55);
  color: #b9c7d8;
  font-weight: 900;
}

.report-top-button {
  min-width: 112px;
  background: linear-gradient(180deg, #ffd45f 0 50%, #f08b3e 50% 100%);
  box-shadow: 4px 4px 0 #070912;
}

.report-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.report-summary-card {
  min-height: 86px;
  border: 4px solid #070912;
  border-radius: 6px;
  padding: 12px;
  background: linear-gradient(180deg, #314967 0 50%, #263a56 50% 100%);
  box-shadow: 4px 4px 0 #070912;
  color: #d9e7ff;
  font-weight: 900;
}

.report-summary-card span {
  display: block;
  color: #9af1ff;
  font-size: 13px;
}

.report-summary-card strong {
  display: block;
  margin-top: 8px;
  color: #fff4d0;
  font-size: 30px;
  text-shadow: 3px 3px 0 #070912;
}

.report-summary-card.accent {
  background: linear-gradient(180deg, #5a4b1e 0 50%, #3b4b38 50% 100%);
}

.report-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.92fr) minmax(360px, 1.25fr);
  gap: 14px;
}

.report-weak-card {
  grid-column: span 2;
}

.report-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.report-card-header h3 {
  margin: 0;
}

.report-card-header span {
  color: #9af1ff;
  font-size: 12px;
  font-weight: 900;
}

.report-deck-list,
.report-weak-list {
  display: grid;
  gap: 10px;
}

.report-deck-row {
  display: grid;
  gap: 8px;
  width: 100%;
  min-height: 84px;
  border: 3px solid #070912;
  border-radius: 4px;
  padding: 10px;
  background: linear-gradient(180deg, rgba(255, 244, 208, 0.12) 0 50%, rgba(7, 9, 18, 0.16) 50% 100%);
  color: #d9e7ff;
  text-align: left;
  box-shadow: 3px 3px 0 #070912;
}

.report-deck-row.active {
  background: linear-gradient(180deg, rgba(255, 212, 95, 0.28) 0 50%, rgba(74, 231, 255, 0.18) 50% 100%);
}

.report-deck-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.report-deck-row-top strong {
  overflow: hidden;
  color: #fff4d0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-deck-row-top em {
  color: #5cf3a7;
  font-style: normal;
  font-weight: 900;
}

.report-progress-track {
  height: 12px;
  border: 3px solid #070912;
  border-radius: 3px;
  background: rgba(7, 9, 18, 0.45);
  overflow: hidden;
}

.report-progress-track i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #5cf3a7, #ffd45f);
}

.report-deck-row-meta {
  color: #b9c7d8;
  font-size: 12px;
  font-weight: 900;
}

.report-word-table {
  display: grid;
  max-height: none;
  overflow: auto;
  border: 3px solid #070912;
  border-radius: 4px;
  background: rgba(7, 9, 18, 0.22);
}

.report-word-head,
.report-word-row {
  display: grid;
  grid-template-columns: minmax(110px, 1.1fr) minmax(90px, 1fr) 64px 78px;
  gap: 8px;
  align-items: center;
  min-height: 38px;
  padding: 8px 10px;
  border-bottom: 2px solid rgba(7, 9, 18, 0.45);
  color: #d9e7ff;
  font-size: 13px;
  font-weight: 900;
}

.report-word-head {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #18263d;
  color: #9af1ff;
}

.report-word-row span {
  overflow-wrap: anywhere;
}

.report-word-row strong {
  color: #b9c7d8;
}

.report-word-row.good strong {
  color: #5cf3a7;
}

.report-word-row.warn strong {
  color: #ffd45f;
}

.report-word-row.bad strong {
  color: #ff8a7a;
}

.report-weak-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 66px;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  border: 3px solid #070912;
  border-radius: 4px;
  padding: 8px 10px;
  background: linear-gradient(180deg, rgba(255, 138, 122, 0.18) 0 50%, rgba(7, 9, 18, 0.16) 50% 100%);
  color: #d9e7ff;
  font-weight: 900;
}

.report-weak-row > strong {
  color: #ffd45f;
  font-size: 18px;
  text-align: center;
}

.report-weak-row span {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.report-weak-row b {
  overflow: hidden;
  color: #fff4d0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-weak-row em {
  overflow: hidden;
  color: #9af1ff;
  font-size: 12px;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.report-weak-row i {
  color: #ff8a7a;
  font-style: normal;
  text-align: right;
}


@media (max-width: 720px) {
  .topbar,
  .dashboard,
  .control-panel,
  .game-stage,
  .panel-section,
  .stat-card,
  .result-panel,
  .adventure-end-panel {
    box-shadow: 4px 4px 0 #070912;
  }

  .card {
    min-height: 96px;
  }

  .top-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .report-summary-grid,
  .report-layout {
    grid-template-columns: 1fr;
  }

  .report-weak-card {
    grid-column: auto;
  }

  .report-word-head,
  .report-word-row {
    grid-template-columns: minmax(82px, 1fr) minmax(72px, 1fr) 48px 66px;
    padding-inline: 7px;
    font-size: 12px;
  }

  .battle-rpg-panel {
    left: 10px;
    right: auto;
    bottom: 10px;
    top: auto;
    grid-template-columns: minmax(104px, 1fr) auto;
    column-gap: 6px;
    width: 238px;
  }

  .profile-battle-button {
    min-width: 48px;
    padding: 6px 7px;
    font-size: 11px;
  }

  .battle-status-row {
    bottom: 58px;
  }

  .boss-challenge-button {
    right: 10px;
    bottom: 10px;
    min-height: 38px;
    padding: 7px 10px;
    font-size: 12px;
  }

  .ability-reward-panel {
    width: calc(100% - 24px);
    padding: 12px;
  }

  .monster-wave {
    top: 124px;
    right: 10px;
    min-width: 62px;
    padding: 5px 7px;
    font-size: 10px;
  }

  .hero-fighter {
    left: 12%;
    bottom: 58px;
  }

  .monster-fighter {
    bottom: 58px;
  }

  .profile-grid,
  .hero-card,
  .monster-log-list {
    grid-template-columns: 1fr;
  }

  .hero-card,
  .monster-log {
    grid-column: auto;
  }

  .leaderboard-row {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .leaderboard-row em {
    grid-column: 2;
  }
}

/* Device responsive layer */
html {
  overflow-x: hidden;
}

.app-shell {
  width: min(1480px, calc(100vw - clamp(12px, 3vw, 32px)));
}

.topbar {
  flex-wrap: wrap;
}

.top-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: 100%;
}

.primary-button {
  white-space: nowrap;
}

.control-panel,
.game-stage,
.board-wrap,
.battle-panel {
  min-width: 0;
}

@media (max-width: 1280px) {
  .app-shell {
    padding: 14px 0;
  }

  .dashboard {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 14px;
  }

  .control-panel {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
  }

  .intro-panel {
    grid-column: auto;
  }

  .game-stage {
    min-height: auto;
  }

  .board {
    min-height: 0;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .topbar {
    align-items: stretch;
  }

  .brand-block {
    width: 100%;
  }

  .top-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: 100%;
    gap: 8px;
  }

  .top-actions .primary-button {
    min-height: 40px;
    padding: 0 8px;
    font-size: 12px;
  }

  .control-panel {
    grid-template-columns: 1fr 1fr;
  }

  .intro-panel {
    grid-column: 1 / -1;
  }

  .panel-section {
    padding: 12px;
  }

  .stats-row {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .stat-card {
    min-height: 64px;
    padding: 10px;
  }

  .stat-card strong {
    font-size: 24px;
  }

  .stage-header {
    margin: 14px 0 12px;
  }

  .board-wrap {
    padding: 10px;
  }

  .board {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .card {
    min-height: 92px;
    padding: 25px 8px 9px;
  }

  .card-text {
    min-height: 42px;
    font-size: calc(clamp(15px, 2.6vw, 21px) * var(--text-scale, 1));
  }

  .battle-sky {
    min-height: 300px;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: calc(100vw - 12px);
    padding: 6px 0;
  }

  .topbar,
  .dashboard,
  .game-stage {
    border-width: 3px;
  }

  .brand-mark {
    width: 44px;
    height: 44px;
    font-size: 22px;
  }

  .brand-block {
    gap: 10px;
  }

  h1 {
    font-size: 22px;
    line-height: 1.12;
  }

  h2 {
    font-size: 19px;
  }

  .eyebrow {
    font-size: 9px;
  }

  .top-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard {
    margin-top: 8px;
    padding: 8px;
  }

  .control-panel {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 8px;
  }

  .upload-zone {
    min-height: 88px;
    padding: 10px;
  }

  .deck-list {
    max-height: 230px;
    overflow: auto;
    padding-right: 2px;
  }

  .deck-item {
    min-height: 52px;
    padding: 8px;
  }

  .game-stage {
    padding: 8px;
  }

  .stats-row {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }

  .stat-card {
    min-height: 56px;
    padding: 7px 5px;
  }

  .stat-card span {
    font-size: 10px;
  }

  .stat-card strong {
    margin-top: 5px;
    font-size: 21px;
  }

  .stage-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 54px;
    align-items: center;
    gap: 8px;
    padding: 10px;
  }

  .progress-ring {
    width: 52px;
    height: 52px;
    font-size: 12px;
  }

  .board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .card {
    min-height: 84px;
  }

  .card::before {
    height: 20px;
    min-width: 26px;
    font-size: 10px;
    line-height: 14px;
  }

  .card::after {
    inset: 9px;
    top: 34px;
  }

  .card-text {
    min-height: 36px;
    padding: 4px;
    font-size: calc(clamp(14px, 4.2vw, 18px) * var(--text-scale, 1));
  }

  .battle-panel {
    margin-top: 10px;
    padding: 5px;
  }

  .battle-sky {
    min-height: 292px;
  }

  .battle-hud {
    top: 6px;
    width: calc(50% - 12px);
    padding: 6px;
  }

  .hero-hud {
    left: 6px;
  }

  .monster-hud {
    right: 6px;
  }

  .battle-name {
    font-size: 11px;
  }

  .battle-traits,
  .battle-hud strong {
    font-size: 10px;
  }

  .hp-track {
    height: 10px;
    border-width: 2px;
  }

  .battle-map-title {
    top: 70px;
    left: 50%;
    min-width: 118px;
    padding: 5px 8px;
    font-size: 11px;
    transform: translateX(-50%);
  }

  .monster-wave {
    top: 102px;
    right: 6px;
    min-width: 58px;
    font-size: 10px;
  }

  .fighter {
    width: 104px;
    height: 104px;
    bottom: 66px;
  }

  .hero-fighter {
    left: 5%;
  }

  .monster-fighter {
    right: 4%;
  }

  .battle-rpg-panel {
    left: 6px;
    bottom: 8px;
    width: min(224px, calc(100% - 126px));
    padding: 6px;
  }

  .battle-status-row {
    left: 6px;
    right: 6px;
    bottom: 54px;
    width: auto;
    gap: 5px;
  }

  .battle-combo {
    min-width: 54px;
    padding: 6px 5px;
    font-size: 10px;
  }

  .battle-message {
    min-width: 0;
    flex: 1;
    padding: 6px;
    font-size: 11px;
  }

  .boss-challenge-button {
    right: 6px;
    bottom: 8px;
    min-height: 34px;
    padding: 6px 8px;
    font-size: 11px;
  }
}

/* Home v4: lighter healing pixel-RPG polish */
:root {
  --v4-ink: #17345f;
  --v4-muted: #587196;
  --v4-line: rgba(83, 115, 154, 0.82);
  --v4-line-soft: rgba(96, 137, 178, 0.52);
  --v4-cloud: rgba(255, 255, 255, 0.96);
  --v4-cloud-blue: rgba(238, 247, 255, 0.95);
  --v4-shadow: rgba(23, 58, 94, 0.2);
  --v4-gold: #ffc857;
  --v4-green: #67df9c;
}

body {
  color: #f6fbff;
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(154, 216, 255, 0.1) 38%, rgba(23, 79, 119, 0.44)),
    url("assets/ui/cloud-kingdom-game-bg.png") center top / cover fixed no-repeat,
    #bce7ff;
}

body::before {
  opacity: 0.28;
}

.app-shell {
  width: min(1320px, calc(100vw - clamp(12px, 3vw, 32px)));
  padding-bottom: 92px;
}

.topbar {
  min-height: 62px;
  padding: 8px 12px;
  border: 2px solid rgba(151, 205, 242, 0.55);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(58, 142, 219, 0.58), rgba(31, 84, 154, 0.62)),
    rgba(255, 255, 255, 0.18);
  box-shadow: 0 8px 20px rgba(26, 72, 118, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.brand-mark {
  width: 40px;
  height: 40px;
  border: 2px solid rgba(28, 66, 112, 0.78);
  border-radius: 8px;
  box-shadow: 0 4px 10px rgba(24, 62, 103, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.brand-block h1 {
  color: #f7fbff;
  font-size: clamp(18px, 1.9vw, 27px);
  text-shadow: 0 2px 0 rgba(32, 76, 132, 0.42);
}

.brand-block .eyebrow {
  color: #dff8ff;
}

.top-player-chip,
.sound-icon-button,
.settings-menu > summary {
  min-height: 36px;
  border: 1.5px solid rgba(221, 241, 255, 0.7);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 10px rgba(20, 58, 96, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.top-player-chip img {
  width: 30px;
  height: 30px;
}

.sound-icon-button {
  width: 38px;
  min-width: 38px;
}

.settings-menu > summary img {
  width: 22px;
  height: 22px;
}

.settings-popover {
  border: 2px solid var(--v4-line);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--v4-cloud), var(--v4-cloud-blue));
  box-shadow: 0 12px 26px rgba(25, 67, 110, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.settings-action {
  border: 1.5px solid var(--v4-line);
  box-shadow: 0 4px 9px rgba(33, 75, 118, 0.16);
}

.home-v2 {
  grid-template-columns: minmax(300px, 0.78fr) minmax(470px, 1.22fr);
  gap: clamp(14px, 2vw, 28px);
  min-height: min(590px, calc(100vh - 130px));
  border: 2px solid rgba(91, 137, 178, 0.62);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(236, 248, 255, 0.12), rgba(149, 210, 245, 0.1) 42%, rgba(39, 99, 131, 0.26)),
    url("assets/ui/cloud-kingdom-game-bg.png") center bottom / cover no-repeat;
  box-shadow: 0 16px 38px rgba(30, 82, 124, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.42);
}

.home-v2::after {
  height: 34%;
  background: linear-gradient(180deg, transparent, rgba(230, 248, 255, 0.14));
}

.daily-quest-card {
  max-width: 640px;
  gap: 12px;
  padding: clamp(16px, 2.1vw, 24px);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(238, 247, 255, 0.96));
  border: 2px solid var(--v4-line);
  border-radius: 12px;
  box-shadow:
    0 10px 24px rgba(23, 58, 94, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

.daily-quest-card .eyebrow {
  margin-bottom: 4px;
  color: #3f7df0;
  font-size: 10px;
  letter-spacing: 0.04em;
}

.daily-quest-card h2 {
  color: var(--v4-ink);
  font-size: clamp(32px, 3.2vw, 52px);
  line-height: 1.08;
  letter-spacing: 0;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.82);
  white-space: normal;
}

.daily-quest-lead {
  color: var(--v4-muted);
  font-size: clamp(14px, 1.15vw, 18px);
  line-height: 1.55;
  font-weight: 800;
}

.quest-reward {
  min-width: 60px;
  color: #7b5a1c;
}

.quest-reward img {
  width: 50px;
  height: 50px;
  filter: drop-shadow(0 5px 7px rgba(36, 77, 116, 0.2));
}

.quest-progress-block {
  padding: 10px 12px;
  background: linear-gradient(180deg, #edf7ff, #dcecff);
  border: 1.5px solid var(--v4-line-soft);
  border-radius: 10px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

.quest-progress-block strong {
  color: #24466f;
}

.quest-progress-block small {
  color: #587196;
  line-height: 1.35;
}

.quest-percent {
  width: 46px;
  height: 46px;
  border: 1.5px solid var(--v4-line);
  color: #23456d;
  background:
    radial-gradient(circle at center, #ffffff 0 50%, transparent 52%),
    conic-gradient(#70df9b 0 var(--progress, 0deg), #cad9e8 var(--progress, 0deg) 100%);
  box-shadow: 0 4px 8px rgba(30, 75, 118, 0.14);
  font-size: 12px;
}

.home-progress-head {
  color: #24466f;
}

.home-progress-head span {
  color: #66809d;
  font-size: 12px;
}

.home-progress-track {
  height: 12px;
  border: 1.5px solid var(--v4-line-soft);
  background: #dceaf7;
  box-shadow: inset 0 1px 2px rgba(48, 83, 122, 0.15);
}

.home-progress-track span {
  background: linear-gradient(90deg, #52d990, #a7f475);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.home-round-progress p {
  color: #b16b08;
  font-size: 12px;
}

.daily-main-button {
  min-height: 58px;
  border: 2px solid var(--v4-line);
  border-radius: 10px;
  color: #4a2d00;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.32), transparent 40%),
    linear-gradient(180deg, #ffe987 0 46%, #ffc24b 47% 100%);
  box-shadow: 0 9px 18px rgba(176, 105, 13, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.72);
  font-size: clamp(18px, 1.8vw, 22px);
}

.daily-main-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 22px rgba(176, 105, 13, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.daily-main-button img {
  width: 38px;
  height: 38px;
}

.daily-secondary-link {
  color: #3470d9;
  font-size: 13px;
}

.home-v2-scene {
  min-height: 430px;
}

.home-v2-hero {
  bottom: 12px;
  width: min(306px, 49vw);
  transform: translateX(-47%) scaleX(-1);
  filter: drop-shadow(0 13px 10px rgba(56, 94, 92, 0.35));
}

.home-v2-pet {
  right: 13%;
  bottom: 38px;
  width: 108px;
  filter: drop-shadow(0 9px 7px rgba(56, 94, 92, 0.28));
}

.home-v2-egg {
  width: 58px;
  padding: 5px;
  border: 1.5px solid rgba(83, 115, 154, 0.6);
  background: rgba(255, 255, 255, 0.68);
  box-shadow: 0 5px 10px rgba(32, 74, 112, 0.14);
  opacity: 0.82;
}

.egg-one {
  left: 6%;
  bottom: 78px;
}

.egg-two {
  right: 5%;
  bottom: 110px;
}

.home-v2-hub {
  gap: 10px;
  margin-top: 12px;
}

.home-v2-hub .hub-panel {
  min-height: 164px;
  padding: 12px;
  border: 2px solid var(--v4-line-soft);
  border-radius: 10px;
  box-shadow: 0 8px 18px rgba(26, 72, 118, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.home-v2-hub .training-panel {
  background: linear-gradient(135deg, rgba(117, 191, 243, 0.86), rgba(125, 159, 232, 0.72));
}

.home-v2-hub .adventure-panel {
  background: linear-gradient(135deg, rgba(130, 149, 221, 0.82), rgba(152, 133, 216, 0.72));
}

.home-v2-hub .garden-panel {
  background: linear-gradient(135deg, rgba(97, 184, 174, 0.78), rgba(127, 198, 192, 0.7));
}

.hub-panel-head {
  gap: 10px;
}

.hub-panel-head > img {
  width: 46px;
  height: 46px;
  filter: drop-shadow(0 5px 6px rgba(35, 73, 109, 0.2));
}

.home-v2-hub .hub-panel h2 {
  font-size: clamp(20px, 1.75vw, 26px);
  text-shadow: 0 2px 0 rgba(31, 78, 126, 0.22);
}

.home-v2-hub .hub-panel p:not(.eyebrow) {
  font-size: 13px;
  line-height: 1.35;
}

.home-v2-hub .hub-action {
  min-height: 58px;
  padding: 8px 9px;
  border: 1.5px solid rgba(83, 115, 154, 0.62);
  border-radius: 9px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(239, 247, 255, 0.95));
  box-shadow: 0 5px 12px rgba(30, 75, 118, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.86);
}

.home-v2-hub .hub-action:hover {
  transform: translateY(-1px);
  box-shadow: 0 7px 14px rgba(30, 75, 118, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.hub-action > img {
  width: 38px;
  height: 38px;
  filter: drop-shadow(0 4px 5px rgba(34, 72, 110, 0.18));
}

.home-v2-hub .hub-action strong {
  color: #203c62;
  font-size: 15px;
}

.home-v2-hub .hub-action small {
  color: #637b99;
  font-size: 10.5px;
  line-height: 1.28;
}

.module-tools {
  display: none;
}

.bottom-tabbar {
  width: min(400px, calc(100vw - 18px));
  min-height: 52px;
  padding: 4px;
  border: 1.5px solid rgba(83, 115, 154, 0.72);
  border-radius: 12px;
  background: rgba(247, 252, 255, 0.86);
  box-shadow: 0 9px 22px rgba(27, 70, 111, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

.tabbar-item {
  min-height: 44px;
  color: #2c4668;
  border-radius: 9px;
  font-size: 10.5px;
}

.tabbar-item img {
  width: 22px;
  height: 22px;
}

.tabbar-item.is-active,
.tabbar-item:focus-visible,
.tabbar-item:hover {
  background: linear-gradient(180deg, #fff3a5 0 50%, #ffc857 50% 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.68);
}

@media (min-width: 1081px) {
  .daily-quest-card h2 {
    white-space: nowrap;
  }

  .home-v2-hub .hub-panel {
    grid-template-columns: minmax(116px, 0.36fr) minmax(0, 0.64fr);
    align-items: center;
  }

  .home-v2-hub .hub-action-grid {
    gap: 7px;
  }
}

@media (max-width: 1080px) {
  .home-v2 {
    grid-template-columns: minmax(280px, 0.82fr) minmax(390px, 1.18fr);
  }

  .home-v2-hub {
    grid-template-columns: 1fr;
  }

  .home-v2-hub .hub-panel {
    grid-template-columns: minmax(180px, 0.32fr) minmax(0, 0.68fr);
  }
}

@media (max-width: 860px) {
  .home-v2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  body {
    padding-bottom: calc(76px + env(safe-area-inset-bottom));
  }

  .topbar {
    min-height: 54px;
    padding: 7px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .brand-block h1 {
    font-size: 17px;
  }

  .home-statusbar {
    gap: 6px;
  }

  .top-player-chip,
  .sound-icon-button,
  .settings-menu > summary {
    min-height: 34px;
  }

  .sound-icon-button {
    width: 34px;
    min-width: 34px;
  }

  .home-v2 {
    gap: 10px;
    padding: 10px;
  }

  .daily-quest-card {
    order: 1;
    padding: 13px;
  }

  .daily-quest-card h2 {
    font-size: clamp(28px, 8.4vw, 36px);
    white-space: normal;
  }

  .daily-quest-lead {
    font-size: 13px;
  }

  .quest-progress-block {
    padding: 9px;
  }

  .quest-percent {
    width: 40px;
    height: 40px;
    font-size: 11px;
  }

  .home-round-progress p {
    font-size: 11.5px;
  }

  .daily-main-button {
    min-height: 52px;
    font-size: 17px;
  }

  .home-v2-scene {
    order: 2;
    min-height: 208px;
  }

  .home-v2-hero {
    width: min(194px, 56vw);
  }

  .home-v2-pet {
    right: 8%;
    width: 72px;
  }

  .home-v2-hub .hub-panel {
    grid-template-columns: 1fr;
    min-height: auto;
    padding: 10px;
  }

  .home-v2-hub .hub-action {
    min-height: 56px;
  }

  .bottom-tabbar {
    width: min(390px, calc(100vw - 14px));
    min-height: 54px;
    bottom: max(8px, env(safe-area-inset-bottom));
  }
}

/* Four-page shell: home / word flash / matching / sentence practice */
.home-page .home-shell {
  min-height: 100vh;
}

.home-page .home-topbar {
  margin-bottom: 12px;
}

.home-top-note {
  color: rgba(242, 250, 255, 0.9);
  font-size: 14px;
  font-weight: 900;
}

.home-portal {
  grid-template-columns: minmax(280px, 0.78fr) minmax(420px, 1.22fr);
  min-height: min(520px, calc(100vh - 210px));
}

.home-portal-card {
  max-width: 620px;
}

.module-page-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.module-page-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  min-height: 128px;
  padding: 14px;
  color: #17345f;
  text-decoration: none;
  border: 2px solid rgba(83, 115, 154, 0.72);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(238, 247, 255, 0.92));
  box-shadow: 0 8px 18px rgba(26, 72, 118, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

.module-page-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 11px 22px rgba(26, 72, 118, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.module-page-card img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  filter: drop-shadow(0 5px 6px rgba(35, 73, 109, 0.2));
}

.module-page-card h2 {
  margin: 0 0 5px;
  color: #17345f;
  font-size: clamp(22px, 2vw, 30px);
}

.module-page-card span {
  display: block;
  color: #587196;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.45;
}

.word-page-card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(220, 241, 255, 0.92));
}

.match-page-card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(232, 228, 255, 0.92));
}

.sentence-page-card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(220, 250, 244, 0.92));
}

.adventure-page .kid-lobby,
.adventure-page .home-hub-grid {
  display: none !important;
}

.adventure-page .dashboard {
  margin-top: 12px;
}

@media (max-width: 920px) {
  .home-portal {
    grid-template-columns: 1fr;
  }

  .module-page-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .home-top-note {
    display: none;
  }

  .home-portal {
    min-height: auto;
  }

  .module-page-card {
    min-height: 104px;
    padding: 11px;
  }

  .module-page-card img {
    width: 52px;
    height: 52px;
  }
}

/* Clean landing page: light-blue pixel RPG, isolated from legacy game styles */
.landing-page {
  min-height: 100vh;
  margin: 0;
  padding: 14px 14px calc(78px + env(safe-area-inset-bottom));
  color: #183761;
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", Arial, sans-serif;
  background:
    linear-gradient(180deg, rgba(238, 248, 255, 0.72), rgba(207, 234, 255, 0.44) 38%, rgba(111, 181, 214, 0.22)),
    url("assets/ui/cloud-kingdom-game-bg.png") center bottom / cover fixed no-repeat,
    #dff4ff;
  overflow-x: hidden;
}

.landing-page *,
.landing-page *::before,
.landing-page *::after {
  box-sizing: border-box;
  text-shadow: none !important;
}

.landing-page::before {
  display: none;
}

.landing-shell {
  width: min(1120px, 100%);
  margin: 0 auto;
}

.landing-statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  padding: 8px 12px;
  border: 2px solid rgba(91, 137, 190, 0.68);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(226, 244, 255, 0.78));
  box-shadow: 0 8px 20px rgba(59, 105, 148, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.landing-brand,
.landing-player {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.landing-brand img {
  width: 38px;
  height: 38px;
  object-fit: contain;
  image-rendering: pixelated;
}

.landing-brand strong,
.landing-brand span {
  display: block;
}

.landing-brand strong {
  color: #14325f;
  font-size: 17px;
  font-weight: 900;
  line-height: 1.08;
}

.landing-brand span {
  margin-top: 2px;
  color: #5b7598;
  font-size: 12px;
  font-weight: 800;
}

.landing-player {
  flex: 0 0 auto;
  padding: 4px 7px;
  border: 1.5px solid rgba(91, 137, 190, 0.55);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.6);
}

.landing-player img {
  width: 30px;
  height: 30px;
  object-fit: contain;
  image-rendering: pixelated;
}

.landing-player span,
.landing-player a {
  color: #254976;
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
}

.landing-hero {
  display: grid;
  grid-template-columns: minmax(270px, 0.9fr) minmax(440px, 1.1fr);
  gap: 18px;
  align-items: stretch;
  margin-top: 12px;
  padding: 14px;
  min-height: 500px;
  border: 2px solid rgba(91, 137, 190, 0.62);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(244, 251, 255, 0.14), rgba(186, 229, 255, 0.2)),
    url("assets/ui/cloud-kingdom-game-bg.png") center bottom / cover no-repeat;
  box-shadow: 0 14px 30px rgba(59, 105, 148, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  overflow: hidden;
}

.landing-scene {
  position: relative;
  min-height: 420px;
}

.landing-hero-role,
.landing-pet {
  position: absolute;
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(0 10px 8px rgba(55, 99, 116, 0.24));
}

.landing-hero-role {
  left: 46%;
  bottom: 22px;
  width: min(310px, 52vw);
  transform: translateX(-50%) scaleX(-1);
}

.landing-pet {
  right: 10%;
  bottom: 42px;
  width: 112px;
}

.landing-quest {
  align-self: center;
  display: grid;
  gap: 12px;
  width: 100%;
  max-width: 590px;
  padding: clamp(16px, 2.2vw, 24px);
  border: 2px solid rgba(91, 137, 190, 0.74);
  border-radius: 14px;
  color: #183761;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(239, 248, 255, 0.94));
  box-shadow: 0 10px 24px rgba(59, 105, 148, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

.landing-kicker {
  margin: 0;
  color: #3f79d7;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.landing-quest h1 {
  margin: 0;
  color: #17345f;
  font-size: clamp(32px, 3.4vw, 50px);
  line-height: 1.08;
  letter-spacing: 0;
  font-weight: 900;
}

.landing-subtitle {
  margin: 0;
  color: #587196;
  font-size: clamp(14px, 1.2vw, 18px);
  font-weight: 800;
  line-height: 1.55;
}

.landing-progress-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 16px;
  align-items: center;
  padding: 10px 12px;
  border: 1.5px solid rgba(91, 137, 190, 0.5);
  border-radius: 10px;
  background: #edf8ff;
}

.landing-progress-card span,
.landing-progress-card strong {
  display: block;
}

.landing-progress-card span {
  color: #66809d;
  font-size: 12px;
  font-weight: 800;
}

.landing-progress-card strong {
  margin-top: 2px;
  color: #24466f;
  font-size: 14px;
  font-weight: 900;
}

.landing-progress-track {
  grid-column: 1 / -1;
  height: 12px;
  overflow: hidden;
  border: 1.5px solid rgba(91, 137, 190, 0.5);
  border-radius: 999px;
  background: #d7e8f6;
}

.landing-progress-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #58d996, #a9f279);
}

.landing-reward {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 8px 10px;
  color: #976111;
  border: 1.5px solid rgba(224, 171, 71, 0.5);
  border-radius: 10px;
  background: #fff8df;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.35;
}

.landing-reward img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.landing-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 58px;
  color: #4d3205;
  text-decoration: none;
  border: 2px solid rgba(126, 105, 54, 0.62);
  border-radius: 12px;
  background: linear-gradient(180deg, #fff3a3, #ffc24b);
  box-shadow: 0 8px 16px rgba(174, 115, 25, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.75);
  font-size: 20px;
  font-weight: 900;
}

.landing-primary img {
  width: 38px;
  height: 38px;
  object-fit: contain;
}

.landing-secondary {
  justify-self: center;
  color: #3470d9;
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
}

.landing-modules {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.landing-module {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 112px;
  padding: 12px;
  color: #17345f;
  text-decoration: none;
  border: 2px solid rgba(91, 137, 190, 0.56);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(236, 248, 255, 0.88));
  box-shadow: 0 8px 18px rgba(59, 105, 148, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.86);
}

.landing-module img {
  width: 58px;
  height: 58px;
  object-fit: contain;
}

.landing-module p,
.landing-module h2,
.landing-module span {
  margin: 0;
}

.landing-module p {
  color: #4f82c4;
  font-size: 11px;
  font-weight: 900;
}

.landing-module h2 {
  margin-top: 3px;
  color: #17345f;
  font-size: 22px;
  line-height: 1.15;
}

.landing-module span {
  display: block;
  margin-top: 4px;
  color: #587196;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.landing-sections {
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.92fr) minmax(0, 0.92fr);
  align-items: stretch;
}

.landing-section-card {
  display: grid;
  gap: 12px;
  min-width: 0;
  min-height: 148px;
  padding: 12px;
  color: #17345f;
  border: 2px solid rgba(91, 137, 190, 0.56);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(232, 247, 255, 0.9));
  box-shadow: 0 8px 18px rgba(59, 105, 148, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.landing-section-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.landing-section-head > img {
  width: 52px;
  height: 52px;
  object-fit: contain;
}

.landing-section-head p,
.landing-section-head h2 {
  margin: 0;
}

.landing-section-head p {
  color: #4f82c4;
  font-size: 12px;
  font-weight: 900;
}

.landing-section-head h2 {
  margin-top: 3px;
  color: #17345f;
  font-size: clamp(16px, 2.2vw, 20px);
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.landing-mini-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.landing-mini-actions a,
.landing-section-main {
  display: grid;
  place-items: center;
  gap: 6px;
  min-width: 0;
  min-height: 74px;
  padding: 8px 6px;
  color: #1e4778;
  text-align: center;
  text-decoration: none;
  border: 1.5px solid rgba(91, 137, 190, 0.46);
  border-radius: 10px;
  background: linear-gradient(180deg, #fefefe, #def2ff);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

.landing-mini-actions a:hover,
.landing-section-main:hover,
.landing-mini-actions a:focus-visible,
.landing-section-main:focus-visible {
  border-color: rgba(56, 123, 205, 0.72);
  background: linear-gradient(180deg, #ffffff, #d3ecff);
  outline: none;
}

.landing-mini-actions img,
.landing-section-main img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.landing-mini-actions strong,
.landing-section-main strong {
  max-width: 100%;
  color: #17345f;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.landing-section-main {
  grid-template-columns: auto minmax(0, max-content);
  justify-content: center;
  align-self: end;
  min-height: 82px;
}

.landing-section-main img {
  width: 42px;
  height: 42px;
}

.landing-section-main strong {
  font-size: 15px;
}

@media (max-width: 420px) {
  .top-actions {
    grid-template-columns: 1fr 1fr;
  }

  .top-actions .primary-button {
    font-size: 11px;
  }

  .board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .card {
    min-height: 76px;
    padding: 23px 6px 7px;
  }

  .card-text {
    font-size: calc(clamp(13px, 4vw, 16px) * var(--text-scale, 1));
  }

  .card-loot-badge {
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    border-width: 2px;
    box-shadow: 2px 2px 0 #070912;
  }

  .card-loot-badge img {
    width: 17px;
    height: 17px;
  }

  .battle-sky {
    min-height: 270px;
  }

  .fighter {
    width: 92px;
    height: 92px;
  }
}

@media (max-width: 520px) {
  .board-wrap {
    padding: 7px;
  }

  .board {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .card {
    min-height: 58px;
    border-width: 3px;
    padding: 18px 4px 5px;
    box-shadow:
      3px 3px 0 #070912,
      inset 0 0 0 2px rgba(255, 255, 255, 0.1),
      inset 0 -7px 0 rgba(0, 0, 0, 0.14);
  }

  .card::before {
    top: 5px;
    left: 5px;
    height: 16px;
    min-width: 22px;
    border-width: 2px;
    font-size: 9px;
    line-height: 12px;
    box-shadow: 2px 2px 0 #070912;
  }

  .card::after {
    inset: 6px;
    top: 25px;
    border-width: 2px;
  }

  .card-text {
    min-height: 26px;
    border-width: 2px;
    padding: 2px 3px;
    font-size: calc(clamp(11px, 3.2vw, 14px) * var(--text-scale, 1));
    line-height: 1;
    text-shadow: 2px 2px 0 #080a10;
  }

  .battle-sky {
    min-height: 318px;
  }

  .battle-hud {
    min-height: 84px;
  }

  .battle-hud > div:first-child {
    display: block;
    margin-bottom: 5px;
  }

  .battle-name {
    overflow: hidden;
    max-width: 100%;
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .battle-traits {
    margin-top: 3px;
    font-size: 9px;
  }

  .battle-hud strong {
    display: block;
    margin-top: 3px;
    font-size: 10px;
    text-align: right;
  }

  .battle-map-title {
    top: 86px;
    min-width: 104px;
    padding: 4px 7px;
  }

  .monster-wave {
    top: 118px;
  }

  .fighter {
    bottom: 86px;
  }

  .battle-status-row {
    left: 7px;
    right: 7px;
    bottom: 72px;
    display: block;
    transform: none;
  }

  .battle-combo {
    display: none;
  }

  .battle-message {
    width: 100%;
    min-height: 34px;
    min-width: 0;
    padding: 7px 8px;
    font-size: 11px;
    line-height: 1.25;
    white-space: normal;
  }

  .battle-rpg-panel {
    left: 7px;
    right: 104px;
    bottom: 8px;
    width: auto;
    min-width: 0;
    grid-template-columns: minmax(0, 1fr) 46px;
    padding: 6px;
  }

  .rpg-line {
    gap: 5px;
    font-size: 10px;
  }

  .exp-track {
    height: 10px;
    margin: 4px 0;
    border-width: 2px;
  }

  .profile-battle-button {
    min-width: 42px;
    padding: 5px;
    font-size: 10px;
  }

  .boss-challenge-button {
    right: 7px;
    bottom: 8px;
    width: 88px;
    min-height: 48px;
    padding: 5px 6px;
    font-size: 10px;
    line-height: 1.15;
    white-space: normal;
  }
}

@media (max-width: 380px) {
  .board {
    gap: 5px;
  }

  .card {
    min-height: 54px;
  }

  .card-text {
    font-size: calc(clamp(10px, 3vw, 13px) * var(--text-scale, 1));
  }

  .battle-rpg-panel {
    right: 96px;
  }

  .boss-challenge-button {
    width: 82px;
    font-size: 9px;
  }
}

@media (orientation: landscape) and (max-height: 620px) and (max-width: 1180px) {
  .app-shell {
    width: calc(100vw - 12px);
    padding: 6px 0;
  }

  .topbar {
    min-height: 0;
    padding: 8px;
  }

  .brand-mark {
    width: 40px;
    height: 40px;
  }

  h1 {
    font-size: 20px;
  }

  .top-actions {
    display: flex;
    gap: 6px;
  }

  .top-actions .primary-button {
    min-height: 34px;
    padding: 0 8px;
    font-size: 11px;
  }

  .dashboard {
    grid-template-columns: minmax(190px, 0.48fr) minmax(0, 1fr);
    gap: 8px;
    margin-top: 8px;
    padding: 8px;
  }

  .control-panel {
    display: flex;
    max-height: calc(100vh - 92px);
    overflow: auto;
    padding: 8px;
  }

  .panel-section {
    padding: 9px;
  }

  .upload-zone {
    min-height: 70px;
  }

  .game-stage {
    padding: 8px;
  }

  .stats-row {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }

  .stat-card {
    min-height: 48px;
    padding: 6px;
  }

  .stat-card strong {
    font-size: 20px;
  }

  .stage-header {
    margin: 8px 0;
    padding: 8px;
  }

  .stage-header h2 {
    font-size: 18px;
  }

  .progress-ring {
    width: 50px;
    height: 50px;
  }

  .board {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .card {
    min-height: 74px;
  }

  .battle-sky {
    min-height: 220px;
  }
}

@media (max-width: 520px) {
  .app-shell {
    padding-top: max(10px, env(safe-area-inset-top));
  }

  .game-stage {
    padding-top: 12px;
  }

  .board-wrap {
    margin-top: 6px;
  }

  .battle-sky {
    min-height: 340px;
  }

  .battle-hud {
    z-index: 6;
  }

  .fighter {
    z-index: 4;
    bottom: 118px;
    width: 94px;
    height: 94px;
  }

  .hero-fighter {
    left: 6%;
  }

  .monster-fighter {
    right: 5%;
  }

  .monster-fighter.boss {
    right: 5%;
    bottom: 116px;
    width: 124px;
    height: 124px;
  }

  .battle-status-row {
    bottom: 66px;
    z-index: 5;
  }

  .battle-message {
    min-height: 30px;
    padding: 5px 7px;
    font-size: 10px;
    line-height: 1.2;
  }

  .monster-hud {
    text-align: right;
  }

  .monster-hud .battle-traits,
  .monster-hud strong {
    text-align: right;
  }
}

@media (max-width: 380px) {
  .battle-sky {
    min-height: 328px;
  }

  .fighter {
    bottom: 112px;
    width: 86px;
    height: 86px;
  }

  .monster-fighter.boss {
    bottom: 112px;
    width: 108px;
    height: 108px;
  }

  .battle-status-row {
    bottom: 62px;
  }
}

@media (orientation: landscape) and (max-height: 620px) and (max-width: 1180px) {
  .battle-sky {
    min-height: 250px;
  }

  .fighter {
    bottom: 72px;
    width: 88px;
    height: 88px;
  }

  .monster-fighter.boss {
    bottom: 72px;
    width: 116px;
    height: 116px;
  }
}

@media (max-width: 760px) {
  .board[data-grade="1"] {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
  }

  .card[data-grade="1"] {
    min-height: 82px;
    padding: 24px 12px 12px 18px;
  }

  .card[data-grade="1"]::before {
    font-size: 10px;
  }

  .card[data-grade="1"] .card-text {
    min-height: 35px;
    padding: 3px 7px 1px;
  }
}

@media (max-width: 520px) {
  .board[data-grade="1"] {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
  }

  .card[data-grade="1"] {
    min-height: 64px;
    padding: 19px 8px 8px 13px;
    border-width: 0;
    box-shadow: none;
  }

  .card[data-grade="1"]::before {
    border-width: 0;
    box-shadow: none;
  }

  .card[data-grade="1"]::after {
    opacity: 0.82;
  }

  .card[data-grade="1"] .card-loot-badge {
    border-width: 0;
    box-shadow: none;
  }

  .card[data-grade="1"] .card-text {
    min-height: 28px;
    border-width: 0;
    font-size: calc(clamp(11px, 3.2vw, 14px) * var(--text-scale, 1));
    text-shadow:
      0 1px 0 rgba(255, 255, 255, 0.86),
      0 2px 7px rgba(49, 80, 44, 0.18);
  }
}

/* Keep the grassland card art aligned after the shared responsive rules. */
.board[data-grade="1"] {
  grid-template-columns: repeat(auto-fit, minmax(214px, 1fr));
  gap: 7px;
}

.card[data-grade="1"] {
  aspect-ratio: 3.6 / 1;
  min-height: 78px;
  padding: 24px 20px 9px 29px;
}

.card[data-grade="1"]::before {
  top: 21.2%;
  left: 15.4%;
}

.card[data-grade="1"] .card-loot-badge {
  top: 25%;
  right: auto;
  left: 83.4%;
  transform: translate(-50%, -50%);
}

.card[data-grade="1"]:hover {
  filter: none;
  box-shadow: none;
  transform: translate(-2px, -2px);
}

.card[data-grade="1"]:hover::after {
  opacity: 0.86;
  filter:
    brightness(1.06)
    drop-shadow(3px 3px 0 rgba(7, 9, 18, 0.68))
    drop-shadow(0 0 8px rgba(255, 244, 172, 0.4));
}

.card[data-grade="1"] .card-text {
  min-height: 26px;
  padding: 0 10px;
  color: #10140c;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.92),
    0 2px 4px rgba(20, 28, 12, 0.18);
}

.card[data-grade="1"] .card-loot-badge img {
  width: 84%;
  height: 84%;
  object-position: center;
}

@media (max-width: 760px) {
  .board[data-grade="1"] {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .card[data-grade="1"] {
    aspect-ratio: 3.5 / 1;
    min-height: 48px;
    padding: 15px 10px 5px 16px;
  }

  .card[data-grade="1"]::before {
    top: 21%;
    left: 15.2%;
  }

  .card[data-grade="1"] .card-loot-badge {
    top: 24.6%;
    right: auto;
    left: 83.2%;
    transform: translate(-50%, -50%);
  }

  .card[data-grade="1"] .card-text {
    min-height: 18px;
    padding: 0 7px;
  }
}

@media (max-width: 520px) {
  .board[data-grade="1"] {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
  }

  .card[data-grade="1"] {
    aspect-ratio: 3.4 / 1;
    min-height: 38px;
    padding: 12px 6px 4px 11px;
  }

  .card[data-grade="1"]::before {
    top: 20.8%;
    left: 15%;
  }

  .card[data-grade="1"] .card-loot-badge {
    top: 24.2%;
    right: auto;
    left: 83%;
    transform: translate(-50%, -50%);
  }

  .card[data-grade="1"] .card-text {
    min-height: 15px;
    padding: 0 5px;
  }
}

/* Grade 2 wheatfield card art. */
.board[data-grade="2"] {
  grid-template-columns: repeat(auto-fit, minmax(214px, 1fr));
  gap: 7px;
}

.card[data-grade="2"] {
  aspect-ratio: 3.6 / 1;
  min-height: 78px;
  border: 0;
  border-radius: 10px;
  padding: 24px 20px 9px 29px;
  color: #10140c;
  container-type: inline-size;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}

.card[data-grade="2"]::before {
  top: 23%;
  left: 15.5%;
  z-index: 3;
  display: grid;
  place-items: center;
  width: clamp(21px, 14.4cqw, 54px);
  height: clamp(21px, 14.4cqw, 54px);
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #5a4412;
  font-size: clamp(8px, 4.2cqw, 16px);
  line-height: 1;
  transform: translate(-50%, -50%);
  background: transparent;
  box-shadow: none;
}

.card[data-grade="2"]::after {
  position: absolute;
  inset: -2px;
  z-index: 0;
  display: block;
  border: 0;
  border-radius: 10px;
  content: "";
  opacity: 0.8;
  background:
    url("assets/card-frames/grade2-wheatfield-button-alpha.png") center / 100% 100% no-repeat;
  transform: none;
  animation: none;
  pointer-events: none;
}

.card[data-grade="2"] .card-text {
  z-index: 2;
  min-height: 26px;
  padding: 0 10px;
  border: 0;
  color: #10140c;
  background: transparent;
  box-shadow: none;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9),
    0 2px 4px rgba(45, 29, 8, 0.18);
}

.card[data-grade="2"] .card-loot-badge {
  top: 24.5%;
  right: auto;
  left: 80.8%;
  z-index: 3;
  width: clamp(19px, 11.2cqw, 42px);
  height: clamp(19px, 11.2cqw, 42px);
  border: 0;
  background: transparent;
  box-shadow: none;
  transform: translate(-50%, -50%);
}

.card[data-grade="2"] .card-loot-badge::after {
  display: none;
}

.card[data-grade="2"] .card-loot-badge img {
  width: 84%;
  height: 84%;
  object-position: center;
  filter: drop-shadow(0 2px 2px rgba(80, 55, 10, 0.35));
}

.card[data-grade="2"]:hover {
  filter: none;
  box-shadow: none;
  transform: translate(-2px, -2px);
}

.card[data-grade="2"]:hover::after {
  opacity: 0.88;
  filter:
    brightness(1.06)
    drop-shadow(3px 3px 0 rgba(7, 9, 18, 0.64))
    drop-shadow(0 0 8px rgba(255, 210, 92, 0.42));
}

.card[data-grade="2"].selected {
  background: transparent;
  filter: saturate(1.12) brightness(1.06);
  box-shadow: none;
  transform: translate(-4px, -4px) scale(1.02);
}

.card[data-grade="2"].selected::after {
  opacity: 0.92;
  filter:
    drop-shadow(3px 3px 0 rgba(7, 9, 18, 0.72))
    drop-shadow(0 0 10px rgba(255, 210, 92, 0.58));
}

@media (max-width: 760px) {
  .board[data-grade="2"] {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .card[data-grade="2"] {
    aspect-ratio: 3.5 / 1;
    min-height: 48px;
    padding: 15px 10px 5px 16px;
  }

  .card[data-grade="2"]::before {
    top: 22.8%;
    left: 15.3%;
  }

  .card[data-grade="2"] .card-loot-badge {
    top: 24.2%;
    left: 80.6%;
  }

  .card[data-grade="2"] .card-text {
    min-height: 18px;
    padding: 0 7px;
  }
}

@media (max-width: 520px) {
  .board[data-grade="2"] {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
  }

  .card[data-grade="2"] {
    aspect-ratio: 3.4 / 1;
    min-height: 38px;
    padding: 12px 6px 4px 11px;
  }

  .card[data-grade="2"]::before {
    top: 22.6%;
    left: 15.1%;
  }

  .card[data-grade="2"] .card-loot-badge {
    top: 24%;
    left: 80.4%;
  }

  .card[data-grade="2"] .card-text {
    min-height: 15px;
    padding: 0 5px;
  }
}

/* Grade 3 and 4 themed card art. */
.board[data-grade="3"],
.board[data-grade="4"] {
  grid-template-columns: repeat(auto-fit, minmax(214px, 1fr));
  gap: 7px;
}

.card[data-grade="3"],
.card[data-grade="4"] {
  aspect-ratio: 3.6 / 1;
  min-height: 78px;
  border: 0;
  border-radius: 10px;
  padding: 24px 20px 9px 29px;
  color: #10140c;
  container-type: inline-size;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}

.card[data-grade="3"]::before,
.card[data-grade="4"]::before {
  top: 23%;
  left: 15.5%;
  z-index: 3;
  display: grid;
  place-items: center;
  width: clamp(21px, 14.4cqw, 54px);
  height: clamp(21px, 14.4cqw, 54px);
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #183449;
  font-size: clamp(8px, 4.2cqw, 16px);
  line-height: 1;
  transform: translate(-50%, -50%);
  background: transparent;
  box-shadow: none;
}

.card[data-grade="3"]::after,
.card[data-grade="4"]::after {
  position: absolute;
  inset: -2px;
  z-index: 0;
  display: block;
  border: 0;
  border-radius: 10px;
  content: "";
  opacity: 0.82;
  transform: none;
  animation: none;
  pointer-events: none;
}

.card[data-grade="3"]::after {
  background:
    url("assets/card-frames/grade3-forest-button-alpha.png") center / 100% 100% no-repeat;
}

.card[data-grade="4"]::after {
  background:
    url("assets/card-frames/grade4-mine-button-alpha.png") center / 100% 100% no-repeat;
}

.card[data-grade="3"] .card-text,
.card[data-grade="4"] .card-text {
  z-index: 2;
  min-height: 26px;
  padding: 0 10px;
  border: 0;
  color: #10140c;
  background: transparent;
  box-shadow: none;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.92),
    0 2px 4px rgba(8, 20, 32, 0.18);
}

.card[data-grade="3"] .card-loot-badge,
.card[data-grade="4"] .card-loot-badge {
  top: 24.2%;
  right: auto;
  left: 80.6%;
  z-index: 3;
  width: clamp(19px, 11.2cqw, 42px);
  height: clamp(19px, 11.2cqw, 42px);
  border: 0;
  background: transparent;
  box-shadow: none;
  transform: translate(-50%, -50%);
}

.card[data-grade="4"] .card-loot-badge {
  left: 80.2%;
}

.card[data-grade="3"] .card-loot-badge::after,
.card[data-grade="4"] .card-loot-badge::after {
  display: none;
}

.card[data-grade="3"] .card-loot-badge img,
.card[data-grade="4"] .card-loot-badge img {
  width: 84%;
  height: 84%;
  object-position: center;
  filter: drop-shadow(0 2px 2px rgba(12, 30, 52, 0.34));
}

.card[data-grade="3"]:hover,
.card[data-grade="4"]:hover {
  filter: none;
  box-shadow: none;
  transform: translate(-2px, -2px);
}

.card[data-grade="3"]:hover::after,
.card[data-grade="4"]:hover::after {
  opacity: 0.9;
  filter:
    brightness(1.06)
    drop-shadow(3px 3px 0 rgba(7, 9, 18, 0.64))
    drop-shadow(0 0 8px rgba(103, 202, 255, 0.38));
}

.card[data-grade="3"].selected,
.card[data-grade="4"].selected {
  background: transparent;
  filter: saturate(1.12) brightness(1.06);
  box-shadow: none;
  transform: translate(-4px, -4px) scale(1.02);
}

.card[data-grade="3"].selected::after,
.card[data-grade="4"].selected::after {
  opacity: 0.92;
  filter:
    drop-shadow(3px 3px 0 rgba(7, 9, 18, 0.72))
    drop-shadow(0 0 10px rgba(103, 202, 255, 0.54));
}

@media (max-width: 760px) {
  .board[data-grade="3"],
  .board[data-grade="4"] {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .card[data-grade="3"],
  .card[data-grade="4"] {
    aspect-ratio: 3.5 / 1;
    min-height: 48px;
    padding: 15px 10px 5px 16px;
  }

  .card[data-grade="3"]::before,
  .card[data-grade="4"]::before {
    top: 22.8%;
    left: 15.3%;
  }

  .card[data-grade="3"] .card-loot-badge,
  .card[data-grade="4"] .card-loot-badge {
    top: 24%;
    left: 80.4%;
  }

  .card[data-grade="4"] .card-loot-badge {
    left: 80%;
  }

  .card[data-grade="3"] .card-text,
  .card[data-grade="4"] .card-text {
    min-height: 18px;
    padding: 0 7px;
  }
}

@media (max-width: 520px) {
  .board[data-grade="3"],
  .board[data-grade="4"] {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
  }

  .card[data-grade="3"],
  .card[data-grade="4"] {
    aspect-ratio: 3.4 / 1;
    min-height: 38px;
    padding: 12px 6px 4px 11px;
  }

  .card[data-grade="3"]::before,
  .card[data-grade="4"]::before {
    top: 22.6%;
    left: 15.1%;
  }

  .card[data-grade="3"] .card-loot-badge,
  .card[data-grade="4"] .card-loot-badge {
    top: 23.8%;
    left: 80.2%;
  }

  .card[data-grade="4"] .card-loot-badge {
    left: 79.8%;
  }

  .card[data-grade="3"] .card-text,
  .card[data-grade="4"] .card-text {
    min-height: 15px;
    padding: 0 5px;
  }
}

/* Grade 5 and 6 themed card art. */
.board[data-grade="5"],
.board[data-grade="6"] {
  grid-template-columns: repeat(auto-fit, minmax(214px, 1fr));
  gap: 7px;
}

.card[data-grade="5"],
.card[data-grade="6"] {
  aspect-ratio: 3.6 / 1;
  min-height: 78px;
  border: 0;
  border-radius: 10px;
  padding: 24px 20px 9px 29px;
  color: #10140c;
  container-type: inline-size;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}

.card[data-grade="5"]::before,
.card[data-grade="6"]::before {
  top: 23%;
  left: 15.5%;
  z-index: 3;
  display: grid;
  place-items: center;
  width: clamp(21px, 14.4cqw, 54px);
  height: clamp(21px, 14.4cqw, 54px);
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #4d3a17;
  font-size: clamp(8px, 4.2cqw, 16px);
  line-height: 1;
  transform: translate(-50%, -50%);
  background: transparent;
  box-shadow: none;
}

.card[data-grade="6"]::before {
  color: #f2e6ff;
  text-shadow: 0 1px 3px rgba(24, 9, 44, 0.42);
}

.card[data-grade="5"]::after,
.card[data-grade="6"]::after {
  position: absolute;
  inset: -2px;
  z-index: 0;
  display: block;
  border: 0;
  border-radius: 10px;
  content: "";
  opacity: 0.82;
  transform: none;
  animation: none;
  pointer-events: none;
}

.card[data-grade="5"]::after {
  background:
    url("assets/card-frames/grade5-ruins-button-alpha.png") center / 100% 100% no-repeat;
}

.card[data-grade="6"]::after {
  background:
    url("assets/card-frames/grade6-darkmoon-button-alpha.png") center / 100% 100% no-repeat;
}

.card[data-grade="5"] .card-text,
.card[data-grade="6"] .card-text {
  z-index: 2;
  min-height: 26px;
  padding: 0 10px;
  border: 0;
  color: #10140c;
  background: transparent;
  box-shadow: none;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.92),
    0 2px 4px rgba(28, 20, 8, 0.18);
}

.card[data-grade="6"] .card-text {
  color: #171021;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.72),
    0 2px 4px rgba(40, 8, 70, 0.16);
}

.card[data-grade="5"] .card-loot-badge,
.card[data-grade="6"] .card-loot-badge {
  top: 24.2%;
  right: auto;
  left: 80.4%;
  z-index: 3;
  width: clamp(19px, 11.2cqw, 42px);
  height: clamp(19px, 11.2cqw, 42px);
  border: 0;
  background: transparent;
  box-shadow: none;
  transform: translate(-50%, -50%);
}

.card[data-grade="6"] .card-loot-badge {
  left: 79.8%;
}

.card[data-grade="5"] .card-loot-badge::after,
.card[data-grade="6"] .card-loot-badge::after {
  display: none;
}

.card[data-grade="5"] .card-loot-badge img,
.card[data-grade="6"] .card-loot-badge img {
  width: 84%;
  height: 84%;
  object-position: center;
  filter: drop-shadow(0 2px 2px rgba(22, 14, 8, 0.34));
}

.card[data-grade="5"]:hover,
.card[data-grade="6"]:hover {
  filter: none;
  box-shadow: none;
  transform: translate(-2px, -2px);
}

.card[data-grade="5"]:hover::after,
.card[data-grade="6"]:hover::after {
  opacity: 0.9;
  filter:
    brightness(1.06)
    drop-shadow(3px 3px 0 rgba(7, 9, 18, 0.64))
    drop-shadow(0 0 8px rgba(238, 213, 128, 0.38));
}

.card[data-grade="6"]:hover::after {
  filter:
    brightness(1.08)
    drop-shadow(3px 3px 0 rgba(7, 9, 18, 0.7))
    drop-shadow(0 0 8px rgba(184, 90, 255, 0.44));
}

.card[data-grade="5"].selected,
.card[data-grade="6"].selected {
  background: transparent;
  filter: saturate(1.12) brightness(1.06);
  box-shadow: none;
  transform: translate(-4px, -4px) scale(1.02);
}

.card[data-grade="5"].selected::after,
.card[data-grade="6"].selected::after {
  opacity: 0.92;
  filter:
    drop-shadow(3px 3px 0 rgba(7, 9, 18, 0.72))
    drop-shadow(0 0 10px rgba(238, 213, 128, 0.54));
}

.card[data-grade="6"].selected::after {
  filter:
    drop-shadow(3px 3px 0 rgba(7, 9, 18, 0.76))
    drop-shadow(0 0 10px rgba(184, 90, 255, 0.6));
}

@media (max-width: 760px) {
  .board[data-grade="5"],
  .board[data-grade="6"] {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .card[data-grade="5"],
  .card[data-grade="6"] {
    aspect-ratio: 3.5 / 1;
    min-height: 48px;
    padding: 15px 10px 5px 16px;
  }

  .card[data-grade="5"]::before,
  .card[data-grade="6"]::before {
    top: 22.8%;
    left: 15.3%;
  }

  .card[data-grade="5"] .card-loot-badge,
  .card[data-grade="6"] .card-loot-badge {
    top: 24%;
    left: 80.2%;
  }

  .card[data-grade="6"] .card-loot-badge {
    left: 79.6%;
  }

  .card[data-grade="5"] .card-text,
  .card[data-grade="6"] .card-text {
    min-height: 18px;
    padding: 0 7px;
  }
}

@media (max-width: 520px) {
  .board[data-grade="5"],
  .board[data-grade="6"] {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
  }

  .card[data-grade="5"],
  .card[data-grade="6"] {
    aspect-ratio: 3.4 / 1;
    min-height: 38px;
    padding: 12px 6px 4px 11px;
  }

  .card[data-grade="5"]::before,
  .card[data-grade="6"]::before {
    top: 22.6%;
    left: 15.1%;
  }

  .card[data-grade="5"] .card-loot-badge,
  .card[data-grade="6"] .card-loot-badge {
    top: 23.8%;
    left: 80%;
  }

  .card[data-grade="6"] .card-loot-badge {
    left: 79.4%;
  }

  .card[data-grade="5"] .card-text,
  .card[data-grade="6"] .card-text {
    min-height: 15px;
    padding: 0 5px;
  }
}

/* Unified themed card alignment. Keep desktop rows inside the board cleanly. */
@media (min-width: 761px) {
  .board[data-grade="1"],
  .board[data-grade="2"],
  .board[data-grade="3"],
  .board[data-grade="4"],
  .board[data-grade="5"],
  .board[data-grade="6"] {
    grid-template-columns: repeat(4, minmax(0, calc((100% - 15px) / 4)));
    gap: 5px;
    padding: 5px;
    box-sizing: border-box;
    overflow: hidden;
    justify-content: start;
  }

  .card[data-grade="1"],
  .card[data-grade="2"],
  .card[data-grade="3"],
  .card[data-grade="4"],
  .card[data-grade="5"],
  .card[data-grade="6"] {
    width: 100%;
    min-width: 0;
    min-height: 0;
    aspect-ratio: 3.6 / 1;
    padding: 7.2% 6% 2.7% 8%;
    box-sizing: border-box;
  }

  .card[data-grade="1"]::after,
  .card[data-grade="2"]::after,
  .card[data-grade="3"]::after,
  .card[data-grade="4"]::after,
  .card[data-grade="5"]::after,
  .card[data-grade="6"]::after {
    inset: -5px -9px;
    background-size: 100% 100%;
  }

  .card[data-grade="1"] .card-loot-badge,
  .card[data-grade="2"] .card-loot-badge,
  .card[data-grade="3"] .card-loot-badge,
  .card[data-grade="4"] .card-loot-badge,
  .card[data-grade="5"] .card-loot-badge,
  .card[data-grade="6"] .card-loot-badge {
    top: 24.4%;
    right: auto;
    left: 82.6%;
    transform: translate(-50%, -50%);
  }
}

/* Final mobile battle tuning: keep the pet behind the hero and let the center message own the space. */
@media (max-width: 760px) {
  .battle-combo {
    display: none !important;
  }

  .battle-status-row {
    left: 50% !important;
    right: auto !important;
    bottom: 70px !important;
    width: min(340px, calc(100% - 72px)) !important;
    transform: translateX(-50%) !important;
    justify-content: center !important;
    z-index: 8;
  }

  .battle-message {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    min-height: 38px;
    padding: 8px 10px !important;
    font-size: 12px !important;
  }

  .hero-fighter {
    z-index: 3;
    left: 18% !important;
  }

  .pet-fighter {
    z-index: 2;
    left: 5% !important;
    bottom: 122px !important;
    width: 70px !important;
    height: 70px !important;
  }

  .pet-battle-name {
    top: -18px !important;
    max-width: 94px;
    font-size: 8px;
  }
}

@media (max-width: 420px) {
  .hero-fighter {
    left: 21% !important;
  }

  .pet-fighter {
    left: 4% !important;
    bottom: 132px !important;
    width: 62px !important;
    height: 62px !important;
  }
}

/* Final override, intentionally last: only tune mobile card width so the art fits horizontally. */
@media (max-width: 760px) {
  .board-wrap {
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow: hidden !important;
  }

  .board,
  .board[data-grade="1"],
  .board[data-grade="2"],
  .board[data-grade="3"],
  .board[data-grade="4"],
  .board[data-grade="5"],
  .board[data-grade="6"] {
    box-sizing: border-box !important;
    display: grid !important;
    width: 100% !important;
    max-width: 100% !important;
    grid-template-columns: repeat(3, minmax(0, calc((100% - 24px) / 3))) !important;
    column-gap: 4px !important;
    justify-content: center !important;
    overflow: visible !important;
  }

  .card,
  .card[data-grade="1"],
  .card[data-grade="2"],
  .card[data-grade="3"],
  .card[data-grade="4"],
  .card[data-grade="5"],
  .card[data-grade="6"] {
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }
}

/* Final override, intentionally last: mobile battle layout follows title, actors, message, bottom stats. */
@media (max-width: 760px) {
  .battle-sky {
    min-height: 430px !important;
  }

  .battle-map-title {
    top: 10px !important;
    left: 50% !important;
    min-width: 132px !important;
    padding: 6px 16px !important;
    font-size: 13px !important;
    transform: translateX(-50%) !important;
    z-index: 6 !important;
  }

  .hero-hud,
  .monster-hud {
    top: auto !important;
    bottom: 10px !important;
    width: calc(50% - 16px) !important;
    min-height: 0 !important;
    border-radius: 6px !important;
    padding: 6px !important;
    background: rgba(6, 13, 22, 0.86) !important;
    box-shadow: 4px 4px 0 #070912 !important;
    backdrop-filter: none !important;
    text-align: left !important;
    z-index: 7 !important;
  }

  .hero-hud {
    left: 8px !important;
  }

  .monster-hud {
    right: 8px !important;
  }

  .battle-hud > div:first-child {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    gap: 4px 6px !important;
    margin-bottom: 4px !important;
  }

  .battle-name {
    overflow: hidden !important;
    color: #dceaff !important;
    font-size: 10px !important;
    line-height: 1.1 !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  .battle-hud strong {
    grid-column: 2 !important;
    grid-row: 1 !important;
    align-self: center !important;
    color: #fff6d0 !important;
    font-size: 10px !important;
    line-height: 1 !important;
  }

  .battle-traits,
  .monster-hud .battle-traits {
    width: auto !important;
    margin: 0 !important;
    color: #9af1ff !important;
    font-size: 9px !important;
    line-height: 1 !important;
    text-align: left !important;
    white-space: nowrap !important;
  }

  .hp-track {
    height: 7px !important;
    border-width: 1px !important;
    border-radius: 2px !important;
  }

  .monster-charge-panel {
    margin-top: 4px !important;
    padding-top: 3px !important;
  }

  .monster-charge-head {
    margin-bottom: 2px !important;
    font-size: 8px !important;
    line-height: 1 !important;
  }

  .monster-charge-head strong {
    font-size: 9px !important;
  }

  .monster-charge-panel .pressure-track {
    height: 5px !important;
  }

  .fighter {
    bottom: 150px !important;
    width: 92px !important;
    height: 92px !important;
  }

  .pet-fighter {
    left: 6% !important;
    bottom: 158px !important;
    width: 72px !important;
    height: 72px !important;
    z-index: 2 !important;
  }

  .hero-fighter {
    left: 29% !important;
    z-index: 3 !important;
  }

  .monster-fighter {
    right: 8% !important;
    z-index: 4 !important;
  }

  .monster-fighter.boss {
    bottom: 145px !important;
    width: 112px !important;
    height: 112px !important;
    right: 5% !important;
  }

  .pet-battle-name {
    top: -16px !important;
    max-width: 90px !important;
    padding: 2px 5px !important;
    font-size: 8px !important;
  }

  .battle-status-row {
    left: 50% !important;
    right: auto !important;
    bottom: 94px !important;
    width: min(280px, calc(100% - 44px)) !important;
    transform: translateX(-50%) !important;
    z-index: 6 !important;
  }

  .battle-message {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 34px !important;
    padding: 7px 10px !important;
    border-radius: 6px !important;
    font-size: 12px !important;
    line-height: 1.2 !important;
  }

  .monster-wave {
    top: auto !important;
    right: 8px !important;
    bottom: 76px !important;
    min-width: 66px !important;
    padding: 4px 6px !important;
    font-size: 10px !important;
    z-index: 7 !important;
  }

  .battle-rpg-panel {
    left: 8px !important;
    right: auto !important;
    bottom: 70px !important;
    width: calc(50% - 16px) !important;
    min-height: 0 !important;
    grid-template-columns: minmax(0, 1fr) 36px !important;
    gap: 4px 6px !important;
    padding: 5px !important;
    border-radius: 6px !important;
    box-shadow: 4px 4px 0 #070912 !important;
    z-index: 7 !important;
  }

  .rpg-line {
    gap: 4px !important;
    font-size: 9px !important;
    line-height: 1 !important;
  }

  .exp-track {
    height: 7px !important;
    margin: 2px 0 0 !important;
  }

  .profile-battle-button {
    min-width: 34px !important;
    min-height: 30px !important;
    padding: 3px !important;
    font-size: 9px !important;
  }

  .boss-challenge-button {
    right: 8px !important;
    bottom: 70px !important;
    width: calc(50% - 16px) !important;
    min-height: 36px !important;
    padding: 5px 7px !important;
    font-size: 10px !important;
    z-index: 7 !important;
  }
}

@media (max-width: 380px) {
  .fighter {
    width: 84px !important;
    height: 84px !important;
  }

  .pet-fighter {
    width: 64px !important;
    height: 64px !important;
    left: 5% !important;
  }

  .hero-fighter {
    left: 30% !important;
  }

  .monster-fighter {
    right: 6% !important;
  }
}

@media (min-width: 761px) and (max-width: 1080px) {
  .board[data-grade="1"],
  .board[data-grade="2"],
  .board[data-grade="3"],
  .board[data-grade="4"],
  .board[data-grade="5"],
  .board[data-grade="6"] {
    grid-template-columns: repeat(4, minmax(0, calc((100% - 15px) / 4)));
    gap: 5px;
    padding-inline: 5px;
  }
}

.difficulty-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(7, 9, 18, 0.74);
}

.difficulty-overlay.hidden {
  display: none;
}

.difficulty-panel {
  width: min(860px, 100%);
  border: 4px solid #070912;
  border-radius: 8px;
  padding: 22px;
  color: #eef9ff;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03)),
    #26334a;
  box-shadow: 8px 8px 0 #070912;
}

.difficulty-panel h2 {
  margin: 0;
  color: #fff4d0;
  font-size: clamp(28px, 4vw, 42px);
  text-shadow: 3px 3px 0 #070912;
}

.difficulty-lead {
  margin: 10px 0 18px;
  color: #b9cbe0;
  font-weight: 800;
}

.difficulty-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.difficulty-card {
  min-height: 170px;
  border: 4px solid #070912;
  border-radius: 6px;
  padding: 16px;
  color: #1a1208;
  text-align: left;
  background:
    linear-gradient(180deg, #d9f4ff 0 50%, #8bd7ff 50% 100%);
  box-shadow: 5px 5px 0 #070912;
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.difficulty-card strong {
  display: block;
  margin-bottom: 10px;
  font-size: 26px;
}

.difficulty-card span {
  display: block;
  color: #253247;
  font-size: 15px;
  font-weight: 900;
  line-height: 1.55;
}

.difficulty-card.recommended {
  background:
    linear-gradient(180deg, #ffe58b 0 50%, #f0a63d 50% 100%);
}

.difficulty-card.hard {
  color: #fff4d0;
  background:
    linear-gradient(180deg, #6a4ad8 0 50%, #2c244d 50% 100%);
}

.difficulty-card.hard span {
  color: #d7e5ff;
}

.difficulty-card:hover {
  transform: translate(-2px, -2px);
  box-shadow: 7px 7px 0 #070912;
}

@media (max-width: 760px) {
  .difficulty-grid {
    grid-template-columns: 1fr;
  }

  .difficulty-card {
    min-height: 124px;
  }
}

/* Final mobile battle layout: keep HUDs, title, fighters, message and actions from overlapping. */
@media (max-width: 760px) {
  .battle-sky {
    min-height: 430px;
  }

  .battle-hud {
    top: 7px;
    width: calc(50% - 13px);
    min-height: 116px;
    padding: 7px;
  }

  .hero-hud {
    left: 7px;
  }

  .monster-hud {
    right: 7px;
  }

  .monster-charge-head {
    font-size: 9px;
  }

  .monster-charge-head strong {
    font-size: 10px;
  }

  .monster-charge-panel .pressure-track {
    height: 8px;
  }

  .battle-map-title {
    top: 132px;
    left: 50%;
    min-width: 118px;
    transform: translateX(-50%);
  }

  .monster-wave {
    top: 168px;
    right: 7px;
  }

  .fighter {
    bottom: 110px;
    width: 104px;
    height: 104px;
  }

  .hero-fighter {
    left: 7%;
  }

  .pet-fighter {
    left: 1%;
    bottom: 142px;
    width: 74px;
    height: 74px;
  }

  .pet-battle-name {
    display: block;
    top: -14px;
    max-width: 90px;
    padding: 2px 5px;
    font-size: 8px;
  }

  .monster-fighter {
    right: 6%;
  }

  .monster-fighter.boss {
    bottom: 110px;
    width: 124px;
    height: 124px;
  }

  .battle-status-row {
    left: 50%;
    right: auto;
    bottom: 70px;
    width: min(250px, calc(100% - 180px));
    transform: translateX(-50%);
    justify-content: center;
  }

  .battle-message {
    width: 100%;
    min-width: 0;
    min-height: 34px;
    padding: 7px 8px;
    font-size: 11px;
  }

  .battle-rpg-panel {
    left: 7px;
    right: auto;
    bottom: 8px;
    width: min(285px, calc(100% - 128px));
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 6px;
  }

  .battle-rpg-panel .battle-combo {
    display: block;
    position: absolute;
    left: 8px;
    bottom: calc(100% + 6px);
    min-width: 78px;
    padding: 5px 9px;
    font-size: 11px;
  }

  .boss-challenge-button {
    right: 7px;
    bottom: 8px;
    width: 90px;
  }
}

@media (max-width: 420px) {
  .battle-sky {
    min-height: 410px;
  }

  .battle-hud {
    min-height: 112px;
  }

  .battle-map-title {
    top: 128px;
  }

  .monster-wave {
    top: 160px;
  }

  .fighter {
    bottom: 106px;
    width: 90px;
    height: 90px;
  }

  .battle-status-row {
    bottom: 66px;
    width: min(220px, calc(100% - 160px));
  }

  .battle-rpg-panel {
    width: min(250px, calc(100% - 112px));
  }

  .rpg-line {
    font-size: 10px;
  }

  .profile-battle-button {
    min-width: 38px;
    padding: 4px;
    font-size: 9px;
  }
}

.card[data-grade="1"].selected,
.card[data-grade="2"].selected,
.card[data-grade="3"].selected,
.card[data-grade="4"].selected,
.card[data-grade="5"].selected,
.card[data-grade="6"].selected {
  z-index: 12;
  filter: brightness(1.12) saturate(1.18);
  transform: translate(-3px, -5px) scale(1.035);
}

.card[data-grade="1"].selected::after,
.card[data-grade="2"].selected::after,
.card[data-grade="3"].selected::after,
.card[data-grade="4"].selected::after,
.card[data-grade="5"].selected::after,
.card[data-grade="6"].selected::after {
  opacity: 0.98;
  filter:
    brightness(1.14)
    drop-shadow(0 0 0 #fff7bf)
    drop-shadow(0 0 8px rgba(255, 242, 139, 0.95))
    drop-shadow(0 0 18px rgba(255, 196, 58, 0.74))
    drop-shadow(4px 5px 0 rgba(7, 9, 18, 0.82));
  animation: selectedCardGlow 900ms ease-in-out infinite alternate;
}

.card[data-grade="1"].selected .card-text,
.card[data-grade="2"].selected .card-text,
.card[data-grade="3"].selected .card-text,
.card[data-grade="4"].selected .card-text,
.card[data-grade="5"].selected .card-text,
.card[data-grade="6"].selected .card-text {
  color: #050705;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.96),
    0 0 7px rgba(255, 244, 160, 0.68);
}

@keyframes selectedCardGlow {
  from {
    filter:
      brightness(1.1)
      drop-shadow(0 0 0 #fff7bf)
      drop-shadow(0 0 7px rgba(255, 242, 139, 0.86))
      drop-shadow(0 0 14px rgba(255, 196, 58, 0.62))
      drop-shadow(4px 5px 0 rgba(7, 9, 18, 0.78));
  }

  to {
    filter:
      brightness(1.2)
      drop-shadow(0 0 0 #fff7bf)
      drop-shadow(0 0 11px rgba(255, 252, 188, 1))
      drop-shadow(0 0 24px rgba(255, 196, 58, 0.88))
      drop-shadow(4px 5px 0 rgba(7, 9, 18, 0.82));
  }
}

/* Desktop battle spacing: keep a clear slot for the active pet behind the hero. */
@media (min-width: 761px) {
  .hero-fighter {
    left: 30%;
  }

  .pet-fighter {
    left: 20%;
    bottom: 36px;
  }

  .pet-battle-name {
    display: block;
  }

  .battle-map-title {
    left: 53%;
  }

  .battle-status-row {
    left: 54%;
    width: min(330px, calc(100% - 590px));
  }

  .battle-rpg-panel {
    left: 12px;
    bottom: 10px;
    grid-template-columns: minmax(118px, 1fr) auto;
    width: 218px;
    padding: 5px 6px;
  }

  .battle-rpg-panel .battle-combo {
    min-width: 72px;
    padding: 5px 8px;
    font-size: 12px;
  }

  .rpg-line {
    gap: 5px;
    font-size: 10px;
  }

  .exp-track {
    height: 9px;
    margin: 4px 0;
  }

  .profile-battle-button {
    min-width: 42px;
    min-height: 34px;
    padding: 4px 6px;
    font-size: 11px;
  }
}

/* Final override, intentionally last: mobile battle pet and message spacing. */
@media (max-width: 760px) {
  .battle-combo,
  .battle-rpg-panel .battle-combo {
    display: none !important;
  }

  .battle-status-row {
    left: 50% !important;
    right: auto !important;
    bottom: 70px !important;
    width: min(340px, calc(100% - 72px)) !important;
    transform: translateX(-50%) !important;
    justify-content: center !important;
    z-index: 8 !important;
  }

  .battle-message {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    min-height: 38px !important;
    padding: 8px 10px !important;
    font-size: 12px !important;
  }

  .hero-fighter {
    z-index: 3 !important;
    left: 18% !important;
  }

  .pet-fighter {
    z-index: 2 !important;
    left: 5% !important;
    bottom: 122px !important;
    width: 70px !important;
    height: 70px !important;
  }

  .pet-battle-name {
    top: -18px !important;
    max-width: 94px !important;
    font-size: 8px !important;
  }
}

@media (max-width: 420px) {
  .hero-fighter {
    left: 21% !important;
  }

  .pet-fighter {
    left: 4% !important;
    bottom: 132px !important;
    width: 62px !important;
    height: 62px !important;
  }
}
/* Final override, intentionally last: only tune mobile card width so the art fits horizontally. */
@media (max-width: 760px) {
  .board-wrap {
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow: hidden !important;
  }

  .board,
  .board[data-grade="1"],
  .board[data-grade="2"],
  .board[data-grade="3"],
  .board[data-grade="4"],
  .board[data-grade="5"],
  .board[data-grade="6"] {
    box-sizing: border-box !important;
    display: grid !important;
    width: 100% !important;
    max-width: 100% !important;
    grid-template-columns: repeat(3, minmax(0, calc((100% - 24px) / 3))) !important;
    column-gap: 4px !important;
    justify-content: center !important;
    overflow: visible !important;
  }

  .card,
  .card[data-grade="1"],
  .card[data-grade="2"],
  .card[data-grade="3"],
  .card[data-grade="4"],
  .card[data-grade="5"],
  .card[data-grade="6"] {
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }
}

/* Final override, intentionally last: mobile battle layout follows title, actors, message, bottom stats. */
@media (max-width: 760px) {
  .battle-sky { min-height: 430px !important; }
  .battle-map-title { top: 10px !important; left: 50% !important; min-width: 132px !important; padding: 6px 16px !important; font-size: 13px !important; transform: translateX(-50%) !important; z-index: 6 !important; }
  .hero-hud, .monster-hud { top: auto !important; bottom: 10px !important; width: calc(50% - 16px) !important; min-height: 0 !important; border-radius: 6px !important; padding: 6px !important; background: rgba(6, 13, 22, 0.86) !important; box-shadow: 4px 4px 0 #070912 !important; backdrop-filter: none !important; text-align: left !important; z-index: 7 !important; }
  .hero-hud { left: 8px !important; }
  .monster-hud { right: 8px !important; }
  .battle-hud > div:first-child { display: grid !important; grid-template-columns: minmax(0, 1fr) auto !important; gap: 4px 6px !important; margin-bottom: 4px !important; }
  .battle-name { overflow: hidden !important; color: #dceaff !important; font-size: 10px !important; line-height: 1.1 !important; text-overflow: ellipsis !important; white-space: nowrap !important; }
  .battle-hud strong { grid-column: 2 !important; grid-row: 1 !important; align-self: center !important; color: #fff6d0 !important; font-size: 10px !important; line-height: 1 !important; }
  .battle-traits, .monster-hud .battle-traits { width: auto !important; margin: 0 !important; color: #9af1ff !important; font-size: 9px !important; line-height: 1 !important; text-align: left !important; white-space: nowrap !important; }
  .hp-track { height: 7px !important; border-width: 1px !important; border-radius: 2px !important; }
  .monster-charge-panel { margin-top: 4px !important; padding-top: 3px !important; }
  .monster-charge-head { margin-bottom: 2px !important; font-size: 8px !important; line-height: 1 !important; }
  .monster-charge-head strong { font-size: 9px !important; }
  .monster-charge-panel .pressure-track { height: 5px !important; }
  .fighter { bottom: 150px !important; width: 92px !important; height: 92px !important; }
  .pet-fighter { left: 6% !important; bottom: 158px !important; width: 72px !important; height: 72px !important; z-index: 2 !important; }
  .hero-fighter { left: 29% !important; z-index: 3 !important; }
  .monster-fighter { right: 8% !important; z-index: 4 !important; }
  .monster-fighter.boss { bottom: 145px !important; width: 112px !important; height: 112px !important; right: 5% !important; }
  .pet-battle-name { top: -16px !important; max-width: 90px !important; padding: 2px 5px !important; font-size: 8px !important; }
  .battle-status-row { left: 50% !important; right: auto !important; bottom: 94px !important; width: min(280px, calc(100% - 44px)) !important; transform: translateX(-50%) !important; z-index: 6 !important; }
  .battle-message { width: 100% !important; min-width: 0 !important; min-height: 34px !important; padding: 7px 10px !important; border-radius: 6px !important; font-size: 12px !important; line-height: 1.2 !important; }
  .monster-wave { top: auto !important; right: 8px !important; bottom: 76px !important; min-width: 66px !important; padding: 4px 6px !important; font-size: 10px !important; z-index: 7 !important; }
  .battle-rpg-panel { left: 8px !important; right: auto !important; bottom: 70px !important; width: calc(50% - 16px) !important; min-height: 0 !important; grid-template-columns: minmax(0, 1fr) 36px !important; gap: 4px 6px !important; padding: 5px !important; border-radius: 6px !important; box-shadow: 4px 4px 0 #070912 !important; z-index: 7 !important; }
  .rpg-line { gap: 4px !important; font-size: 9px !important; line-height: 1 !important; }
  .exp-track { height: 7px !important; margin: 2px 0 0 !important; }
  .profile-battle-button { min-width: 34px !important; min-height: 30px !important; padding: 3px !important; font-size: 9px !important; }
  .boss-challenge-button { right: 8px !important; bottom: 70px !important; width: calc(50% - 16px) !important; min-height: 36px !important; padding: 5px 7px !important; font-size: 10px !important; z-index: 7 !important; }
}

@media (max-width: 380px) {
  .fighter { width: 84px !important; height: 84px !important; }
  .pet-fighter { width: 64px !important; height: 64px !important; left: 5% !important; }
  .hero-fighter { left: 30% !important; }
  .monster-fighter { right: 6% !important; }
}

/* Final mobile battle cleanup: compact four-layer layout, no extra top air. */
@media (max-width: 760px) {
  .battle-sky {
    min-height: 330px !important;
  }

  .battle-map-title {
    top: 8px !important;
    left: 50% !important;
    min-width: 120px !important;
    padding: 5px 14px !important;
    font-size: 12px !important;
    transform: translateX(-50%) !important;
    z-index: 8 !important;
  }

  .battle-rpg-panel,
  .monster-wave,
  .boss-challenge-button {
    display: none !important;
  }

  .fighter {
    bottom: 118px !important;
    width: 86px !important;
    height: 86px !important;
  }

  .pet-fighter {
    left: 6% !important;
    bottom: 126px !important;
    width: 64px !important;
    height: 64px !important;
    z-index: 2 !important;
  }

  .hero-fighter {
    left: 30% !important;
    z-index: 3 !important;
  }

  .monster-fighter {
    right: 7% !important;
    z-index: 4 !important;
  }

  .monster-fighter.boss {
    bottom: 112px !important;
    width: 104px !important;
    height: 104px !important;
    right: 4% !important;
  }

  .pet-battle-name {
    top: -15px !important;
    max-width: 86px !important;
    padding: 2px 5px !important;
    font-size: 8px !important;
  }

  .battle-status-row {
    left: 50% !important;
    right: auto !important;
    bottom: 62px !important;
    width: min(260px, calc(100% - 42px)) !important;
    transform: translateX(-50%) !important;
    z-index: 7 !important;
  }

  .battle-message {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 30px !important;
    padding: 6px 9px !important;
    border-radius: 6px !important;
    font-size: 11px !important;
    line-height: 1.15 !important;
  }

  .hero-hud,
  .monster-hud {
    top: auto !important;
    bottom: 8px !important;
    width: calc(50% - 14px) !important;
    min-height: 0 !important;
    border-radius: 5px !important;
    padding: 5px !important;
    background: rgba(6, 13, 22, 0.88) !important;
    box-shadow: 3px 3px 0 #070912 !important;
    backdrop-filter: none !important;
    text-align: left !important;
    z-index: 8 !important;
  }

  .hero-hud {
    left: 7px !important;
  }

  .monster-hud {
    right: 7px !important;
  }

  .battle-hud > div:first-child {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    gap: 3px 5px !important;
    margin-bottom: 3px !important;
  }

  .battle-name {
    overflow: hidden !important;
    color: #dceaff !important;
    font-size: 9px !important;
    line-height: 1.05 !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  .battle-hud strong {
    grid-column: 2 !important;
    grid-row: 1 !important;
    align-self: center !important;
    color: #fff6d0 !important;
    font-size: 9px !important;
    line-height: 1 !important;
  }

  .battle-traits,
  .monster-hud .battle-traits {
    width: auto !important;
    margin: 0 !important;
    color: #9af1ff !important;
    font-size: 8px !important;
    line-height: 1 !important;
    text-align: left !important;
    white-space: nowrap !important;
  }

  .hp-track {
    height: 6px !important;
    border-width: 1px !important;
    border-radius: 2px !important;
  }

  .monster-charge-panel {
    margin-top: 3px !important;
    padding-top: 2px !important;
  }

  .monster-charge-head {
    margin-bottom: 2px !important;
    font-size: 7px !important;
    line-height: 1 !important;
  }

  .monster-charge-head strong {
    font-size: 8px !important;
  }

  .monster-charge-panel .pressure-track {
    height: 4px !important;
  }
}

@media (max-width: 380px) {
  .battle-sky {
    min-height: 316px !important;
  }

  .fighter {
    bottom: 112px !important;
    width: 78px !important;
    height: 78px !important;
  }

  .pet-fighter {
    left: 5% !important;
    bottom: 120px !important;
    width: 58px !important;
    height: 58px !important;
  }

  .hero-fighter {
    left: 31% !important;
  }

  .monster-fighter {
    right: 6% !important;
  }
}

/* Final mobile battle nudge: less top air, hero left, message higher. */
@media (max-width: 760px) {
  .battle-sky {
    min-height: 306px !important;
  }

  .battle-map-title {
    top: 7px !important;
  }

  .fighter {
    bottom: 130px !important;
    width: 84px !important;
    height: 84px !important;
  }

  .pet-fighter {
    bottom: 138px !important;
    left: 6% !important;
    width: 62px !important;
    height: 62px !important;
  }

  .hero-fighter {
    left: 24% !important;
  }

  .monster-fighter {
    right: 7% !important;
  }

  .battle-status-row {
    bottom: 76px !important;
  }
}

@media (max-width: 380px) {
  .battle-sky {
    min-height: 296px !important;
  }

  .fighter {
    bottom: 124px !important;
    width: 76px !important;
    height: 76px !important;
  }

  .pet-fighter {
    bottom: 132px !important;
    width: 56px !important;
    height: 56px !important;
  }

  .hero-fighter {
    left: 25% !important;
  }

  .battle-status-row {
    bottom: 72px !important;
  }
}

/* Final mobile vertical tightening: halve top air and lift battle message clear of bottom stats. */
@media (max-width: 760px) {
  .battle-map-title {
    top: 5px !important;
  }

  .fighter {
    bottom: 158px !important;
  }

  .pet-fighter {
    bottom: 166px !important;
  }

  .monster-fighter.boss {
    bottom: 154px !important;
  }

  .battle-status-row {
    bottom: 102px !important;
  }
}

@media (max-width: 380px) {
  .fighter {
    bottom: 150px !important;
  }

  .pet-fighter {
    bottom: 158px !important;
  }

  .battle-status-row {
    bottom: 96px !important;
  }
}

/* Final mobile battle layout: keep stats outside the map background. */
@media (max-width: 760px) {
  .battle-panel {
    padding-bottom: 78px !important;
  }

  .battle-sky {
    min-height: 250px !important;
    overflow: visible !important;
  }

  .battle-map-title {
    top: 8px !important;
  }

  .fighter {
    bottom: 58px !important;
    width: 86px !important;
    height: 86px !important;
  }

  .pet-fighter {
    left: 6% !important;
    bottom: 66px !important;
    width: 64px !important;
    height: 64px !important;
    z-index: 2 !important;
  }

  .hero-fighter {
    left: 25% !important;
    z-index: 3 !important;
  }

  .monster-fighter {
    right: 7% !important;
    z-index: 4 !important;
  }

  .monster-fighter.boss {
    bottom: 54px !important;
    width: 104px !important;
    height: 104px !important;
    right: 4% !important;
  }

  .battle-status-row {
    bottom: 14px !important;
    width: min(260px, calc(100% - 42px)) !important;
    z-index: 7 !important;
  }

  .hero-hud,
  .monster-hud {
    top: auto !important;
    bottom: -70px !important;
    width: calc(50% - 14px) !important;
    z-index: 9 !important;
  }

  .hero-hud {
    left: 7px !important;
  }

  .monster-hud {
    right: 7px !important;
  }
}

@media (max-width: 380px) {
  .battle-panel {
    padding-bottom: 74px !important;
  }

  .battle-sky {
    min-height: 238px !important;
  }

  .fighter {
    bottom: 54px !important;
    width: 78px !important;
    height: 78px !important;
  }

  .pet-fighter {
    bottom: 62px !important;
    width: 58px !important;
    height: 58px !important;
  }

  .hero-hud,
  .monster-hud {
    bottom: -66px !important;
  }
}

/* Final mobile battle refinement: flatter map and clearer bottom monster info. */
@media (max-width: 760px) {
  .battle-panel {
    padding-bottom: 86px !important;
  }

  .battle-sky {
    min-height: 220px !important;
  }

  .battle-map-title {
    top: 6px !important;
  }

  .fighter {
    bottom: 52px !important;
  }

  .pet-fighter {
    bottom: 60px !important;
  }

  .monster-fighter.boss {
    bottom: 48px !important;
  }

  .battle-status-row {
    bottom: 12px !important;
  }

  .hero-hud,
  .monster-hud {
    bottom: -78px !important;
    width: calc(50% - 18px) !important;
    padding: 6px !important;
  }

  .hero-hud {
    left: 8px !important;
  }

  .monster-hud {
    right: 8px !important;
  }

  .battle-hud > div:first-child {
    gap: 4px 6px !important;
    margin-bottom: 5px !important;
  }

  .battle-traits,
  .monster-hud .battle-traits {
    margin-bottom: 4px !important;
  }

  .hp-track {
    margin-top: 2px !important;
    margin-bottom: 3px !important;
  }

  .monster-charge-panel {
    margin-top: 6px !important;
    padding-top: 4px !important;
  }

  .monster-charge-head {
    margin-bottom: 4px !important;
  }
}

@media (max-width: 380px) {
  .battle-panel {
    padding-bottom: 82px !important;
  }

  .battle-sky {
    min-height: 210px !important;
  }

  .fighter {
    bottom: 48px !important;
  }

  .pet-fighter {
    bottom: 56px !important;
  }

  .hero-hud,
  .monster-hud {
    bottom: -74px !important;
  }
}

/* Final mobile stat placement: move bottom stat blocks down, do not make them taller. */
@media (max-width: 760px) {
  .battle-panel {
    padding-bottom: 104px !important;
  }

  .hero-hud,
  .monster-hud {
    bottom: -94px !important;
  }
}

@media (max-width: 380px) {
  .battle-panel {
    padding-bottom: 100px !important;
  }

  .hero-hud,
  .monster-hud {
    bottom: -90px !important;
  }
}

/* Hero bottom HUD detail: add level and EXP without stretching the block awkwardly. */
.hero-hud-progress {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  margin-top: 5px;
  padding-top: 4px;
}

.hero-hud-exp-line {
  color: #fff4d0;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
}

.hero-hud-exp-track {
  grid-column: 2;
  height: 6px;
  margin: 0;
}

@media (max-width: 760px) {
  .hero-hud-progress {
    gap: 5px !important;
    margin-top: 4px !important;
    padding-top: 3px !important;
  }

  .hero-hud-exp-line {
    font-size: 9px !important;
  }

  .hero-hud-exp-track {
    height: 6px !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
  }
}

/* Final hero HUD alignment: keep full name readable and match monster card height. */
@media (max-width: 760px) {
  .hero-hud > div:first-child {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    grid-template-rows: auto auto !important;
    gap: 2px 6px !important;
    margin-bottom: 3px !important;
  }

  .hero-hud .battle-name {
    grid-column: 1 !important;
    grid-row: 1 !important;
    min-width: 0 !important;
    max-width: none !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  .hero-hud .hero-traits {
    grid-column: 1 / span 2 !important;
    grid-row: 2 !important;
    margin: 0 !important;
  }

  .hero-hud #heroHpText {
    grid-column: 2 !important;
    grid-row: 1 !important;
    align-self: center !important;
    white-space: nowrap !important;
  }

  .hero-hud-progress {
    margin-top: 4px !important;
    padding-top: 3px !important;
  }

  .hero-hud-exp-track {
    height: 5px !important;
  }
}

/* Absolute final mobile HUD sizing: hero and monster cards must match the full monster card size. */
@media (max-width: 760px) {
  .hero-hud,
  .monster-hud {
    box-sizing: border-box !important;
    width: calc(50% - 14px) !important;
    height: 84px !important;
    min-height: 84px !important;
    max-height: 84px !important;
    padding: 5px !important;
    overflow: hidden !important;
  }

  .hero-hud > div:first-child,
  .monster-hud > div:first-child {
    margin-bottom: 3px !important;
  }

  .hero-hud .hp-track,
  .monster-hud .hp-track {
    height: 6px !important;
    margin: 2px 0 0 !important;
  }

  .hero-hud-progress {
    margin-top: 4px !important;
    padding-top: 3px !important;
  }

  .monster-charge-panel {
    display: block !important;
    margin-top: 4px !important;
    padding-top: 3px !important;
  }

  .monster-charge-head {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    margin-bottom: 2px !important;
  }

  .monster-charge-panel .pressure-track,
  .hero-hud-exp-track {
    height: 5px !important;
  }
}

/* Put hero EXP bar under the level text, matching monster charge layout. */
@media (max-width: 760px) {
  .hero-hud-progress {
    display: block !important;
    margin-top: 4px !important;
    padding-top: 3px !important;
  }

  .hero-hud-exp-line {
    display: block !important;
    margin-bottom: 2px !important;
  }

  .hero-hud-exp-track {
    display: block !important;
    width: 100% !important;
    height: 5px !important;
    margin: 0 !important;
  }
}

/* Final mobile top action layout: equal-size buttons in a stable two-column grid. */
@media (max-width: 760px) {
  .topbar {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: start !important;
    gap: 8px !important;
    min-height: 0 !important;
    padding: 8px !important;
    border-radius: 8px !important;
  }

  .brand-block {
    grid-column: 1 !important;
    min-width: 0 !important;
    padding-right: 72px !important;
  }

  .top-actions {
    grid-column: 1 / -1 !important;
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 7px !important;
    width: 100% !important;
    padding-right: 0 !important;
    align-items: stretch !important;
  }

  .top-actions .primary-button:not(.admin-top-button) {
    box-sizing: border-box !important;
    width: 100% !important;
    min-width: 0 !important;
    height: 42px !important;
    min-height: 42px !important;
    max-height: 42px !important;
    padding: 0 8px !important;
    border-radius: 6px !important;
    font-size: 12px !important;
    line-height: 1 !important;
    white-space: nowrap !important;
  }

  .admin-top-button {
    top: 8px !important;
    right: 8px !important;
    width: 58px !important;
    min-width: 58px !important;
    height: 34px !important;
    min-height: 34px !important;
    max-height: 34px !important;
    font-size: 12px !important;
  }
}

/* Home v3: mobile-RPG lobby hierarchy */
:root {
  --home-ink: #101b32;
  --home-line: #14213d;
  --home-blue: #2f7df2;
  --home-purple: #6851d9;
  --home-gold: #ffc24b;
  --home-cream: #fff8df;
}

.app-shell {
  padding-top: 14px;
}

.topbar {
  min-height: 72px;
  padding: 10px 14px;
  border-color: rgba(168, 210, 255, 0.42);
  background: linear-gradient(180deg, rgba(17, 34, 75, 0.84), rgba(9, 17, 39, 0.78));
  backdrop-filter: blur(14px);
}

.brand-block {
  gap: 11px;
}

.brand-mark {
  width: 46px;
  height: 46px;
  font-size: 24px;
}

.brand-block h1 {
  font-size: clamp(20px, 2.2vw, 30px);
  line-height: 1.1;
  text-shadow: 2px 2px 0 rgba(6, 12, 28, 0.58);
}

.brand-block .eyebrow {
  margin-bottom: 3px;
  color: #9feaff;
  font-size: 10px;
}

.home-statusbar {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: 9px;
  padding-right: 0;
}

.top-player-chip,
.sound-icon-button,
.settings-menu > summary {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  border: 2px solid rgba(228, 241, 255, 0.58);
  border-radius: 8px;
  color: #eff7ff;
  background: rgba(255, 255, 255, 0.14);
  box-shadow: 3px 3px 0 rgba(6, 12, 28, 0.82);
}

.top-player-chip {
  gap: 8px;
  padding: 4px 10px 4px 5px;
  font-weight: 900;
}

.top-player-chip img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  image-rendering: pixelated;
}

.top-player-chip span {
  font-size: 13px;
}

.top-player-chip strong {
  color: #ffdc73;
  font-size: 13px;
}

.sound-icon-button {
  justify-content: center;
  width: 44px;
  min-width: 44px;
  padding: 0;
  overflow: hidden;
  color: transparent !important;
  font-size: 0;
}

.sound-icon-button::before {
  content: "??";
  color: #f3fbff;
  font-size: 20px;
  line-height: 1;
}

.sound-icon-button.is-muted::before {
  content: "??";
  opacity: 0.82;
}

.settings-menu {
  position: relative;
}

.settings-menu > summary {
  gap: 5px;
  padding: 0 9px;
  cursor: pointer;
  list-style: none;
  font-size: 13px;
  font-weight: 900;
}

.settings-menu > summary::-webkit-details-marker {
  display: none;
}

.settings-menu > summary img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.settings-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 2300;
  display: grid;
  gap: 8px;
  width: min(260px, calc(100vw - 24px));
  padding: 12px;
  color: var(--home-ink);
  background: rgba(255, 248, 223, 0.98);
  border: 3px solid var(--home-line);
  border-radius: 8px;
  box-shadow: 6px 6px 0 rgba(6, 12, 28, 0.9), 0 18px 45px rgba(0, 0, 0, 0.3);
}

.settings-popover strong {
  font-size: 14px;
  font-weight: 900;
}

.settings-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 12px;
  color: #13203a;
  text-decoration: none;
  background: linear-gradient(180deg, #ffffff 0 50%, #dcecff 50% 100%);
  border: 2px solid var(--home-line);
  border-radius: 6px;
  box-shadow: 2px 2px 0 var(--home-line);
  font-size: 13px;
  font-weight: 900;
}

.settings-action.danger {
  background: linear-gradient(180deg, #fff1e0 0 50%, #ffb98c 50% 100%);
}

.home-v2 {
  grid-template-columns: minmax(300px, 0.86fr) minmax(420px, 1.14fr);
  min-height: min(610px, calc(100vh - 142px));
  margin-top: 12px;
}

.daily-quest-card {
  align-self: center;
  gap: 16px;
  color: var(--home-ink);
  background: rgba(255, 248, 223, 0.96);
  border-color: var(--home-line);
  box-shadow: 7px 7px 0 rgba(9, 16, 35, 0.94), 0 24px 58px rgba(0, 0, 0, 0.32);
}

.daily-quest-card h2 {
  color: #10244a;
  font-size: clamp(36px, 4.6vw, 62px);
  letter-spacing: 0;
  text-shadow: 2px 2px 0 #c8e6ff;
}

.daily-quest-card .eyebrow {
  color: #2e6fe6;
  font-size: 11px;
}

.daily-quest-lead {
  color: #3e5271;
  font-size: clamp(16px, 1.7vw, 20px);
}

.quest-reward img {
  width: 66px;
  height: 66px;
}

.quest-progress-block {
  background: linear-gradient(180deg, #142850, #0e1830);
  border-color: var(--home-line);
}

.home-round-progress {
  display: grid;
  gap: 8px;
}

.home-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #263a58;
  font-size: 13px;
  font-weight: 900;
}

.home-progress-head span {
  color: #2d6d9e;
}

.home-progress-track {
  height: 14px;
  overflow: hidden;
  background: #d7e5f5;
  border: 3px solid var(--home-line);
  border-radius: 999px;
  box-shadow: inset 2px 2px 0 rgba(10, 18, 38, 0.18);
}

.home-progress-track span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #58e38a, #c9ff70);
}

.home-round-progress p {
  margin: 0;
  color: #6a4511;
  font-size: 13px;
  font-weight: 900;
}

.daily-secondary-link {
  justify-self: center;
  color: #2f63c8;
  font-size: 14px;
  font-weight: 900;
  text-decoration: none;
}

.daily-secondary-link:hover {
  text-decoration: underline;
}

.home-v2-scene {
  min-height: 460px;
}

.home-v2-hero {
  width: min(286px, 48vw);
}

.home-v2-pet {
  right: 7%;
  width: 118px;
}

.home-v2-hub {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.home-v2-hub .hub-panel {
  display: grid;
  grid-template-columns: 1fr;
  align-content: start;
  min-height: 212px;
  padding: 14px;
  border-color: var(--home-line);
  box-shadow: 5px 5px 0 rgba(9, 16, 35, 0.94), 0 16px 38px rgba(0, 0, 0, 0.24);
}

.hub-panel-head > img {
  width: 56px;
  height: 56px;
}

.home-v2-hub .hub-panel h2 {
  margin-bottom: 3px;
  font-size: clamp(22px, 2.2vw, 30px);
  text-shadow: 2px 2px 0 rgba(5, 12, 28, 0.4);
}

.home-v2-hub .hub-action-grid {
  grid-template-columns: 1fr;
  gap: 8px;
}

.home-v2-hub .hub-action {
  min-height: 70px;
  padding: 9px;
  border-color: var(--home-line);
  box-shadow: 3px 3px 0 var(--home-line);
}

.hub-action > img {
  width: 44px;
  height: 44px;
}

.home-v2-hub .hub-action strong {
  font-size: 16px;
}

.home-v2-hub .hub-action small {
  font-size: 11px;
}

.module-tools {
  align-self: end;
}

.module-tools > summary {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  padding: 0 10px;
  color: #fff6c9;
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
}

.module-tools > div {
  display: grid;
  gap: 7px;
  margin-top: 6px;
}

.bottom-tabbar {
  width: min(440px, calc(100vw - 18px));
  min-height: 58px;
  padding: 5px;
  background: rgba(236, 246, 255, 0.88);
  border-color: var(--home-line);
  box-shadow: 5px 5px 0 rgba(9, 16, 35, 0.9), 0 16px 42px rgba(0, 0, 0, 0.3);
}

.tabbar-item {
  min-height: 48px;
  color: #233958;
  font-size: 11px;
}

.tabbar-item img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.tabbar-item.is-active,
.tabbar-item:focus-visible,
.tabbar-item:hover {
  color: #11203a;
  background: linear-gradient(180deg, #fff3a5 0 50%, #ffc24b 50% 100%);
}

@media (max-width: 1180px) {
  .home-v2-hub {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding-top: max(8px, env(safe-area-inset-top));
  }

  .topbar {
    grid-template-columns: minmax(0, 1fr) auto !important;
    min-height: 58px;
    padding: 8px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
    font-size: 20px;
  }

  .brand-block h1 {
    font-size: 18px;
  }

  .brand-block .eyebrow {
    display: none;
  }

  .top-player-chip span {
    display: none;
  }

  .top-player-chip {
    min-height: 38px;
    padding-right: 7px;
  }

  .top-player-chip img {
    width: 30px;
    height: 30px;
  }

  .sound-icon-button,
  .settings-menu > summary {
    min-height: 38px;
  }

  .settings-menu > summary span {
    display: none;
  }

  .home-v2 {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .daily-quest-card {
    padding: 14px;
  }

  .daily-quest-card h2 {
    font-size: clamp(30px, 9vw, 40px);
    line-height: 1.08;
  }

  .daily-quest-lead {
    font-size: 14px;
  }

  .quest-reward img {
    width: 50px;
    height: 50px;
  }

  .home-progress-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .home-v2-scene {
    min-height: 214px;
  }

  .home-v2-hero {
    width: min(184px, 54vw);
  }

  .home-v2-pet {
    width: 74px;
    right: 5%;
  }

  .home-v2-egg {
    width: 50px;
  }

  .home-v2-hub {
    gap: 9px;
  }

  .home-v2-hub .hub-panel {
    min-height: auto;
  }

  .bottom-tabbar {
    min-height: 58px;
  }

  .tabbar-item {
    min-height: 46px;
  }
}

/* Mobile battle corner actions inside the map. */
@media (max-width: 760px) {
  .mobile-battle-button {
    position: absolute !important;
    top: 12px !important;
    z-index: 9 !important;
    display: inline-grid !important;
    place-items: center !important;
    width: 58px !important;
    height: 30px !important;
    min-width: 58px !important;
    min-height: 30px !important;
    border: 3px solid #070912 !important;
    border-radius: 5px !important;
    color: #1a1208 !important;
    background: linear-gradient(180deg, #ffe98a 0 50%, #f5b33f 50% 100%) !important;
    box-shadow: 3px 3px 0 #070912 !important;
    font-size: 10px !important;
    font-weight: 900 !important;
    line-height: 1 !important;
    text-align: center !important;
    white-space: nowrap !important;
  }

  .mobile-profile-button {
    left: 12px !important;
  }

  .mobile-boss-button {
    right: 12px !important;
  }
}

/* Mobile battle top row: prevent corner actions from colliding with the map title. */
@media (max-width: 760px) {
  .battle-map-title {
    min-width: 92px !important;
    max-width: 82px !important;
    padding: 5px 8px !important;
    font-size: 11px !important;
  }

  .mobile-battle-button {
    top: 12px !important;
    width: 48px !important;
    min-width: 48px !important;
    height: 26px !important;
    min-height: 26px !important;
    border-width: 2px !important;
    border-radius: 4px !important;
    box-shadow: 2px 2px 0 #070912 !important;
    font-size: 8px !important;
    letter-spacing: 0 !important;
  }

  .mobile-profile-button {
    left: 8px !important;
  }

  .mobile-boss-button {
    right: 8px !important;
    font-size: 7px !important;
  }
}

/* Desktop battle layout mirrors mobile: map actions and actors stay in the scene, HUDs sit below. */
@media (min-width: 761px) {
  .battle-panel {
    padding: 8px 8px 118px !important;
  }

  .battle-sky {
    min-height: 292px !important;
    overflow: visible !important;
  }

  .battle-rpg-panel,
  .monster-wave,
  .boss-challenge-button {
    display: none !important;
  }

  .battle-map-title {
    top: 14px !important;
    left: 50% !important;
    min-width: 132px !important;
    max-width: 170px !important;
    padding: 7px 16px !important;
    font-size: 14px !important;
    transform: translateX(-50%) !important;
    z-index: 9 !important;
  }

  .mobile-battle-button {
    position: absolute !important;
    top: 18px !important;
    z-index: 9 !important;
    display: inline-grid !important;
    place-items: center !important;
    height: 34px !important;
    min-height: 34px !important;
    border: 3px solid #070912 !important;
    border-radius: 5px !important;
    color: #1a1208 !important;
    background: linear-gradient(180deg, #ffe98a 0 50%, #f5b33f 50% 100%) !important;
    box-shadow: 3px 3px 0 #070912 !important;
    font-size: 11px !important;
    font-weight: 900 !important;
    line-height: 1 !important;
    white-space: nowrap !important;
  }

  .mobile-profile-button {
    left: 18px !important;
    width: 78px !important;
    min-width: 78px !important;
  }

  .mobile-boss-button {
    right: 18px !important;
    width: 86px !important;
    min-width: 86px !important;
    font-size: 10px !important;
  }

  .fighter {
    bottom: 68px !important;
    width: 112px !important;
    height: 112px !important;
  }

  .pet-fighter {
    left: 19% !important;
    bottom: 78px !important;
    width: 88px !important;
    height: 88px !important;
    z-index: 2 !important;
  }

  .hero-fighter {
    left: 35% !important;
    z-index: 3 !important;
  }

  .monster-fighter {
    right: 19% !important;
    z-index: 4 !important;
  }

  .monster-fighter.boss {
    bottom: 60px !important;
    right: 16% !important;
    width: 132px !important;
    height: 132px !important;
  }

  .battle-status-row {
    left: 50% !important;
    right: auto !important;
    bottom: 26px !important;
    width: min(300px, calc(100% - 360px)) !important;
    transform: translateX(-50%) !important;
    z-index: 8 !important;
  }

  .battle-message {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 38px !important;
    padding: 9px 16px !important;
    border-radius: 6px !important;
    font-size: 13px !important;
    line-height: 1.2 !important;
  }

  .hero-hud,
  .monster-hud {
    top: auto !important;
    bottom: -106px !important;
    box-sizing: border-box !important;
    width: calc(50% - 22px) !important;
    height: 94px !important;
    min-height: 94px !important;
    max-height: 94px !important;
    padding: 9px !important;
    border-radius: 6px !important;
    background: rgba(6, 13, 22, 0.9) !important;
    box-shadow: 4px 4px 0 #070912 !important;
    backdrop-filter: none !important;
    overflow: hidden !important;
    text-align: left !important;
    z-index: 8 !important;
  }

  .hero-hud {
    left: 10px !important;
  }

  .monster-hud {
    right: 10px !important;
  }

  .battle-hud > div:first-child {
    margin-bottom: 5px !important;
  }

  .battle-name {
    overflow: hidden !important;
    color: #dceaff !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  .hero-hud .hp-track,
  .monster-hud .hp-track {
    height: 8px !important;
    margin: 4px 0 0 !important;
  }

  .hero-hud-progress,
  .monster-charge-panel {
    margin-top: 6px !important;
    padding-top: 5px !important;
  }

  .hero-hud-exp-track,
  .monster-charge-panel .pressure-track {
    height: 6px !important;
  }
}

/* Desktop battle HUD visibility fix: allow bottom panels to sit outside the scene image. */
@media (min-width: 761px) {
  .battle-sky {
    overflow: visible !important;
  }

  .hero-hud,
  .monster-hud {
    z-index: 20 !important;
  }
}

/* Desktop battle HUD full-height fix: show level, EXP and monster charge text completely. */
@media (min-width: 761px) {
  .battle-panel {
    padding-bottom: 146px !important;
  }

  .hero-hud,
  .monster-hud {
    bottom: -132px !important;
    height: 120px !important;
    min-height: 120px !important;
    max-height: 120px !important;
    overflow: visible !important;
  }
}

/* Desktop hero EXP layout: put the filled bar under Lv text and stretch it full width. */
@media (min-width: 761px) {
  .hero-hud-progress {
    display: block !important;
    margin-top: 6px !important;
    padding-top: 5px !important;
  }

  .hero-hud-exp-line {
    display: block !important;
    margin-bottom: 4px !important;
  }

  .hero-hud-exp-track {
    display: block !important;
    width: 100% !important;
    height: 8px !important;
    margin: 0 !important;
  }

  .hero-hud-exp-track .exp-fill {
    display: block !important;
    height: 100% !important;
  }
}

/* Battle pet size by evolution stage. */
@media (min-width: 761px) {
  .pet-fighter[data-pet-stage="1"] {
    width: 76px !important;
    height: 76px !important;
    bottom: 78px !important;
  }

  .pet-fighter[data-pet-stage="2"] {
    width: 132px !important;
    height: 132px !important;
    bottom: 58px !important;
  }

  .pet-fighter[data-pet-stage="3"] {
    width: 164px !important;
    height: 164px !important;
    bottom: 44px !important;
  }
}

@media (max-width: 760px) {
  .pet-fighter[data-pet-stage="1"] {
    width: 58px !important;
    height: 58px !important;
    bottom: 74px !important;
  }

  .pet-fighter[data-pet-stage="2"] {
    width: 82px !important;
    height: 82px !important;
    bottom: 62px !important;
  }

  .pet-fighter[data-pet-stage="2"] .pet-battle-name {
    top: -10px !important;
    max-width: 88px !important;
    z-index: 12 !important;
  }

  .pet-fighter[data-pet-stage="3"] {
    width: 84px !important;
    height: 84px !important;
    bottom: 62px !important;
  }

  .pet-fighter[data-pet-stage="3"] .pet-battle-name {
    top: -12px !important;
    max-width: 92px !important;
    z-index: 12 !important;
  }
}

/* Damage numbers: damage is red/orange; reserve green for future healing only. */
.damage-number,
.damage-number.hit,
.damage-number.combo,
.damage-number.pet,
.damage-number.danger {
  color: #ff5f6f !important;
  text-shadow:
    2px 2px 0 #3d0914,
    0 0 16px rgba(255, 79, 95, 0.78) !important;
}

.damage-number.combo {
  color: #ff9f45 !important;
  text-shadow:
    2px 2px 0 #4a1805,
    0 0 16px rgba(255, 159, 69, 0.78) !important;
}

.damage-number.heal {
  color: #7dff9d !important;
  text-shadow:
    2px 2px 0 #06351d,
    0 0 16px rgba(88, 245, 167, 0.78) !important;
}

/* Main first-run guide: mobile-game style spotlight tutorial. */
.main-guide.hidden {
  display: none;
}

.main-guide {
  position: fixed;
  inset: 0;
  z-index: 5000;
  pointer-events: none;
  font-family: "Noto Sans SC", "Inter", system-ui, sans-serif;
}

.main-guide-dim,
.main-guide-spotlight,
.main-guide-card,
.main-guide-arrow {
  position: fixed;
}

.main-guide-dim {
  z-index: 5000;
  background: rgba(2, 5, 14, 0.78);
  pointer-events: auto;
}

.main-guide-spotlight {
  z-index: 5001;
  border: 4px solid #ffef8a;
  border-radius: 12px;
  box-shadow:
    0 0 0 3px #c92828,
    0 0 24px rgba(255, 236, 132, 0.95),
    inset 0 0 20px rgba(255, 236, 132, 0.2);
  pointer-events: none;
  animation: guideSpotlightPulse 0.95s ease-in-out infinite alternate;
}

.main-guide-arrow {
  z-index: 5003;
  width: 34px;
  height: 34px;
  filter: drop-shadow(3px 3px 0 #070912);
  pointer-events: none;
}

.main-guide-arrow::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
  transform: translate(-50%, -50%);
  border-left: 17px solid transparent;
  border-right: 17px solid transparent;
}

.main-guide-arrow.up::before {
  border-bottom: 30px solid #ff3737;
}

.main-guide-arrow.down::before {
  border-top: 30px solid #ff3737;
}

.main-guide-card {
  z-index: 5004;
  box-sizing: border-box;
  padding: 16px;
  color: #1c1407;
  background:
    linear-gradient(180deg, #fff7d6 0 50%, #ffd876 50% 100%);
  border: 4px solid #070912;
  border-radius: 8px;
  box-shadow: 8px 8px 0 #070912, 0 12px 34px rgba(0, 0, 0, 0.36);
  pointer-events: auto;
}

.main-guide .main-guide-step {
  margin: 0 0 5px;
  color: #8c3a0d !important;
  font-size: 12px !important;
  font-weight: 900 !important;
  text-shadow: none !important;
}

.main-guide .main-guide-title {
  margin: 0 0 8px;
  color: #251707 !important;
  font-size: 20px !important;
  line-height: 1.15 !important;
  letter-spacing: 0 !important;
  text-shadow: none !important;
}

.main-guide .main-guide-text {
  margin: 0;
  color: #3d2910 !important;
  font-size: 14px !important;
  font-weight: 800 !important;
  line-height: 1.55 !important;
  text-shadow: none !important;
}

.main-guide-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

.main-guide-skip,
.main-guide-next {
  min-height: 34px;
  padding: 7px 12px;
  color: #120d05;
  font: inherit;
  font-size: 13px;
  font-weight: 900;
  border: 3px solid #070912;
  border-radius: 4px;
  box-shadow: 4px 4px 0 #070912;
  cursor: pointer;
}

.main-guide-skip {
  background: linear-gradient(180deg, #ffffff 0 50%, #d8e0ef 50% 100%);
}

.main-guide-next {
  color: #fff9d7;
  background: linear-gradient(180deg, #ff8a8a 0 50%, #ff4545 50% 100%);
}

.main-guide-next.waiting,
.main-guide-next:disabled {
  color: #fff5c5;
  background: linear-gradient(180deg, #b9a58d 0 50%, #806954 50% 100%);
  cursor: default;
  opacity: 0.92;
}

@keyframes guideSpotlightPulse {
  from {
    transform: scale(1);
  }
  to {
    transform: scale(1.015);
  }
}

@media (max-width: 760px) {
  .main-guide-card {
    padding: 13px;
    box-shadow: 5px 5px 0 #070912, 0 10px 28px rgba(0, 0, 0, 0.34);
  }

  .main-guide-title {
    font-size: 17px;
  }

  .main-guide-text {
    font-size: 13px;
    line-height: 1.45;
  }

  .main-guide-actions {
    gap: 8px;
  }

  .main-guide-skip,
  .main-guide-next {
    min-height: 32px;
    padding: 6px 10px;
    font-size: 12px;
  }
}

.main-guide-dim {
  background: rgba(28, 68, 112, 0.44) !important;
  backdrop-filter: blur(2px);
}

.main-guide-spotlight {
  border: 2px solid rgba(255, 222, 99, 0.95) !important;
  border-radius: 18px !important;
  box-shadow:
    0 0 0 3px rgba(255, 255, 255, 0.86),
    0 0 24px rgba(117, 179, 241, 0.72),
    inset 0 0 18px rgba(255, 255, 255, 0.34) !important;
}

.main-guide-arrow {
  width: 28px !important;
  height: 28px !important;
  filter: drop-shadow(0 4px 8px rgba(35, 92, 155, 0.24)) !important;
}

.main-guide-arrow.up::before {
  border-bottom-color: #6bb6ff !important;
}

.main-guide-arrow.down::before {
  border-top-color: #6bb6ff !important;
}

.main-guide-card {
  padding: 16px !important;
  border: 2px solid rgba(126, 177, 235, 0.95) !important;
  border-radius: 20px !important;
  color: #17345f !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(230, 247, 255, 0.92)) !important;
  box-shadow:
    0 18px 34px rgba(37, 92, 150, 0.24),
    inset 0 0 0 1px rgba(255, 255, 255, 0.92) !important;
}

.main-guide .main-guide-step {
  margin: 0 0 4px !important;
  color: #3b82d6 !important;
  font-size: 12px !important;
  font-weight: 900 !important;
  text-shadow: none !important;
}

.main-guide .main-guide-title {
  margin: 0 0 7px !important;
  color: #1f5ea9 !important;
  font-size: 21px !important;
  line-height: 1.16 !important;
  letter-spacing: 0 !important;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.9) !important;
}

.main-guide .main-guide-text {
  margin: 0 !important;
  color: #21476f !important;
  font-size: 15px !important;
  font-weight: 850 !important;
  line-height: 1.45 !important;
  text-shadow: none !important;
}

.main-guide-actions {
  gap: 10px !important;
  margin-top: 14px !important;
}

.main-guide-skip,
.main-guide-next {
  min-height: 36px !important;
  padding: 7px 14px !important;
  border: 2px solid rgba(96, 151, 216, 0.9) !important;
  border-radius: 12px !important;
  color: #1f5ea9 !important;
  font-size: 13px !important;
  font-weight: 900 !important;
  box-shadow: 0 5px 12px rgba(61, 116, 179, 0.16) !important;
}

.main-guide-skip {
  background: linear-gradient(180deg, #ffffff, #e7f4ff) !important;
}

.main-guide-next {
  border-color: rgba(242, 178, 68, 0.95) !important;
  color: #7a4b00 !important;
  background: linear-gradient(180deg, #fff4bf, #ffd66f) !important;
}

.main-guide-next.waiting,
.main-guide-next:disabled {
  border-color: rgba(142, 158, 178, 0.9) !important;
  color: #5e6d80 !important;
  background: linear-gradient(180deg, #f7fbff, #dbe8f4) !important;
}

@media (max-width: 760px) {
  .main-guide-card {
    padding: 13px !important;
    border-radius: 16px !important;
  }

  .main-guide .main-guide-title {
    font-size: 18px !important;
  }

  .main-guide .main-guide-text {
    font-size: 13px !important;
    line-height: 1.38 !important;
  }

  .main-guide-skip,
  .main-guide-next {
    min-height: 32px !important;
    padding: 6px 11px !important;
    font-size: 12px !important;
  }
}

/* Kid app shell first draft */
html {
  scroll-behavior: smooth;
}

body {
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
}

.kid-lobby,
.home-hub-grid,
.bottom-tabbar {
  font-family: "Inter", "Noto Sans SC", system-ui, sans-serif;
}

.kid-lobby {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.92fr);
  gap: 18px;
  margin-top: 16px;
  padding: 22px;
  color: #122033;
  background:
    linear-gradient(135deg, rgba(255, 248, 214, 0.96), rgba(216, 245, 255, 0.94) 46%, rgba(227, 255, 230, 0.94));
  border: 4px solid #070912;
  border-radius: 8px;
  box-shadow: 8px 8px 0 #070912, 0 24px 70px rgba(0, 0, 0, 0.32);
}

.lobby-copy {
  min-width: 0;
  align-self: center;
}

.kid-lobby .eyebrow,
.home-hub-grid .eyebrow {
  color: #17647a;
}

.kid-lobby h2 {
  max-width: 620px;
  margin: 0 0 10px;
  color: #111d2c;
  font-size: clamp(30px, 5vw, 58px);
  line-height: 1.04;
}

.lobby-lead {
  max-width: 560px;
  margin: 0;
  color: #42546a;
  font-size: clamp(16px, 2.2vw, 22px);
  font-weight: 800;
  line-height: 1.5;
}

.lobby-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}

.lobby-main-action,
.lobby-soft-action,
.hub-action {
  text-decoration: none;
}

.lobby-main-action,
.lobby-soft-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 22px;
  border: 3px solid #070912;
  border-radius: 6px;
  font-weight: 900;
  box-shadow: 4px 4px 0 #070912;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.lobby-main-action {
  color: #fffbea;
  background: linear-gradient(180deg, #ff8f6b 0 50%, #e6484c 50% 100%);
}

.lobby-soft-action {
  color: #142236;
  background: linear-gradient(180deg, #ffffff 0 50%, #bceeff 50% 100%);
}

.lobby-main-action:hover,
.lobby-soft-action:hover,
.hub-action:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 #070912;
}

.lobby-hero-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-self: stretch;
}

.quest-card {
  display: grid;
  align-content: center;
  min-height: 132px;
  padding: 14px;
  color: #142236;
  background: rgba(255, 255, 255, 0.78);
  border: 3px solid #070912;
  border-radius: 8px;
  box-shadow: 4px 4px 0 rgba(7, 9, 18, 0.88);
}

.quest-card.is-active {
  background: linear-gradient(180deg, #fff3a5 0 50%, #ffd15c 50% 100%);
}

.quest-icon {
  display: inline-grid;
  place-items: center;
  width: 46px;
  height: 38px;
  margin-bottom: 10px;
  color: #070912;
  background: #ffffff;
  border: 3px solid #070912;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 900;
}

.quest-card strong {
  font-size: 20px;
  font-weight: 900;
}

.quest-card small {
  margin-top: 4px;
  color: #4a5c70;
  font-size: 13px;
  font-weight: 800;
}

.home-hub-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(260px, 0.85fr);
  gap: 16px;
  margin-top: 16px;
}

.hub-panel {
  display: grid;
  gap: 14px;
  min-width: 0;
  padding: 18px;
  color: #132033;
  background: rgba(247, 251, 255, 0.92);
  border: 4px solid #070912;
  border-radius: 8px;
  box-shadow: 6px 6px 0 #070912, 0 18px 50px rgba(0, 0, 0, 0.22);
}

.training-panel {
  grid-row: span 2;
}

.adventure-panel {
  background: linear-gradient(180deg, #f6fbff 0 50%, #d9efff 50% 100%);
}

.garden-panel {
  background: linear-gradient(180deg, #fffdf0 0 50%, #ddffe1 50% 100%);
}

.hub-panel h2 {
  margin: 0 0 6px;
  color: #142236;
  font-size: clamp(24px, 3vw, 38px);
}

.hub-panel p {
  margin: 0;
  color: #506176;
  font-weight: 800;
  line-height: 1.45;
}

.hub-action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.hub-action {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 12px;
  align-items: center;
  min-height: 86px;
  padding: 13px;
  color: #172235;
  background: #ffffff;
  border: 3px solid #070912;
  border-radius: 8px;
  box-shadow: 4px 4px 0 #070912;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.hub-action.wide {
  grid-template-columns: auto minmax(0, 1fr);
}

.hub-action span {
  grid-row: 1 / span 2;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  color: #070912;
  background: linear-gradient(180deg, #fff4a8 0 50%, #ffbd66 50% 100%);
  border: 3px solid #070912;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 900;
}

.hub-action strong {
  overflow-wrap: anywhere;
  font-size: 18px;
  font-weight: 900;
}

.hub-action small {
  color: #617084;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.bottom-tabbar {
  position: fixed;
  left: 50%;
  bottom: max(10px, env(safe-area-inset-bottom));
  z-index: 2100;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  width: min(520px, calc(100vw - 18px));
  padding: 7px;
  background: rgba(255, 255, 255, 0.94);
  border: 3px solid #070912;
  border-radius: 8px;
  box-shadow: 6px 6px 0 #070912, 0 18px 48px rgba(0, 0, 0, 0.34);
  transform: translateX(-50%);
}

.tabbar-item {
  display: grid;
  place-items: center;
  gap: 3px;
  min-height: 54px;
  color: #26364a;
  text-decoration: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 900;
}

.tabbar-item span {
  font-size: 18px;
  line-height: 1;
}

.tabbar-item.is-active,
.tabbar-item:focus-visible,
.tabbar-item:hover {
  color: #091422;
  background: linear-gradient(180deg, #fff3a5 0 50%, #ffc95b 50% 100%);
  outline: none;
}

@media (max-width: 1080px) {
  .kid-lobby,
  .home-hub-grid {
    grid-template-columns: 1fr;
  }

  .training-panel {
    grid-row: auto;
  }
}

@media (max-width: 760px) {
  body {
    padding-bottom: calc(82px + env(safe-area-inset-bottom));
  }

  .kid-lobby {
    margin-top: 10px;
    padding: 14px;
    gap: 14px;
  }

  .kid-lobby h2 {
    font-size: clamp(28px, 9vw, 40px);
  }

  .lobby-lead {
    font-size: 15px;
  }

  .lobby-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .lobby-main-action,
  .lobby-soft-action {
    min-height: 46px;
    padding: 0 12px;
    font-size: 14px;
  }

  .lobby-hero-panel {
    gap: 8px;
  }

  .quest-card {
    min-height: 108px;
    padding: 10px;
  }

  .quest-icon {
    width: 38px;
    height: 32px;
    margin-bottom: 7px;
    font-size: 13px;
  }

  .quest-card strong {
    font-size: 16px;
  }

  .quest-card small {
    font-size: 11px;
  }

  .home-hub-grid {
    gap: 10px;
    margin-top: 10px;
  }

  .hub-panel {
    padding: 13px;
  }

  .hub-action-grid {
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .hub-action {
    min-height: 74px;
    padding: 10px;
  }

  .hub-action span {
    width: 42px;
    height: 42px;
  }

  .hub-action strong {
    font-size: 16px;
  }

  .bottom-tabbar {
    width: calc(100vw - 14px);
    min-height: 68px;
    padding: 6px;
  }

  .tabbar-item {
    min-height: 52px;
  }
}

/* Home v2: single core quest, existing project art, compact secondary modules */
body {
  background:
    linear-gradient(180deg, rgba(7, 13, 31, 0.1), rgba(7, 13, 31, 0.78)),
    url("assets/ui/cloud-kingdom-game-bg.png") center top / cover fixed no-repeat,
    #08111f;
}

.topbar {
  overflow: visible;
  background: rgba(8, 16, 34, 0.72);
  border: 3px solid rgba(224, 238, 255, 0.22);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.34);
}

.brand-mark {
  border: 3px solid #070912;
  border-radius: 8px;
  background: linear-gradient(180deg, #eaf6ff 0 50%, #8bd7ff 50% 100%);
  box-shadow: 4px 4px 0 #070912;
}

.top-actions {
  flex-wrap: wrap;
}

.home-v2 {
  position: relative;
  grid-template-columns: minmax(320px, 0.92fr) minmax(360px, 1.08fr);
  min-height: min(620px, calc(100vh - 160px));
  overflow: hidden;
  padding: clamp(18px, 3vw, 34px);
  color: #f7fbff;
  background:
    linear-gradient(180deg, rgba(51, 128, 224, 0.15), rgba(8, 14, 34, 0.76)),
    url("assets/ui/cloud-kingdom-game-bg.png") center bottom / cover no-repeat;
  border: 4px solid #070912;
  box-shadow: 10px 10px 0 #070912, 0 28px 80px rgba(0, 0, 0, 0.46);
}

.home-v2::after {
  position: absolute;
  inset: auto 0 0;
  height: 44%;
  content: "";
  background: linear-gradient(180deg, transparent, rgba(8, 14, 34, 0.68));
  pointer-events: none;
}

.home-v2-scene,
.daily-quest-card {
  position: relative;
  z-index: 1;
}

.home-v2-scene {
  min-height: 490px;
  align-self: end;
}

.home-v2-hero {
  position: absolute;
  left: 50%;
  bottom: 16px;
  width: min(300px, 58vw);
  max-height: 58vh;
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(0 18px 12px rgba(0, 0, 0, 0.42));
  transform: translateX(-50%);
}

.home-v2-egg,
.home-v2-pet {
  position: absolute;
  object-fit: contain;
  image-rendering: pixelated;
  filter: drop-shadow(0 10px 8px rgba(0, 0, 0, 0.34));
}

.home-v2-egg {
  width: 82px;
  padding: 7px;
  background: rgba(255, 255, 255, 0.88);
  border: 3px solid #070912;
  border-radius: 8px;
  box-shadow: 4px 4px 0 #070912;
}

.egg-one {
  left: 5%;
  bottom: 98px;
}

.egg-two {
  right: 6%;
  bottom: 126px;
}

.home-v2-pet {
  right: 9%;
  bottom: 22px;
  width: 122px;
}

.daily-quest-card {
  align-self: center;
  display: grid;
  gap: 15px;
  max-width: 520px;
  padding: clamp(18px, 2.6vw, 28px);
  color: #151f31;
  background: rgba(255, 255, 255, 0.94);
  border: 4px solid #070912;
  border-radius: 8px;
  box-shadow: 8px 8px 0 #070912, 0 22px 54px rgba(0, 0, 0, 0.28);
}

.quest-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.daily-quest-card .eyebrow {
  color: #2c62c7;
}

.daily-quest-card h2 {
  margin: 0;
  color: #121a2a;
  font-size: clamp(34px, 5.4vw, 58px);
  line-height: 1.02;
}

.quest-reward {
  display: grid;
  justify-items: center;
  gap: 3px;
  min-width: 76px;
  color: #6a3b05;
  font-size: 12px;
  font-weight: 900;
}

.quest-reward img {
  width: 58px;
  height: 58px;
  object-fit: contain;
}

.daily-quest-lead {
  margin: 0;
  color: #4b5e78;
  font-size: clamp(15px, 2vw, 20px);
  font-weight: 900;
  line-height: 1.42;
}

.quest-week-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 7px;
}

.quest-week-row span {
  display: grid;
  place-items: center;
  height: 34px;
  color: #5d6f86;
  background: #e8edf5;
  border: 3px solid #070912;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 900;
  box-shadow: 2px 2px 0 #070912;
}

.quest-week-row .done {
  color: #0c4928;
  background: linear-gradient(180deg, #eaffb7 0 50%, #8eea89 50% 100%);
}

.quest-week-row .today {
  color: #3d2300;
  background: linear-gradient(180deg, #fff4a8 0 50%, #ffbf58 50% 100%);
}

.quest-progress-block {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px;
  background: #111827;
  border: 3px solid #070912;
  border-radius: 8px;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.07);
}

.quest-progress-block strong,
.quest-progress-block small {
  display: block;
}

.quest-progress-block strong {
  color: #fff5bd;
  font-size: 14px;
  font-weight: 900;
}

.quest-progress-block small {
  margin-top: 3px;
  color: #d8e6ff;
  font-size: 13px;
  font-weight: 800;
}

.quest-percent {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  color: #112033;
  background:
    radial-gradient(circle at center, #ffffff 0 48%, transparent 50%),
    conic-gradient(#78ef9b 0 39%, #4e5b70 39% 100%);
  border: 3px solid #070912;
  border-radius: 50%;
  font-size: 15px;
  font-weight: 900;
}

.daily-main-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 64px;
  color: #2b1700;
  text-decoration: none;
  background: linear-gradient(180deg, #fff0a0 0 50%, #ffb13e 50% 100%);
  border: 4px solid #070912;
  border-radius: 8px;
  box-shadow: 6px 6px 0 #070912;
  font-size: clamp(19px, 2.4vw, 25px);
  font-weight: 900;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.daily-main-button:hover {
  transform: translate(-2px, -2px);
  box-shadow: 8px 8px 0 #070912;
}

.daily-main-button img {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.home-v2-hub {
  grid-template-columns: minmax(0, 1fr);
}

.home-v2-hub .hub-panel {
  grid-template-columns: minmax(240px, 0.42fr) minmax(0, 0.58fr);
  align-items: center;
  min-height: 156px;
  color: #f5f9ff;
  background: rgba(10, 18, 38, 0.78);
  border-color: #070912;
}

.home-v2-hub .hub-panel h2,
.home-v2-hub .hub-panel p {
  color: inherit;
}

.home-v2-hub .hub-panel p:not(.eyebrow) {
  color: rgba(229, 242, 255, 0.82);
}

.hub-panel-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.hub-panel-head > img {
  flex: 0 0 auto;
  width: 76px;
  height: 76px;
  object-fit: contain;
  filter: drop-shadow(0 8px 8px rgba(0, 0, 0, 0.24));
}

.home-v2-hub .hub-action {
  grid-template-columns: auto minmax(0, 1fr);
  color: #152033;
}

.hub-action > img {
  grid-row: 1 / span 2;
  width: 56px;
  height: 56px;
  object-fit: contain;
}

.home-v2-hub .training-panel {
  background:
    linear-gradient(90deg, rgba(37, 87, 189, 0.92), rgba(21, 34, 75, 0.82)),
    rgba(10, 18, 38, 0.78);
}

.home-v2-hub .adventure-panel {
  background:
    linear-gradient(90deg, rgba(108, 63, 191, 0.9), rgba(21, 34, 75, 0.82)),
    rgba(10, 18, 38, 0.78);
}

.home-v2-hub .garden-panel {
  background:
    linear-gradient(90deg, rgba(42, 137, 103, 0.9), rgba(21, 34, 75, 0.82)),
    rgba(10, 18, 38, 0.78);
}

@media (max-width: 1080px) {
  .home-v2 {
    grid-template-columns: 1fr;
  }

  .home-v2-scene {
    order: 2;
    min-height: 320px;
  }

  .daily-quest-card {
    order: 1;
    max-width: none;
  }

  .home-v2-hub .hub-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .topbar {
    border-width: 3px;
  }

  .home-v2 {
    min-height: auto;
    padding: 12px;
  }

  .daily-quest-card {
    gap: 12px;
    padding: 15px;
  }

  .daily-quest-card h2 {
    font-size: clamp(32px, 11vw, 46px);
  }

  .quest-reward {
    min-width: 58px;
  }

  .quest-reward img {
    width: 48px;
    height: 48px;
  }

  .quest-week-row {
    gap: 5px;
  }

  .quest-week-row span {
    height: 30px;
    border-width: 2px;
    font-size: 11px;
  }

  .quest-progress-block {
    padding: 10px;
  }

  .quest-percent {
    width: 54px;
    height: 54px;
    font-size: 13px;
  }

  .daily-main-button {
    min-height: 58px;
  }

  .home-v2-scene {
    min-height: 250px;
  }

  .home-v2-hero {
    width: min(210px, 62vw);
  }

  .home-v2-egg {
    width: 58px;
  }

  .home-v2-pet {
    width: 86px;
  }

  .egg-one {
    left: 2%;
    bottom: 62px;
  }

  .egg-two {
    right: 2%;
    bottom: 78px;
  }

  .home-v2-hub .hub-panel {
    min-height: auto;
    gap: 10px;
    padding: 12px;
  }

  .hub-panel-head > img {
    width: 58px;
    height: 58px;
  }

  .hub-action > img {
    width: 46px;
    height: 46px;
  }
}

/* Adventure UI v1: scoped layout for the match adventure page. */
html:has(body.adventure-rpg-page) {
  height: 100%;
  overflow: hidden;
}

.adventure-rpg-page {
  height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
  color: #16345f;
  background: linear-gradient(180deg, rgba(232, 247, 255, 0.86), rgba(247, 252, 255, 0.94)),
    url("assets/ui/cloud-kingdom-game-bg.png") center bottom / cover no-repeat fixed;
  font-family: "Noto Sans SC", "Inter", system-ui, sans-serif;
}

.adventure-rpg-page *,
.adventure-rpg-page *::before,
.adventure-rpg-page *::after {
  box-sizing: border-box;
  text-shadow: none !important;
}

.adventure-shell {
  --adventure-border: rgba(73, 129, 199, 0.72);
  --adventure-panel: rgba(248, 253, 255, 0.94);
  display: grid;
  grid-template-rows: minmax(58px, 8fr) minmax(56px, 8fr) minmax(0, 4fr) minmax(160px, 25fr) minmax(260px, 42fr) minmax(44px, 5fr);
  gap: 6px;
  width: min(1240px, calc(100vw - 18px));
  height: calc(100dvh - 86px - env(safe-area-inset-bottom));
  min-height: 680px;
  margin: 0 auto;
  padding-top: 8px;
}

.adventure-topbar,
.adventure-controlbar,
.adventure-pressurebar,
.adventure-battle-panel,
.adventure-card-area,
.adventure-rewardbar {
  min-width: 0;
  border: 2px solid var(--adventure-border);
  border-radius: 8px;
  background: linear-gradient(180deg, var(--adventure-panel), rgba(226, 244, 255, 0.92));
  box-shadow: 0 7px 18px rgba(54, 112, 170, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

.adventure-topbar {
  display: grid;
  grid-template-columns: auto minmax(160px, 1fr) auto auto auto;
  gap: 12px;
  align-items: center;
  padding: 8px 12px;
}

.adventure-back-button,
.adventure-icon-button,
.adventure-help-button,
.adventure-settings summary {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  color: #153765;
  border: 1.5px solid rgba(73, 129, 199, 0.72);
  border-radius: 8px;
  background: linear-gradient(180deg, #fff, #d9efff);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95);
  font-size: 24px;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
}

.adventure-title-block p,
.adventure-title-block h1 {
  margin: 0;
}

.adventure-title-block p {
  color: #5e8bc3;
  font-size: 11px;
  font-weight: 900;
}

.adventure-title-block h1 {
  color: #102b58;
  font-size: clamp(22px, 2.8vw, 32px);
  line-height: 1.1;
}

.adventure-hero-chip,
.adventure-resource-row,
.adventure-top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.adventure-hero-chip {
  min-width: 148px;
  padding: 5px 10px 5px 6px;
  border: 1.5px solid rgba(73, 129, 199, 0.48);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
}

.adventure-hero-chip img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.adventure-hero-chip span,
.adventure-hero-chip strong,
.adventure-resource-row span {
  color: #17345f;
  font-size: 14px;
  font-weight: 900;
}

.adventure-resource-row span {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 78px;
}

.adventure-resource-row img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.adventure-icon-button {
  overflow: hidden;
  color: transparent;
  font-size: 0;
}

.adventure-icon-button::before {
  content: "??";
  color: #234a7d;
  font-size: 22px;
}

.adventure-icon-button.is-muted::before {
  content: "??";
}

.adventure-settings,
.adventure-more-menu,
.adventure-reward-details {
  position: relative;
}

.adventure-settings summary,
.adventure-more-menu summary,
.adventure-reward-details summary {
  list-style: none;
}

.adventure-settings summary::-webkit-details-marker,
.adventure-more-menu summary::-webkit-details-marker,
.adventure-reward-details summary::-webkit-details-marker {
  display: none;
}

.adventure-settings summary img {
  width: 25px;
  height: 25px;
  object-fit: contain;
}

.adventure-settings-menu,
.adventure-more-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 50;
  display: grid;
  gap: 8px;
  width: min(360px, calc(100vw - 28px));
  max-height: min(68vh, 540px);
  overflow: auto;
  padding: 12px;
  border: 2px solid rgba(73, 129, 199, 0.78);
  border-radius: 10px;
  background: #f8fdff;
  box-shadow: 0 16px 30px rgba(35, 85, 142, 0.22);
}

.adventure-controlbar {
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(138px, 0.38fr) minmax(116px, 0.28fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 8px 12px;
}

.adventure-control-field,
.adventure-control-button,
.adventure-more-menu summary {
  min-width: 0;
  min-height: 42px;
  padding: 7px 12px;
  color: #17345f;
  border: 1.5px solid rgba(73, 129, 199, 0.56);
  border-radius: 8px;
  background: linear-gradient(180deg, #fff, #deefff);
}

.adventure-control-field span,
.adventure-control-button span {
  display: block;
  color: #4d7ab4;
  font-size: 11px;
  font-weight: 900;
}

.adventure-control-field strong,
.adventure-control-button strong {
  display: block;
  overflow: hidden;
  color: #102b58;
  font-size: 14px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.adventure-control-field small {
  display: block;
  overflow: hidden;
  color: #607a9e;
  font-size: 11px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.adventure-control-button,
.adventure-more-menu summary,
.adventure-help-button {
  cursor: pointer;
}

.adventure-more-menu summary {
  display: grid;
  place-items: center;
  min-width: 90px;
  font-weight: 900;
}

.adventure-more-panel .deck-list {
  max-height: 260px;
  overflow: auto;
}

.hidden-count {
  display: none;
}

.upload-inline {
  display: grid;
  place-items: center;
}

.adventure-pressurebar {
  display: grid;
  grid-template-columns: minmax(170px, auto) minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 7px 14px;
}

.adventure-pressurebar.no-pressure {
  display: none !important;
}

.adventure-shell:has(.adventure-pressurebar.no-pressure) {
  grid-template-rows: minmax(58px, 8fr) minmax(56px, 8fr) minmax(172px, 27fr) minmax(300px, 52fr) minmax(44px, 5fr);
}

.adventure-pressurebar .monster-charge-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: #17345f;
  font-size: 14px;
  font-weight: 900;
}

.adventure-pressurebar .pressure-track {
  height: 12px;
  overflow: hidden;
  border: 1.5px solid rgba(73, 129, 199, 0.56);
  border-radius: 999px;
  background: #cfdfef;
}

.adventure-pressurebar .pressure-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #33c6ff, #5cedb0);
}

.adventure-pressurebar.danger .pressure-track span {
  background: linear-gradient(90deg, #ffc44d, #ff8f54);
  animation: adventureSoftPulse 0.55s ease-in-out infinite alternate;
}

.adventure-battle-panel {
  min-height: 0;
  overflow: hidden;
  padding: 0 !important;
}

.adventure-rpg-page .battle-sky {
  min-height: 0 !important;
  height: 100% !important;
  overflow: hidden !important;
  border: 0 !important;
  border-radius: 6px !important;
  box-shadow: none !important;
}

.adventure-rpg-page .battle-hud {
  top: auto !important;
  bottom: clamp(94px, 13vh, 132px) !important;
  width: min(250px, 30%) !important;
  min-height: 0 !important;
  padding: 6px 8px !important;
  color: #17345f !important;
  border: 1.5px solid rgba(73, 129, 199, 0.62) !important;
  border-radius: 8px !important;
  background: rgba(248, 253, 255, 0.74) !important;
  box-shadow: 0 5px 12px rgba(45, 95, 150, 0.12) !important;
}

.adventure-rpg-page .hero-hud {
  left: 11% !important;
  right: auto !important;
}

.adventure-rpg-page .monster-hud {
  left: auto !important;
  right: 10% !important;
  text-align: right !important;
}

.adventure-rpg-page .battle-name,
.adventure-rpg-page .battle-hud strong,
.adventure-rpg-page .battle-traits,
.adventure-rpg-page .monster-hud .battle-traits {
  color: #16345f !important;
  font-size: 11px !important;
}

.adventure-rpg-page .battle-hud > div:first-child {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  gap: 2px 6px !important;
  margin-bottom: 4px !important;
}

.adventure-rpg-page .battle-traits,
.adventure-rpg-page .monster-hud .battle-traits {
  grid-column: 1 / -1 !important;
  opacity: 0.78 !important;
}

.adventure-rpg-page .fighter {
  bottom: 20px !important;
  width: clamp(86px, 11vw, 132px) !important;
  height: clamp(86px, 11vw, 132px) !important;
}

.adventure-rpg-page .hero-fighter {
  left: 15% !important;
}

.adventure-rpg-page .pet-fighter {
  left: 27% !important;
  bottom: 26px !important;
  width: clamp(62px, 7vw, 88px) !important;
  height: clamp(62px, 7vw, 88px) !important;
}

.adventure-rpg-page .monster-fighter {
  right: 16% !important;
}

.adventure-rpg-page .battle-map-title {
  top: 10px !important;
  left: 50% !important;
  bottom: auto !important;
  padding: 5px 14px !important;
  color: #17345f !important;
  border: 1.5px solid rgba(73, 129, 199, 0.56) !important;
  border-radius: 999px !important;
  background: rgba(248, 253, 255, 0.78) !important;
  box-shadow: none !important;
  transform: translateX(-50%) !important;
}

.adventure-rpg-page .battle-status-row {
  display: none !important;
}

.adventure-rpg-page .battle-message {
  width: 100% !important;
  min-width: 0 !important;
  min-height: 34px !important;
  padding: 8px 12px !important;
  color: #17345f !important;
  border: 1.5px solid rgba(73, 129, 199, 0.5) !important;
  border-radius: 999px !important;
  background: rgba(248, 253, 255, 0.84) !important;
  box-shadow: none !important;
  font-size: 13px !important;
}

.adventure-rpg-page .battle-rpg-panel,
.adventure-rpg-page .boss-challenge-button,
.adventure-rpg-page .mobile-battle-button {
  display: none !important;
}

.adventure-card-area {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  padding: 10px 14px 12px;
}

.adventure-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
}

.adventure-card-head p,
.adventure-card-head h2 {
  margin: 0;
}

.adventure-card-head p {
  color: #5e8bc3;
  font-size: 11px;
  font-weight: 900;
}

.adventure-card-head h2 {
  color: #102b58;
  font-size: 20px;
  line-height: 1.1;
}

.adventure-card-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.adventure-card-stats span {
  padding: 4px 8px;
  color: #355d8e;
  border: 1px solid rgba(73, 129, 199, 0.36);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
  font-size: 12px;
  font-weight: 900;
}

.adventure-rpg-page .board-wrap {
  display: grid !important;
  min-height: 0 !important;
  height: 100% !important;
  margin: 0 !important;
  padding: 8px !important;
  overflow: hidden !important;
  border: 0 !important;
  border-radius: 8px !important;
  background: rgba(241, 249, 255, 0.78) !important;
  box-shadow: inset 0 0 0 1px rgba(73, 129, 199, 0.18) !important;
}

.adventure-rpg-page .board,
.adventure-rpg-page .board[data-grade] {
  display: grid !important;
  grid-template-columns: repeat(var(--match-columns, 4), minmax(0, 1fr)) !important;
  grid-auto-rows: var(--match-card-height, 72px) !important;
  gap: var(--match-gap, 10px) !important;
  align-content: start !important;
  align-items: stretch !important;
  justify-content: stretch !important;
  min-height: 0 !important;
  height: auto !important;
  margin: 0 !important;
  overflow: hidden !important;
}

.adventure-rpg-page .card {
  display: grid !important;
  place-items: center !important;
  min-height: 0 !important;
  height: var(--match-card-height, 72px) !important;
  padding: 6px 10px !important;
  color: #102b58 !important;
  border: 2px solid rgba(65, 122, 194, 0.74) !important;
  border-radius: 8px !important;
  background: linear-gradient(180deg, #fff, #eef8ff) !important;
  box-shadow: 0 4px 0 rgba(92, 137, 190, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.95) !important;
  font-size: var(--match-font-size, 18px) !important;
  font-weight: 900 !important;
}

.adventure-rpg-page .card::before,
.adventure-rpg-page .card::after {
  display: none !important;
}

.adventure-rpg-page .card.selected {
  border-color: #f2bd3d !important;
  background: linear-gradient(180deg, #fff8bf, #ffe278) !important;
  transform: translateY(-2px);
}

.adventure-rpg-page .card.mismatch {
  border-color: #ff8e70 !important;
  background: linear-gradient(180deg, #fff5f1, #ffd7ca) !important;
}

.adventure-rpg-page .card.matched {
  opacity: 0;
  pointer-events: none;
}

.adventure-rpg-page .card-text {
  display: block !important;
  max-width: 100% !important;
  overflow-wrap: anywhere !important;
  color: inherit !important;
  font-size: inherit !important;
  line-height: 1.12 !important;
  text-align: center !important;
}

.adventure-rewardbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 14px;
}

.adventure-reward-left,
.adventure-reward-details summary {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #234a7d;
  font-size: 13px;
  font-weight: 900;
}

.adventure-reward-left img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.adventure-reward-details p {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 30;
  width: min(360px, calc(100vw - 32px));
  margin: 0;
  padding: 10px 12px;
  color: #24466f;
  border: 1.5px solid rgba(73, 129, 199, 0.56);
  border-radius: 8px;
  background: #f8fdff;
  box-shadow: 0 14px 26px rgba(35, 85, 142, 0.2);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
}

.adventure-rpg-page .bottom-tabbar {
  width: min(430px, calc(100vw - 16px));
  min-height: 62px;
  padding: 6px;
  border: 1.5px solid rgba(73, 129, 199, 0.62);
  border-radius: 14px;
  background: rgba(248, 253, 255, 0.93);
  box-shadow: 0 10px 22px rgba(59, 105, 148, 0.18);
}

.adventure-rpg-page .tabbar-item {
  min-height: 48px;
  color: #2c4668;
  border-radius: 10px;
}

.adventure-rpg-page .tabbar-item.is-active {
  color: #17345f;
  background: linear-gradient(180deg, #fff3a5, #ffc857);
}

@keyframes adventureSoftPulse {
  from { opacity: 0.72; }
  to { opacity: 1; }
}

@media (max-width: 900px) {
  .adventure-shell {
    grid-template-rows: auto auto minmax(0, 32px) minmax(128px, 22fr) minmax(330px, 48fr) auto;
    width: calc(100vw - 12px);
    height: calc(100dvh - 82px - env(safe-area-inset-bottom));
    min-height: 0;
    gap: 5px;
    padding-top: 6px;
  }

  .adventure-shell:has(.adventure-pressurebar.no-pressure) {
    grid-template-rows: auto auto minmax(132px, 23fr) minmax(350px, 52fr) auto;
  }

  .adventure-topbar {
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    gap: 7px;
    padding: 6px 8px;
  }

  .adventure-title-block h1 { font-size: 20px; }
  .adventure-hero-chip { min-width: 0; padding: 4px 6px; }
  .adventure-hero-chip span,
  .adventure-resource-row { display: none; }

  .adventure-controlbar {
    grid-template-columns: minmax(0, 1fr) minmax(106px, auto) auto auto;
    gap: 6px;
    padding: 6px 8px;
  }

  .adventure-control-field small,
  .adventure-control-field span,
  .adventure-control-button span { display: none; }

  .adventure-control-field,
  .adventure-control-button,
  .adventure-more-menu summary {
    min-height: 38px;
    padding: 6px 8px;
  }

  .adventure-control-field:not(.deck-field) { display: none; }
  .adventure-help-button,
  .adventure-back-button,
  .adventure-icon-button,
  .adventure-settings summary { width: 38px; height: 38px; }

  .adventure-pressurebar {
    grid-template-columns: 136px minmax(0, 1fr);
    gap: 8px;
    padding: 5px 9px;
  }

  .adventure-pressurebar .monster-charge-head { font-size: 12px; }

  .adventure-rpg-page .battle-hud {
    top: 7px !important;
    width: calc(50% - 12px) !important;
    padding: 6px !important;
  }

  .adventure-rpg-page .battle-name,
  .adventure-rpg-page .battle-hud strong,
  .adventure-rpg-page .battle-traits,
  .adventure-rpg-page .monster-hud .battle-traits { font-size: 10px !important; }

  .adventure-rpg-page .fighter {
    bottom: 18px !important;
    width: 82px !important;
    height: 82px !important;
  }

  .adventure-rpg-page .pet-fighter {
    width: 58px !important;
    height: 58px !important;
  }

  .adventure-card-area { padding: 7px; }
  .adventure-card-head { align-items: flex-start; min-height: 38px; }
  .adventure-card-head p { display: none; }
  .adventure-card-head h2 { font-size: 16px; }
  .adventure-card-stats { gap: 4px; }
  .adventure-card-stats span { padding: 3px 6px; font-size: 11px; }
  .adventure-card-stats span:nth-child(n + 4) { display: none; }
  .adventure-rpg-page .board-wrap { padding: 6px !important; }
  .adventure-rewardbar { padding: 6px 9px; }
  .adventure-reward-details summary {
    overflow: hidden;
    max-width: 56vw;
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media (max-width: 520px) {
  .adventure-shell {
    grid-template-rows: auto auto minmax(0, 30px) minmax(116px, 20fr) minmax(360px, 52fr) auto;
    width: calc(100vw - 8px);
    height: calc(100dvh - 78px - env(safe-area-inset-bottom));
    padding-top: 4px;
  }

  .adventure-shell:has(.adventure-pressurebar.no-pressure) {
    grid-template-rows: auto auto minmax(122px, 20fr) minmax(380px, 56fr) auto;
  }

  .adventure-title-block p,
  .adventure-control-button,
  .adventure-rpg-page .battle-map-title { display: none !important; }

  .adventure-title-block h1 { font-size: 18px; }
  .adventure-hero-chip img { width: 30px; height: 30px; }
  .adventure-hero-chip strong { font-size: 12px; }
  .adventure-controlbar { grid-template-columns: minmax(0, 1fr) auto auto; }
  .adventure-control-field strong { font-size: 12px; }
  .adventure-more-menu summary { min-width: 58px; font-size: 12px; }
  .adventure-pressurebar { grid-template-columns: 116px minmax(0, 1fr); }
  .adventure-pressurebar .monster-charge-head { gap: 4px; font-size: 11px; }

  .adventure-rpg-page .battle-hud { padding: 5px !important; }
  .adventure-rpg-page .battle-hud > div:first-child { margin-bottom: 3px !important; }
  .adventure-rpg-page .fighter {
    bottom: 14px !important;
    width: 72px !important;
    height: 72px !important;
  }
  .adventure-rpg-page .hero-fighter { left: 12% !important; }
  .adventure-rpg-page .monster-fighter { right: 12% !important; }
  .adventure-rpg-page .pet-fighter {
    left: 28% !important;
    bottom: 18px !important;
    width: 50px !important;
    height: 50px !important;
  }

  .adventure-card-head { min-height: 34px; }
  .adventure-card-stats span:nth-child(n + 3) { display: none; }
  .adventure-rpg-page .card { padding: 5px 6px !important; }
  .adventure-reward-left { font-size: 11px; }
  .adventure-reward-left img { width: 24px; height: 24px; }
}

/* Adventure UI v3: match the supplied blueprint distribution and light-blue pixel style. */
html:has(body.adventure-rpg-page) {
  overflow: hidden !important;
  background: #eaf8ff;
}

.adventure-rpg-page {
  --blue-line: #3b82e6;
  --blue-soft: #82b5fb;
  --ink: #102b58;
  --panel-white: rgba(248, 253, 255, 0.96);
  background:
    linear-gradient(180deg, rgba(232, 248, 255, 0.76), rgba(250, 254, 255, 0.9)),
    url("assets/ui/cloud-kingdom-game-bg.png") center bottom / cover no-repeat fixed !important;
}

.adventure-shell {
  grid-template-rows: 8fr 8fr 4fr 25fr 42fr 5fr !important;
  gap: 5px !important;
  width: min(1280px, calc(100vw - 20px)) !important;
  height: calc(100dvh - 74px - env(safe-area-inset-bottom)) !important;
  min-height: 620px !important;
  padding-top: 8px !important;
}

.adventure-shell:has(.adventure-pressurebar.no-pressure) {
  grid-template-rows: 8fr 8fr 25fr 54fr 5fr !important;
}

.adventure-topbar,
.adventure-controlbar,
.adventure-pressurebar,
.adventure-battle-panel,
.adventure-card-area,
.adventure-rewardbar {
  border: 2px solid var(--blue-line) !important;
  border-radius: 7px !important;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(232, 247, 255, 0.92)) !important;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.75),
    0 2px 0 rgba(59, 130, 230, 0.18) !important;
}

.adventure-topbar {
  grid-template-columns: 48px minmax(210px, 1fr) minmax(132px, auto) minmax(210px, auto) minmax(104px, auto) !important;
  padding: 6px 12px !important;
}

.adventure-back-button,
.adventure-icon-button,
.adventure-help-button,
.adventure-settings summary {
  width: 42px !important;
  height: 42px !important;
  border: 1.5px solid var(--blue-soft) !important;
  border-radius: 7px !important;
  background: linear-gradient(180deg, #ffffff, #ddebff) !important;
  box-shadow: 0 2px 0 rgba(32, 88, 160, 0.24), inset 0 1px 0 #fff !important;
}

.adventure-title-block {
  display: flex;
  align-items: center;
  gap: 10px;
}

.adventure-title-block p {
  display: none !important;
}

.adventure-title-block h1 {
  font-size: clamp(24px, 2.2vw, 32px) !important;
  font-weight: 900 !important;
  color: var(--ink) !important;
}

.adventure-hero-chip {
  justify-self: center;
  min-width: 150px !important;
  height: 46px;
  border: 1.5px solid var(--blue-soft) !important;
  border-radius: 7px !important;
  background: rgba(246, 252, 255, 0.86) !important;
}

.adventure-hero-chip img {
  width: 42px !important;
  height: 42px !important;
}

.adventure-resource-row {
  justify-content: center;
  gap: 28px !important;
}

.adventure-resource-row span {
  min-width: auto !important;
  font-size: 16px !important;
}

.adventure-resource-row img {
  width: 34px !important;
  height: 34px !important;
}

.adventure-top-actions {
  justify-content: end;
}

.adventure-controlbar {
  grid-template-columns: minmax(220px, 1.25fr) minmax(150px, 0.72fr) minmax(150px, 0.72fr) minmax(92px, auto) 48px !important;
  padding: 4px 48px !important;
  gap: 22px !important;
}

.adventure-control-field,
.adventure-control-button,
.adventure-more-menu summary {
  min-height: 36px !important;
  padding: 4px 14px !important;
  border: 1.5px solid var(--blue-soft) !important;
  border-radius: 7px !important;
  background: linear-gradient(180deg, #ffffff, #e5f1ff) !important;
  box-shadow: 0 2px 0 rgba(32, 88, 160, 0.18) !important;
}

.adventure-control-field {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px 10px;
  align-items: center;
}

.adventure-control-field span,
.adventure-control-button span {
  color: var(--ink) !important;
  font-size: 13px !important;
  font-weight: 900 !important;
}

.adventure-control-field strong,
.adventure-control-button strong {
  color: var(--ink) !important;
  font-size: 15px !important;
}

.adventure-control-field small {
  display: none !important;
  grid-column: 2;
  color: #466895 !important;
  font-size: 11px !important;
}

.adventure-control-button {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  text-align: left;
}

.adventure-more-menu summary {
  min-width: 96px !important;
  color: var(--ink) !important;
  font-size: 15px;
}

.adventure-pressurebar {
  grid-template-columns: auto minmax(260px, 0.34fr) auto !important;
  justify-content: center;
  gap: 12px !important;
  padding: 2px 18px !important;
}

.adventure-pressurebar .monster-charge-head {
  gap: 8px !important;
  font-size: 14px !important;
}

.adventure-pressurebar .monster-charge-head::before {
  content: "?";
  font-size: 18px;
}

.adventure-pressurebar .pressure-track {
  height: 8px !important;
  min-width: 260px;
  border: 0 !important;
  background: #c8dbee !important;
}

.adventure-pressurebar .pressure-track span {
  background: linear-gradient(90deg, #0ab8ff, #37e7c2) !important;
}

.adventure-pressurebar.danger .pressure-track span {
  background: linear-gradient(90deg, #ffc247, #ff9e3f) !important;
}

.adventure-battle-panel {
  border-radius: 7px !important;
}

.adventure-rpg-page .battle-sky {
  background:
    linear-gradient(to bottom, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03)),
    var(--battle-map, url("assets/maps/grade3-starlight-forest.png")) center 62% / cover no-repeat !important;
}

.adventure-rpg-page .battle-hud {
  bottom: auto !important;
  top: 14px !important;
  width: min(260px, 28%) !important;
  height: auto !important;
  max-height: 50px !important;
  aspect-ratio: auto !important;
  padding: 4px 8px !important;
  border: 0 !important;
  border-radius: 4px !important;
  background: rgba(246, 252, 255, 0.76) !important;
  box-shadow: none !important;
}

.adventure-rpg-page .hero-hud {
  left: 96px !important;
}

.adventure-rpg-page .monster-hud {
  right: 96px !important;
}

.adventure-rpg-page .battle-hud > div:first-child {
  grid-template-columns: auto minmax(0, 1fr) auto !important;
  align-items: center;
  margin-bottom: 3px !important;
}

.adventure-rpg-page .battle-name {
  color: var(--ink) !important;
  font-size: 13px !important;
  font-weight: 900 !important;
}

.adventure-rpg-page .battle-traits,
.adventure-rpg-page .monster-hud .battle-traits {
  display: none !important;
}

.adventure-rpg-page .battle-hud strong {
  color: #ffffff !important;
  font-size: 13px !important;
  font-weight: 900 !important;
  z-index: 2;
}

.adventure-rpg-page .hp-track {
  height: 14px !important;
  border: 2px solid #23345c !important;
  border-radius: 2px !important;
  background: #202a46 !important;
}

.adventure-rpg-page .hero-fill {
  background: linear-gradient(90deg, #ff5270, #ff315b) !important;
}

.adventure-rpg-page .monster-fill {
  background: linear-gradient(90deg, #ff456a, #ff244f) !important;
}

.adventure-rpg-page .hero-hud-progress {
  display: none !important;
}

.adventure-rpg-page .battle-map-title {
  top: 12px !important;
  min-width: 132px !important;
  padding: 7px 20px !important;
  border: 0 !important;
  border-radius: 999px !important;
  color: var(--ink) !important;
  background: rgba(245, 250, 255, 0.86) !important;
  font-size: 14px !important;
  font-weight: 900 !important;
}

.adventure-rpg-page .fighter {
  bottom: 18px !important;
  width: clamp(105px, 12vw, 150px) !important;
  height: clamp(105px, 12vw, 150px) !important;
}

.adventure-rpg-page .hero-fighter {
  left: 14% !important;
}

.adventure-rpg-page .pet-fighter {
  left: 25% !important;
  bottom: 20px !important;
  width: clamp(72px, 7vw, 96px) !important;
  height: clamp(72px, 7vw, 96px) !important;
}

.adventure-rpg-page .monster-fighter {
  right: 18% !important;
}

.adventure-card-area {
  padding: 8px 18px 10px !important;
  background: linear-gradient(180deg, rgba(247, 252, 255, 0.98), rgba(232, 246, 255, 0.96)) !important;
}

.adventure-card-head {
  position: relative;
  justify-content: center !important;
  min-height: 34px !important;
}

.adventure-card-head > div:first-child {
  position: absolute;
  left: 0;
  top: 0;
}

.adventure-card-head p {
  color: #4077c8 !important;
  font-size: 11px !important;
}

.adventure-card-head h2 {
  color: var(--ink) !important;
  font-size: 18px !important;
}

.adventure-card-stats {
  justify-content: center !important;
}

.adventure-card-stats span {
  border: 0 !important;
  background: transparent !important;
  color: var(--ink) !important;
  font-size: 17px !important;
}

.adventure-card-stats span:not(:first-child) {
  display: none !important;
}

.adventure-card-stats span:first-child::before {
  content: "";
}

.adventure-card-stats span:first-child {
  font-size: 18px !important;
}

.adventure-rpg-page .board-wrap {
  padding: 14px 16px 20px !important;
  background: rgba(246, 252, 255, 0.72) !important;
  box-shadow: none !important;
}

.adventure-rpg-page .board,
.adventure-rpg-page .board[data-grade] {
  align-content: center !important;
  gap: var(--match-gap, 14px) !important;
}

.adventure-rpg-page .card {
  height: var(--match-card-height, 68px) !important;
  border: 2px solid #2d6cd3 !important;
  border-radius: 4px !important;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 52%, #edf6ff 100%) !important;
  box-shadow:
    3px 3px 0 rgba(34, 92, 176, 0.28),
    inset 0 0 0 1px rgba(255, 255, 255, 0.92) !important;
  color: var(--ink) !important;
  font-weight: 900 !important;
}

.adventure-rpg-page .card.selected {
  background: linear-gradient(180deg, #fff7b8, #ffd75c) !important;
  box-shadow: 3px 3px 0 rgba(169, 119, 23, 0.34) !important;
}

.adventure-rewardbar {
  padding: 5px 28px !important;
}

.adventure-reward-left img {
  width: 30px !important;
  height: 30px !important;
}

.adventure-reward-left,
.adventure-reward-details summary {
  color: var(--ink) !important;
  font-size: 14px !important;
}

.adventure-reward-details summary::after {
  content: " ?";
}

.adventure-rpg-page .result-panel,
.adventure-rpg-page .adventure-end-panel {
  position: fixed !important;
  left: 50% !important;
  right: auto !important;
  bottom: calc(82px + env(safe-area-inset-bottom)) !important;
  z-index: 80 !important;
  width: min(900px, calc(100vw - 28px)) !important;
  max-height: min(42vh, 320px) !important;
  overflow: hidden !important;
  transform: translateX(-50%) !important;
}

.adventure-rpg-page .result-panel.hidden,
.adventure-rpg-page .adventure-end-panel.hidden {
  display: none !important;
}

.adventure-rpg-page .bottom-tabbar {
  bottom: max(8px, env(safe-area-inset-bottom)) !important;
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  width: min(860px, calc(100vw - 20px)) !important;
  min-height: 58px !important;
  border: 2px solid var(--blue-line) !important;
  border-radius: 7px !important;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(232, 247, 255, 0.94)) !important;
  box-shadow: none !important;
}

.adventure-rpg-page .tabbar-item {
  grid-template-columns: auto auto !important;
  justify-content: center !important;
  gap: 8px !important;
  min-height: 46px !important;
  border-radius: 6px !important;
}

.adventure-rpg-page .tabbar-item img {
  width: 30px !important;
  height: 30px !important;
}

.adventure-rpg-page .tabbar-item.is-active {
  border: 1.5px solid #2d6cd3 !important;
  background: linear-gradient(180deg, #e9f5ff, #bfe1ff) !important;
}

@media (max-width: 900px) {
  .adventure-shell {
    grid-template-rows: 7fr 8fr 4fr 22fr 49fr 5fr !important;
    width: calc(100vw - 10px) !important;
    height: calc(100dvh - 72px - env(safe-area-inset-bottom)) !important;
    min-height: 0 !important;
  }

  .adventure-shell:has(.adventure-pressurebar.no-pressure) {
    grid-template-rows: 7fr 8fr 23fr 57fr 5fr !important;
  }

  .adventure-topbar {
    grid-template-columns: 40px minmax(0, 1fr) auto auto !important;
    gap: 8px !important;
    padding: 5px 8px !important;
  }

  .adventure-resource-row {
    display: none !important;
  }

  .adventure-title-block h1 {
    font-size: 20px !important;
  }

  .adventure-hero-chip {
    min-width: 88px !important;
    height: 38px;
  }

  .adventure-hero-chip span {
    display: none;
  }

  .adventure-hero-chip img {
    width: 34px !important;
    height: 34px !important;
  }

  .adventure-controlbar {
    grid-template-columns: minmax(0, 1fr) auto auto !important;
    padding: 5px 8px !important;
    gap: 7px !important;
  }

  .adventure-control-button,
  .adventure-control-field:not(.deck-field) {
    display: none !important;
  }

  .adventure-control-field,
  .adventure-more-menu summary {
    min-height: 36px !important;
  }

  .adventure-pressurebar {
    grid-template-columns: auto minmax(120px, 1fr) !important;
    justify-content: stretch !important;
    padding: 4px 10px !important;
  }

  .adventure-rpg-page .battle-hud {
    top: 8px !important;
    width: calc(42% - 8px) !important;
  }

  .adventure-rpg-page .hero-hud {
    left: 10px !important;
  }

  .adventure-rpg-page .monster-hud {
    right: 10px !important;
  }

  .adventure-rpg-page .fighter {
    width: 84px !important;
    height: 84px !important;
  }

  .adventure-rpg-page .hero-fighter {
    left: 12% !important;
  }

  .adventure-rpg-page .monster-fighter {
    right: 13% !important;
  }

  .adventure-card-area {
    padding: 6px 8px 8px !important;
  }

  .adventure-card-head {
    min-height: 30px !important;
  }

  .adventure-card-head > div:first-child {
    display: none;
  }

  .adventure-card-stats span:first-child {
    font-size: 15px !important;
  }

  .adventure-rpg-page .board-wrap {
    padding: 8px !important;
  }

  .adventure-rpg-page .bottom-tabbar {
    width: min(430px, calc(100vw - 12px)) !important;
  }

.adventure-rpg-page .tabbar-item {
  grid-template-columns: 1fr !important;
  gap: 1px !important;
  }
}

/* Desktop refinement: blueprint-style dropdown controls, flatter battle strip, compact card zone. */
@media (min-width: 901px) {
  .adventure-control-field select,
  .adventure-control-button select {
    appearance: none;
    width: min(220px, 100%);
    min-height: 36px;
    padding: 0 42px 0 16px;
    color: var(--ink);
    border: 1.5px solid #7daef4;
    border-radius: 6px;
    background:
      linear-gradient(45deg, transparent 50%, #174477 50%) right 18px center / 7px 7px no-repeat,
      linear-gradient(135deg, #174477 50%, transparent 50%) right 12px center / 7px 7px no-repeat,
      linear-gradient(180deg, #ffffff, #eef6ff);
    box-shadow: 0 2px 0 rgba(32, 88, 160, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.95);
    font: 900 15px "Noto Sans SC", "Inter", system-ui, sans-serif;
    cursor: pointer;
  }

  .adventure-control-field select:focus,
  .adventure-control-button select:focus {
    border-color: #2f79e6;
    outline: none;
    box-shadow: 0 0 0 3px rgba(79, 145, 231, 0.18), 0 2px 0 rgba(32, 88, 160, 0.24);
  }

  .adventure-control-field .control-mirror,
  .adventure-control-button > strong,
  .adventure-control-field > strong {
    display: none !important;
  }

  .adventure-controlbar {
    grid-template-columns: minmax(250px, 1fr) minmax(190px, 0.7fr) minmax(190px, 0.7fr) 104px 48px !important;
    align-items: center !important;
    padding-left: 58px !important;
    padding-right: 58px !important;
  }

  .adventure-control-field,
  .adventure-control-button {
    grid-template-columns: auto minmax(0, 220px) !important;
    justify-content: center;
    gap: 10px !important;
    padding: 3px 8px !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  .adventure-control-field span,
  .adventure-control-button span {
    font-size: 14px !important;
  }

  .adventure-battle-panel {
    max-height: 150px !important;
  }

  .adventure-rpg-page .battle-sky {
    background-position: center 66% !important;
  }

  .adventure-rpg-page .battle-hud {
    top: 10px !important;
    width: 250px !important;
    max-height: 34px !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  .adventure-rpg-page .hero-hud {
    left: 92px !important;
  }

  .adventure-rpg-page .monster-hud {
    right: 92px !important;
  }

  .adventure-rpg-page .battle-hud > div:first-child {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 8px !important;
    height: 15px !important;
    margin: 0 0 1px !important;
    padding: 0 4px !important;
  }

  .adventure-rpg-page .battle-name,
  .adventure-rpg-page .battle-hud strong {
    color: #102b58 !important;
    font-size: 12px !important;
    line-height: 1 !important;
  }

  .adventure-rpg-page .hp-track {
    height: 16px !important;
    border: 2px solid #26365a !important;
    border-radius: 3px !important;
    background: linear-gradient(180deg, #293856, #16213a) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 1px 0 rgba(0, 0, 0, 0.24) !important;
  }

  .adventure-rpg-page .hp-fill {
    height: 100% !important;
    border-radius: 1px !important;
    background: linear-gradient(180deg, #ff6c82 0%, #ff315b 52%, #b90f35 100%) !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55) !important;
  }

  .adventure-rpg-page .fighter {
    bottom: 8px !important;
    width: 120px !important;
    height: 120px !important;
  }

  .adventure-rpg-page .pet-fighter {
    bottom: 10px !important;
    width: 82px !important;
    height: 82px !important;
  }

  .adventure-card-area {
    padding: 5px 18px 7px !important;
  }

  .adventure-card-head {
    min-height: 28px !important;
  }

  .adventure-rpg-page .board-wrap {
    padding: 6px 18px 10px !important;
  }

  .adventure-rpg-page .board,
  .adventure-rpg-page .board[data-grade] {
    align-content: start !important;
  }

  .adventure-rpg-page .card {
    height: var(--match-card-height, 62px) !important;
    min-height: 0 !important;
  }
}

/* Desktop final alignment: reference-style controls, flat battle strip, tight 6x3 board. */
@media (min-width: 901px) {
  body.adventure-rpg-page {
    --desktop-frame: #2e78df;
    --desktop-ink: #12345f;
    --desktop-panel: rgba(244, 251, 255, 0.94);
  }

  .adventure-rpg-page .adventure-shell {
    grid-template-rows: 58px 50px 30px 208px auto 42px !important;
    gap: 5px !important;
    height: auto !important;
    min-height: 0 !important;
  }

  .adventure-rpg-page .adventure-shell:has(.adventure-pressurebar.no-pressure) {
    grid-template-rows: 58px 50px 208px auto 42px !important;
  }

  .adventure-rpg-page .adventure-topbar,
  .adventure-rpg-page .adventure-controlbar,
  .adventure-rpg-page .adventure-pressurebar,
  .adventure-rpg-page .adventure-battle-panel,
  .adventure-rpg-page .adventure-card-area,
  .adventure-rpg-page .adventure-rewardbar {
    border: 2px solid var(--desktop-frame) !important;
    border-radius: 6px !important;
  }

  .adventure-rpg-page .adventure-controlbar {
    grid-template-columns: minmax(300px, 1fr) minmax(230px, 0.7fr) minmax(210px, 0.62fr) 112px 52px !important;
    padding: 5px 46px !important;
    gap: 24px !important;
    background: rgba(242, 250, 255, 0.9) !important;
  }

  .adventure-rpg-page .adventure-topbar {
    grid-template-columns: auto minmax(280px, 1fr) auto auto !important;
  }

  .adventure-rpg-page .adventure-resource-row {
    display: none !important;
  }

  .adventure-rpg-page .adventure-top-actions {
    gap: 8px !important;
    align-items: center !important;
  }

  .adventure-rpg-page .adventure-icon-button.sound-toggle-button,
  .adventure-rpg-page .adventure-settings summary {
    display: grid !important;
    grid-template-rows: 22px 14px !important;
    place-items: center !important;
    width: 48px !important;
    height: 44px !important;
    min-width: 48px !important;
    min-height: 44px !important;
    padding: 3px 0 4px !important;
    border: 0 !important;
    border-radius: 4px !important;
    background: transparent !important;
    box-shadow: none !important;
    color: var(--desktop-ink) !important;
    font-size: 12px !important;
    font-weight: 900 !important;
    line-height: 1 !important;
    cursor: pointer !important;
  }

  .adventure-rpg-page .adventure-icon-button.sound-toggle-button::before {
    content: "" !important;
    display: block !important;
    width: 24px !important;
    height: 22px !important;
    background: url("data:image/svg+xml,%3Csvg width='24' height='22' viewBox='0 0 24 22' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4 9.2V12.8H7.4L12.5 17V5L7.4 9.2H4Z' stroke='%23153765' stroke-width='2' stroke-linejoin='round'/%3E%3Cpath d='M16 8C17.2 9.2 17.2 12.8 16 14' stroke='%23153765' stroke-width='2' stroke-linecap='round'/%3E%3Cpath d='M19 5.5C21.6 8.4 21.6 13.6 19 16.5' stroke='%23153765' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat !important;
  }

  .adventure-rpg-page .adventure-icon-button.sound-toggle-button.is-muted::before {
    background-image: url("data:image/svg+xml,%3Csvg width='24' height='22' viewBox='0 0 24 22' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4 9.2V12.8H7.4L12.5 17V5L7.4 9.2H4Z' stroke='%23153765' stroke-width='2' stroke-linejoin='round'/%3E%3Cpath d='M17 8L22 14' stroke='%23153765' stroke-width='2' stroke-linecap='round'/%3E%3Cpath d='M22 8L17 14' stroke='%23153765' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") !important;
    opacity: 0.85 !important;
  }

  .adventure-rpg-page .adventure-settings summary::before {
    content: "" !important;
    display: block !important;
    width: 24px !important;
    height: 24px !important;
    background: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M9.6 3.4L10.2 5.8C10.7 5.7 11.3 5.7 11.8 5.8L12.4 3.4H15.5L16.1 5.8C16.6 6 17.1 6.3 17.5 6.6L19.6 5.3L21.2 8L19.3 9.5C19.4 10 19.5 10.5 19.5 11C19.5 11.5 19.4 12 19.3 12.5L21.2 14L19.6 16.7L17.5 15.4C17.1 15.7 16.6 16 16.1 16.2L15.5 18.6H12.4L11.8 16.2C11.3 16.3 10.7 16.3 10.2 16.2L9.6 18.6H6.5L5.9 16.2C5.4 16 4.9 15.7 4.5 15.4L2.4 16.7L0.8 14L2.7 12.5C2.6 12 2.5 11.5 2.5 11C2.5 10.5 2.6 10 2.7 9.5L0.8 8L2.4 5.3L4.5 6.6C4.9 6.3 5.4 6 5.9 5.8L6.5 3.4H9.6Z' stroke='%23153765' stroke-width='1.8' stroke-linejoin='round' transform='translate(1 1)'/%3E%3Ccircle cx='12' cy='12' r='3.2' stroke='%23153765' stroke-width='1.8'/%3E%3C/svg%3E") center / contain no-repeat !important;
  }

  .adventure-rpg-page .adventure-settings summary::after {
    content: "ÉèÖÃ" !important;
    display: block !important;
    color: var(--desktop-ink) !important;
    font-size: 12px !important;
    font-weight: 900 !important;
    line-height: 1 !important;
  }

  .adventure-rpg-page .adventure-settings summary img {
    display: none !important;
  }

  .adventure-rpg-page .adventure-control-field,
  .adventure-rpg-page .adventure-control-button {
    min-height: 38px !important;
    padding: 0 !important;
    display: grid !important;
    grid-template-columns: auto minmax(0, 220px) !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px !important;
  }

  .adventure-rpg-page .adventure-control-field span,
  .adventure-rpg-page .adventure-control-button span {
    color: var(--desktop-ink) !important;
    font-size: 14px !important;
    line-height: 1 !important;
    white-space: nowrap !important;
  }

  .adventure-rpg-page .adventure-control-field select,
  .adventure-rpg-page .adventure-control-button select {
    width: 100% !important;
    height: 38px !important;
    min-height: 38px !important;
    padding: 0 44px 0 16px !important;
    border: 2px solid #6da4ee !important;
    border-radius: 6px !important;
    color: var(--desktop-ink) !important;
    background:
      linear-gradient(45deg, transparent 50%, #113b72 50%) right 18px center / 7px 7px no-repeat,
      linear-gradient(135deg, #113b72 50%, transparent 50%) right 12px center / 7px 7px no-repeat,
      linear-gradient(180deg, #ffffff 0%, #f8fcff 48%, #dbeeff 100%) !important;
    box-shadow:
      inset 0 0 0 1px rgba(255, 255, 255, 0.95),
      2px 2px 0 rgba(45, 102, 180, 0.18) !important;
    font-size: 15px !important;
    font-weight: 900 !important;
  }

  .adventure-rpg-page .adventure-pressurebar {
    min-height: 30px !important;
    padding: 3px 18px !important;
    background: rgba(238, 248, 255, 0.88) !important;
  }

  .adventure-rpg-page .adventure-pressurebar .pressure-track {
    height: 9px !important;
    border: 1px solid rgba(51, 93, 145, 0.24) !important;
    border-radius: 4px !important;
  }

  .adventure-rpg-page .adventure-battle-panel {
    height: 208px !important;
    max-height: 208px !important;
    min-height: 0 !important;
    overflow: hidden !important;
    background: #b7e1ff !important;
  }

  .adventure-rpg-page .battle-sky {
    height: 100% !important;
    background-position: center 58% !important;
  }

  .adventure-rpg-page .battle-map-title,
  .adventure-rpg-page .battle-message {
    display: none !important;
  }

  .adventure-rpg-page .boss-challenge-button {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: absolute !important;
    top: 10px !important;
    right: 50% !important;
    bottom: auto !important;
    transform: translateX(50%) !important;
    z-index: 8 !important;
    width: auto !important;
    min-width: 104px !important;
    min-height: 32px !important;
    padding: 0 14px !important;
    border: 2px solid #2e78df !important;
    border-radius: 6px !important;
    color: var(--desktop-ink) !important;
    background: linear-gradient(180deg, #fff8bd 0%, #ffd763 100%) !important;
    box-shadow:
      inset 0 0 0 1px rgba(255, 255, 255, 0.76),
      2px 2px 0 rgba(33, 82, 156, 0.28) !important;
    font-size: 13px !important;
    font-weight: 900 !important;
    line-height: 1 !important;
  }

  .adventure-rpg-page .battle-hud {
    top: 10px !important;
    width: 270px !important;
    height: 36px !important;
    max-height: 36px !important;
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
    filter: none !important;
  }

  .adventure-rpg-page .hero-hud {
    left: 56px !important;
  }

  .adventure-rpg-page .monster-hud {
    right: 56px !important;
  }

  .adventure-rpg-page .battle-hud > div:first-child {
    height: 16px !important;
    padding: 0 4px !important;
    margin: 0 0 2px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
  }

  .adventure-rpg-page .battle-name,
  .adventure-rpg-page .battle-hud strong {
    color: #f8fbff !important;
    font-size: 12px !important;
    line-height: 1 !important;
    font-weight: 900 !important;
    text-shadow: none !important;
  }

  .adventure-rpg-page .hp-track {
    height: 18px !important;
    border: 2px solid #23315a !important;
    border-radius: 3px !important;
    background:
      linear-gradient(180deg, #3f496b 0%, #1e2b4c 48%, #111a32 100%) !important;
    box-shadow:
      inset 0 2px 0 rgba(255, 255, 255, 0.18),
      inset 0 -2px 0 rgba(0, 0, 0, 0.22),
      2px 2px 0 rgba(5, 24, 66, 0.28) !important;
  }

  .adventure-rpg-page .hp-fill {
    border-radius: 1px !important;
    background:
      linear-gradient(180deg, #ff7a88 0%, #ff4c68 46%, #d71842 48%, #a71134 100%) !important;
    box-shadow:
      inset 0 2px 0 rgba(255, 255, 255, 0.42),
      inset 0 -2px 0 rgba(110, 0, 25, 0.3) !important;
  }

  .adventure-rpg-page .fighter {
    bottom: 10px !important;
    width: 128px !important;
    height: 128px !important;
  }

  .adventure-rpg-page .hero-fighter {
    left: 168px !important;
  }

  .adventure-rpg-page .pet-fighter {
    left: 92px !important;
    bottom: 12px !important;
    width: 78px !important;
    height: 78px !important;
  }

  .adventure-rpg-page .monster-fighter {
    right: 210px !important;
  }

  .adventure-rpg-page .adventure-card-area {
    padding: 4px 18px 7px !important;
    min-height: 0 !important;
    height: auto !important;
    align-self: start !important;
    grid-template-rows: 28px auto !important;
    overflow: hidden !important;
    background: rgba(247, 252, 255, 0.94) !important;
  }

  .adventure-rpg-page .adventure-card-head {
    min-height: 28px !important;
    height: 28px !important;
    margin: 0 !important;
  }

  .adventure-rpg-page .adventure-card-head > div:first-child {
    display: none !important;
  }

  .adventure-rpg-page .adventure-card-stats {
    width: 100% !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 0 !important;
  }

  .adventure-rpg-page .adventure-card-stats span:first-child {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 28px !important;
    color: var(--desktop-ink) !important;
    font-size: 18px !important;
    line-height: 1 !important;
    font-weight: 900 !important;
  }

  .adventure-rpg-page .adventure-card-stats span:not(:first-child) {
    display: none !important;
  }

  .adventure-rpg-page .board-wrap {
    padding: 6px 24px 8px !important;
    min-height: 0 !important;
    height: auto !important;
    align-self: start !important;
    overflow: hidden !important;
    align-content: start !important;
    background: rgba(255, 255, 255, 0.5) !important;
  }

  .adventure-rpg-page .board,
  .adventure-rpg-page .board[data-grade] {
    height: auto !important;
    align-content: start !important;
    gap: 10px 12px !important;
  }

  .adventure-rpg-page .card {
    height: min(var(--match-card-height, 64px), 64px) !important;
    border: 2px solid #2e78df !important;
    border-radius: 5px !important;
    font-size: var(--match-font-size, 22px) !important;
    box-shadow:
      3px 3px 0 rgba(35, 91, 172, 0.26),
      inset 0 0 0 1px rgba(255, 255, 255, 0.92) !important;
  }

  .adventure-rpg-page .adventure-rewardbar {
    height: 42px !important;
    min-height: 42px !important;
    padding: 4px 28px !important;
    background: rgba(239, 249, 255, 0.9) !important;
  }

  .adventure-rpg-page .adventure-hero-chip {
    appearance: none !important;
    border: 2px solid #6da4ee !important;
    min-width: 162px !important;
    height: 48px !important;
    padding: 3px 14px 3px 5px !important;
    cursor: pointer !important;
    background: linear-gradient(180deg, #ffffff 0%, #f5fbff 50%, #dcefff 100%) !important;
    box-shadow:
      inset 0 0 0 1px rgba(255, 255, 255, 0.9),
      2px 2px 0 rgba(45, 102, 180, 0.16) !important;
  }

  .adventure-rpg-page .adventure-hero-chip:hover {
    transform: translateY(-1px) !important;
    border-color: #2e78df !important;
  }

  .adventure-rpg-page .adventure-hero-avatar {
    display: block !important;
    width: 42px !important;
    height: 42px !important;
    overflow: hidden !important;
    border: 1.5px solid #2e78df !important;
    border-radius: 5px !important;
    background: linear-gradient(180deg, #e8f6ff, #bfe5ff) !important;
  }

  .adventure-rpg-page .adventure-hero-avatar img {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    object-fit: contain !important;
    transform: none !important;
  }

  .adventure-rpg-page .adventure-hero-chip > img {
    display: none !important;
  }

  .adventure-rpg-page .adventure-hero-chip span:not(.adventure-hero-avatar),
  .adventure-rpg-page .adventure-hero-chip strong {
    color: var(--desktop-ink) !important;
    font-size: 15px !important;
    font-weight: 900 !important;
    line-height: 1 !important;
  }

  .adventure-rpg-page .adventure-reward-details summary {
    gap: 8px !important;
    color: var(--desktop-ink) !important;
    font-size: 13px !important;
    font-weight: 900 !important;
    white-space: nowrap !important;
  }

  .adventure-rpg-page .reward-label {
    color: #2d609d !important;
  }

  .adventure-rpg-page .reward-drop-item {
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
    min-height: 28px !important;
    padding-left: 9px !important;
    border-left: 1px solid rgba(46, 120, 223, 0.24) !important;
  }

  .adventure-rpg-page .reward-drop-item img {
    width: 26px !important;
    height: 26px !important;
    object-fit: contain !important;
  }

  .adventure-rpg-page .adventure-reward-details summary::after {
    margin-left: 2px !important;
    color: #174477 !important;
  }

  .adventure-rpg-page .hero-profile-page {
    background: rgba(205, 233, 255, 0.46) !important;
    backdrop-filter: blur(4px) !important;
  }

  .adventure-rpg-page .profile-frame {
    width: min(940px, calc(100vw - 42px)) !important;
    max-height: min(720px, calc(100dvh - 40px)) !important;
    border: 2px solid #2e78df !important;
    border-radius: 8px !important;
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(231, 247, 255, 0.96)) !important;
    box-shadow:
      0 18px 36px rgba(30, 83, 150, 0.22),
      inset 0 0 0 1px rgba(255, 255, 255, 0.86) !important;
  }

  .adventure-rpg-page .profile-header {
    padding-bottom: 12px !important;
    border-bottom: 1.5px solid rgba(46, 120, 223, 0.28) !important;
  }

  .adventure-rpg-page .profile-header .eyebrow {
    color: #3b76c2 !important;
  }

  .adventure-rpg-page .profile-header h2 {
    color: var(--desktop-ink) !important;
  }

  .adventure-rpg-page .profile-card {
    border: 2px solid #6da4ee !important;
    border-radius: 7px !important;
    background: linear-gradient(180deg, #ffffff, #e8f5ff) !important;
    box-shadow:
      2px 2px 0 rgba(45, 102, 180, 0.18),
      inset 0 0 0 1px rgba(255, 255, 255, 0.9) !important;
  }

  .adventure-rpg-page .profile-card h3 {
    color: var(--desktop-ink) !important;
    font-size: 17px !important;
  }

  .adventure-rpg-page .profile-card p,
  .adventure-rpg-page .profile-stat span,
  .adventure-rpg-page .monster-log-row span {
    color: #3b5e88 !important;
  }

  .adventure-rpg-page .profile-stat,
  .adventure-rpg-page .monster-log-row {
    border-color: rgba(46, 120, 223, 0.22) !important;
    background: rgba(239, 249, 255, 0.72) !important;
  }

  .adventure-rpg-page .profile-stat strong,
  .adventure-rpg-page .monster-log-row strong {
    color: #12345f !important;
  }

  .adventure-rpg-page .profile-portrait {
    border: 2px solid #2e78df !important;
    border-radius: 8px !important;
    background: linear-gradient(180deg, #dff3ff, #bce2ff) !important;
  }

  .adventure-rpg-page .ability-row,
  .adventure-rpg-page .leaderboard-row,
  .adventure-rpg-page .leaderboard-empty {
    border: 1.5px solid rgba(46, 120, 223, 0.58) !important;
    border-radius: 6px !important;
    background:
      linear-gradient(180deg, #ffffff 0%, #eef8ff 100%) !important;
    box-shadow:
      inset 0 0 0 1px rgba(255, 255, 255, 0.9),
      1px 1px 0 rgba(45, 102, 180, 0.14) !important;
    color: #12345f !important;
  }

  .adventure-rpg-page .ability-row.unlocked {
    background:
      linear-gradient(180deg, #fff9d7 0%, #e7f7ff 100%) !important;
  }

  .adventure-rpg-page .ability-row strong,
  .adventure-rpg-page .leaderboard-row strong {
    color: #12345f !important;
  }

  .adventure-rpg-page .ability-row span,
  .adventure-rpg-page .leaderboard-row span,
  .adventure-rpg-page .leaderboard-empty {
    color: #355d8c !important;
  }

  .adventure-rpg-page .ability-row *,
  .adventure-rpg-page .leaderboard-row * {
    text-shadow: none !important;
  }

  .adventure-rpg-page .leaderboard-row em {
    color: #2c77c6 !important;
    font-weight: 900 !important;
  }

  .adventure-rpg-page .profile-item-line img,
  .adventure-rpg-page .ability-icon {
    filter: drop-shadow(1px 1px 0 rgba(36, 90, 156, 0.22)) !important;
  }

  .adventure-rpg-page .bottom-tabbar {
    position: static !important;
    left: auto !important;
    bottom: auto !important;
    transform: none !important;
    margin: 2px auto 0 !important;
    width: min(860px, calc(100vw - 20px)) !important;
    min-height: 50px !important;
    padding: 3px !important;
  }

  .adventure-rpg-page .tabbar-item {
    min-height: 40px !important;
  }

  .adventure-rpg-page .tabbar-item img {
    width: 26px !important;
    height: 26px !important;
  }
}

/* Mobile adventure last override: must remain the final rules in this file. */
@media (max-width: 900px) {
  html:has(body.adventure-rpg-page),
  body.adventure-rpg-page {
    height: auto !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
  }

  .adventure-rpg-page .adventure-shell,
  .adventure-rpg-page .adventure-shell:has(.adventure-pressurebar.no-pressure) {
    display: grid !important;
    grid-template-rows: auto auto auto auto auto auto !important;
    gap: 5px !important;
    width: calc(100vw - 10px) !important;
    height: auto !important;
    min-height: 0 !important;
    padding-top: 5px !important;
  }

  .adventure-rpg-page .adventure-topbar {
    grid-template-columns: 38px minmax(0, 1fr) 74px 74px !important;
    min-height: 54px !important;
    padding: 5px 7px !important;
    gap: 6px !important;
  }

  .adventure-rpg-page .adventure-title-block p {
    display: none !important;
  }

  .adventure-rpg-page .adventure-title-block h1 {
    overflow: hidden !important;
    color: #12345f !important;
    font-size: 18px !important;
    line-height: 1.05 !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  .adventure-rpg-page .adventure-back-button {
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    min-height: 34px !important;
    border-radius: 5px !important;
    font-size: 20px !important;
  }

  .adventure-rpg-page .adventure-hero-chip {
    display: grid !important;
    grid-template-columns: 30px minmax(0, 1fr) !important;
    min-width: 74px !important;
    width: 74px !important;
    height: 38px !important;
    padding: 3px 5px !important;
    gap: 4px !important;
    border: 1.5px solid #6da4ee !important;
    border-radius: 5px !important;
    background: linear-gradient(180deg, #fff, #e4f3ff) !important;
    box-shadow: 1px 1px 0 rgba(45, 102, 180, 0.16) !important;
  }

  .adventure-rpg-page .adventure-hero-avatar {
    width: 30px !important;
    height: 30px !important;
    border-radius: 4px !important;
  }

  .adventure-rpg-page .adventure-hero-avatar img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
  }

  .adventure-rpg-page .adventure-hero-chip span:not(.adventure-hero-avatar) {
    display: none !important;
  }

  .adventure-rpg-page .adventure-hero-chip strong {
    display: block !important;
    color: #12345f !important;
    font-size: 11px !important;
    line-height: 1 !important;
    white-space: nowrap !important;
  }

  .adventure-rpg-page .adventure-top-actions {
    display: grid !important;
    grid-template-columns: repeat(2, 34px) !important;
    gap: 4px !important;
    justify-content: end !important;
  }

  .adventure-rpg-page .adventure-icon-button.sound-toggle-button,
  .adventure-rpg-page .adventure-settings summary {
    display: grid !important;
    grid-template-rows: 18px 11px !important;
    place-items: center !important;
    width: 34px !important;
    height: 36px !important;
    min-width: 34px !important;
    min-height: 36px !important;
    padding: 2px 0 !important;
    border: 0 !important;
    border-radius: 4px !important;
    background: transparent !important;
    box-shadow: none !important;
    color: #12345f !important;
    font-size: 10px !important;
    font-weight: 900 !important;
    line-height: 1 !important;
  }

  .adventure-rpg-page .adventure-icon-button.sound-toggle-button::before {
    content: "" !important;
    display: block !important;
    width: 20px !important;
    height: 18px !important;
    background: url("data:image/svg+xml,%3Csvg width='24' height='22' viewBox='0 0 24 22' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4 9.2V12.8H7.4L12.5 17V5L7.4 9.2H4Z' stroke='%23153765' stroke-width='2' stroke-linejoin='round'/%3E%3Cpath d='M16 8C17.2 9.2 17.2 12.8 16 14' stroke='%23153765' stroke-width='2' stroke-linecap='round'/%3E%3Cpath d='M19 5.5C21.6 8.4 21.6 13.6 19 16.5' stroke='%23153765' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat !important;
  }

  .adventure-rpg-page .adventure-icon-button.sound-toggle-button.is-muted::before {
    background-image: url("data:image/svg+xml,%3Csvg width='24' height='22' viewBox='0 0 24 22' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4 9.2V12.8H7.4L12.5 17V5L7.4 9.2H4Z' stroke='%23153765' stroke-width='2' stroke-linejoin='round'/%3E%3Cpath d='M17 8L22 14' stroke='%23153765' stroke-width='2' stroke-linecap='round'/%3E%3Cpath d='M22 8L17 14' stroke='%23153765' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") !important;
  }

  .adventure-rpg-page .adventure-settings summary::before {
    content: "" !important;
    display: block !important;
    width: 20px !important;
    height: 20px !important;
    background: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M9.6 3.4L10.2 5.8C10.7 5.7 11.3 5.7 11.8 5.8L12.4 3.4H15.5L16.1 5.8C16.6 6 17.1 6.3 17.5 6.6L19.6 5.3L21.2 8L19.3 9.5C19.4 10 19.5 10.5 19.5 11C19.5 11.5 19.4 12 19.3 12.5L21.2 14L19.6 16.7L17.5 15.4C17.1 15.7 16.6 16 16.1 16.2L15.5 18.6H12.4L11.8 16.2C11.3 16.3 10.7 16.3 10.2 16.2L9.6 18.6H6.5L5.9 16.2C5.4 16 4.9 15.7 4.5 15.4L2.4 16.7L0.8 14L2.7 12.5C2.6 12 2.5 11.5 2.5 11C2.5 10.5 2.6 10 2.7 9.5L0.8 8L2.4 5.3L4.5 6.6C4.9 6.3 5.4 6 5.9 5.8L6.5 3.4H9.6Z' stroke='%23153765' stroke-width='1.8' stroke-linejoin='round' transform='translate(1 1)'/%3E%3Ccircle cx='12' cy='12' r='3.2' stroke='%23153765' stroke-width='1.8'/%3E%3C/svg%3E") center / contain no-repeat !important;
  }

  .adventure-rpg-page .adventure-settings summary::after {
    content: "ÉèÖÃ" !important;
    display: block !important;
    color: #12345f !important;
    font-size: 10px !important;
    font-weight: 900 !important;
    line-height: 1 !important;
  }

  .adventure-rpg-page .adventure-settings summary img {
    display: none !important;
  }

  .adventure-rpg-page .adventure-controlbar {
    grid-template-columns: minmax(0, 1.28fr) minmax(68px, .5fr) minmax(68px, .5fr) 42px 32px !important;
    gap: 4px !important;
    min-height: 44px !important;
    padding: 4px !important;
  }

  .adventure-rpg-page .adventure-control-field,
  .adventure-rpg-page .adventure-control-button,
  .adventure-rpg-page .adventure-more-menu summary {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    min-width: 0 !important;
    min-height: 32px !important;
    height: 32px !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  .adventure-rpg-page .adventure-control-field span,
  .adventure-rpg-page .adventure-control-button span,
  .adventure-rpg-page .adventure-control-field small,
  .adventure-rpg-page .control-mirror,
  .adventure-rpg-page #difficultyBadge,
  .adventure-rpg-page #monsterWaveText {
    display: none !important;
  }

  .adventure-rpg-page .adventure-control-field select,
  .adventure-rpg-page .adventure-control-button select {
    display: block !important;
    appearance: auto !important;
    width: 100% !important;
    height: 32px !important;
    min-height: 32px !important;
    padding: 0 4px !important;
    border: 1.5px solid #6da4ee !important;
    border-radius: 5px !important;
    color: #12345f !important;
    background: linear-gradient(180deg, #ffffff, #e4f3ff) !important;
    box-shadow: 1px 1px 0 rgba(45, 102, 180, 0.14) !important;
    font-size: 11px !important;
    font-weight: 900 !important;
  }

  .adventure-rpg-page .adventure-more-menu summary,
  .adventure-rpg-page .adventure-help-button {
    display: grid !important;
    place-items: center !important;
    width: 100% !important;
    min-width: 0 !important;
    height: 32px !important;
    min-height: 32px !important;
    border: 1.5px solid #6da4ee !important;
    border-radius: 5px !important;
    color: #12345f !important;
    background: linear-gradient(180deg, #ffffff, #e4f3ff) !important;
    box-shadow: 1px 1px 0 rgba(45, 102, 180, 0.14) !important;
    font-size: 12px !important;
    font-weight: 900 !important;
  }

  .adventure-rpg-page .adventure-pressurebar {
    min-height: 26px !important;
    padding: 3px 8px !important;
  }

  .adventure-rpg-page .adventure-battle-panel {
    height: 134px !important;
    min-height: 134px !important;
    max-height: 134px !important;
    overflow: hidden !important;
  }

  .adventure-rpg-page .battle-map-title,
  .adventure-rpg-page .battle-message,
  .adventure-rpg-page .battle-rpg-panel,
  .adventure-rpg-page .mobile-battle-button,
  .adventure-rpg-page .hero-hud-progress,
  .adventure-rpg-page .battle-traits,
  .adventure-rpg-page .monster-hud .battle-traits,
  .adventure-rpg-page .pet-battle-name {
    display: none !important;
  }

  .adventure-rpg-page .boss-challenge-button {
    display: inline-flex !important;
    position: absolute !important;
    top: 6px !important;
    left: 50% !important;
    right: auto !important;
    bottom: auto !important;
    transform: translateX(-50%) !important;
    z-index: 8 !important;
    min-width: 82px !important;
    min-height: 25px !important;
    padding: 0 9px !important;
    border: 1.5px solid #2e78df !important;
    border-radius: 5px !important;
    color: #12345f !important;
    background: linear-gradient(180deg, #fff8bd 0%, #ffd763 100%) !important;
    box-shadow: 1px 1px 0 rgba(33, 82, 156, 0.22) !important;
    font-size: 11px !important;
    font-weight: 900 !important;
  }

  .adventure-rpg-page .battle-hud {
    top: 7px !important;
    bottom: auto !important;
    width: calc(50% - 18px) !important;
    height: 30px !important;
    max-height: 30px !important;
    min-height: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    filter: none !important;
  }

  .adventure-rpg-page .hero-hud {
    left: 8px !important;
    right: auto !important;
    text-align: left !important;
  }

  .adventure-rpg-page .monster-hud {
    left: auto !important;
    right: 8px !important;
    text-align: right !important;
  }

  .adventure-rpg-page .battle-hud > div:first-child {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    height: 13px !important;
    min-height: 0 !important;
    margin: 0 0 1px !important;
    padding: 0 2px !important;
  }

  .adventure-rpg-page .battle-name,
  .adventure-rpg-page .battle-hud strong {
    display: block !important;
    overflow: hidden !important;
    color: #f8fbff !important;
    font-size: 10px !important;
    font-weight: 900 !important;
    line-height: 1 !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  .adventure-rpg-page .hp-track,
  .adventure-rpg-page .hero-hud .hp-track,
  .adventure-rpg-page .monster-hud .hp-track {
    display: block !important;
    width: 100% !important;
    height: 12px !important;
    overflow: hidden !important;
    border: 1.5px solid #23315a !important;
    border-radius: 2px !important;
    background: linear-gradient(180deg, #3f496b 0%, #1e2b4c 48%, #111a32 100%) !important;
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.18),
      inset 0 -1px 0 rgba(0, 0, 0, 0.24) !important;
  }

  .adventure-rpg-page .hp-fill,
  .adventure-rpg-page .hero-fill,
  .adventure-rpg-page .monster-fill {
    display: block !important;
    height: 100% !important;
    border-radius: 1px !important;
    background: linear-gradient(180deg, #ff7a88 0%, #ff4c68 46%, #d71842 48%, #a71134 100%) !important;
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.42),
      inset 0 -1px 0 rgba(110, 0, 25, 0.3) !important;
  }

  .adventure-rpg-page .fighter {
    bottom: 7px !important;
    width: 74px !important;
    height: 74px !important;
  }

  .adventure-rpg-page .hero-fighter {
    left: 24% !important;
    right: auto !important;
    z-index: 3 !important;
  }

  .adventure-rpg-page .pet-fighter,
  .adventure-rpg-page .pet-fighter[data-pet-stage="1"],
  .adventure-rpg-page .pet-fighter[data-pet-stage="2"],
  .adventure-rpg-page .pet-fighter[data-pet-stage="3"] {
    left: 9% !important;
    right: auto !important;
    bottom: 9px !important;
    width: 48px !important;
    height: 48px !important;
    z-index: 2 !important;
  }

  .adventure-rpg-page .monster-fighter {
    left: auto !important;
    right: 13% !important;
    z-index: 3 !important;
  }

  .adventure-rpg-page .adventure-card-area {
    padding: 4px 7px 6px !important;
    grid-template-rows: 24px auto !important;
  }

  .adventure-rpg-page .adventure-card-head > div:first-child {
    display: none !important;
  }

  .adventure-rpg-page .adventure-card-stats {
    width: 100% !important;
    justify-content: center !important;
  }

  .adventure-rpg-page .adventure-card-stats span:first-child {
    display: inline-flex !important;
    min-height: 22px !important;
    color: #12345f !important;
    font-size: 15px !important;
    line-height: 1 !important;
  }

  .adventure-rpg-page .adventure-card-stats span:not(:first-child) {
    display: none !important;
  }

  .adventure-rpg-page .board-wrap {
    padding: 5px !important;
  }
}

@media (max-width: 520px) {
  .adventure-rpg-page .adventure-topbar {
    grid-template-columns: 34px minmax(0, 1fr) 70px 72px !important;
    gap: 4px !important;
    padding-inline: 5px !important;
  }

  .adventure-rpg-page .adventure-title-block h1 {
    font-size: 16px !important;
  }

  .adventure-rpg-page .adventure-controlbar {
    grid-template-columns: minmax(0, 1.18fr) minmax(60px, .48fr) minmax(60px, .48fr) 34px 30px !important;
    gap: 3px !important;
    padding: 3px !important;
  }

  .adventure-rpg-page .adventure-control-field select,
  .adventure-rpg-page .adventure-control-button select {
    height: 30px !important;
    min-height: 30px !important;
    padding-inline: 2px !important;
    font-size: 10px !important;
  }

  .adventure-rpg-page .adventure-more-menu summary,
  .adventure-rpg-page .adventure-help-button {
    height: 30px !important;
    min-height: 30px !important;
    font-size: 11px !important;
  }

  .adventure-rpg-page .adventure-battle-panel {
    height: 128px !important;
    min-height: 128px !important;
    max-height: 128px !important;
  }

  .adventure-rpg-page .fighter {
    bottom: 6px !important;
    width: 66px !important;
    height: 66px !important;
  }

  .adventure-rpg-page .hero-fighter {
    left: 23% !important;
  }

  .adventure-rpg-page .pet-fighter,
  .adventure-rpg-page .pet-fighter[data-pet-stage="1"],
  .adventure-rpg-page .pet-fighter[data-pet-stage="2"],
  .adventure-rpg-page .pet-fighter[data-pet-stage="3"] {
    left: 7% !important;
    bottom: 8px !important;
    width: 42px !important;
    height: 42px !important;
  }

  .adventure-rpg-page .monster-fighter {
    right: 10% !important;
  }
}

/* Mobile adventure HUD hotfix: this is intentionally last. */
@media (max-width: 900px) {
  body.adventure-rpg-page .adventure-battle-panel .boss-challenge-button {
    top: 7px !important;
    left: 50% !important;
    right: auto !important;
    width: 70px !important;
    min-width: 70px !important;
    max-width: 70px !important;
    min-height: 20px !important;
    height: 20px !important;
    padding: 0 3px !important;
    transform: translateX(-50%) !important;
    font-size: 8px !important;
    line-height: 1 !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .battle-hud {
    top: 7px !important;
    width: 112px !important;
    max-width: 82px !important;
    height: 28px !important;
    max-height: 28px !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .hero-hud {
    left: 7px !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .monster-hud {
    right: 7px !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .battle-hud > div:first-child {
    height: 12px !important;
    margin-bottom: 1px !important;
    padding: 0 !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .battle-name,
  body.adventure-rpg-page .adventure-battle-panel .battle-hud strong {
    max-width: 64px !important;
    font-size: 10px !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .monster-hud strong {
    max-width: 50px !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .hp-track,
  body.adventure-rpg-page .adventure-battle-panel .hero-hud .hp-track,
  body.adventure-rpg-page .adventure-battle-panel .monster-hud .hp-track {
    height: 9px !important;
  }
}

@media (max-width: 520px) {
  body.adventure-rpg-page .adventure-battle-panel .battle-hud {
    width: 96px !important;
    max-width: 96px !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .boss-challenge-button {
    width: 60px !important;
    min-width: 60px !important;
    max-width: 60px !important;
    font-size: 9px !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .battle-name,
  body.adventure-rpg-page .adventure-battle-panel .battle-hud strong {
    max-width: 54px !important;
    font-size: 9px !important;
  }
}

/* Mobile adventure boss HUD and compact board hotfix: real final override. */
@media (max-width: 900px) {
  body.adventure-rpg-page .adventure-battle-panel .battle-hud {
    position: absolute !important;
    width: 126px !important;
    max-width: 126px !important;
    height: 30px !important;
    overflow: visible !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .hero-hud {
    left: 8px !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .monster-hud {
    right: 8px !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .battle-hud > div:first-child {
    position: static !important;
    display: block !important;
    height: 13px !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .battle-name {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    color: #f8fbff !important;
    font-size: 10px !important;
    line-height: 13px !important;
    text-align: center !important;
    white-space: nowrap !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .battle-hud strong {
    position: absolute !important;
    left: 0 !important;
    right: 0 !important;
    top: 15px !important;
    z-index: 2 !important;
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    color: #fff6df !important;
    font-size: 10px !important;
    line-height: 11px !important;
    text-align: center !important;
    white-space: nowrap !important;
    pointer-events: none !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .hp-track,
  body.adventure-rpg-page .adventure-battle-panel .hero-hud .hp-track,
  body.adventure-rpg-page .adventure-battle-panel .monster-hud .hp-track {
    position: relative !important;
    height: 13px !important;
    margin-top: 1px !important;
  }

  body.adventure-rpg-page .adventure-card-area .board,
  body.adventure-rpg-page .adventure-card-area .board[data-grade] {
    grid-auto-rows: min(var(--match-card-height, 46px), 46px) !important;
    gap: 6px !important;
  }

  body.adventure-rpg-page .adventure-card-area .card {
    height: min(var(--match-card-height, 46px), 46px) !important;
    min-height: 0 !important;
    padding: 3px 5px !important;
    font-size: min(var(--match-font-size, 17px), 17px) !important;
  }
}

@media (max-width: 520px) {
  body.adventure-rpg-page .adventure-battle-panel .battle-hud {
    width: 112px !important;
    max-width: 82px !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .battle-name,
  body.adventure-rpg-page .adventure-battle-panel .battle-hud strong {
    font-size: 9px !important;
  }

  body.adventure-rpg-page .adventure-card-area .board,
  body.adventure-rpg-page .adventure-card-area .board[data-grade] {
    grid-auto-rows: min(var(--match-card-height, 42px), 42px) !important;
    gap: 5px !important;
  }

  body.adventure-rpg-page .adventure-card-area .card {
    height: min(var(--match-card-height, 42px), 42px) !important;
    padding: 2px 4px !important;
    font-size: min(var(--match-font-size, 16px), 16px) !important;
  }
}

/* Mobile battle HP text alignment hotfix: absolute final override. */
@media (max-width: 900px) {
  body.adventure-rpg-page .adventure-battle-panel .battle-hud {
    height: 34px !important;
    max-height: 34px !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .battle-hud > div:first-child {
    height: 14px !important;
    line-height: 14px !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .battle-name {
    height: 14px !important;
    line-height: 14px !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .hp-track,
  body.adventure-rpg-page .adventure-battle-panel .hero-hud .hp-track,
  body.adventure-rpg-page .adventure-battle-panel .monster-hud .hp-track {
    height: 16px !important;
    margin-top: 1px !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .battle-hud strong,
  body.adventure-rpg-page .adventure-battle-panel .hero-hud strong,
  body.adventure-rpg-page .adventure-battle-panel .monster-hud strong {
    position: absolute !important;
    inset: 11px 0 auto 0 !important;
    z-index: 5 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    max-width: none !important;
    height: 16px !important;
    overflow: visible !important;
    color: #fff6df !important;
    font-size: 10px !important;
    font-weight: 900 !important;
    line-height: 1 !important;
    text-align: center !important;
    white-space: nowrap !important;
  }
}

@media (max-width: 520px) {
  body.adventure-rpg-page .adventure-battle-panel .battle-hud strong,
  body.adventure-rpg-page .adventure-battle-panel .hero-hud strong,
  body.adventure-rpg-page .adventure-battle-panel .monster-hud strong {
    font-size: 9px !important;
    line-height: 1 !important;
  }
}

/* Mobile pet name and HP micro alignment: absolute final override. */
@media (max-width: 900px) {
  body.adventure-rpg-page .adventure-battle-panel .pet-battle-name {
    position: absolute !important;
    left: 50% !important;
    top: -15px !important;
    z-index: 4 !important;
    display: block !important;
    min-width: 44px !important;
    max-width: 76px !important;
    padding: 1px 5px !important;
    overflow: hidden !important;
    border: 1px solid rgba(46, 120, 223, 0.72) !important;
    border-radius: 4px !important;
    color: #12345f !important;
    background: rgba(238, 248, 255, 0.92) !important;
    box-shadow: 1px 1px 0 rgba(33, 82, 156, 0.18) !important;
    font-size: 9px !important;
    font-weight: 900 !important;
    line-height: 12px !important;
    text-align: center !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    transform: translateX(-50%) !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .battle-hud strong,
  body.adventure-rpg-page .adventure-battle-panel .hero-hud strong,
  body.adventure-rpg-page .adventure-battle-panel .monster-hud strong {
    inset: 11px 0 auto 0 !important;
  }
}

@media (max-width: 520px) {
  body.adventure-rpg-page .adventure-battle-panel .pet-battle-name {
    top: -14px !important;
    min-width: 38px !important;
    max-width: 62px !important;
    padding-inline: 4px !important;
    font-size: 8px !important;
    line-height: 11px !important;
  }
}

/* Mobile pet name desktop-style badge: absolute final override. */
@media (max-width: 900px) {
  body.adventure-rpg-page .adventure-battle-panel .pet-battle-name {
    position: absolute !important;
    left: 50% !important;
    top: -18px !important;
    z-index: 8 !important;
    display: block !important;
    min-width: 0 !important;
    max-width: 96px !important;
    padding: 3px 6px !important;
    overflow: hidden !important;
    border: 2px solid #080a10 !important;
    border-radius: 3px !important;
    color: #fff4d0 !important;
    background: rgba(18, 25, 38, 0.96) !important;
    box-shadow: 2px 2px 0 #080a10 !important;
    font-size: 9px !important;
    font-weight: 900 !important;
    line-height: 1.1 !important;
    text-align: center !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    transform: translateX(-50%) !important;
  }
}

@media (max-width: 520px) {
  body.adventure-rpg-page .adventure-battle-panel .pet-battle-name {
    top: -17px !important;
    max-width: 86px !important;
    padding: 2px 5px !important;
    border-width: 2px !important;
    font-size: 8px !important;
  }
}

/* Desktop battle HP layout: match the mobile HUD structure. */
@media (min-width: 901px) {
  body.adventure-rpg-page .adventure-battle-panel .battle-hud {
    height: 46px !important;
    max-height: 46px !important;
    overflow: visible !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .battle-hud > div:first-child {
    position: static !important;
    display: block !important;
    height: 18px !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .battle-name {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    height: 18px !important;
    color: #f8fbff !important;
    font-size: 13px !important;
    font-weight: 900 !important;
    line-height: 18px !important;
    text-align: center !important;
    white-space: nowrap !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .hp-track,
  body.adventure-rpg-page .adventure-battle-panel .hero-hud .hp-track,
  body.adventure-rpg-page .adventure-battle-panel .monster-hud .hp-track {
    position: relative !important;
    height: 20px !important;
    margin-top: 2px !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .battle-hud strong,
  body.adventure-rpg-page .adventure-battle-panel .hero-hud strong,
  body.adventure-rpg-page .adventure-battle-panel .monster-hud strong {
    position: absolute !important;
    inset: 20px 0 auto 0 !important;
    z-index: 5 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    max-width: none !important;
    height: 20px !important;
    overflow: visible !important;
    color: #fff6df !important;
    font-size: 13px !important;
    font-weight: 900 !important;
    line-height: 1 !important;
    text-align: center !important;
    white-space: nowrap !important;
    pointer-events: none !important;
  }
}

/* Desktop pressure timer compact final override. */
@media (min-width: 901px) {
  body.adventure-rpg-page .adventure-pressurebar {
    display: grid !important;
    grid-template-columns: auto 280px !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 14px !important;
    padding: 3px 18px !important;
  }

  body.adventure-rpg-page .adventure-pressurebar .monster-charge-head {
    gap: 8px !important;
    color: #12345f !important;
    font-size: 14px !important;
    line-height: 1 !important;
    white-space: nowrap !important;
  }

  body.adventure-rpg-page .adventure-pressurebar .monster-charge-head strong {
    min-width: 36px !important;
    color: #f47a1f !important;
    font-size: 15px !important;
    font-weight: 900 !important;
    line-height: 1 !important;
    text-align: left !important;
  }

  body.adventure-rpg-page .adventure-pressurebar .pressure-track {
    width: 280px !important;
    max-width: 280px !important;
    height: 10px !important;
  }
}

/* Hero defeated frame and light adventure over dialog final override. */
body.adventure-rpg-page .hero-fighter.defeated .hero-sprite {
  background-position: 33.333% 66.666% !important;
}

body.adventure-rpg-page .hero-fighter.defeated {
  filter: none !important;
  opacity: 1 !important;
}

body.adventure-rpg-page .adventure-end-panel {
  position: fixed !important;
  left: 50% !important;
  top: 50% !important;
  z-index: 120 !important;
  width: min(560px, calc(100vw - 32px)) !important;
  max-height: calc(100dvh - 32px) !important;
  overflow: auto !important;
  padding: 22px 24px 24px !important;
  border: 2px solid #2e78df !important;
  border-radius: 8px !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(226, 244, 255, 0.97)) !important;
  box-shadow:
    0 0 0 999vmax rgba(191, 224, 249, 0.48),
    0 18px 36px rgba(30, 83, 150, 0.24),
    inset 0 0 0 1px rgba(255, 255, 255, 0.9) !important;
  color: #12345f !important;
  text-align: center !important;
  transform: translate(-50%, -50%) !important;
}

body.adventure-rpg-page .adventure-end-panel.hidden {
  display: none !important;
}

body.adventure-rpg-page .adventure-end-panel::before {
  content: "" !important;
  position: absolute !important;
  inset: 8px !important;
  border: 1.5px solid rgba(46, 120, 223, 0.18) !important;
  border-radius: 5px !important;
  pointer-events: none !important;
}

body.adventure-rpg-page .adventure-end-panel .result-glow {
  display: none !important;
}

body.adventure-rpg-page .adventure-end-panel .eyebrow {
  margin: 0 0 6px !important;
  color: #3b76c2 !important;
  font-size: 11px !important;
  font-weight: 900 !important;
  letter-spacing: 0 !important;
  text-transform: uppercase !important;
}

body.adventure-rpg-page .adventure-end-panel h2 {
  margin: 0 0 10px !important;
  color: #12345f !important;
  font-size: clamp(22px, 3vw, 30px) !important;
  font-weight: 900 !important;
  line-height: 1.1 !important;
}

body.adventure-rpg-page .adventure-end-panel p:not(.eyebrow) {
  margin: 0 auto 16px !important;
  max-width: 460px !important;
  color: #355d8c !important;
  font-size: 15px !important;
  font-weight: 800 !important;
  line-height: 1.55 !important;
}

body.adventure-rpg-page .adventure-end-panel .deck-name-input {
  display: block !important;
  width: min(360px, 100%) !important;
  height: 46px !important;
  margin: 12px auto 0 !important;
  padding: 0 14px !important;
  border: 2px solid #6da4ee !important;
  border-radius: 6px !important;
  color: #12345f !important;
  background: linear-gradient(180deg, #ffffff, #eaf6ff) !important;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.92) !important;
  font-size: 16px !important;
  font-weight: 900 !important;
  text-align: center !important;
}

body.adventure-rpg-page .adventure-end-panel .adventure-actions {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 12px !important;
  margin-top: 16px !important;
}

body.adventure-rpg-page .adventure-end-panel .icon-button,
body.adventure-rpg-page .adventure-end-panel .primary-button {
  min-height: 42px !important;
  border: 2px solid #2e78df !important;
  border-radius: 6px !important;
  color: #12345f !important;
  background: linear-gradient(180deg, #ffffff, #dff1ff) !important;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.82),
    2px 2px 0 rgba(45, 102, 180, 0.2) !important;
  font-weight: 900 !important;
}

body.adventure-rpg-page .adventure-end-panel .icon-button {
  width: 44px !important;
  min-width: 44px !important;
  padding: 0 !important;
  font-size: 22px !important;
}

body.adventure-rpg-page .adventure-end-panel .primary-button {
  padding: 0 18px !important;
  background: linear-gradient(180deg, #fff8bd, #ffd763) !important;
}

@media (max-width: 520px) {
  body.adventure-rpg-page .adventure-end-panel {
    width: calc(100vw - 20px) !important;
    padding: 18px 14px 20px !important;
  }

  body.adventure-rpg-page .adventure-end-panel p:not(.eyebrow) {
    font-size: 13px !important;
  }
}

/* Easy mode should not show pressure timer: absolute final override. */
body.adventure-rpg-page .adventure-pressurebar.no-pressure,
body.adventure-rpg-page #monsterChargePanel.no-pressure {
  display: none !important;
  height: 0 !important;
  min-height: 0 !important;
  max-height: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  overflow: hidden !important;
}

@media (min-width: 901px) {
  body.adventure-rpg-page .adventure-shell:has(.adventure-pressurebar.no-pressure) {
    grid-template-rows: 58px 50px 208px auto 42px !important;
  }
}

@media (max-width: 900px) {
  body.adventure-rpg-page .adventure-shell:has(.adventure-pressurebar.no-pressure) {
    grid-template-rows: auto auto auto auto auto !important;
  }
}

/* Adventure lower board redesign: match reference layout, keep battle/top intact. */
body.adventure-rpg-page {
  --adventure-lower-bg: url("assets/ui/cloud-kingdom-game-bg.png");
}

body.adventure-rpg-page .adventure-card-area {
  position: relative !important;
  isolation: isolate !important;
  padding: 18px 28px 18px !important;
  border: 2px solid #5d98f0 !important;
  border-radius: 10px !important;
  background:
    linear-gradient(180deg, rgba(244, 250, 255, 0.64), rgba(235, 247, 255, 0.74)),
    var(--adventure-lower-bg) center center / cover no-repeat !important;
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.72),
    0 8px 18px rgba(58, 114, 181, 0.12) !important;
  overflow: hidden !important;
}

body.adventure-rpg-page .adventure-card-area::before {
  content: "ÖÐÓ¢ÎÄµ¥´ÊÅä¶ÔÇø" !important;
  position: relative !important;
  z-index: 1 !important;
  display: grid !important;
  place-items: center !important;
  width: min(360px, 72%) !important;
  height: 38px !important;
  margin: -8px auto 7px !important;
  border: 2px solid #78a8f4 !important;
  border-radius: 0 0 14px 14px !important;
  color: #ffffff !important;
  background: linear-gradient(180deg, #77a7f4 0%, #4f7fd7 100%) !important;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.52),
    0 3px 0 rgba(47, 91, 162, 0.28) !important;
  font-size: 22px !important;
  font-weight: 900 !important;
  line-height: 1 !important;
}

body.adventure-rpg-page .adventure-card-area::after {
  content: "??  µã»÷Ó¢ÎÄºÍÖÐÎÄ£¬Íê³ÉÕýÈ·Åä¶Ô" !important;
  position: relative !important;
  z-index: 1 !important;
  display: block !important;
  margin: 0 auto 10px !important;
  color: #244f98 !important;
  font-size: 15px !important;
  font-weight: 900 !important;
  line-height: 1.2 !important;
  text-align: center !important;
}

body.adventure-rpg-page .adventure-card-head {
  position: relative !important;
  z-index: 2 !important;
  display: flex !important;
  justify-content: center !important;
  min-height: 30px !important;
  height: 30px !important;
  margin: 0 0 4px !important;
}

body.adventure-rpg-page .adventure-card-head > div:first-child {
  display: none !important;
}

body.adventure-rpg-page .adventure-card-stats {
  position: relative !important;
  z-index: 2 !important;
  justify-content: center !important;
  width: 100% !important;
}

body.adventure-rpg-page .adventure-card-stats span:first-child {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: 28px !important;
  padding: 0 18px !important;
  border: 2px solid #78a8f4 !important;
  border-radius: 999px !important;
  color: #244f98 !important;
  background: linear-gradient(180deg, #ffffff, #e6f4ff) !important;
  box-shadow: 2px 2px 0 rgba(58, 114, 181, 0.16) !important;
  font-size: 17px !important;
  font-weight: 900 !important;
}

body.adventure-rpg-page .adventure-card-stats span:first-child::before {
  content: "??" !important;
  margin-right: 8px !important;
}

body.adventure-rpg-page .adventure-card-stats span:not(:first-child) {
  display: none !important;
}

body.adventure-rpg-page .board-wrap {
  position: relative !important;
  z-index: 1 !important;
  padding: 16px 20px !important;
  border: 2px solid rgba(115, 164, 238, 0.84) !important;
  border-radius: 14px !important;
  background: rgba(246, 251, 255, 0.68) !important;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.86),
    0 4px 0 rgba(77, 128, 204, 0.12) !important;
}

body.adventure-rpg-page .board-wrap::before,
body.adventure-rpg-page .board-wrap::after {
  position: absolute !important;
  left: 18px !important;
  z-index: 2 !important;
  display: inline-flex !important;
  align-items: center !important;
  min-height: 24px !important;
  padding: 0 12px !important;
  border: 1.5px solid #6f9fe8 !important;
  border-radius: 999px !important;
  color: #ffffff !important;
  background: linear-gradient(180deg, #7eaef5, #557fd5) !important;
  box-shadow: 1px 1px 0 rgba(47, 91, 162, 0.22) !important;
  font-size: 12px !important;
  font-weight: 900 !important;
  line-height: 1 !important;
}

body.adventure-rpg-page .board-wrap::before {
  content: "Ó¢ÎÄµ¥´Ê£¨µã»÷Ñ¡Ôñ£©" !important;
  top: -12px !important;
}

body.adventure-rpg-page .board-wrap::after {
  content: "ÖÐÎÄÒâË¼£¨µã»÷Ñ¡Ôñ£©" !important;
  top: calc(50% - 12px) !important;
}

body.adventure-rpg-page .adventure-card-area .board,
body.adventure-rpg-page .adventure-card-area .board[data-grade] {
  gap: 12px 18px !important;
  padding-top: 8px !important;
}

body.adventure-rpg-page .adventure-card-area .card {
  border: 2px solid #78a8f4 !important;
  border-radius: 7px !important;
  background: linear-gradient(180deg, #ffffff 0%, #f7fbff 52%, #eaf5ff 100%) !important;
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.82),
    2px 2px 0 rgba(58, 114, 181, 0.2) !important;
  color: #17345f !important;
}

body.adventure-rpg-page .adventure-card-area .card.selected {
  border-color: #f0bd35 !important;
  background: linear-gradient(180deg, #fff9ca, #ffe47b) !important;
}

body.adventure-rpg-page .adventure-rewardbar {
  display: grid !important;
  grid-template-columns: minmax(150px, auto) minmax(0, 1fr) !important;
  gap: 20px !important;
  align-items: center !important;
  min-height: 78px !important;
  padding: 12px 46px !important;
  border: 2px solid #5d98f0 !important;
  border-radius: 10px !important;
  background:
    linear-gradient(180deg, rgba(246, 251, 255, 0.76), rgba(232, 246, 255, 0.82)),
    var(--adventure-lower-bg) center 78% / cover no-repeat !important;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.7) !important;
}

body.adventure-rpg-page .adventure-reward-left {
  display: inline-grid !important;
  grid-template-columns: 42px auto !important;
  align-items: center !important;
  gap: 10px !important;
  color: #244f98 !important;
  font-size: 18px !important;
  font-weight: 900 !important;
}

body.adventure-rpg-page .adventure-reward-left img {
  width: 42px !important;
  height: 42px !important;
}

body.adventure-rpg-page .adventure-reward-details summary {
  display: flex !important;
  justify-content: flex-end !important;
  gap: 12px !important;
  color: #244f98 !important;
}

body.adventure-rpg-page .reward-label {
  color: #244f98 !important;
  font-size: 15px !important;
  font-weight: 900 !important;
}

body.adventure-rpg-page .reward-drop-item {
  display: inline-grid !important;
  justify-items: center !important;
  gap: 2px !important;
  min-width: 62px !important;
  min-height: 60px !important;
  padding: 5px 7px !important;
  border: 2px solid #8bb6f5 !important;
  border-radius: 7px !important;
  color: #244f98 !important;
  background: rgba(255, 255, 255, 0.74) !important;
  box-shadow: 2px 2px 0 rgba(58, 114, 181, 0.16) !important;
  font-size: 13px !important;
  font-weight: 900 !important;
  line-height: 1.1 !important;
}

body.adventure-rpg-page .reward-drop-item img {
  width: 30px !important;
  height: 30px !important;
}

body.adventure-rpg-page .bottom-tabbar {
  border: 2px solid #5d98f0 !important;
  border-radius: 13px !important;
  background: rgba(247, 252, 255, 0.9) !important;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.86),
    0 6px 16px rgba(58, 114, 181, 0.14) !important;
}

body.adventure-rpg-page .tabbar-item {
  border-radius: 9px !important;
  color: #244f98 !important;
  background: transparent !important;
}

body.adventure-rpg-page .tabbar-item.is-active {
  color: #ffffff !important;
  background: linear-gradient(180deg, #79aaf3, #527ed9) !important;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.32) !important;
}

@media (max-width: 900px) {
  body.adventure-rpg-page .adventure-card-area {
    padding: 12px 10px 10px !important;
  }

  body.adventure-rpg-page .adventure-card-area::before {
    width: min(280px, 78%) !important;
    height: 30px !important;
    margin-top: -4px !important;
    font-size: 17px !important;
  }

  body.adventure-rpg-page .adventure-card-area::after {
    margin-bottom: 7px !important;
    font-size: 12px !important;
  }

  body.adventure-rpg-page .board-wrap {
    padding: 12px 8px !important;
  }

  body.adventure-rpg-page .board-wrap::before,
  body.adventure-rpg-page .board-wrap::after {
    left: 8px !important;
    min-height: 20px !important;
    padding-inline: 8px !important;
    font-size: 10px !important;
  }

  body.adventure-rpg-page .adventure-card-area .board,
  body.adventure-rpg-page .adventure-card-area .board[data-grade] {
    gap: 6px !important;
    padding-top: 6px !important;
  }

  body.adventure-rpg-page .adventure-rewardbar {
    grid-template-columns: 1fr !important;
    gap: 6px !important;
    min-height: 64px !important;
    padding: 8px 10px !important;
  }

  body.adventure-rpg-page .adventure-reward-left {
    justify-content: center !important;
    grid-template-columns: 28px auto !important;
    font-size: 15px !important;
  }

  body.adventure-rpg-page .adventure-reward-left img {
    width: 28px !important;
    height: 28px !important;
  }

  body.adventure-rpg-page .adventure-reward-details summary {
    justify-content: center !important;
    gap: 6px !important;
    flex-wrap: wrap !important;
  }

  body.adventure-rpg-page .reward-label {
    width: 100% !important;
    text-align: center !important;
    font-size: 12px !important;
  }

  body.adventure-rpg-page .reward-drop-item {
    min-width: 54px !important;
    min-height: 44px !important;
    padding: 3px 5px !important;
    font-size: 11px !important;
  }

  body.adventure-rpg-page .reward-drop-item img {
    width: 22px !important;
    height: 22px !important;
  }
}

/* Adventure unified lower panel: one continuous background area, random mixed cards kept. */
body.adventure-rpg-page .adventure-lower-panel {
  position: relative !important;
  display: grid !important;
  grid-template-rows: minmax(0, 1fr) auto auto !important;
  gap: 8px !important;
  min-height: 0 !important;
  padding: 0 18px 12px !important;
  border: 2px solid #5d98f0 !important;
  border-radius: 10px !important;
  background:
    linear-gradient(180deg, rgba(244, 250, 255, 0.58), rgba(238, 249, 255, 0.84)),
    var(--adventure-lower-bg) center center / cover no-repeat !important;
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.72),
    0 8px 18px rgba(58, 114, 181, 0.12) !important;
  overflow: hidden !important;
}

body.adventure-rpg-page .adventure-lower-panel::before {
  content: "ÖÐÓ¢ÎÄµ¥´ÊÅä¶ÔÇø" !important;
  position: relative !important;
  z-index: 2 !important;
  display: grid !important;
  place-items: center !important;
  width: min(360px, 72%) !important;
  height: 38px !important;
  margin: -2px auto -4px !important;
  border: 2px solid #78a8f4 !important;
  border-top: 0 !important;
  border-radius: 0 0 14px 14px !important;
  color: #ffffff !important;
  background: linear-gradient(180deg, #77a7f4 0%, #4f7fd7 100%) !important;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.52),
    0 3px 0 rgba(47, 91, 162, 0.28) !important;
  font-size: 22px !important;
  font-weight: 900 !important;
  line-height: 1 !important;
}

body.adventure-rpg-page .adventure-lower-panel::after {
  content: "?? µã»÷Ó¢ÎÄºÍÖÐÎÄ£¬Íê³ÉÕýÈ·Åä¶Ô" !important;
  position: absolute !important;
  left: 0 !important;
  right: 0 !important;
  bottom: calc(78px + 62px + 10px) !important;
  z-index: 2 !important;
  color: #244f98 !important;
  font-size: 14px !important;
  font-weight: 900 !important;
  line-height: 1.2 !important;
  text-align: center !important;
  pointer-events: none !important;
}

body.adventure-rpg-page .adventure-lower-panel .adventure-card-area,
body.adventure-rpg-page .adventure-lower-panel .adventure-rewardbar,
body.adventure-rpg-page .adventure-lower-panel .bottom-tabbar {
  position: relative !important;
  z-index: 1 !important;
  width: 100% !important;
  margin: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

body.adventure-rpg-page .adventure-lower-panel .adventure-card-area {
  display: grid !important;
  grid-template-rows: auto minmax(0, 1fr) !important;
  min-height: 0 !important;
  padding: 0 10px 18px !important;
  border: 0 !important;
  border-radius: 0 !important;
  overflow: visible !important;
}

body.adventure-rpg-page .adventure-lower-panel .adventure-card-area::before,
body.adventure-rpg-page .adventure-lower-panel .adventure-card-area::after,
body.adventure-rpg-page .adventure-lower-panel .board-wrap::before,
body.adventure-rpg-page .adventure-lower-panel .board-wrap::after {
  display: none !important;
  content: none !important;
}

body.adventure-rpg-page .adventure-lower-panel .adventure-card-head {
  height: 34px !important;
  min-height: 34px !important;
  margin: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

body.adventure-rpg-page .adventure-lower-panel .adventure-card-stats span:first-child {
  min-height: 28px !important;
  padding: 0 22px !important;
  border: 2px solid #83aef3 !important;
  border-radius: 999px !important;
  color: #244f98 !important;
  background: rgba(255, 255, 255, 0.82) !important;
  box-shadow: 2px 2px 0 rgba(58, 114, 181, 0.16) !important;
  font-size: 17px !important;
  font-weight: 900 !important;
}

body.adventure-rpg-page .adventure-lower-panel .board-wrap {
  display: grid !important;
  min-height: 0 !important;
  height: 100% !important;
  padding: 22px 26px 34px !important;
  border: 2px solid rgba(115, 164, 238, 0.84) !important;
  border-radius: 16px !important;
  background: rgba(247, 252, 255, 0.62) !important;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.86),
    0 4px 0 rgba(77, 128, 204, 0.12) !important;
  overflow: hidden !important;
}

body.adventure-rpg-page .adventure-lower-panel .board,
body.adventure-rpg-page .adventure-lower-panel .board[data-grade] {
  align-content: center !important;
  gap: var(--match-gap, 12px) !important;
  padding: 0 !important;
}

body.adventure-rpg-page .adventure-lower-panel .card {
  border: 2px solid #78a8f4 !important;
  border-radius: 7px !important;
  background: linear-gradient(180deg, #ffffff 0%, #f7fbff 52%, #eaf5ff 100%) !important;
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.82),
    2px 2px 0 rgba(58, 114, 181, 0.2) !important;
  color: #17345f !important;
}

body.adventure-rpg-page .adventure-lower-panel .adventure-rewardbar {
  display: grid !important;
  grid-template-columns: minmax(170px, auto) minmax(0, 1fr) !important;
  gap: 18px !important;
  align-items: center !important;
  min-height: 72px !important;
  padding: 8px 54px !important;
  border: 2px solid rgba(115, 164, 238, 0.84) !important;
  border-radius: 16px !important;
  background: rgba(247, 252, 255, 0.62) !important;
}

body.adventure-rpg-page .adventure-lower-panel .bottom-tabbar {
  position: static !important;
  left: auto !important;
  bottom: auto !important;
  transform: none !important;
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  min-height: 56px !important;
  width: min(860px, calc(100% - 120px)) !important;
  padding: 5px !important;
  justify-self: center !important;
  border: 2px solid #83aef3 !important;
  border-radius: 16px !important;
  background: rgba(247, 252, 255, 0.86) !important;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.86) !important;
}

body.adventure-rpg-page .adventure-lower-panel .tabbar-item {
  min-height: 44px !important;
  border-radius: 10px !important;
  color: #244f98 !important;
}

body.adventure-rpg-page .adventure-lower-panel .tabbar-item.is-active {
  color: #ffffff !important;
  background: linear-gradient(180deg, #79aaf3, #527ed9) !important;
}

@media (min-width: 901px) {
  body.adventure-rpg-page .adventure-shell,
  body.adventure-rpg-page .adventure-shell:has(.adventure-pressurebar.no-pressure) {
    grid-template-rows: 58px 50px 30px 208px minmax(360px, 1fr) !important;
  }

  body.adventure-rpg-page .adventure-shell:has(.adventure-pressurebar.no-pressure) {
    grid-template-rows: 58px 50px 208px minmax(410px, 1fr) !important;
  }
}

@media (max-width: 900px) {
  body.adventure-rpg-page .adventure-lower-panel {
    gap: 6px !important;
    padding: 0 6px 8px !important;
  }

  body.adventure-rpg-page .adventure-lower-panel::before {
    width: min(270px, 78%) !important;
    height: 30px !important;
    font-size: 17px !important;
  }

  body.adventure-rpg-page .adventure-lower-panel::after {
    bottom: calc(74px + 48px + 6px) !important;
    font-size: 11px !important;
  }

  body.adventure-rpg-page .adventure-lower-panel .adventure-card-area {
    padding: 0 3px 14px !important;
  }

  body.adventure-rpg-page .adventure-lower-panel .board-wrap {
    padding: 12px 8px 24px !important;
    border-radius: 10px !important;
  }

  body.adventure-rpg-page .adventure-lower-panel .adventure-rewardbar {
    grid-template-columns: 1fr !important;
    gap: 4px !important;
    min-height: 74px !important;
    padding: 6px 8px !important;
    border-radius: 10px !important;
  }

  body.adventure-rpg-page .adventure-lower-panel .bottom-tabbar {
    width: calc(100% - 16px) !important;
    min-height: 48px !important;
    border-radius: 12px !important;
  }
}

/* Adventure lower panel separation: battle area and lower area are two distinct blocks. */
body.adventure-rpg-page .adventure-lower-panel {
  margin-top: 8px !important;
  padding-top: 0 !important;
  border: 2px solid #5d98f0 !important;
  border-radius: 10px !important;
  background:
    linear-gradient(180deg, rgba(244, 250, 255, 0.56), rgba(238, 249, 255, 0.84)),
    var(--adventure-lower-bg) center center / cover no-repeat !important;
}

body.adventure-rpg-page .adventure-lower-panel::before {
  margin: 0 auto 4px !important;
  border-top: 0 !important;
  transform: none !important;
}

body.adventure-rpg-page .adventure-lower-panel .adventure-card-area {
  padding-top: 0 !important;
}

body.adventure-rpg-page .adventure-battle-panel {
  margin-bottom: 0 !important;
}

@media (min-width: 901px) {
  body.adventure-rpg-page .adventure-shell,
  body.adventure-rpg-page .adventure-shell:has(.adventure-pressurebar.no-pressure) {
    gap: 6px !important;
  }

  body.adventure-rpg-page .adventure-lower-panel {
    margin-top: 4px !important;
    padding-bottom: 12px !important;
  }
}

@media (max-width: 900px) {
  body.adventure-rpg-page .adventure-lower-panel {
    margin-top: 6px !important;
    padding: 0 6px 8px !important;
  }

  body.adventure-rpg-page .adventure-lower-panel::before {
    margin: 0 auto 3px !important;
  }
}

/* Clear gap between battle panel and lower panel: absolute final override. */
body.adventure-rpg-page .adventure-lower-panel {
  margin-top: 18px !important;
  padding-top: 22px !important;
}

body.adventure-rpg-page .adventure-lower-panel::before {
  margin: 0 auto 8px !important;
  border-top: 2px solid #78a8f4 !important;
  border-radius: 14px !important;
}

body.adventure-rpg-page .adventure-lower-panel .adventure-card-area {
  padding-top: 0 !important;
}

@media (min-width: 901px) {
  body.adventure-rpg-page .adventure-shell,
  body.adventure-rpg-page .adventure-shell:has(.adventure-pressurebar.no-pressure) {
    gap: 8px !important;
  }

  body.adventure-rpg-page .adventure-lower-panel {
    margin-top: 16px !important;
    padding-top: 20px !important;
  }
}

@media (max-width: 900px) {
  body.adventure-rpg-page .adventure-lower-panel {
    margin-top: 14px !important;
    padding-top: 18px !important;
  }

  body.adventure-rpg-page .adventure-lower-panel::before {
    margin-bottom: 6px !important;
  }
}

/* Lower panel background visibility and reward width final override. */
body.adventure-rpg-page .adventure-lower-panel {
  background:
    linear-gradient(180deg, rgba(244, 250, 255, 0.38), rgba(238, 249, 255, 0.64)),
    var(--adventure-lower-bg) center center / 100% 100% no-repeat !important;
}

body.adventure-rpg-page .adventure-lower-panel .adventure-rewardbar {
  width: min(860px, calc(100% - 120px)) !important;
  justify-self: center !important;
  grid-template-columns: minmax(160px, auto) minmax(0, 1fr) !important;
  padding: 8px 32px !important;
}

body.adventure-rpg-page .adventure-lower-panel .adventure-reward-details summary {
  justify-content: flex-end !important;
}

@media (max-width: 900px) {
  body.adventure-rpg-page .adventure-lower-panel .adventure-rewardbar {
    width: calc(100% - 16px) !important;
    padding: 6px 8px !important;
  }
}

/* Lower panel cleanup: remove duplicate counters/hints and center rewards. */
body.adventure-rpg-page .adventure-lower-panel::after {
  display: none !important;
  content: none !important;
}

body.adventure-rpg-page .adventure-lower-panel .adventure-card-head,
body.adventure-rpg-page .adventure-lower-panel .adventure-reward-left {
  display: none !important;
}

body.adventure-rpg-page .adventure-lower-panel .adventure-card-area {
  grid-template-rows: minmax(0, 1fr) !important;
}

body.adventure-rpg-page .adventure-lower-panel .board-wrap {
  padding-top: 20px !important;
  padding-bottom: 20px !important;
}

body.adventure-rpg-page .adventure-lower-panel .adventure-rewardbar {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: min(860px, calc(100% - 120px)) !important;
  min-height: 64px !important;
  padding: 8px 24px !important;
}

body.adventure-rpg-page .adventure-lower-panel .adventure-reward-details {
  width: 100% !important;
}

body.adventure-rpg-page .adventure-lower-panel .adventure-reward-details summary {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 12px !important;
  width: 100% !important;
  cursor: default !important;
}

body.adventure-rpg-page .adventure-lower-panel .adventure-reward-details summary::after {
  display: none !important;
  content: none !important;
}

body.adventure-rpg-page .adventure-lower-panel .adventure-reward-details p {
  display: none !important;
}

@media (max-width: 900px) {
  body.adventure-rpg-page .adventure-lower-panel .adventure-rewardbar {
    width: calc(100% - 16px) !important;
    min-height: 58px !important;
    padding: 6px 8px !important;
  }

  body.adventure-rpg-page .adventure-lower-panel .adventure-reward-details summary {
    gap: 6px !important;
    flex-wrap: wrap !important;
  }
}

/* Adventure lower strip alignment: rewards and tabbar share one exact width. */
body.adventure-rpg-page .adventure-lower-panel {
  --adventure-lower-strip-width: min(860px, calc(100% - 120px));
}

body.adventure-rpg-page .adventure-lower-panel .adventure-rewardbar,
body.adventure-rpg-page .adventure-lower-panel .bottom-tabbar {
  box-sizing: border-box !important;
  width: var(--adventure-lower-strip-width) !important;
  max-width: var(--adventure-lower-strip-width) !important;
  margin-left: auto !important;
  margin-right: auto !important;
  justify-self: center !important;
}

@media (max-width: 900px) {
  body.adventure-rpg-page .adventure-lower-panel {
    --adventure-lower-strip-width: min(648px, calc(100% - 32px));
  }
}

/* Mobile match card text fitting: shrink long words before breaking them. */
body.adventure-rpg-page .adventure-lower-panel .card-text {
  overflow-wrap: break-word !important;
  word-break: normal !important;
  hyphens: none !important;
}

body.adventure-rpg-page .adventure-lower-panel .card.english .card-text {
  white-space: normal !important;
}

@media (max-width: 520px) {
  body.adventure-rpg-page .adventure-lower-panel .card {
    padding-left: 4px !important;
    padding-right: 4px !important;
  }

  body.adventure-rpg-page .adventure-lower-panel .card-text {
    line-height: 1.02 !important;
  }
}

/* Desktop reward bar breathing room. */
@media (min-width: 901px) {
  body.adventure-rpg-page .adventure-lower-panel .adventure-rewardbar {
    min-height: 76px !important;
    padding-top: 12px !important;
    padding-bottom: 12px !important;
  }

  body.adventure-rpg-page .adventure-lower-panel .adventure-reward-details summary {
    row-gap: 8px !important;
  }
}

/* Monster rank icon and desktop boss button placement. */
body.adventure-rpg-page .adventure-battle-panel .monster-hud > div:first-child {
  display: grid !important;
  grid-template-columns: 28px minmax(0, 1fr) auto !important;
  align-items: center !important;
  column-gap: 6px !important;
}

body.adventure-rpg-page .adventure-battle-panel .monster-rank-icon {
  display: block !important;
  grid-column: 1 !important;
  grid-row: 1 !important;
  width: 28px !important;
  height: 28px !important;
  object-fit: contain !important;
  image-rendering: pixelated !important;
  filter: drop-shadow(0 2px 0 rgba(7, 21, 44, 0.42)) !important;
}

body.adventure-rpg-page .adventure-battle-panel .monster-hud .battle-name {
  grid-column: 2 !important;
  min-width: 0 !important;
}

body.adventure-rpg-page .adventure-battle-panel .monster-hud strong {
  grid-column: 3 !important;
}

@media (min-width: 901px) {
  body.adventure-rpg-page .adventure-battle-panel .boss-challenge-button {
    position: absolute !important;
    right: 18px !important;
    bottom: 14px !important;
    top: auto !important;
    left: auto !important;
    z-index: 8 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: auto !important;
    min-width: 118px !important;
    min-height: 34px !important;
    padding: 7px 14px !important;
    border-radius: 8px !important;
    font-size: 13px !important;
  }
}

@media (max-width: 900px) {
  body.adventure-rpg-page .adventure-battle-panel .monster-hud > div:first-child {
    grid-template-columns: 22px minmax(0, 1fr) auto !important;
    column-gap: 4px !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .monster-rank-icon {
    width: 22px !important;
    height: 22px !important;
  }
}

/* Monster HUD final layout: rank icon sits beside, not over, the HP bar. */
body.adventure-rpg-page .adventure-battle-panel .monster-hud {
  display: grid !important;
  grid-template-columns: 36px minmax(0, 1fr) !important;
  grid-template-rows: 14px 24px !important;
  align-items: center !important;
  column-gap: 8px !important;
}

body.adventure-rpg-page .adventure-battle-panel .monster-hud > div:first-child {
  display: contents !important;
}

body.adventure-rpg-page .adventure-battle-panel .monster-rank-icon {
  grid-column: 1 !important;
  grid-row: 1 / span 2 !important;
  align-self: center !important;
  justify-self: center !important;
  width: 34px !important;
  height: 34px !important;
}

body.adventure-rpg-page .adventure-battle-panel .monster-hud .battle-name {
  grid-column: 2 !important;
  grid-row: 1 !important;
  align-self: end !important;
}

body.adventure-rpg-page .adventure-battle-panel .monster-hud .hp-track {
  grid-column: 2 !important;
  grid-row: 2 !important;
  align-self: center !important;
  width: 100% !important;
}

body.adventure-rpg-page .adventure-battle-panel .monster-hud strong {
  grid-column: 2 !important;
  grid-row: 2 !important;
  align-self: center !important;
  justify-self: center !important;
  z-index: 2 !important;
}

body.adventure-rpg-page .adventure-battle-panel .monster-hud .battle-traits {
  display: none !important;
}

@media (min-width: 901px) {
  body.adventure-rpg-page .adventure-battle-panel .boss-challenge-button {
    right: 42px !important;
    bottom: 12px !important;
    max-width: calc(100% - 84px) !important;
    transform: none !important;
  }
}

@media (max-width: 900px) {
  body.adventure-rpg-page .adventure-battle-panel .monster-hud {
    grid-template-columns: 26px minmax(0, 1fr) !important;
    grid-template-rows: 12px 22px !important;
    column-gap: 5px !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .monster-rank-icon {
    width: 24px !important;
    height: 24px !important;
  }
}

/* Mobile battle HUD final correction. */
@media (max-width: 900px) {
  body.adventure-rpg-page .adventure-battle-panel .boss-challenge-button {
    display: none !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .mobile-boss-button {
    position: absolute !important;
    right: 8px !important;
    bottom: 8px !important;
    left: auto !important;
    top: auto !important;
    z-index: 9 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: auto !important;
    min-width: 70px !important;
    max-width: 96px !important;
    min-height: 28px !important;
    padding: 4px 8px !important;
    border-radius: 8px !important;
    font-size: 10px !important;
    line-height: 1 !important;
    white-space: nowrap !important;
    transform: none !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .monster-hud {
    grid-template-columns: 24px minmax(0, 1fr) !important;
    grid-template-rows: 12px 20px !important;
    column-gap: 4px !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .monster-rank-icon {
    width: 22px !important;
    height: 22px !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .monster-hud .hp-track {
    grid-column: 2 !important;
    grid-row: 2 !important;
    align-self: center !important;
    height: 18px !important;
    margin: 0 !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .monster-hud strong,
  body.adventure-rpg-page .adventure-battle-panel .monster-hud #monsterHpText {
    position: static !important;
    grid-column: 2 !important;
    grid-row: 2 !important;
    align-self: center !important;
    justify-self: center !important;
    margin: 0 !important;
    padding: 0 !important;
    transform: translateY(-1px) !important;
    color: #ffffff !important;
    font-size: 9px !important;
    line-height: 1 !important;
    text-align: center !important;
    z-index: 3 !important;
  }
}

/* Mobile battle layout revert: centered boss button and shorter hero HP. */
@media (max-width: 900px) {
  body.adventure-rpg-page .adventure-battle-panel .hero-hud {
    width: 122px !important;
    max-width: 122px !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .hero-hud .hp-track {
    width: 100% !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .mobile-boss-button {
    top: 7px !important;
    right: auto !important;
    bottom: auto !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    min-width: 74px !important;
    max-width: 96px !important;
    min-height: 28px !important;
  }
}

/* Mobile match text final fit: actually apply per-card text scaling. */
@media (max-width: 520px) {
  body.adventure-rpg-page .adventure-lower-panel .card-text {
    display: block !important;
    max-width: 100% !important;
    font-size: calc(var(--match-font-size, 15px) * var(--text-scale, 1)) !important;
    line-height: 1 !important;
  }

  body.adventure-rpg-page .adventure-lower-panel .card.english .card-text {
    overflow-wrap: normal !important;
    word-break: normal !important;
  }
}

/* Mobile final battle balance: hero HP matches boss HP, boss button clears icon. */
@media (max-width: 900px) {
  body.adventure-rpg-page .adventure-battle-panel .hero-hud {
    width: 82px !important;
    max-width: 82px !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .hero-hud .hp-track {
    width: 100% !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .hero-hud .hp-track,
  body.adventure-rpg-page .adventure-battle-panel .monster-hud .hp-track {
    height: 18px !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .mobile-boss-button {
    left: 43% !important;
    top: 7px !important;
    transform: translateX(-50%) !important;
  }
}

/* Desktop monster HP text final correction: keep number centered on HP bar. */
@media (min-width: 901px) {
  body.adventure-rpg-page .adventure-battle-panel .monster-hud {
    grid-template-columns: 40px minmax(0, 1fr) !important;
    grid-template-rows: 18px 22px !important;
    column-gap: 8px !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .monster-hud .hp-track {
    grid-column: 2 !important;
    grid-row: 2 !important;
    align-self: center !important;
    height: 18px !important;
    margin: 0 !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .monster-hud strong,
  body.adventure-rpg-page .adventure-battle-panel .monster-hud #monsterHpText {
    position: static !important;
    grid-column: 2 !important;
    grid-row: 2 !important;
    align-self: center !important;
    justify-self: center !important;
    margin: 0 !important;
    padding: 0 !important;
    transform: translateY(-1px) !important;
    color: #ffffff !important;
    font-size: 12px !important;
    line-height: 1 !important;
    text-align: center !important;
    z-index: 5 !important;
  }
}

/* Pressure timer number readability. */
body.adventure-rpg-page .adventure-pressurebar .monster-charge-head strong,
body.adventure-rpg-page .adventure-pressurebar #pressureTimer {
  color: #163a70 !important;
  text-shadow: none !important;
}

/* Lobby settings menu: match the shared blue-white settings panel without covering controls. */
body.landing-page .landing-statusbar {
  position: relative !important;
  z-index: 1200 !important;
  overflow: visible !important;
}

body.landing-page .landing-player {
  position: relative !important;
  overflow: visible !important;
}

body.landing-page .landing-player > img {
  flex: 0 0 auto !important;
}

body.landing-page .landing-player > span {
  flex: 0 0 auto !important;
  color: #17345f !important;
  font-size: 16px !important;
  font-weight: 900 !important;
  line-height: 1 !important;
  white-space: nowrap !important;
}

body.landing-page .lobby-settings {
  position: relative !important;
  z-index: 1300 !important;
  flex: 0 0 auto !important;
}

body.landing-page .lobby-settings > summary {
  display: inline-grid !important;
  place-items: center !important;
  width: 32px !important;
  height: 32px !important;
  min-width: 32px !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 999px !important;
  background: transparent !important;
  list-style: none !important;
  cursor: pointer !important;
}

body.landing-page .lobby-settings > summary::-webkit-details-marker {
  display: none !important;
}

body.landing-page .lobby-settings > summary img {
  display: block !important;
  width: 23px !important;
  height: 23px !important;
  object-fit: contain !important;
  image-rendering: pixelated !important;
  filter: drop-shadow(0 2px 0 rgba(87, 132, 190, 0.18)) !important;
}

body.landing-page .lobby-settings-popover {
  position: absolute !important;
  top: calc(100% + 14px) !important;
  right: -6px !important;
  z-index: 9999 !important;
  display: grid !important;
  gap: 12px !important;
  box-sizing: border-box !important;
  width: min(480px, calc(100vw - 32px)) !important;
  padding: 20px !important;
  color: #17345f !important;
  background: linear-gradient(180deg, rgba(250, 255, 255, 0.98), rgba(235, 249, 255, 0.96)) !important;
  border: 3px solid #8fc1f4 !important;
  border-radius: 20px !important;
  box-shadow:
    0 18px 38px rgba(62, 116, 176, 0.24),
    inset 0 0 0 1px rgba(255, 255, 255, 0.9) !important;
}

body.landing-page .lobby-settings-popover strong {
  color: #17345f !important;
  font-size: 24px !important;
  font-weight: 900 !important;
  line-height: 1.1 !important;
}

body.landing-page .lobby-settings-action {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: 58px !important;
  padding: 0 18px !important;
  color: #17345f !important;
  text-align: center !important;
  text-decoration: none !important;
  background: rgba(255, 255, 255, 0.88) !important;
  border: 2px solid #8fc1f4 !important;
  border-radius: 13px !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95), 0 3px 0 rgba(97, 154, 218, 0.12) !important;
  font: inherit !important;
  font-size: 22px !important;
  font-weight: 900 !important;
  line-height: 1.1 !important;
  cursor: pointer !important;
}

body.landing-page .lobby-settings-action:hover,
body.landing-page .lobby-settings-action:focus-visible {
  background: linear-gradient(180deg, #ffffff, #edf8ff) !important;
  transform: translateY(-1px) !important;
}

@media (max-width: 560px) {
  body.landing-page .lobby-settings-popover {
    right: -10px !important;
    width: min(360px, calc(100vw - 20px)) !important;
    padding: 16px !important;
    border-radius: 18px !important;
  }

  body.landing-page .lobby-settings-popover strong {
    font-size: 20px !important;
  }

  body.landing-page .lobby-settings-action {
    min-height: 50px !important;
    font-size: 18px !important;
  }
}

/* Adventure active pet evolution scale: young < mature < final, kept behind the hero. */
@media (min-width: 761px) {
  body.adventure-rpg-page .adventure-battle-panel .pet-fighter[data-pet-stage="1"] {
    width: clamp(68px, 6.2vw, 86px) !important;
    height: clamp(68px, 6.2vw, 86px) !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .pet-fighter[data-pet-stage="2"] {
    width: clamp(88px, 7.8vw, 112px) !important;
    height: clamp(88px, 7.8vw, 112px) !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .pet-fighter[data-pet-stage="3"] {
    width: clamp(104px, 9vw, 128px) !important;
    height: clamp(104px, 9vw, 128px) !important;
  }
}

@media (max-width: 760px) {
  body.adventure-rpg-page .adventure-battle-panel .pet-fighter[data-pet-stage="1"] {
    width: 46px !important;
    height: 46px !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .pet-fighter[data-pet-stage="2"] {
    width: 56px !important;
    height: 56px !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .pet-fighter[data-pet-stage="3"] {
    width: 58px !important;
    height: 58px !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .pet-battle-name {
    top: -24px !important;
    z-index: 20 !important;
  }
}

@media (max-width: 380px) {
  body.adventure-rpg-page .adventure-battle-panel .pet-fighter[data-pet-stage="1"] {
    width: 42px !important;
    height: 42px !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .pet-fighter[data-pet-stage="2"] {
    width: 50px !important;
    height: 50px !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .pet-fighter[data-pet-stage="3"] {
    width: 52px !important;
    height: 52px !important;
  }
}

/* Adventure hero archive final skin: align with the current cloud-blue UI system. */
body.adventure-rpg-page .hero-profile-page {
  z-index: 9990 !important;
  padding: clamp(12px, 2.4vw, 26px) !important;
  background:
    linear-gradient(180deg, rgba(220, 241, 255, 0.58), rgba(236, 249, 255, 0.72)),
    rgba(198, 229, 255, 0.5) !important;
  backdrop-filter: blur(5px) !important;
}

body.adventure-rpg-page .hero-profile-page .profile-frame {
  width: min(980px, calc(100vw - 28px)) !important;
  max-height: min(760px, calc(100dvh - 26px)) !important;
  padding: clamp(14px, 2vw, 22px) !important;
  color: #17345f !important;
  border: 2px solid #8fc1f4 !important;
  border-radius: 16px !important;
  background:
    radial-gradient(circle at 14% 0%, rgba(255, 248, 207, 0.42), transparent 30%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(232, 247, 255, 0.96)) !important;
  box-shadow:
    0 20px 42px rgba(48, 99, 164, 0.24),
    inset 0 0 0 1px rgba(255, 255, 255, 0.92) !important;
}

body.adventure-rpg-page .hero-profile-page .profile-header {
  margin-bottom: 16px !important;
  padding-bottom: 12px !important;
  border-bottom: 1.5px solid rgba(94, 153, 229, 0.28) !important;
}

body.adventure-rpg-page .hero-profile-page .profile-header .eyebrow {
  color: #3d78c5 !important;
  text-shadow: none !important;
}

body.adventure-rpg-page .hero-profile-page .profile-header h2 {
  color: #17345f !important;
  text-shadow: none !important;
}

body.adventure-rpg-page .hero-profile-page .icon-button {
  color: #17345f !important;
  border: 2px solid #8fc1f4 !important;
  border-radius: 12px !important;
  background: linear-gradient(180deg, #ffffff, #e9f7ff) !important;
  box-shadow: 0 4px 0 rgba(84, 139, 205, 0.18) !important;
}

body.adventure-rpg-page .hero-profile-page .profile-grid {
  gap: 14px !important;
}

body.adventure-rpg-page .hero-profile-page .profile-card {
  color: #17345f !important;
  border: 2px solid #8fc1f4 !important;
  border-radius: 12px !important;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(235, 248, 255, 0.92)) !important;
  box-shadow:
    0 5px 0 rgba(82, 139, 205, 0.13),
    inset 0 0 0 1px rgba(255, 255, 255, 0.92) !important;
}

body.adventure-rpg-page .hero-profile-page .profile-card h3 {
  color: #17345f !important;
  text-shadow: none !important;
}

body.adventure-rpg-page .hero-profile-page .profile-card p,
body.adventure-rpg-page .hero-profile-page .profile-stat span,
body.adventure-rpg-page .hero-profile-page .monster-log-row span {
  color: #496c96 !important;
  text-shadow: none !important;
}

body.adventure-rpg-page .hero-profile-page .profile-stat,
body.adventure-rpg-page .hero-profile-page .monster-log-row {
  min-height: 34px !important;
  color: #24476f !important;
  border-bottom: 1.5px solid rgba(95, 151, 222, 0.24) !important;
}

body.adventure-rpg-page .hero-profile-page .profile-stat strong,
body.adventure-rpg-page .hero-profile-page .monster-log-row strong {
  color: #17345f !important;
  text-shadow: none !important;
}

body.adventure-rpg-page .hero-profile-page .profile-portrait {
  border: 2px solid #8fc1f4 !important;
  border-radius: 12px !important;
  background:
    linear-gradient(180deg, rgba(226, 246, 255, 0.98), rgba(188, 226, 255, 0.88)) !important;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.88) !important;
}

body.adventure-rpg-page .hero-profile-page .ability-row,
body.adventure-rpg-page .hero-profile-page .leaderboard-row,
body.adventure-rpg-page .hero-profile-page .leaderboard-empty {
  color: #17345f !important;
  border: 2px solid #8fc1f4 !important;
  border-radius: 10px !important;
  background: linear-gradient(180deg, #ffffff 0%, #eaf7ff 100%) !important;
  box-shadow:
    0 3px 0 rgba(82, 139, 205, 0.12),
    inset 0 0 0 1px rgba(255, 255, 255, 0.92) !important;
}

body.adventure-rpg-page .hero-profile-page .ability-row.unlocked {
  background: linear-gradient(180deg, #fff9de 0%, #e9f8ff 100%) !important;
}

body.adventure-rpg-page .hero-profile-page .ability-row strong,
body.adventure-rpg-page .hero-profile-page .leaderboard-row strong {
  color: #17345f !important;
  text-shadow: none !important;
}

body.adventure-rpg-page .hero-profile-page .ability-row span,
body.adventure-rpg-page .hero-profile-page .leaderboard-row span,
body.adventure-rpg-page .hero-profile-page .leaderboard-empty {
  color: #31557f !important;
  text-shadow: none !important;
}

body.adventure-rpg-page .hero-profile-page .leaderboard-row em {
  color: #d99a1f !important;
  text-shadow: none !important;
}

body.adventure-rpg-page .hero-profile-page .ability-icon {
  filter: drop-shadow(1px 2px 0 rgba(37, 83, 141, 0.2)) !important;
}

@media (max-width: 760px) {
  body.adventure-rpg-page .hero-profile-page {
    align-items: start !important;
    padding: 10px !important;
  }

  body.adventure-rpg-page .hero-profile-page .profile-frame {
    width: calc(100vw - 20px) !important;
    max-height: calc(100dvh - 20px) !important;
    padding: 12px !important;
    border-radius: 14px !important;
  }

  body.adventure-rpg-page .hero-profile-page .profile-grid {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  body.adventure-rpg-page .hero-profile-page .hero-card {
    grid-column: auto !important;
    grid-template-columns: 86px minmax(0, 1fr) !important;
    gap: 12px !important;
  }

  body.adventure-rpg-page .hero-profile-page .profile-portrait {
    width: 82px !important;
    height: 82px !important;
  }

  body.adventure-rpg-page .hero-profile-page .profile-portrait .sprite {
    width: 110px !important;
    height: 110px !important;
  }
}

/* Adventure parent dashboard: align with the current cloud-blue UI system. */
body.adventure-rpg-page .parent-report-page {
  z-index: 9990 !important;
  display: grid !important;
  place-items: center !important;
  padding: clamp(12px, 2.4vw, 26px) !important;
  background:
    linear-gradient(180deg, rgba(219, 241, 255, 0.58), rgba(237, 249, 255, 0.76)),
    rgba(199, 229, 255, 0.58) !important;
  backdrop-filter: blur(6px);
}

body.adventure-rpg-page .parent-report-page.hidden {
  display: none !important;
}

body.adventure-rpg-page .parent-report-page .report-frame {
  width: min(980px, calc(100vw - 28px)) !important;
  max-height: min(760px, calc(100dvh - 26px)) !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: clamp(14px, 2vw, 22px) !important;
  overflow: auto !important;
  color: #17345f !important;
  border: 2px solid #8fc1f4 !important;
  border-radius: 18px !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(232, 247, 255, 0.9)),
    rgba(246, 252, 255, 0.92) !important;
  box-shadow:
    0 22px 48px rgba(48, 102, 164, 0.24),
    inset 0 0 0 1px rgba(255, 255, 255, 0.9) !important;
}

body.adventure-rpg-page .parent-report-page .profile-header {
  margin-bottom: 16px !important;
  padding-bottom: 12px !important;
  border-bottom: 1.5px solid rgba(94, 153, 229, 0.28) !important;
}

body.adventure-rpg-page .parent-report-page .profile-header .eyebrow {
  color: #3d78c5 !important;
  text-shadow: none !important;
}

body.adventure-rpg-page .parent-report-page .profile-header h2 {
  color: #17345f !important;
  text-shadow: none !important;
}

body.adventure-rpg-page .parent-report-page #closeParentReportBtn {
  min-height: 42px !important;
  padding: 8px 18px !important;
  border: 2px solid rgba(242, 178, 68, 0.95) !important;
  border-radius: 12px !important;
  color: #7a4b00 !important;
  background: linear-gradient(180deg, #fff4bf, #ffd66f) !important;
  box-shadow: 0 5px 12px rgba(171, 119, 23, 0.18) !important;
  text-shadow: none !important;
}

body.adventure-rpg-page .report-summary-grid {
  gap: 12px !important;
  margin-bottom: 14px !important;
}

body.adventure-rpg-page .report-summary-card {
  min-height: 92px !important;
  padding: 14px !important;
  border: 2px solid #8fc1f4 !important;
  border-radius: 14px !important;
  color: #17345f !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(231, 246, 255, 0.92)) !important;
  box-shadow:
    0 8px 18px rgba(53, 106, 170, 0.13),
    inset 0 0 0 1px rgba(255, 255, 255, 0.9) !important;
}

body.adventure-rpg-page .report-summary-card span {
  color: #3374bd !important;
  font-size: 13px !important;
  font-weight: 900 !important;
  text-shadow: none !important;
}

body.adventure-rpg-page .report-summary-card strong {
  margin-top: 8px !important;
  color: #17345f !important;
  font-size: clamp(26px, 4.5vw, 34px) !important;
  line-height: 1 !important;
  text-shadow: none !important;
}

body.adventure-rpg-page .report-summary-card.accent {
  background:
    linear-gradient(180deg, rgba(255, 249, 222, 0.98), rgba(222, 246, 228, 0.92)) !important;
  border-color: #95d5ad !important;
}

body.adventure-rpg-page .parent-report-page .profile-card {
  color: #17345f !important;
  border: 2px solid #8fc1f4 !important;
  border-radius: 14px !important;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(235, 248, 255, 0.92)) !important;
  box-shadow:
    0 8px 18px rgba(53, 106, 170, 0.13),
    inset 0 0 0 1px rgba(255, 255, 255, 0.9) !important;
}

body.adventure-rpg-page .parent-report-page .profile-card h3,
body.adventure-rpg-page .parent-report-page .report-card-header h3 {
  color: #17345f !important;
  text-shadow: none !important;
}

body.adventure-rpg-page .parent-report-page .profile-card span,
body.adventure-rpg-page .parent-report-page .profile-card p,
body.adventure-rpg-page .parent-report-page .report-card-header span {
  color: #496c96 !important;
  text-shadow: none !important;
}

body.adventure-rpg-page .parent-report-page .report-deck-row,
body.adventure-rpg-page .parent-report-page .report-word-row,
body.adventure-rpg-page .parent-report-page .report-weak-row {
  color: #17345f !important;
  border: 2px solid rgba(143, 193, 244, 0.82) !important;
  border-radius: 12px !important;
  background: linear-gradient(180deg, #ffffff 0%, #eaf7ff 100%) !important;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.88) !important;
  text-shadow: none !important;
}

body.adventure-rpg-page .parent-report-page .report-series-tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

body.adventure-rpg-page .parent-report-page .report-series-tab {
  display: grid;
  gap: 3px;
  min-height: 58px;
  padding: 8px 10px;
  border: 2px solid rgba(143, 193, 244, 0.86);
  border-radius: 12px;
  color: #24537f;
  background: linear-gradient(180deg, #ffffff 0%, #eaf7ff 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.88);
  text-align: left;
  cursor: pointer;
}

body.adventure-rpg-page .parent-report-page .report-series-tab strong {
  overflow: hidden;
  color: #17345f;
  font-size: 14px;
  font-weight: 950;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.adventure-rpg-page .parent-report-page .report-series-tab span {
  color: #54789f !important;
  font-size: 11px;
  font-weight: 850;
}

body.adventure-rpg-page .parent-report-page .report-series-tab.active {
  border-color: #f0bf4e;
  background: linear-gradient(180deg, #fff8dc 0%, #eaf7ff 100%);
  box-shadow:
    0 6px 14px rgba(213, 158, 45, 0.16),
    inset 0 0 0 1px rgba(255, 255, 255, 0.9);
}

body.adventure-rpg-page .parent-report-page .report-deck-stack {
  display: grid;
  gap: 10px;
}

body.adventure-rpg-page .parent-report-page .report-deck-row.active {
  border-color: #f0bf4e !important;
  background: linear-gradient(180deg, #fff8dc 0%, #ecf8ff 100%) !important;
}

body.adventure-rpg-page .parent-report-page .report-deck-row-top strong,
body.adventure-rpg-page .parent-report-page .report-weak-row b,
body.adventure-rpg-page .parent-report-page .report-word-row strong {
  color: #17345f !important;
  text-shadow: none !important;
}

body.adventure-rpg-page .parent-report-page .report-deck-row-top em {
  color: #2c9a63 !important;
  text-shadow: none !important;
}

body.adventure-rpg-page .parent-report-page .report-deck-row-meta,
body.adventure-rpg-page .parent-report-page .report-weak-row em {
  color: #54789f !important;
  text-shadow: none !important;
}

body.adventure-rpg-page .parent-report-page .report-weak-card {
  display: none !important;
}

body.adventure-rpg-page .parent-report-page .report-weak-row > strong {
  color: #d99a1f !important;
  text-shadow: none !important;
}

body.adventure-rpg-page .parent-report-page .report-weak-row i,
body.adventure-rpg-page .parent-report-page .report-word-row.bad strong {
  color: #dc6a58 !important;
  text-shadow: none !important;
}

body.adventure-rpg-page .parent-report-page .report-word-row.good strong {
  color: #2c9a63 !important;
  text-shadow: none !important;
}

body.adventure-rpg-page .parent-report-page .report-word-row.warn strong {
  color: #d99a1f !important;
  text-shadow: none !important;
}

body.adventure-rpg-page .parent-report-page .report-word-table {
  overflow: auto !important;
  border: 2px solid rgba(143, 193, 244, 0.82) !important;
  border-radius: 12px !important;
  background: rgba(255, 255, 255, 0.7) !important;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.88) !important;
}

body.adventure-rpg-page .parent-report-page .report-word-head {
  color: #31557f !important;
  background: linear-gradient(180deg, #e9f7ff, #d9efff) !important;
  text-shadow: none !important;
}

body.adventure-rpg-page .parent-report-page .report-progress-track,
body.adventure-rpg-page .parent-report-page .report-deck-progress {
  border: 1.5px solid rgba(95, 151, 222, 0.55) !important;
  border-radius: 999px !important;
  background: rgba(224, 240, 255, 0.88) !important;
  box-shadow: inset 0 1px 2px rgba(57, 96, 150, 0.12) !important;
}

body.adventure-rpg-page .parent-report-page .report-progress-track i,
body.adventure-rpg-page .parent-report-page .report-deck-progress i {
  border-radius: inherit !important;
  background: linear-gradient(90deg, #74d99b, #72b6ff) !important;
}

@media (max-width: 760px) {
  body.adventure-rpg-page .parent-report-page {
    align-items: start !important;
    padding: 10px !important;
  }

  body.adventure-rpg-page .parent-report-page .report-frame {
    width: calc(100vw - 20px) !important;
    max-height: calc(100dvh - 20px) !important;
    padding: 12px !important;
    border-radius: 14px !important;
  }

  body.adventure-rpg-page .report-summary-grid,
  body.adventure-rpg-page .report-layout {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  body.adventure-rpg-page .report-summary-card {
    min-height: 78px !important;
  }

  body.adventure-rpg-page .parent-report-page .report-series-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  body.adventure-rpg-page .parent-report-page .report-series-tab {
    min-height: 50px;
    padding: 7px 9px;
    border-radius: 10px;
  }

  body.adventure-rpg-page .parent-report-page .report-series-tab strong {
    font-size: 13px;
  }

  body.adventure-rpg-page .parent-report-page .report-deck-row {
    min-height: 72px !important;
  }
}
/* Shared learning-game background: Adventure Match. */
html:has(body.adventure-rpg-page),
body.adventure-rpg-page {
  background:
    linear-gradient(180deg, rgba(160, 222, 255, 0.16), rgba(255, 255, 255, 0.05)),
    url("assets/ui/cloud-kingdom-game-bg.png") center bottom / cover fixed no-repeat,
    #bdeeff !important;
}

body.adventure-rpg-page .adventure-shell {
  background:
    linear-gradient(180deg, rgba(160, 222, 255, 0.1), rgba(255, 255, 255, 0.03)),
    url("assets/ui/cloud-kingdom-game-bg.png") center bottom / cover fixed no-repeat !important;
}

body.adventure-rpg-page .adventure-battle-panel,
body.adventure-rpg-page .adventure-lower-panel {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.08)),
    url("assets/ui/cloud-kingdom-game-bg.png") center bottom / cover no-repeat !important;
}

body.adventure-rpg-page .adventure-lower-panel::before,
body.adventure-rpg-page .adventure-lower-panel::after {
  opacity: 0.22 !important;
}

@media (max-width: 720px) {
  html:has(body.adventure-rpg-page),
  body.adventure-rpg-page,
  body.adventure-rpg-page .adventure-shell {
    background:
      linear-gradient(180deg, rgba(160, 222, 255, 0.14), rgba(255, 255, 255, 0.04)),
      url("assets/ui/cloud-kingdom-game-bg.png") center bottom / cover scroll no-repeat,
      #bdeeff !important;
  }
}

/* Adventure Design System migration v1: unified two-row topbar and responsive game layout. */
html:has(body.adventure-rpg-page),
body.adventure-rpg-page {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  margin: 0 !important;
  overflow-x: hidden !important;
  color: var(--lq-ink, #17345f) !important;
}

body.adventure-rpg-page *,
body.adventure-rpg-page *::before,
body.adventure-rpg-page *::after {
  box-sizing: border-box !important;
}

body.adventure-rpg-page .adventure-shell {
  width: min(1180px, calc(100vw - 28px)) !important;
  max-width: min(1180px, calc(100vw - 28px)) !important;
  min-height: 100dvh !important;
  margin: 0 auto !important;
  padding: 12px 0 calc(96px + env(safe-area-inset-bottom)) !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(330px, 0.7fr) !important;
  grid-template-rows: auto auto auto minmax(0, 1fr) !important;
  gap: 10px !important;
  overflow: visible !important;
}

body.adventure-rpg-page .adventure-topbar,
body.adventure-rpg-page .adventure-controlbar,
body.adventure-rpg-page .monster-charge-panel,
body.adventure-rpg-page .adventure-battle-panel,
body.adventure-rpg-page .adventure-lower-panel,
body.adventure-rpg-page .adventure-card-area,
body.adventure-rpg-page .adventure-rewardbar {
  min-width: 0 !important;
  max-width: 100% !important;
  border: 2px solid #8fc1f4 !important;
  border-radius: var(--lq-radius-xl, 24px) !important;
  background: rgba(255, 255, 255, 0.84) !important;
  box-shadow: var(--lq-shadow-soft, 0 8px 18px rgba(65, 129, 196, 0.14)) !important;
}

body.adventure-rpg-page .adventure-topbar {
  grid-column: 1 / -1 !important;
  min-height: 76px !important;
  padding: 10px 12px !important;
  display: grid !important;
  grid-template-columns: 44px minmax(150px, 1fr) minmax(240px, 0.85fr) auto auto auto auto !important;
  align-items: center !important;
  gap: 8px !important;
  overflow: visible !important;
}

body.adventure-rpg-page .adventure-back-button,
body.adventure-rpg-page .guide-top-button,
body.adventure-rpg-page .adventure-icon-button,
body.adventure-rpg-page .adventure-settings > summary,
body.adventure-rpg-page .adventure-hero-chip,
body.adventure-rpg-page .adventure-control-button,
body.adventure-rpg-page .adventure-control-field,
body.adventure-rpg-page .adventure-more-menu > summary,
body.adventure-rpg-page .settings-action,
body.adventure-rpg-page .upload-inline {
  min-width: 0 !important;
  border: 2px solid #8fc1f4 !important;
  border-radius: 16px !important;
  background: rgba(255, 255, 255, 0.9) !important;
  color: #17345f !important;
  box-shadow: 0 6px 14px rgba(65, 129, 196, 0.12) !important;
  font-family: "Inter", "Noto Sans SC", system-ui, sans-serif !important;
  font-weight: 800 !important;
}

body.adventure-rpg-page .adventure-back-button,
body.adventure-rpg-page .guide-top-button,
body.adventure-rpg-page .adventure-icon-button,
body.adventure-rpg-page .adventure-settings > summary {
  width: 44px !important;
  height: 44px !important;
  display: grid !important;
  place-items: center !important;
  padding: 0 !important;
  text-decoration: none !important;
  flex: 0 0 auto !important;
}

body.adventure-rpg-page .guide-top-button {
  width: 58px !important;
  font-size: 14px !important;
}

body.adventure-rpg-page .adventure-title-block {
  min-width: 0 !important;
  display: grid !important;
  gap: 2px !important;
}

body.adventure-rpg-page .adventure-title-block h1 {
  margin: 0 !important;
  color: #17345f !important;
  font-size: clamp(20px, 2.3vw, 30px) !important;
  line-height: 1.05 !important;
  letter-spacing: 0 !important;
  white-space: nowrap !important;
}

body.adventure-rpg-page .adventure-title-block p {
  margin: 0 !important;
  color: #3d78bd !important;
  font-size: clamp(10px, 1vw, 13px) !important;
  line-height: 1 !important;
  font-weight: 900 !important;
  letter-spacing: 0 !important;
  text-transform: uppercase !important;
}

body.adventure-rpg-page .adventure-top-deck {
  height: 50px !important;
  padding: 6px 10px !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  grid-template-rows: auto auto !important;
  gap: 1px 8px !important;
  align-content: center !important;
  overflow: hidden !important;
}

body.adventure-rpg-page .adventure-top-deck > span {
  grid-column: 1 / -1 !important;
  color: #3d78bd !important;
  font-size: 10px !important;
  line-height: 1 !important;
  font-weight: 900 !important;
}

body.adventure-rpg-page .adventure-top-deck select {
  position: static !important;
  grid-column: 1 / -1 !important;
  grid-row: 2 !important;
  width: 100% !important;
  min-width: 0 !important;
  height: 22px !important;
  padding: 0 18px 0 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  opacity: 1 !important;
  appearance: none !important;
  background: transparent !important;
  color: #17345f !important;
  font-size: 13px !important;
  line-height: 1 !important;
  font-weight: 900 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  cursor: pointer !important;
}

body.adventure-rpg-page .adventure-top-deck .control-mirror {
  display: none !important;
}

body.adventure-rpg-page .adventure-top-deck small {
  min-width: 0 !important;
  overflow: hidden !important;
  color: #6a7f9c !important;
  font-size: 10px !important;
  line-height: 1 !important;
  white-space: nowrap !important;
  text-overflow: ellipsis !important;
}

body.adventure-rpg-page .adventure-hero-chip {
  height: 50px !important;
  padding: 5px 9px !important;
  display: inline-grid !important;
  grid-template-columns: 28px auto !important;
  grid-template-rows: auto auto !important;
  column-gap: 6px !important;
  align-items: center !important;
  justify-content: center !important;
  white-space: nowrap !important;
}

body.adventure-rpg-page .adventure-hero-avatar {
  grid-row: 1 / 3 !important;
  width: 28px !important;
  height: 28px !important;
}

body.adventure-rpg-page .adventure-hero-chip span:not(.adventure-hero-avatar) {
  font-size: 11px !important;
  line-height: 1 !important;
  color: #3d78bd !important;
}

body.adventure-rpg-page .adventure-hero-chip strong {
  font-size: 14px !important;
  line-height: 1 !important;
}

body.adventure-rpg-page .adventure-top-actions {
  display: contents !important;

  justify-self: end !important;
  width: max-content !important;
  max-width: 100% !important;}

body.adventure-rpg-page .sound-toggle-button {
  font-size: 0 !important;
}

body.adventure-rpg-page .sound-toggle-button::before {
  content: "??" !important;
  font-size: 20px !important;
  line-height: 1 !important;
}

body.adventure-rpg-page .sound-toggle-button.is-muted::before {
  content: "??" !important;
}

body.adventure-rpg-page .adventure-settings {
  position: relative !important;
  width: 44px !important;
  height: 44px !important;
}

body.adventure-rpg-page .adventure-settings > summary {
  list-style: none !important;
  cursor: pointer !important;
}

body.adventure-rpg-page .adventure-settings > summary::-webkit-details-marker {
  display: none !important;
}

body.adventure-rpg-page .adventure-settings > summary img {
  width: 24px !important;
  height: 24px !important;
}

body.adventure-rpg-page .adventure-settings-menu,
body.adventure-rpg-page .adventure-more-panel {
  z-index: 80 !important;
  border: 2px solid #8fc1f4 !important;
  border-radius: 20px !important;
  background: rgba(255, 255, 255, 0.96) !important;
  box-shadow: var(--lq-shadow-panel, 0 18px 34px rgba(38, 88, 145, 0.2)) !important;
}

body.adventure-rpg-page .adventure-controlbar {
  grid-column: 1 / -1 !important;
  min-height: 56px !important;
  padding: 8px 10px !important;
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  overflow: visible !important;
}

body.adventure-rpg-page .adventure-controlbar .adventure-control-button,
body.adventure-rpg-page .adventure-controlbar .adventure-control-field,
body.adventure-rpg-page .adventure-more-menu > summary,
body.adventure-rpg-page .adventure-controlbar .settings-action,
body.adventure-rpg-page .adventure-controlbar .upload-inline {
  min-height: 42px !important;
  padding: 6px 12px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  white-space: nowrap !important;
  font-size: 13px !important;
  line-height: 1.1 !important;
}

body.adventure-rpg-page .adventure-controlbar select {
  max-width: 104px !important;
  min-width: 0 !important;
  border: 0 !important;
  background: transparent !important;
  color: #17345f !important;
  font-weight: 900 !important;
}

body.adventure-rpg-page .difficulty-top-button {
  background: linear-gradient(180deg, #fff6cf, #ffe199) !important;
  border-color: #ffc24b !important;
}

body.adventure-rpg-page .monster-charge-panel {
  grid-column: 1 / -1 !important;
  min-height: 40px !important;
  padding: 7px 12px !important;
}

body.adventure-rpg-page .monster-charge-panel.no-pressure {
  display: none !important;
}

body.adventure-rpg-page .adventure-lower-panel {
  grid-column: 1 !important;
  grid-row: 4 !important;
  display: grid !important;
  grid-template-rows: auto minmax(0, 1fr) auto !important;
  gap: 8px !important;
  min-height: 0 !important;
  padding: 10px !important;
  overflow: visible !important;
}

body.adventure-rpg-page .adventure-lower-panel::before,
body.adventure-rpg-page .adventure-lower-panel::after {
  display: none !important;
  content: none !important;
}

body.adventure-rpg-page .adventure-lower-panel .adventure-card-area {
  display: grid !important;
  grid-template-rows: auto minmax(0, 1fr) !important;
  gap: 8px !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  overflow: visible !important;
}

body.adventure-rpg-page .adventure-card-head {
  min-height: 42px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 10px !important;
}

body.adventure-rpg-page .adventure-card-head p,
body.adventure-rpg-page .adventure-card-head h2 {
  margin: 0 !important;
  letter-spacing: 0 !important;
}

body.adventure-rpg-page .adventure-card-head p {
  color: #3d78bd !important;
  font-size: 11px !important;
  line-height: 1 !important;
  font-weight: 900 !important;
  text-transform: uppercase !important;
}

body.adventure-rpg-page .adventure-card-head h2 {
  color: #17345f !important;
  font-size: 20px !important;
  line-height: 1.05 !important;
}

body.adventure-rpg-page .adventure-card-stats {
  min-width: 0 !important;
  display: flex !important;
  flex-wrap: wrap !important;
  justify-content: flex-end !important;
  gap: 5px !important;
}

body.adventure-rpg-page .adventure-card-stats span {
  min-height: 26px !important;
  padding: 4px 8px !important;
  border: 1px solid rgba(143, 193, 244, 0.9) !important;
  border-radius: 999px !important;
  background: rgba(255, 255, 255, 0.72) !important;
  color: #315982 !important;
  font-size: 12px !important;
  line-height: 1.1 !important;
  font-weight: 800 !important;
}

body.adventure-rpg-page .adventure-lower-panel .board-wrap {
  min-height: 0 !important;
  height: auto !important;
  padding: 10px !important;
  display: grid !important;
  border: 2px solid rgba(143, 193, 244, 0.9) !important;
  border-radius: 20px !important;
  background: rgba(255, 255, 255, 0.76) !important;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.8) !important;
  overflow: hidden !important;
}

body.adventure-rpg-page .adventure-lower-panel .board,
body.adventure-rpg-page .adventure-lower-panel .board[data-grade] {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  gap: clamp(6px, 1vw, 10px) !important;
  padding: 0 !important;
  align-content: center !important;
}

body.adventure-rpg-page .adventure-lower-panel .card {
  min-width: 0 !important;
  border: 2px solid #8fc1f4 !important;
  border-radius: 14px !important;
  background: linear-gradient(180deg, #ffffff 0%, #f2f9ff 100%) !important;
  box-shadow: 0 6px 12px rgba(65, 129, 196, 0.12) !important;
  color: #17345f !important;
  overflow: hidden !important;
}

body.adventure-rpg-page .adventure-lower-panel .card.selected {
  border-color: #ffc24b !important;
  background:
    linear-gradient(135deg, rgba(143, 193, 244, 0.95) 0 44%, rgba(255, 226, 138, 0.98) 44% 100%) !important;
  box-shadow: 0 8px 18px rgba(255, 194, 75, 0.3), 0 0 0 3px rgba(143, 193, 244, 0.55) !important;
}

body.adventure-rpg-page .adventure-lower-panel .card.matched {
  border-color: #6fcf97 !important;
  background: linear-gradient(180deg, #f4fff7, #dff7e9) !important;
}

body.adventure-rpg-page .adventure-lower-panel .card.mismatch {
  border-color: #ff8fa3 !important;
  background: linear-gradient(180deg, #fff5f7, #ffdce4) !important;
}

body.adventure-rpg-page .adventure-lower-panel .card-text {
  max-width: 100% !important;
  overflow-wrap: anywhere !important;
  letter-spacing: 0 !important;
}

body.adventure-rpg-page .adventure-rewardbar {
  min-height: 58px !important;
  padding: 8px 10px !important;
  display: grid !important;
  grid-template-columns: minmax(120px, auto) minmax(0, 1fr) !important;
  align-items: center !important;
  gap: 8px !important;
}

body.adventure-rpg-page .adventure-reward-left,
body.adventure-rpg-page .adventure-reward-details summary {
  min-width: 0 !important;
}

body.adventure-rpg-page .adventure-reward-details summary {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 5px !important;
}

body.adventure-rpg-page .reward-drop-item {
  white-space: nowrap !important;
}

body.adventure-rpg-page .adventure-battle-panel {
  grid-column: 2 !important;
  grid-row: 4 !important;
  min-height: 0 !important;
  height: 100% !important;
  overflow: hidden !important;
}

body.adventure-rpg-page .battle-sky {
  min-height: 0 !important;
  height: 100% !important;
  border-radius: 22px !important;
  background:
    linear-gradient(180deg, rgba(168, 225, 255, 0.14), rgba(255, 255, 255, 0.08)),
    url("assets/ui/cloud-kingdom-game-bg.png") center bottom / cover no-repeat !important;
}

body.adventure-rpg-page .battle-message {
  border: 2px solid #8fc1f4 !important;
  border-radius: 16px !important;
  background: rgba(255, 255, 255, 0.9) !important;
  color: #17345f !important;
  box-shadow: 0 6px 14px rgba(65, 129, 196, 0.12) !important;
}

@media (min-width: 1025px) {
  body.adventure-rpg-page .adventure-shell {
    grid-template-columns: minmax(620px, 1fr) minmax(340px, 430px) !important;
  }

  body.adventure-rpg-page .adventure-lower-panel,
  body.adventure-rpg-page .adventure-battle-panel {
    align-self: stretch !important;
  }

  body.adventure-rpg-page .adventure-lower-panel .board-wrap {
    min-height: 420px !important;
  }

  body.adventure-rpg-page .adventure-battle-panel {
    min-height: 540px !important;
  }
}

@media (min-width: 541px) and (max-width: 1024px) {
  body.adventure-rpg-page .adventure-shell {
    width: min(736px, calc(100vw - 32px)) !important;
    max-width: min(736px, calc(100vw - 32px)) !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: auto auto auto auto auto !important;
    gap: 10px !important;
    padding-top: 12px !important;
  }

  body.adventure-rpg-page .adventure-topbar {
    grid-template-columns: 42px minmax(130px, 1fr) minmax(190px, 0.85fr) 88px 58px 42px 42px !important;
    gap: 6px !important;
    padding: 9px !important;
  }

  body.adventure-rpg-page .adventure-top-deck {
    width: 100% !important;
  }

  body.adventure-rpg-page .adventure-battle-panel,
  body.adventure-rpg-page .adventure-lower-panel {
    grid-column: 1 !important;
    grid-row: auto !important;
  }

  body.adventure-rpg-page .adventure-battle-panel {
    min-height: 300px !important;
    height: 300px !important;
  }

  body.adventure-rpg-page .adventure-lower-panel .board-wrap {
    min-height: 330px !important;
  }
}

@media (max-width: 540px) {
  body.adventure-rpg-page .adventure-shell {
    width: calc(100vw - 16px) !important;
    max-width: calc(100vw - 16px) !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: auto auto auto auto auto !important;
    gap: 8px !important;
    padding-top: 8px !important;
    padding-bottom: calc(92px + env(safe-area-inset-bottom)) !important;
  }

  body.adventure-rpg-page .adventure-topbar {
    grid-template-columns: 34px minmax(90px, 0.9fr) minmax(64px, 0.7fr) 42px 36px 32px 32px !important;
    min-height: 60px !important;
    gap: 4px !important;
    padding: 6px !important;
    border-radius: 18px !important;
  }

  body.adventure-rpg-page .adventure-back-button,
  body.adventure-rpg-page .adventure-icon-button,
  body.adventure-rpg-page .adventure-settings,
  body.adventure-rpg-page .adventure-settings > summary {
    width: 32px !important;
    height: 32px !important;
    border-radius: 12px !important;
  }

  body.adventure-rpg-page .guide-top-button {
    width: 40px !important;
    height: 32px !important;
    border-radius: 12px !important;
    font-size: 11px !important;
  }

  body.adventure-rpg-page .sound-toggle-button::before {
    font-size: 16px !important;
  }

  body.adventure-rpg-page .adventure-settings > summary img {
    width: 18px !important;
    height: 18px !important;
  }

  body.adventure-rpg-page .adventure-title-block h1 {
    font-size: 15px !important;
  }

  body.adventure-rpg-page .adventure-title-block p {
    font-size: 8px !important;
  }

  body.adventure-rpg-page .adventure-top-deck {
    height: 36px !important;
    padding: 3px 5px !important;
    border-radius: 12px !important;
  }

  body.adventure-rpg-page .adventure-top-deck > span,
  body.adventure-rpg-page .adventure-top-deck small {
    display: none !important;
  }

  body.adventure-rpg-page .adventure-top-deck .control-mirror {
    font-size: 10px !important;
  }

  body.adventure-rpg-page .adventure-top-deck select {
    height: 24px !important;
    padding-right: 0 !important;
    font-size: 10px !important;
  }

  body.adventure-rpg-page .adventure-hero-chip {
    height: 36px !important;
    padding: 3px 4px !important;
    grid-template-columns: 18px auto !important;
    column-gap: 3px !important;
    border-radius: 12px !important;
  }

  body.adventure-rpg-page .adventure-hero-avatar {
    width: 18px !important;
    height: 18px !important;
  }

  body.adventure-rpg-page .adventure-hero-chip span:not(.adventure-hero-avatar) {
    display: none !important;
  }

  body.adventure-rpg-page .adventure-hero-chip strong {
    font-size: 11px !important;
  }

  body.adventure-rpg-page .adventure-controlbar {
    min-height: 0 !important;
    padding: 6px !important;
    gap: 5px !important;
    border-radius: 18px !important;
  }

  body.adventure-rpg-page .adventure-controlbar .adventure-control-button,
  body.adventure-rpg-page .adventure-controlbar .adventure-control-field,
  body.adventure-rpg-page .adventure-more-menu > summary,
  body.adventure-rpg-page .adventure-controlbar .settings-action,
  body.adventure-rpg-page .adventure-controlbar .upload-inline {
    min-height: 32px !important;
    padding: 4px 7px !important;
    border-radius: 12px !important;
    font-size: 10px !important;
    gap: 3px !important;
  }

  body.adventure-rpg-page .adventure-controlbar select {
    max-width: 60px !important;
    font-size: 10px !important;
  }

  body.adventure-rpg-page .monster-charge-panel {
    min-height: 34px !important;
    padding: 5px 8px !important;
    border-radius: 16px !important;
  }

  body.adventure-rpg-page .adventure-battle-panel,
  body.adventure-rpg-page .adventure-lower-panel {
    grid-column: 1 !important;
    grid-row: auto !important;
    border-radius: 18px !important;
  }

  body.adventure-rpg-page .adventure-battle-panel {
    min-height: 184px !important;
    height: 184px !important;
    order: 4 !important;
  }

  body.adventure-rpg-page .adventure-lower-panel {
    order: 5 !important;
    padding: 8px !important;
  }

  body.adventure-rpg-page .adventure-card-head {
    min-height: 36px !important;
    gap: 6px !important;
  }

  body.adventure-rpg-page .adventure-card-head h2 {
    font-size: 16px !important;
  }

  body.adventure-rpg-page .adventure-card-head p {
    font-size: 9px !important;
  }

  body.adventure-rpg-page .adventure-card-stats span {
    min-height: 20px !important;
    padding: 2px 5px !important;
    font-size: 9px !important;
  }

  body.adventure-rpg-page .adventure-lower-panel .board-wrap {
    min-height: 242px !important;
    padding: 7px !important;
    border-radius: 14px !important;
  }

  body.adventure-rpg-page .adventure-lower-panel .card {
    border-radius: 10px !important;
  }

  body.adventure-rpg-page .adventure-lower-panel .card-text {
    font-size: clamp(12px, 3.4vw, 17px) !important;
    line-height: 1.05 !important;
  }

  body.adventure-rpg-page .adventure-rewardbar {
    min-height: 46px !important;
    padding: 6px !important;
    grid-template-columns: 1fr !important;
    gap: 4px !important;
    border-radius: 14px !important;
  }

  body.adventure-rpg-page .adventure-reward-left img,
  body.adventure-rpg-page .reward-drop-item img {
    width: 20px !important;
    height: 20px !important;
  }
}

/* Adventure polish v2: More menu cleanup, original battle scene, vertical play flow on all screens. */
body.adventure-rpg-page .adventure-shell {
  grid-template-columns: minmax(0, 1fr) !important;
  grid-template-rows: auto auto auto auto auto !important;
  width: min(1180px, calc(100vw - 28px)) !important;
  max-width: min(1180px, calc(100vw - 28px)) !important;
  gap: 10px !important;
}

body.adventure-rpg-page .adventure-topbar,
body.adventure-rpg-page .adventure-controlbar,
body.adventure-rpg-page .monster-charge-panel,
body.adventure-rpg-page .adventure-battle-panel,
body.adventure-rpg-page .adventure-lower-panel {
  grid-column: 1 !important;
  grid-row: auto !important;
  width: 100% !important;
  max-width: 100% !important;
}

body.adventure-rpg-page .adventure-topbar {
  grid-template-columns: 44px minmax(170px, 1fr) minmax(260px, 0.9fr) auto auto auto auto !important;
}

body.adventure-rpg-page .adventure-controlbar {
  min-height: 54px !important;
}

body.adventure-rpg-page .adventure-more-menu {
  position: relative !important;
}

body.adventure-rpg-page .adventure-more-panel {
  position: absolute !important;
  top: calc(100% + 8px) !important;
  left: 50% !important;
  width: min(320px, calc(100vw - 32px)) !important;
  max-width: calc(100vw - 32px) !important;
  padding: 12px !important;
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 8px !important;
  transform: translateX(-50%) !important;
}

body.adventure-rpg-page .adventure-more-panel .deck-name-input,
body.adventure-rpg-page .adventure-more-panel .upload-message,
body.adventure-rpg-page .adventure-more-panel .deck-list,
body.adventure-rpg-page .adventure-more-panel .hidden-count {
  grid-column: 1 / -1 !important;
}

body.adventure-rpg-page .adventure-more-panel .settings-action,
body.adventure-rpg-page .adventure-more-panel .upload-inline {
  width: 100% !important;
  min-height: 42px !important;
  padding: 8px 10px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  font-size: 13px !important;
}

body.adventure-rpg-page .adventure-battle-panel {
  height: clamp(200px, 18vw, 230px) !important;
  min-height: clamp(200px, 18vw, 230px) !important;
  max-height: none !important;
  padding: 0 !important;
  overflow: hidden !important;
}

body.adventure-rpg-page .battle-sky {
  height: 100% !important;
  min-height: 100% !important;
  overflow: hidden !important;
  border-radius: 22px !important;
  background:
    linear-gradient(to bottom, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03)),
    var(--battle-map, url("assets/maps/grade3-starlight-forest.png")) center 62% / cover no-repeat !important;
}

body.adventure-rpg-page .adventure-lower-panel {
  height: auto !important;
  min-height: 0 !important;
  grid-template-rows: auto auto !important;
  align-content: start !important;
}

body.adventure-rpg-page .adventure-lower-panel .board-wrap {
  min-height: clamp(220px, 28vw, 320px) !important;
}

body.adventure-rpg-page .adventure-lower-panel .adventure-card-area {
  grid-template-rows: auto auto !important;
  align-content: start !important;
}

@media (min-width: 1025px) {
  body.adventure-rpg-page .adventure-battle-panel {
    height: 200px !important;
    min-height: 200px !important;
  }

  body.adventure-rpg-page .adventure-lower-panel .board-wrap {
    min-height: 220px !important;
  }
}

@media (min-width: 541px) and (max-width: 1024px) {
  body.adventure-rpg-page .adventure-shell {
    width: min(736px, calc(100vw - 32px)) !important;
    max-width: min(736px, calc(100vw - 32px)) !important;
  }

  body.adventure-rpg-page .adventure-topbar {
    grid-template-columns: 42px minmax(120px, 1fr) minmax(170px, 0.9fr) 74px 54px 42px 42px !important;
    gap: 6px !important;
  }

  body.adventure-rpg-page .adventure-battle-panel {
    height: 270px !important;
    min-height: 270px !important;
  }

  body.adventure-rpg-page .adventure-lower-panel .board-wrap {
    min-height: 280px !important;
  }
}

@media (max-width: 540px) {
  body.adventure-rpg-page .adventure-shell {
    width: calc(100vw - 16px) !important;
    max-width: calc(100vw - 16px) !important;
    gap: 8px !important;
  }

  body.adventure-rpg-page .adventure-topbar {
    grid-template-columns: 34px minmax(86px, 0.9fr) minmax(54px, 0.62fr) 40px 34px 30px 30px !important;
    gap: 3px !important;
  }

  body.adventure-rpg-page .adventure-title-block h1 {
    font-size: 14px !important;
  }

  body.adventure-rpg-page .adventure-title-block p {
    font-size: 7px !important;
  }

  body.adventure-rpg-page .adventure-top-deck select {
    font-size: 9px !important;
  }

  body.adventure-rpg-page .guide-top-button {
    width: 38px !important;
  }

  body.adventure-rpg-page .adventure-controlbar {
    min-height: 42px !important;
  }

  body.adventure-rpg-page .adventure-more-panel {
    left: auto !important;
    right: 0 !important;
    width: min(300px, calc(100vw - 28px)) !important;
    transform: none !important;
  }

  body.adventure-rpg-page .adventure-battle-panel {
    height: 184px !important;
    min-height: 184px !important;
  }

  body.adventure-rpg-page .battle-sky {
    background-position: center 64% !important;
  }

  body.adventure-rpg-page .adventure-lower-panel .board-wrap {
    min-height: 242px !important;
  }
}

/* Adventure topbar polish v3: compact title, single hero frame, word-flash style tools. */
body.adventure-rpg-page .adventure-topbar {
  grid-template-columns: 52px minmax(96px, 1fr) minmax(250px, 0.9fr) 88px 58px 54px 54px !important;
  gap: 8px !important;
  align-items: center !important;
}

body.adventure-rpg-page .adventure-title-block h1 {
  font-size: clamp(22px, 2.3vw, 30px) !important;
}

body.adventure-rpg-page .adventure-back-button,
body.adventure-rpg-page .guide-top-button,
body.adventure-rpg-page .adventure-icon-button,
body.adventure-rpg-page .adventure-settings,
body.adventure-rpg-page .adventure-settings > summary,
body.adventure-rpg-page .adventure-hero-chip {
  height: 46px !important;
  border-radius: 16px !important;
}

body.adventure-rpg-page .adventure-back-button {
  width: 52px !important;
  min-width: 52px !important;
  font-size: 24px !important;
}

body.adventure-rpg-page .adventure-hero-chip {
  width: 88px !important;
  min-width: 88px !important;
  padding: 4px 8px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 5px !important;
}

body.adventure-rpg-page .adventure-hero-avatar {
  width: 32px !important;
  height: 32px !important;
  flex: 0 0 32px !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  overflow: visible !important;
}

body.adventure-rpg-page .adventure-hero-avatar img {
  width: 32px !important;
  height: 32px !important;
  object-fit: contain !important;
}

body.adventure-rpg-page .adventure-hero-chip span:not(.adventure-hero-avatar) {
  display: none !important;
}

body.adventure-rpg-page .adventure-hero-chip strong {
  font-size: 15px !important;
  font-weight: 900 !important;
  white-space: nowrap !important;
}

body.adventure-rpg-page .guide-top-button,
body.adventure-rpg-page .adventure-icon-button,
body.adventure-rpg-page .adventure-settings,
body.adventure-rpg-page .adventure-settings > summary {
  width: 54px !important;
  min-width: 54px !important;
  padding: 0 !important;
}

body.adventure-rpg-page .guide-top-button {
  width: 58px !important;
  min-width: 58px !important;
  font-size: 14px !important;
}

body.adventure-rpg-page .adventure-settings > summary {
  display: grid !important;
  place-items: center !important;
}

body.adventure-rpg-page .adventure-settings > summary img {
  display: block !important;
  width: 25px !important;
  height: 25px !important;
}

body.adventure-rpg-page .adventure-settings > summary::before,
body.adventure-rpg-page .adventure-settings > summary::after {
  content: none !important;
  display: none !important;
}

body.adventure-rpg-page .sound-toggle-button::before {
  font-size: 23px !important;
}

body.adventure-rpg-page #guideTopBtn.guide-top-button,
body.adventure-rpg-page #soundToggleBtn.sound-toggle-button,
body.adventure-rpg-page .adventure-settings,
body.adventure-rpg-page .adventure-settings > summary {
  display: grid !important;
  place-items: center !important;
}

body.adventure-rpg-page #soundToggleBtn.sound-toggle-button::after {
  content: none !important;
  display: none !important;
}

body.adventure-rpg-page #soundToggleBtn.sound-toggle-button {
  overflow: hidden !important;
  color: #17345f !important;
  font-size: 0 !important;
  line-height: 0 !important;
}

body.adventure-rpg-page #soundToggleBtn.sound-toggle-button::before {
  font-size: 23px !important;
  line-height: 1 !important;
}

@media (min-width: 541px) and (max-width: 1024px) {
  body.adventure-rpg-page .adventure-topbar {
    grid-template-columns: 50px minmax(108px, 1fr) minmax(200px, 0.95fr) 78px 54px 50px 50px !important;
    gap: 6px !important;
  }

  body.adventure-rpg-page .adventure-title-block h1 {
    font-size: 26px !important;
  }

  body.adventure-rpg-page .adventure-hero-chip {
    width: 78px !important;
    min-width: 78px !important;
  }

  body.adventure-rpg-page .guide-top-button,
  body.adventure-rpg-page .adventure-icon-button,
  body.adventure-rpg-page .adventure-settings,
  body.adventure-rpg-page .adventure-settings > summary {
    width: 50px !important;
    min-width: 50px !important;
  }

  body.adventure-rpg-page .guide-top-button {
    width: 54px !important;
    min-width: 54px !important;
  }

  body.adventure-rpg-page #guideTopBtn.guide-top-button {
    width: 54px !important;
    min-width: 54px !important;
  }

  body.adventure-rpg-page #soundToggleBtn.sound-toggle-button {
    width: 50px !important;
    min-width: 50px !important;
  }
}

@media (max-width: 540px) {
  body.adventure-rpg-page .adventure-topbar {
    grid-template-columns: 32px minmax(48px, 0.7fr) minmax(82px, 1fr) 48px 34px 30px 30px !important;
    gap: 3px !important;
    padding: 6px !important;
  }

  body.adventure-rpg-page .adventure-title-block h1 {
    font-size: 14px !important;
  }

  body.adventure-rpg-page .adventure-title-block p {
    display: none !important;
  }

  body.adventure-rpg-page .adventure-back-button,
  body.adventure-rpg-page .guide-top-button,
  body.adventure-rpg-page .adventure-icon-button,
  body.adventure-rpg-page .adventure-settings,
  body.adventure-rpg-page .adventure-settings > summary,
  body.adventure-rpg-page .adventure-hero-chip {
    height: 32px !important;
    border-radius: 12px !important;
  }

  body.adventure-rpg-page .adventure-back-button {
    width: 32px !important;
    min-width: 32px !important;
    font-size: 19px !important;
  }

  body.adventure-rpg-page .adventure-top-deck {
    min-width: 0 !important;
    height: 32px !important;
    padding: 3px 4px !important;
  }

  body.adventure-rpg-page .adventure-top-deck select {
    height: 24px !important;
    font-size: 9px !important;
    line-height: 1 !important;
  }

  body.adventure-rpg-page .adventure-hero-chip {
    width: 48px !important;
    min-width: 48px !important;
    padding: 2px 3px !important;
    gap: 2px !important;
  }

  body.adventure-rpg-page .adventure-hero-avatar,
  body.adventure-rpg-page .adventure-hero-avatar img {
    width: 18px !important;
    height: 18px !important;
    flex-basis: 18px !important;
  }

  body.adventure-rpg-page .adventure-hero-chip strong {
    font-size: 10px !important;
  }

  body.adventure-rpg-page .guide-top-button,
  body.adventure-rpg-page .adventure-icon-button,
  body.adventure-rpg-page .adventure-settings,
  body.adventure-rpg-page .adventure-settings > summary {
    width: 30px !important;
    min-width: 30px !important;
  }

  body.adventure-rpg-page .guide-top-button {
    width: 34px !important;
    min-width: 34px !important;
    font-size: 10px !important;
  }

  body.adventure-rpg-page #guideTopBtn.guide-top-button {
    width: 34px !important;
    min-width: 34px !important;
  }

  body.adventure-rpg-page #soundToggleBtn.sound-toggle-button {
    width: 30px !important;
    min-width: 30px !important;
    font-size: 0 !important;
    line-height: 0 !important;
  }

  body.adventure-rpg-page .sound-toggle-button::before {
    font-size: 15px !important;
  }

  body.adventure-rpg-page .adventure-settings > summary img {
    width: 17px !important;
    height: 17px !important;
  }
}

/* Shared sound icon asset lock used by game topbars. */
.sound-icon-button::before {
  content: "" !important;
  display: block !important;
  width: 24px !important;
  height: 24px !important;
  color: transparent !important;
  background: url("assets/ui/sentence-pixel/sentence-icon-sound.png") center / contain no-repeat !important;
  filter: none !important;
}

.sound-icon-button.is-muted::before {
  filter: grayscale(1) saturate(0) opacity(0.58) !important;
}

body.adventure-rpg-page #soundToggleBtn.sound-toggle-button {
  overflow: hidden !important;
  color: #17345f !important;
  font-size: 0 !important;
  line-height: 0 !important;
}

body.adventure-rpg-page #soundToggleBtn.sound-toggle-button::before {
  content: "" !important;
  display: block !important;
  margin: 0 !important;
  background: url("assets/ui/sentence-pixel/sentence-icon-sound.png") center / contain no-repeat !important;
  filter: none !important;
}

body.adventure-rpg-page #soundToggleBtn.sound-toggle-button.is-muted::before {
  filter: grayscale(0.9) opacity(0.62) !important;
}
/* Homepage 4-breakpoint layout lock.
   Keep the lobby stable at phone, tablet portrait, tablet landscape/mid, and desktop widths. */
html:has(body.landing-page),
body.landing-page {
  width: 100% !important;
  max-width: 100vw !important;
  margin: 0 !important;
  padding-right: 0 !important;
  padding-left: 0 !important;
  background:
    linear-gradient(180deg, rgba(160, 222, 255, 0.16), rgba(255, 255, 255, 0.05)),
    url("assets/ui/cloud-kingdom-game-bg.png") center bottom / cover fixed no-repeat,
    var(--lq-bg-sky, #bdeeff) !important;
  overflow-x: hidden !important;
}

body.landing-page,
body.landing-page * {
  box-sizing: border-box !important;
}

body.landing-page .landing-shell,
body.landing-page .landing-statusbar,
body.landing-page .landing-hero,
body.landing-page .landing-quest,
body.landing-page .landing-primary,
body.landing-page .landing-secondary,
body.landing-page .landing-scene,
body.landing-page .landing-sections,
body.landing-page .landing-section-card {
  min-width: 0 !important;
}

body.landing-page .landing-shell {
  margin-left: auto !important;
  margin-right: auto !important;
  padding-bottom: calc(104px + env(safe-area-inset-bottom, 0px)) !important;
}

body.landing-page .landing-hero {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  overflow: visible !important;
}

body.landing-page .landing-quest { order: 1 !important; }
body.landing-page .landing-primary { order: 2 !important; position: static !important; }
body.landing-page .landing-secondary { order: 3 !important; position: static !important; }
body.landing-page .landing-scene { order: 4 !important; }
body.landing-page .landing-sections { order: 5 !important; }

body.landing-page .landing-quest,
body.landing-page .landing-primary,
body.landing-page .landing-secondary,
body.landing-page .landing-scene,
body.landing-page .landing-sections {
  max-width: 100% !important;
}

body.landing-page .landing-scene {
  position: relative !important;
  display: block !important;
  width: 100% !important;
  border: 2px solid rgba(143, 193, 244, 0.72) !important;
  border-radius: 24px !important;
  background:
    linear-gradient(rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.18)),
    url("assets/ui/cloud-kingdom-game-bg.png") center bottom / cover no-repeat !important;
  box-shadow: 0 14px 30px rgba(38, 88, 145, 0.16) !important;
  overflow: hidden !important;
}

body.landing-page .landing-hero-role,
body.landing-page .landing-pet {
  z-index: 2 !important;
  transform: none !important;
}

/* 1. Phone */
@media (max-width: 540px) {
  body.landing-page .landing-shell {
    width: calc(100vw - 20px) !important;
    max-width: calc(100vw - 20px) !important;
    gap: 9px !important;
  }

  body.landing-page .landing-statusbar,
  body.landing-page .landing-hero,
  body.landing-page .landing-quest,
  body.landing-page .landing-primary,
  body.landing-page .landing-secondary,
  body.landing-page .landing-scene,
  body.landing-page .landing-sections,
  body.landing-page .landing-section-card {
    width: 100% !important;
    max-width: 100% !important;
  }

  body.landing-page .landing-statusbar {
    min-height: 72px !important;
    padding: 10px 16px !important;
    border-radius: 20px !important;
  }

  body.landing-page .landing-brand img {
    width: 48px !important;
    height: 48px !important;
  }

  body.landing-page .landing-brand strong {
    font-size: 25px !important;
    line-height: 1.02 !important;
  }

  body.landing-page .landing-brand span {
    font-size: 22px !important;
    line-height: 1.02 !important;
  }

  body.landing-page .landing-hero {
    gap: 7px !important;
    padding: 9px !important;
  }

  body.landing-page .landing-quest {
    padding: 10px !important;
    border-radius: 22px !important;
  }

  body.landing-page .landing-kicker {
    margin-bottom: 5px !important;
    font-size: 13px !important;
  }

  body.landing-page .landing-quest h1 {
    margin-bottom: 6px !important;
    font-size: 25px !important;
    line-height: 1.08 !important;
  }

  body.landing-page .landing-subtitle {
    margin-bottom: 7px !important;
    font-size: 12px !important;
    line-height: 1.25 !important;
  }

  body.landing-page .landing-progress-card {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 4px !important;
    padding: 7px 10px !important;
    border-radius: 14px !important;
  }

  body.landing-page .landing-progress-card > div:nth-child(2) {
    grid-column: 1 !important;
    grid-row: 2 !important;
    justify-self: start !important;
  }

  body.landing-page .landing-progress-track {
    grid-column: 1 !important;
    grid-row: 3 !important;
    width: 100% !important;
  }

  body.landing-page .landing-progress-card span {
    font-size: 12px !important;
  }

  body.landing-page .landing-progress-card strong {
    font-size: 14px !important;
  }

  body.landing-page .landing-reward {
    min-height: 42px !important;
    margin-top: 7px !important;
    padding: 6px 10px !important;
    border-radius: 16px !important;
    font-size: 13px !important;
    line-height: 1.25 !important;
  }

  body.landing-page .landing-reward img {
    width: 30px !important;
    height: 30px !important;
  }

  body.landing-page .landing-primary {
    min-height: 66px !important;
    height: 66px !important;
    border-radius: 18px !important;
    font-size: 28px !important;
  }

  body.landing-page .landing-primary img {
    width: 40px !important;
    height: 40px !important;
  }

  body.landing-page .landing-secondary {
    min-height: 16px !important;
    font-size: 14px !important;
    line-height: 1.15 !important;
  }

  body.landing-page .landing-scene {
    min-height: 136px !important;
    background-position: center 82% !important;
  }

  body.landing-page .landing-hero-role {
    left: 48px !important;
    bottom: 7px !important;
    width: 108px !important;
  }

  body.landing-page .landing-pet {
    left: 136px !important;
    right: auto !important;
    bottom: 12px !important;
    width: 38px !important;
  }

  body.landing-page .landing-sections {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 8px !important;
  }

  body.landing-page .landing-section-card {
    min-height: 84px !important;
    padding: 10px !important;
    border-radius: 18px !important;
  }

  body.landing-page .landing-mini-actions a,
  body.landing-page .landing-section-main {
    gap: 4px !important;
    padding-left: 6px !important;
    padding-right: 6px !important;
  }

  body.landing-page .landing-mini-actions strong,
  body.landing-page .landing-section-main strong {
    min-width: 0 !important;
    max-width: 100% !important;
    overflow: hidden !important;
    font-size: 12px !important;
    line-height: 1.05 !important;
    white-space: nowrap !important;
    text-overflow: clip !important;
  }

  body.landing-page .landing-section-card {
    display: grid !important;
    grid-template-columns: 78px minmax(0, 1fr) 112px !important;
    align-items: center !important;
    gap: 10px !important;
    min-height: 116px !important;
    padding: 12px 10px !important;
    border-radius: 20px !important;
  }

  body.landing-page .landing-section-head {
    display: contents !important;
  }

  body.landing-page .landing-section-head > img {
    grid-column: 1 !important;
    justify-self: center !important;
    width: 66px !important;
    height: 66px !important;
  }

  body.landing-page .landing-section-head > div {
    grid-column: 2 !important;
    min-width: 0 !important;
  }

  body.landing-page .landing-section-head p {
    font-size: 16px !important;
    line-height: 1.05 !important;
  }

  body.landing-page .landing-section-head h2 {
    margin-top: 8px !important;
    font-size: 24px !important;
    line-height: 1.12 !important;
    overflow-wrap: normal !important;
  }

  body.landing-page .landing-mini-actions,
  body.landing-page .landing-section-main {
    grid-column: 3 !important;
    grid-row: 1 !important;
    align-self: center !important;
  }

  body.landing-page .landing-mini-actions {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 8px !important;
  }

  body.landing-page .landing-mini-actions a,
  body.landing-page .landing-section-main {
    display: grid !important;
    grid-template-columns: 28px minmax(0, 1fr) !important;
    place-items: center !important;
    min-height: 40px !important;
    padding: 6px 8px !important;
    border: 2px solid rgba(143, 193, 244, 0.92) !important;
    border-radius: 16px !important;
  }

  body.landing-page .landing-mini-actions img,
  body.landing-page .landing-section-main img {
    width: 28px !important;
    height: 28px !important;
  }

  body.landing-page .landing-mini-actions strong,
  body.landing-page .landing-section-main strong {
    font-size: 15px !important;
    line-height: 1.1 !important;
    text-overflow: clip !important;
  }

  body.landing-page .landing-sections {
    justify-items: center !important;
    width: 100% !important;
    max-width: 100% !important;
    margin-right: auto !important;
    margin-left: auto !important;
  }

  body.landing-page .landing-section-card {
    position: relative !important;
    display: grid !important;
    width: 100% !important;
    max-width: 100% !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 10px !important;
    min-height: 116px !important;
    padding: 12px 148px 12px 10px !important;
    overflow: hidden !important;
  }

  body.landing-page .landing-section-head {
    display: grid !important;
    grid-template-columns: 66px minmax(0, 1fr) !important;
    gap: 10px !important;
    align-items: center !important;
    min-width: 0 !important;
  }

  body.landing-page .landing-section-head > img {
    grid-column: 1 !important;
    justify-self: center !important;
    width: 62px !important;
    height: 62px !important;
  }

  body.landing-page .landing-section-head > div {
    grid-column: 2 !important;
    min-width: 0 !important;
  }

  body.landing-page .landing-section-head h2 {
    font-size: 22px !important;
    overflow-wrap: anywhere !important;
    word-break: normal !important;
  }

  body.landing-page .landing-mini-actions,
  body.landing-page .landing-section-main {
    position: absolute !important;
    top: 50% !important;
    right: 12px !important;
    width: 128px !important;
    max-width: 128px !important;
    min-width: 0 !important;
    transform: translateY(-50%) !important;
    justify-self: end !important;
  }
}

/* 2. Tablet portrait */
@media (min-width: 541px) and (max-width: 900px) {
  body.landing-page .landing-shell {
    width: min(720px, calc(100vw - 32px)) !important;
    max-width: min(720px, calc(100vw - 32px)) !important;
    gap: 14px !important;
  }

  body.landing-page .landing-statusbar,
  body.landing-page .landing-hero,
  body.landing-page .landing-sections {
    width: 100% !important;
    max-width: 100% !important;
  }

  body.landing-page .landing-sections {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
  }

  body.landing-page .landing-hero {
    padding: 18px !important;
    gap: 14px !important;
  }

  body.landing-page .landing-quest,
  body.landing-page .landing-primary {
    width: min(680px, 100%) !important;
  }

  body.landing-page .landing-primary {
    height: 84px !important;
    min-height: 84px !important;
  }

  body.landing-page .landing-scene {
    min-height: 300px !important;
    background-position: center bottom !important;
  }

  body.landing-page .landing-hero-role {
    left: 82px !important;
    bottom: 16px !important;
    width: 238px !important;
  }

  body.landing-page .landing-pet {
    left: 282px !important;
    right: auto !important;
    bottom: 22px !important;
    width: 62px !important;
  }
}

/* 3. Tablet landscape / middle width */
@media (min-width: 901px) and (max-width: 1180px) {
  body.landing-page .landing-shell {
    width: min(820px, calc(100vw - 64px)) !important;
    max-width: min(820px, calc(100vw - 64px)) !important;
    gap: 14px !important;
  }

  body.landing-page .landing-statusbar,
  body.landing-page .landing-hero,
  body.landing-page .landing-quest,
  body.landing-page .landing-primary,
  body.landing-page .landing-scene,
  body.landing-page .landing-sections {
    width: 100% !important;
    max-width: 100% !important;
  }

  body.landing-page .landing-sections {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
  }

  body.landing-page .landing-hero {
    padding: 18px !important;
    gap: 14px !important;
  }

  body.landing-page .landing-primary {
    height: 84px !important;
    min-height: 84px !important;
  }

  body.landing-page .landing-scene {
    min-height: 300px !important;
    background-position: center bottom !important;
  }

  body.landing-page .landing-hero-role {
    left: 104px !important;
    bottom: 16px !important;
    width: 238px !important;
  }

  body.landing-page .landing-pet {
    left: 304px !important;
    right: auto !important;
    bottom: 22px !important;
    width: 62px !important;
  }
}

/* 4. Desktop */
@media (min-width: 1181px) {
  body.landing-page .landing-shell {
    width: min(1120px, calc(100vw - 36px)) !important;
    max-width: min(1120px, calc(100vw - 36px)) !important;
    gap: 12px !important;
  }

  body.landing-page .landing-statusbar {
    width: 100% !important;
    min-height: 88px !important;
    padding: 16px 24px !important;
  }

  body.landing-page .landing-hero {
    width: 100% !important;
    padding: 22px 24px 18px !important;
    gap: 12px !important;
  }

  body.landing-page .landing-quest {
    width: min(640px, 100%) !important;
    padding: 22px 24px !important;
  }

  body.landing-page .landing-quest h1 {
    margin-bottom: 10px !important;
    font-size: 42px !important;
    line-height: 1.08 !important;
  }

  body.landing-page .landing-subtitle {
    margin-bottom: 12px !important;
  }

  body.landing-page .landing-progress-card {
    gap: 8px !important;
    padding: 12px 14px !important;
  }

  body.landing-page .landing-reward {
    min-height: 54px !important;
    margin-top: 12px !important;
    padding: 8px 14px !important;
  }

  body.landing-page .landing-primary {
    width: min(640px, 100%) !important;
    height: 78px !important;
    min-height: 78px !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    align-self: center !important;
    justify-self: center !important;
    font-size: 34px !important;
  }

  body.landing-page .landing-secondary {
    min-height: 20px !important;
    line-height: 1.15 !important;
  }

  body.landing-page .landing-scene {
    min-height: 214px !important;
    background-position: center bottom !important;
  }

  body.landing-page .landing-hero-role {
    left: 190px !important;
    bottom: 52px !important;
    width: 160px !important;
  }

  body.landing-page .landing-pet {
    left: 330px !important;
    right: auto !important;
    bottom: 62px !important;
    width: 50px !important;
  }

  body.landing-page .landing-scene,
  body.landing-page .landing-sections {
    width: 100% !important;
    max-width: 100% !important;
  }

  body.landing-page .landing-sections {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 14px !important;
  }
}

/* Homepage phone module action alignment final lock. */
@media (max-width: 540px) {
  body.landing-page .landing-sections {
    align-self: stretch !important;
    width: 100% !important;
    max-width: 100% !important;
    justify-items: stretch !important;
  }

  body.landing-page .landing-section-card {
    position: relative !important;
    width: 100% !important;
    max-width: 100% !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    padding: 12px 148px 12px 10px !important;
    overflow: hidden !important;
  }

  body.landing-page .landing-section-head {
    display: grid !important;
    grid-template-columns: 66px minmax(0, 1fr) !important;
    gap: 10px !important;
    align-items: center !important;
    min-width: 0 !important;
  }

  body.landing-page .landing-section-head > img {
    width: 62px !important;
    height: 62px !important;
  }

  body.landing-page .landing-section-head > div,
  body.landing-page .landing-section-head h2 {
    min-width: 0 !important;
    max-width: 100% !important;
  }

  body.landing-page .landing-section-head h2 {
    overflow-wrap: anywhere !important;
    word-break: normal !important;
  }

  body.landing-page .landing-mini-actions,
  body.landing-page .landing-section-main {
    position: absolute !important;
    top: 50% !important;
    right: 12px !important;
    left: auto !important;
    width: 128px !important;
    max-width: 128px !important;
    transform: translateY(-50%) !important;
  }
}
/* Adventure iPad landscape scroll guard: keep the current layout, but do not clip content. */
@media (min-width: 541px) and (max-width: 1180px) {
  html:has(body.adventure-rpg-page),
  body.adventure-rpg-page {
    height: auto !important;
    min-height: 100dvh !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
  }

  body.adventure-rpg-page .adventure-shell,
  body.adventure-rpg-page .adventure-shell:has(.adventure-pressurebar.no-pressure) {
    height: auto !important;
    min-height: 100dvh !important;
    max-height: none !important;
    overflow: visible !important;
    padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)) !important;
  }
}

/* Adventure back button text lock: match Word Flash's "·µ»Ø" label style. */
body.adventure-rpg-page .adventure-back-button {
  width: auto !important;
  min-width: 58px !important;
  padding: 0 14px !important;
  font-size: 14px !important;
  font-weight: 950 !important;
  line-height: 1 !important;
  white-space: nowrap !important;
}
body.adventure-rpg-page .adventure-topbar {
  grid-template-columns: minmax(58px, auto) minmax(96px, 1fr) minmax(250px, 0.9fr) 88px 58px 54px 54px !important;
}

@media (max-width: 720px) {
  body.adventure-rpg-page .adventure-topbar {
    grid-template-columns: minmax(58px, auto) minmax(88px, 1fr) minmax(120px, 1.05fr) auto !important;
  }
}
@media (min-width: 541px) and (max-width: 1024px) {
  body.adventure-rpg-page .adventure-topbar {
    grid-template-columns: minmax(58px, auto) minmax(108px, 1fr) minmax(200px, 0.95fr) 78px 54px 50px 50px !important;
  }
}

@media (max-width: 540px) {
  body.adventure-rpg-page .adventure-topbar {
    grid-template-columns: 42px minmax(48px, 0.7fr) minmax(82px, 1fr) 48px 34px 30px 30px !important;
  }

  body.adventure-rpg-page .adventure-back-button {
    width: 42px !important;
    min-width: 42px !important;
    padding: 0 4px !important;
    font-size: 12px !important;
  }
}

/* Homepage brand logo cutout: replace the old coin with the transparent Lingo Kingdom logo. */
body.landing-page .landing-brand img.landing-logo-cutout {
  width: 66px !important;
  height: 78px !important;
  object-fit: contain !important;
  image-rendering: auto !important;
  filter: drop-shadow(0 6px 10px rgba(43, 100, 171, 0.16)) !important;
}

body.landing-page .landing-brand {
  gap: 12px !important;
}

@media (max-width: 540px) {
  body.landing-page .landing-brand img.landing-logo-cutout {
    width: 64px !important;
    height: 74px !important;
  }
}
/* Homepage desktop brand title scale: keep the new logo prominent on wide screens. */
@media (min-width: 1180px) {
  body.landing-page .landing-statusbar {
    min-height: 118px !important;
    padding: 18px 28px !important;
  }

  body.landing-page .landing-brand img.landing-logo-cutout {
    width: 92px !important;
    height: 104px !important;
  }

  body.landing-page .landing-brand {
    gap: 18px !important;
  }

  body.landing-page .landing-brand strong {
    font-size: 40px !important;
    line-height: 1.02 !important;
    letter-spacing: 0 !important;
  }

  body.landing-page .landing-brand span {
    margin-top: 6px !important;
    font-size: 28px !important;
    line-height: 1.02 !important;
  }
}
/* Homepage desktop brand title stronger scale v2. */
@media (min-width: 1180px) {
  body.landing-page .landing-statusbar {
    min-height: 148px !important;
    padding: 22px 32px !important;
  }

  body.landing-page .landing-brand img.landing-logo-cutout {
    width: 128px !important;
    height: 132px !important;
  }

  body.landing-page .landing-brand {
    gap: 24px !important;
  }

  body.landing-page .landing-brand strong {
    font-size: 56px !important;
    line-height: 1 !important;
    letter-spacing: 0 !important;
  }

  body.landing-page .landing-brand span {
    margin-top: 8px !important;
    font-size: 38px !important;
    line-height: 1 !important;
  }
}
/* Adventure first-run polish: use the top difficulty dropdown and modern name prompt. */
#difficultyPanel {
  display: none !important;
}

.difficulty-top-button.guide-pulse {
  animation: adventureControlPulse 0.9s ease-in-out;
}

@keyframes adventureControlPulse {
  0%, 100% { transform: translateY(0); box-shadow: 0 8px 18px rgba(42, 120, 190, 0.12); }
  50% { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(42, 120, 190, 0.28), 0 0 0 4px rgba(255, 222, 93, 0.45); }
}

body.name-prompt-open .adventure-end-panel {
  position: fixed !important;
  left: 50% !important;
  top: 50% !important;
  z-index: 5010 !important;
  box-sizing: border-box;
  width: min(430px, calc(100vw - 32px)) !important;
  max-height: min(560px, calc(100vh - 32px)) !important;
  overflow: auto !important;
  transform: translate(-50%, -50%) !important;
  padding: 24px 22px 22px !important;
  color: #24446c !important;
  text-align: center;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(236, 249, 255, 0.95)) !important;
  border: 2px solid rgba(111, 184, 231, 0.78) !important;
  border-radius: 22px !important;
  box-shadow:
    0 0 0 999vmax rgba(55, 118, 178, 0.34),
    0 20px 46px rgba(48, 116, 178, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.9) !important;
  pointer-events: auto !important;
}

body.name-prompt-open .adventure-end-panel::before {
  display: none !important;
}

body.name-prompt-open .adventure-end-panel .result-glow {
  opacity: 0.28;
}

body.name-prompt-open .adventure-end-panel .eyebrow {
  margin: 0 0 6px;
  color: #2f8fd0 !important;
  letter-spacing: 0;
  text-shadow: none !important;
}

body.name-prompt-open .adventure-end-panel h2 {
  margin: 0 0 8px;
  color: #1f5f9c !important;
  font-size: clamp(24px, 5vw, 34px);
  line-height: 1.12;
  text-shadow: none !important;
}

body.name-prompt-open #adventureEndText {
  margin: 0 auto 14px;
  max-width: 340px;
  color: #4b6f91;
  font-weight: 800;
  line-height: 1.55;
}

body.name-prompt-open .adventure-end-panel .deck-name-input {
  width: min(340px, 100%) !important;
  min-height: 46px;
  margin: 0 auto 14px !important;
  padding: 0 16px;
  color: #24446c;
  font-size: 16px;
  font-weight: 900;
  text-align: center;
  background: #ffffff;
  border: 2px solid rgba(111, 184, 231, 0.85);
  border-radius: 14px;
  box-shadow: inset 0 2px 6px rgba(75, 139, 196, 0.12);
}

body.name-prompt-open .adventure-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 0;
}

body.name-prompt-open #randomNameBtn,
body.name-prompt-open #restartAdventureBtn {
  min-height: 44px;
  border-radius: 14px;
  font-weight: 900;
  letter-spacing: 0;
}

body.name-prompt-open #randomNameBtn {
  width: auto;
  min-width: 76px;
  padding: 0 14px;
  color: #1f5f9c;
  background: #ffffff;
  border: 2px solid rgba(111, 184, 231, 0.85);
  box-shadow: 0 8px 18px rgba(74, 142, 205, 0.14);
}

body.name-prompt-open #restartAdventureBtn {
  min-width: 150px;
  padding-inline: 18px;
}

@media (max-width: 520px) {
  body.name-prompt-open .adventure-end-panel {
    width: calc(100vw - 24px) !important;
    padding: 22px 16px 18px !important;
    border-radius: 18px !important;
  }

  body.name-prompt-open .adventure-actions {
    flex-direction: column;
  }

  body.name-prompt-open #randomNameBtn,
  body.name-prompt-open #restartAdventureBtn {
    width: 100%;
  }
}
/* Let children tap the match cards during the interactive guide step. */
.main-guide.allow-interaction .main-guide-dim {
  pointer-events: none !important;
}
/* Homepage simplification: remove the old quest-card footprint and keep the first action close to the top. */
body.landing-page .landing-primary {
  order: 1 !important;
}

body.landing-page .landing-secondary {
  order: 2 !important;
}

body.landing-page .landing-scene {
  order: 3 !important;
}

body.landing-page .landing-sections {
  order: 4 !important;
}

body.landing-page .landing-primary span {
  white-space: nowrap;
}

@media (max-width: 540px) {
  body.landing-page .landing-hero {
    padding-top: 8px !important;
  }
}

@media (min-width: 541px) and (max-width: 1180px) {
  body.landing-page .landing-hero {
    padding-top: 14px !important;
  }
}

@media (min-width: 1181px) {
  body.landing-page .landing-hero {
    padding-top: 18px !important;
  }
}
/* Homepage module titles: keep only the two-word section name, centered and larger. */
body.landing-page .landing-section-head {
  align-items: center !important;
}

body.landing-page .landing-section-head > div {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: 100% !important;
  text-align: center !important;
}

body.landing-page .landing-section-head p {
  margin: 0 !important;
  color: #2f73c9 !important;
  font-size: clamp(26px, 4.2vw, 36px) !important;
  font-weight: 1000 !important;
  line-height: 1 !important;
  letter-spacing: 0 !important;
}

body.landing-page .landing-section-head h2 {
  display: none !important;
}

@media (max-width: 540px) {
  body.landing-page .landing-section-head {
    grid-template-columns: 78px minmax(0, 1fr) !important;
  }

  body.landing-page .landing-section-head p {
    font-size: 28px !important;
  }
}

@media (min-width: 541px) and (max-width: 900px) {
  body.landing-page .landing-section-head p {
    font-size: 34px !important;
  }
}

@media (min-width: 901px) {
  body.landing-page .landing-section-head p {
    font-size: 36px !important;
  }
}

body.adventure-rpg-page .adventure-battle-panel .battle-name {
  color: #ffffff !important;
  -webkit-text-stroke: 0.8px rgba(5, 12, 24, 0.96) !important;
  paint-order: stroke fill !important;
  text-shadow:
    1px 0 0 rgba(5, 12, 24, 0.96),
    -1px 0 0 rgba(5, 12, 24, 0.96),
    0 1px 0 rgba(5, 12, 24, 0.96),
    0 -1px 0 rgba(5, 12, 24, 0.96),
    1px 1px 0 rgba(5, 12, 24, 0.96),
    -1px 1px 0 rgba(5, 12, 24, 0.96),
    1px -1px 0 rgba(5, 12, 24, 0.96),
    -1px -1px 0 rgba(5, 12, 24, 0.96) !important;
}
/* Adventure battle sprite cleanup: consolidated outline, sprite crop, and four-size placement rules. */
body.adventure-rpg-page .adventure-battle-panel .hero-sprite,
body.adventure-rpg-page .adventure-battle-panel .monster-sprite,
body.adventure-rpg-page .adventure-battle-panel .pet-battle-sprite {
  filter:
    drop-shadow(1px 0 0 rgba(255, 252, 214, 0.92))
    drop-shadow(-1px 0 0 rgba(255, 252, 214, 0.92))
    drop-shadow(0 1px 0 rgba(255, 252, 214, 0.92))
    drop-shadow(0 -1px 0 rgba(255, 252, 214, 0.92))
    drop-shadow(0 0 6px rgba(111, 214, 255, 0.42))
    drop-shadow(0 10px 8px rgba(0, 0, 0, 0.36)) !important;
}

body.adventure-rpg-page .adventure-battle-panel .monster-fighter.boss .monster-sprite {
  width: 100% !important;
  height: 100% !important;
  background-size: 400% 400% !important;
  background-repeat: no-repeat !important;
  filter:
    drop-shadow(1px 0 0 rgba(255, 244, 168, 0.98))
    drop-shadow(-1px 0 0 rgba(255, 244, 168, 0.98))
    drop-shadow(0 1px 0 rgba(255, 244, 168, 0.98))
    drop-shadow(0 -1px 0 rgba(255, 244, 168, 0.98))
    drop-shadow(0 0 10px rgba(255, 203, 71, 0.55))
    drop-shadow(0 12px 10px rgba(0, 0, 0, 0.42)) !important;
}

/* Adventure size 1: narrow phones, such as 390 x 844. */
@media (max-width: 420px) {
  body.adventure-rpg-page .adventure-battle-panel .battle-sky {
    --battle-ground-y: 14px;
  }

  body.adventure-rpg-page .adventure-battle-panel .hero-fighter {
    bottom: var(--battle-ground-y) !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .pet-fighter,
  body.adventure-rpg-page .adventure-battle-panel .pet-fighter[data-pet-stage="1"],
  body.adventure-rpg-page .adventure-battle-panel .pet-fighter[data-pet-stage="2"],
  body.adventure-rpg-page .adventure-battle-panel .pet-fighter[data-pet-stage="3"] {
    bottom: var(--battle-ground-y) !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .monster-fighter {
    bottom: var(--battle-ground-y) !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .monster-fighter.boss {
    width: 124px !important;
    height: 124px !important;
    right: 2% !important;
    bottom: var(--battle-ground-y) !important;
    z-index: 4 !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .monster-fighter.boss[data-boss-grade="1"],
  body.adventure-rpg-page .adventure-battle-panel .monster-fighter.boss[data-boss-grade="4"] {
    bottom: 15px !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .monster-fighter.boss[data-boss-grade="2"] {
    bottom: 19px !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .monster-fighter.boss[data-boss-grade="3"] {
    bottom: 30px !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .monster-fighter.boss[data-boss-grade="5"] {
    bottom: 6px !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .monster-fighter.boss[data-boss-grade="6"] {
    bottom: 21px !important;
  }
}


@media (max-width: 420px) {
  body.adventure-rpg-page .adventure-lower-panel .card {
    padding: 3px 4px !important;
    border-radius: 10px !important;
  }
}
@media (max-width: 420px) {
  body.adventure-rpg-page .adventure-lower-panel .card,
  body.adventure-rpg-page .adventure-lower-panel .card.english,
  body.adventure-rpg-page .adventure-lower-panel .card.chinese {
    white-space: normal !important;
  }

  body.adventure-rpg-page .adventure-lower-panel .card-text,
  body.adventure-rpg-page .adventure-lower-panel .card.english .card-text,
  body.adventure-rpg-page .adventure-lower-panel .card.chinese .card-text {
    display: block !important;
    max-width: 100% !important;
    overflow: hidden !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
    line-height: 1.08 !important;
    text-align: center !important;
  }
}

/* Adventure size 2: large phones and small tablets. */
@media (min-width: 421px) and (max-width: 767px) {
  body.adventure-rpg-page .adventure-battle-panel .battle-sky {
    --battle-ground-y: 16px;
  }


  body.adventure-rpg-page .adventure-battle-panel .battle-hud {
    width: 150px !important;
    max-width: 150px !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .hero-fighter,
  body.adventure-rpg-page .adventure-battle-panel .monster-fighter {
    bottom: var(--battle-ground-y) !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .pet-fighter,
  body.adventure-rpg-page .adventure-battle-panel .pet-fighter[data-pet-stage="1"],
  body.adventure-rpg-page .adventure-battle-panel .pet-fighter[data-pet-stage="2"],
  body.adventure-rpg-page .adventure-battle-panel .pet-fighter[data-pet-stage="3"] {
    bottom: var(--battle-ground-y) !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .monster-fighter.boss {
    width: 138px !important;
    height: 138px !important;
    right: 2% !important;
    bottom: var(--battle-ground-y) !important;
    z-index: 4 !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .monster-fighter.boss[data-boss-grade="1"],
  body.adventure-rpg-page .adventure-battle-panel .monster-fighter.boss[data-boss-grade="4"] {
    bottom: 19px !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .monster-fighter.boss[data-boss-grade="2"] {
    bottom: 23px !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .monster-fighter.boss[data-boss-grade="3"] {
    bottom: 34px !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .monster-fighter.boss[data-boss-grade="5"] {
    bottom: 8px !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .monster-fighter.boss[data-boss-grade="6"] {
    bottom: 25px !important;
  }
}

/* Adventure size 3: tablets and middle-width windows. */
@media (min-width: 768px) and (max-width: 1199px) {
  body.adventure-rpg-page .adventure-battle-panel .monster-fighter.boss {
    width: 170px !important;
    height: 170px !important;
    left: auto !important;
    right: 18% !important;
    z-index: 4 !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .monster-fighter.boss .monster-sprite {
    background-size: 400% 400% !important;
    background-repeat: no-repeat !important;
  }


  body.adventure-rpg-page .adventure-battle-panel .battle-hud {
    width: 220px !important;
    max-width: 220px !important;
  }
  body.adventure-rpg-page .adventure-battle-panel .boss-challenge-button {
    top: 10px !important;
    left: 50% !important;
    right: auto !important;
    bottom: auto !important;
    transform: translateX(-50%) !important;
  }
}

/* Adventure size 4: desktop and wide desktop. */
@media (min-width: 1200px) {
  body.adventure-rpg-page .adventure-battle-panel .monster-fighter.boss {
    width: 178px !important;
    height: 178px !important;
    left: auto !important;
    right: 17% !important;
    z-index: 4 !important;
  }

  body.adventure-rpg-page .adventure-battle-panel .monster-fighter.boss .monster-sprite {
    background-size: 400% 400% !important;
    background-repeat: no-repeat !important;
  }
}


@media (min-width: 1200px) {
  body.adventure-rpg-page .adventure-battle-panel .boss-challenge-button {
    top: 14px !important;
    left: 50% !important;
    right: auto !important;
    bottom: auto !important;
    transform: translateX(-50%) !important;
  }
}
/* Adventure boss button final visual style: keep every size on the same soft blue/yellow button. */
body.adventure-rpg-page .adventure-battle-panel .boss-challenge-button,
body.adventure-rpg-page .adventure-battle-panel .mobile-boss-button {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: auto !important;
  min-width: 104px !important;
  min-height: 30px !important;
  max-width: calc(100% - 32px) !important;
  padding: 5px 14px !important;
  border: 2px solid #8fc1f4 !important;
  border-radius: 8px !important;
  color: #12345f !important;
  background: linear-gradient(180deg, #ffffff 0%, #fff9d9 46%, #ffd86e 100%) !important;
  box-shadow:
    0 2px 0 rgba(45, 102, 180, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.95) !important;
  font-size: 12px !important;
  font-weight: 900 !important;
  line-height: 1 !important;
  text-align: center !important;
  white-space: nowrap !important;
}

body.adventure-rpg-page .adventure-battle-panel .boss-challenge-button:hover,
body.adventure-rpg-page .adventure-battle-panel .mobile-boss-button:hover {
  box-shadow:
    0 2px 0 rgba(45, 102, 180, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.95) !important;
}

@media (max-width: 420px) {
  body.adventure-rpg-page .adventure-battle-panel .boss-challenge-button,
  body.adventure-rpg-page .adventure-battle-panel .mobile-boss-button {
    min-width: 82px !important;
    min-height: 26px !important;
    padding: 4px 10px !important;
    font-size: 10px !important;
  }
}

@media (min-width: 421px) and (max-width: 767px) {
  body.adventure-rpg-page .adventure-battle-panel .boss-challenge-button,
  body.adventure-rpg-page .adventure-battle-panel .mobile-boss-button {
    min-width: 94px !important;
    min-height: 28px !important;
    padding: 5px 12px !important;
    font-size: 11px !important;
  }
}
/* The main boss button now works across all four sizes; keep the old mobile duplicate hidden. */
body.adventure-rpg-page .adventure-battle-panel .mobile-boss-button {
  display: none !important;
}
/* Adventure reward popup final visual style: match the current light blue adventure UI. */
body.adventure-rpg-page .reward-overlay {
  z-index: 5020 !important;
  padding: 18px !important;
  background: rgba(55, 118, 178, 0.34) !important;
  backdrop-filter: blur(4px) !important;
}

body.adventure-rpg-page .ability-reward-panel {
  box-sizing: border-box !important;
  width: min(430px, calc(100vw - 32px)) !important;
  padding: 24px 22px 22px !important;
  border: 2px solid rgba(111, 184, 231, 0.82) !important;
  border-radius: 22px !important;
  color: #24446c !important;
  text-align: center !important;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(236, 249, 255, 0.96)) !important;
  box-shadow:
    0 20px 46px rgba(48, 116, 178, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.92) !important;
}

body.adventure-rpg-page .ability-reward-panel .eyebrow {
  margin: 0 0 6px !important;
  color: #2f8fd0 !important;
  font-size: 12px !important;
  font-weight: 900 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  text-shadow: none !important;
}

body.adventure-rpg-page .ability-reward-panel h3 {
  margin: 0 0 8px !important;
  color: #1f5f9c !important;
  font-size: clamp(22px, 4.6vw, 32px) !important;
  line-height: 1.14 !important;
  text-shadow: none !important;
}

body.adventure-rpg-page .ability-reward-panel p:not(.eyebrow) {
  max-width: 340px !important;
  margin: 0 auto 16px !important;
  color: #4b6f91 !important;
  font-size: 14px !important;
  font-weight: 800 !important;
  line-height: 1.55 !important;
}

body.adventure-rpg-page .ability-reward-panel .reward-icon {
  width: 72px !important;
  height: 72px !important;
  margin: 0 auto 12px !important;
  border: 2px solid rgba(143, 193, 244, 0.88) !important;
  border-radius: 18px !important;
  background-color: rgba(255, 255, 255, 0.9) !important;
  background-size: 74% !important;
  box-shadow:
    0 10px 22px rgba(50, 121, 190, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.96) !important;
}

body.adventure-rpg-page .ability-reward-panel .reward-icon.has-image {
  background-color: rgba(255, 255, 255, 0.92) !important;
  background-size: contain !important;
}

body.adventure-rpg-page .ability-reward-panel .reward-icon::before,
body.adventure-rpg-page .ability-reward-panel .reward-icon::after {
  filter: none !important;
}

body.adventure-rpg-page .ability-reward-panel .primary-button {
  min-width: 96px !important;
  min-height: 42px !important;
  padding: 0 18px !important;
  border: 2px solid rgba(111, 184, 231, 0.88) !important;
  border-radius: 14px !important;
  color: #1f5f9c !important;
  background: linear-gradient(180deg, #ffffff, #e7f5ff) !important;
  box-shadow: 0 8px 18px rgba(74, 142, 205, 0.14) !important;
  font-weight: 900 !important;
  letter-spacing: 0 !important;
}

@media (max-width: 420px) {
  body.adventure-rpg-page .ability-reward-panel {
    width: min(340px, calc(100vw - 24px)) !important;
    padding: 20px 16px 18px !important;
    border-radius: 18px !important;
  }

  body.adventure-rpg-page .ability-reward-panel .reward-icon {
    width: 62px !important;
    height: 62px !important;
    border-radius: 16px !important;
  }
}
/* Adventure layout consolidation v2: final page-level layout split into four stable sizes. */
body.adventure-rpg-page {
  min-height: 100dvh !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
}

html:has(body.adventure-rpg-page) {
  height: auto !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
}

body.adventure-rpg-page .adventure-shell,
body.adventure-rpg-page .adventure-shell:has(.adventure-pressurebar.no-pressure) {
  display: grid !important;
  box-sizing: border-box !important;
  width: min(var(--adventure-shell-width), calc(100vw - var(--adventure-page-pad) * 2)) !important;
  min-width: 0 !important;
  height: auto !important;
  min-height: 0 !important;
  margin: 0 auto !important;
  padding: var(--adventure-shell-top) 0 calc(96px + env(safe-area-inset-bottom, 0px)) !important;
  gap: var(--adventure-section-gap) !important;
  grid-template-rows: auto auto auto auto auto !important;
}

body.adventure-rpg-page .adventure-topbar,
body.adventure-rpg-page .adventure-controlbar,
body.adventure-rpg-page .adventure-pressurebar,
body.adventure-rpg-page .adventure-battle-panel,
body.adventure-rpg-page .adventure-lower-panel,
body.adventure-rpg-page .adventure-card-area,
body.adventure-rpg-page .adventure-rewardbar {
  box-sizing: border-box !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
}

body.adventure-rpg-page .adventure-topbar,
body.adventure-rpg-page .adventure-controlbar,
body.adventure-rpg-page .adventure-pressurebar,
body.adventure-rpg-page .adventure-battle-panel,
body.adventure-rpg-page .adventure-lower-panel {
  border: 2px solid #8fc1f4 !important;
  border-radius: var(--adventure-panel-radius) !important;
  background: rgba(248, 253, 255, 0.9) !important;
  box-shadow: 0 10px 24px rgba(60, 124, 190, 0.12) !important;
}

body.adventure-rpg-page .adventure-topbar {
  display: grid !important;
  grid-template-columns: var(--adventure-topbar-columns) !important;
  align-items: center !important;
  gap: var(--adventure-topbar-gap) !important;
  min-height: var(--adventure-topbar-height) !important;
  margin: 0 !important;
  padding: var(--adventure-topbar-pad) !important;
  overflow: visible !important;
}

body.adventure-rpg-page .adventure-back-button,
body.adventure-rpg-page #guideTopBtn.guide-top-button,
body.adventure-rpg-page #soundToggleBtn.sound-toggle-button,
body.adventure-rpg-page .adventure-settings,
body.adventure-rpg-page .adventure-settings > summary,
body.adventure-rpg-page .adventure-hero-chip {
  flex: 0 0 auto !important;
  box-sizing: border-box !important;
  min-width: 0 !important;
}

body.adventure-rpg-page .adventure-back-button {
  width: var(--adventure-back-size) !important;
  min-width: var(--adventure-back-size) !important;
  height: var(--adventure-back-size) !important;
  padding: 0 !important;
  font-size: var(--adventure-back-font) !important;
  border-radius: var(--adventure-control-radius) !important;
}

body.adventure-rpg-page .adventure-title-block {
  display: grid !important;
  min-width: 0 !important;
  gap: 2px !important;
  align-content: center !important;
}

body.adventure-rpg-page .adventure-title-block h1 {
  margin: 0 !important;
  overflow: hidden !important;
  font-size: var(--adventure-title-size) !important;
  line-height: 1.05 !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

body.adventure-rpg-page .adventure-title-block p {
  display: block !important;
  margin: 0 !important;
  font-size: var(--adventure-subtitle-size) !important;
  line-height: 1 !important;
  white-space: nowrap !important;
}

body.adventure-rpg-page .adventure-top-deck {
  display: grid !important;
  min-width: 0 !important;
  min-height: var(--adventure-chip-height) !important;
  padding: var(--adventure-chip-pad) !important;
  align-content: center !important;
  border: 2px solid #8fc1f4 !important;
  border-radius: var(--adventure-control-radius) !important;
  background: rgba(255, 255, 255, 0.92) !important;
}

body.adventure-rpg-page .adventure-top-deck > span,
body.adventure-rpg-page .adventure-top-deck small {
  display: none !important;
}

body.adventure-rpg-page .adventure-top-deck select {
  display: block !important;
  width: 100% !important;
  min-width: 0 !important;
  height: var(--adventure-select-height) !important;
  min-height: var(--adventure-select-height) !important;
  padding: 0 8px !important;
  overflow: hidden !important;
  border: 0 !important;
  background: transparent !important;
  color: #17345f !important;
  font-size: var(--adventure-deck-font) !important;
  font-weight: 900 !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

body.adventure-rpg-page .adventure-hero-chip {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: var(--adventure-hero-chip-width) !important;
  height: var(--adventure-chip-height) !important;
  gap: 4px !important;
  padding: 0 6px !important;
  border: 2px solid #8fc1f4 !important;
  border-radius: var(--adventure-control-radius) !important;
  background: rgba(255, 255, 255, 0.92) !important;
}

body.adventure-rpg-page .adventure-hero-avatar,
body.adventure-rpg-page .adventure-hero-avatar img {
  width: var(--adventure-avatar-size) !important;
  height: var(--adventure-avatar-size) !important;
}

body.adventure-rpg-page .adventure-hero-chip span:not(.adventure-hero-avatar) {
  display: none !important;
}

body.adventure-rpg-page .adventure-hero-chip strong {
  display: block !important;
  color: #17345f !important;
  font-size: var(--adventure-level-font) !important;
  line-height: 1 !important;
  white-space: nowrap !important;
}

body.adventure-rpg-page .adventure-top-actions {
  display: grid !important;
  grid-template-columns: var(--adventure-actions-columns) !important;
  gap: var(--adventure-action-gap) !important;
  align-items: center !important;
  justify-content: end !important;
  justify-self: end !important;
  width: max-content !important;
  min-width: max-content !important;
  max-width: 100% !important;
}

body.adventure-rpg-page #guideTopBtn.guide-top-button,
body.adventure-rpg-page #soundToggleBtn.sound-toggle-button,
body.adventure-rpg-page .adventure-settings,
body.adventure-rpg-page .adventure-settings > summary {
  display: grid !important;
  place-items: center !important;
  width: var(--adventure-action-size) !important;
  min-width: var(--adventure-action-size) !important;
  height: var(--adventure-chip-height) !important;
  padding: 0 !important;
  border: 2px solid #8fc1f4 !important;
  border-radius: var(--adventure-control-radius) !important;
  background: rgba(255, 255, 255, 0.92) !important;
}

body.adventure-rpg-page #guideTopBtn.guide-top-button {
  width: var(--adventure-guide-width) !important;
  min-width: var(--adventure-guide-width) !important;
  font-size: var(--adventure-guide-font) !important;
}

body.adventure-rpg-page #soundToggleBtn.sound-toggle-button::before,
body.adventure-rpg-page .adventure-settings > summary img {
  width: var(--adventure-icon-size) !important;
  height: var(--adventure-icon-size) !important;
}
body.adventure-rpg-page .adventure-top-actions .adventure-settings {
  position: relative !important;
  display: block !important;
  width: var(--adventure-action-size) !important;
  min-width: var(--adventure-action-size) !important;
  height: var(--adventure-chip-height) !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

body.adventure-rpg-page .adventure-top-actions .adventure-settings > summary {
  list-style: none !important;
  cursor: pointer !important;
}

body.adventure-rpg-page .adventure-top-actions .adventure-settings > summary::marker,
body.adventure-rpg-page .adventure-top-actions .adventure-settings > summary::-webkit-details-marker,
body.adventure-rpg-page .adventure-top-actions .adventure-settings > summary::before,
body.adventure-rpg-page .adventure-top-actions .adventure-settings > summary::after {
  content: none !important;
  display: none !important;
}

body.adventure-rpg-page .adventure-top-actions .adventure-settings > summary img {
  display: block !important;
  margin: 0 !important;
  object-fit: contain !important;
}
body.adventure-rpg-page .adventure-top-actions #soundToggleBtn.sound-toggle-button,
body.adventure-rpg-page .adventure-top-actions .adventure-settings > summary {
  position: relative !important;
  display: grid !important;
  place-items: center !important;
  overflow: hidden !important;
}

body.adventure-rpg-page .adventure-top-actions #soundToggleBtn.sound-toggle-button::before,
body.adventure-rpg-page .adventure-top-actions .adventure-settings > summary img {
  position: absolute !important;
  left: 50% !important;
  top: 50% !important;
  transform: translate(-50%, -50%) !important;
  margin: 0 !important;
}

body.adventure-rpg-page .adventure-top-actions #soundToggleBtn.sound-toggle-button::after {
  content: none !important;
  display: none !important;
}

body.adventure-rpg-page .adventure-top-deck select,
body.adventure-rpg-page .adventure-controlbar .difficulty-top-button select {
  appearance: none !important;
  -webkit-appearance: none !important;
  box-shadow: none !important;
  outline: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  cursor: pointer !important;
}


body.adventure-rpg-page .adventure-top-deck select,
body.adventure-rpg-page .adventure-controlbar .difficulty-top-button select {
  text-align: center !important;
  text-align-last: center !important;
}

body.adventure-rpg-page .adventure-top-deck select:focus,
body.adventure-rpg-page .adventure-controlbar .difficulty-top-button select:focus {
  box-shadow: none !important;
  outline: 0 !important;
}

body.adventure-rpg-page .adventure-controlbar {
  display: flex !important;
  flex-wrap: var(--adventure-control-wrap) !important;
  align-items: center !important;
  justify-content: center !important;
  align-content: center !important;
  gap: var(--adventure-control-gap) !important;
  min-height: var(--adventure-controlbar-height) !important;
  margin: 0 !important;
  padding: var(--adventure-controlbar-pad) !important;
  overflow: visible !important;
}

body.adventure-rpg-page .adventure-controlbar .adventure-control-button,
body.adventure-rpg-page .adventure-controlbar .adventure-control-field,
body.adventure-rpg-page .adventure-controlbar .restart-top-button {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-sizing: border-box !important;
  height: var(--adventure-control-height) !important;
  min-height: var(--adventure-control-height) !important;
  max-height: var(--adventure-control-height) !important;
  margin: 0 !important;
  padding: 0 var(--adventure-control-inline) !important;
  gap: 6px !important;
  border: 2px solid #8fc1f4 !important;
  border-radius: var(--adventure-control-radius) !important;
  background: rgba(255, 255, 255, 0.92) !important;
  color: #17345f !important;
  font-size: var(--adventure-control-font) !important;
  font-weight: 900 !important;
  line-height: 1 !important;
  white-space: nowrap !important;
}

body.adventure-rpg-page .adventure-controlbar .adventure-more-menu {
  display: none !important;
}
body.adventure-rpg-page .adventure-controlbar .adventure-hero-chip {
  flex: 0 0 var(--adventure-hero-chip-width) !important;
  order: 20 !important;
  margin-left: 0 !important;
  justify-content: flex-start !important;
}

body.adventure-rpg-page .adventure-controlbar .difficulty-top-button {
  flex: 0 1 var(--adventure-difficulty-width) !important;
}

body.adventure-rpg-page .adventure-controlbar .map-name-field {
  flex: 0 1 var(--adventure-map-width) !important;
  pointer-events: none !important;
}

body.adventure-rpg-page .adventure-more-menu > summary {
  flex: 0 0 var(--adventure-more-width) !important;
}

body.adventure-rpg-page .adventure-controlbar .restart-top-button {
  flex: 0 0 var(--adventure-restart-width) !important;
}

body.adventure-rpg-page .adventure-controlbar .difficulty-top-button > span,
body.adventure-rpg-page .adventure-controlbar .map-name-field > span,
body.adventure-rpg-page #difficultyBadge {
  display: none !important;
}

body.adventure-rpg-page .adventure-controlbar select {
  width: 100% !important;
  max-width: var(--adventure-control-select-max) !important;
  height: calc(var(--adventure-control-height) - 12px) !important;
  min-height: calc(var(--adventure-control-height) - 12px) !important;
  padding: 0 4px !important;
  border: 0 !important;
  background: transparent !important;
  color: #17345f !important;
  font-size: var(--adventure-control-font) !important;
  font-weight: 900 !important;
}

body.adventure-rpg-page #monsterWaveText {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  overflow: hidden !important;
  color: #17345f !important;
  font-size: var(--adventure-control-font) !important;
  font-weight: 900 !important;
  line-height: 1.1 !important;
  text-align: center !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

body.adventure-rpg-page .adventure-pressurebar.no-pressure {
  display: none !important;
}

body.adventure-rpg-page .adventure-pressurebar {
  display: grid !important;
  grid-template-columns: var(--adventure-pressure-columns) !important;
  align-items: center !important;
  gap: 8px !important;
  min-height: var(--adventure-pressure-height) !important;
  padding: var(--adventure-pressure-pad) !important;
}

body.adventure-rpg-page .adventure-battle-panel {
  height: var(--adventure-battle-height) !important;
  min-height: var(--adventure-battle-height) !important;
  max-height: var(--adventure-battle-height) !important;
  overflow: hidden !important;
  padding: 0 !important;
}

body.adventure-rpg-page .battle-sky {
  height: 100% !important;
  min-height: 0 !important;
  border-radius: calc(var(--adventure-panel-radius) - 4px) !important;
}

body.adventure-rpg-page .adventure-lower-panel {
  display: grid !important;
  grid-template-rows: auto auto !important;
  align-content: start !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  margin: 0 !important;
  padding: var(--adventure-lower-pad) !important;
  gap: var(--adventure-lower-gap) !important;
  overflow: visible !important;
}

body.adventure-rpg-page .adventure-lower-panel .adventure-card-area {
  display: grid !important;
  grid-template-rows: auto auto !important;
  align-content: start !important;
  height: auto !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

body.adventure-rpg-page .adventure-lower-panel .adventure-card-head,
body.adventure-rpg-page .adventure-lower-panel .adventure-card-area::after {
  display: none !important;
}

body.adventure-rpg-page .adventure-lower-panel .adventure-card-area::before {
  content: "\5C06\4E2D\6587\548C\82F1\6587\914D\5BF9" !important;
  position: static !important;
  inset: auto !important;
  transform: none !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  justify-self: center !important;
  width: min(var(--adventure-hint-width), 90%) !important;
  min-height: var(--adventure-hint-height) !important;
  margin: 0 auto var(--adventure-hint-gap) !important;
  padding: 2px 12px !important;
  box-sizing: border-box !important;
  color: #2f76d2 !important;
  font-size: var(--adventure-hint-font) !important;
  font-weight: 900 !important;
  line-height: 1 !important;
  white-space: nowrap !important;
  background: rgba(255, 255, 255, 0.78) !important;
  border: 2px solid rgba(143, 193, 244, 0.78) !important;
  border-radius: 999px !important;
  pointer-events: none !important;
}

body.adventure-rpg-page .adventure-lower-panel .board-wrap {
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  margin: 0 !important;
  padding: var(--adventure-board-pad) !important;
  align-self: start !important;
  overflow: visible !important;
}

body.adventure-rpg-page .adventure-lower-panel .board,
body.adventure-rpg-page .adventure-lower-panel .board[data-grade] {
  display: grid !important;
  grid-template-columns: repeat(var(--adventure-card-columns), minmax(0, 1fr)) !important;
  grid-auto-rows: var(--adventure-card-height) !important;
  gap: var(--adventure-card-gap) !important;
  height: auto !important;
  min-height: 0 !important;
  align-content: start !important;
  overflow: visible !important;
}

body.adventure-rpg-page .adventure-lower-panel .card {
  height: var(--adventure-card-height) !important;
  min-height: var(--adventure-card-height) !important;
  padding: 4px 8px !important;
  font-size: var(--adventure-card-font) !important;
  border-radius: 12px !important;
}

body.adventure-rpg-page .adventure-lower-panel .adventure-rewardbar {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: var(--adventure-reward-height) !important;
  margin: 0 !important;
  padding: var(--adventure-reward-pad) !important;
  overflow: visible !important;
}

body.adventure-rpg-page .adventure-lower-panel .adventure-reward-left {
  display: none !important;
}

body.adventure-rpg-page .adventure-lower-panel .adventure-reward-details summary {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  justify-content: center !important;
  gap: var(--adventure-reward-gap) !important;
  width: 100% !important;
  overflow: visible !important;
}

body.adventure-rpg-page .adventure-lower-panel .reward-label,
body.adventure-rpg-page .adventure-lower-panel .reward-drop-item {
  font-size: var(--adventure-reward-font) !important;
  line-height: 1 !important;
  white-space: nowrap !important;
}

body.adventure-rpg-page .adventure-lower-panel .reward-drop-item {
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  min-height: var(--adventure-reward-item-height) !important;
  padding: 3px 7px !important;
  border: 2px solid #8fc1f4 !important;
  border-radius: 10px !important;
  background: rgba(255, 255, 255, 0.88) !important;
}

body.adventure-rpg-page .adventure-lower-panel .reward-drop-item img {
  width: var(--adventure-reward-icon-size) !important;
  height: var(--adventure-reward-icon-size) !important;
}

body.adventure-rpg-page .app-bottom-tabbar {
  width: min(var(--adventure-nav-width), calc(100vw - var(--adventure-page-pad) * 2)) !important;
  left: 50% !important;
  right: auto !important;
  transform: translateX(-50%) !important;
}

/* Adventure size 1: narrow phones. */
@media (max-width: 420px) {
  body.adventure-rpg-page {
    --adventure-page-pad: 6px;
    --adventure-shell-width: 420px;
    --adventure-shell-top: 6px;
    --adventure-section-gap: 10px;
    --adventure-panel-radius: 18px;
    --adventure-control-radius: 14px;
    --adventure-topbar-columns: 42px minmax(46px, 0.62fr) minmax(88px, 1fr) max-content;
    --adventure-topbar-gap: 3px;
    --adventure-topbar-height: 58px;
    --adventure-topbar-pad: 6px 5px;
    --adventure-back-size: 38px;
    --adventure-back-font: 13px;
    --adventure-title-size: 14px;
    --adventure-subtitle-size: 7px;
    --adventure-chip-height: 36px;
    --adventure-chip-pad: 0 3px;
    --adventure-select-height: 28px;
    --adventure-deck-font: 9px;
    --adventure-hero-chip-width: 48px;
    --adventure-avatar-size: 25px;
    --adventure-level-font: 10px;
    --adventure-actions-columns: 38px 34px 34px;
    --adventure-action-gap: 3px;
    --adventure-action-size: 34px;
    --adventure-guide-width: 38px;
    --adventure-guide-font: 10px;
    --adventure-icon-size: 19px;
    --adventure-control-wrap: nowrap;
    --adventure-control-gap: 5px;
    --adventure-controlbar-height: 48px;
    --adventure-controlbar-pad: 6px;
    --adventure-control-height: 34px;
    --adventure-control-inline: 7px;
    --adventure-control-font: 11px;
    --adventure-control-select-max: 68px;
    --adventure-difficulty-width: 110px;
    --adventure-map-width: 104px;
    --adventure-more-width: 58px;
    --adventure-restart-width: 74px;
    --adventure-pressure-columns: 116px minmax(0, 1fr);
    --adventure-pressure-height: 32px;
    --adventure-pressure-pad: 5px 8px;
    --adventure-battle-height: 168px;
    --adventure-lower-pad: 10px 8px 8px;
    --adventure-lower-gap: 8px;
    --adventure-hint-width: 260px;
    --adventure-hint-height: 28px;
    --adventure-hint-gap: 8px;
    --adventure-hint-font: 11px;
    --adventure-board-pad: 6px;
    --adventure-card-columns: 3;
    --adventure-card-height: 42px;
    --adventure-card-gap: 5px;
    --adventure-card-font: 13px;
    --adventure-reward-height: 72px;
    --adventure-reward-pad: 6px;
    --adventure-reward-gap: 4px;
    --adventure-reward-font: 9px;
    --adventure-reward-item-height: 30px;
    --adventure-reward-icon-size: 18px;
    --adventure-nav-width: 420px;
  }
}


@media (max-width: 420px) {
  body.adventure-rpg-page .adventure-lower-panel .card,
  body.adventure-rpg-page .adventure-lower-panel .card.english,
  body.adventure-rpg-page .adventure-lower-panel .card.chinese {
    white-space: normal !important;
  }

  body.adventure-rpg-page .adventure-lower-panel .card-text,
  body.adventure-rpg-page .adventure-lower-panel .card.english .card-text,
  body.adventure-rpg-page .adventure-lower-panel .card.chinese .card-text {
    display: block !important;
    max-width: 100% !important;
    overflow: hidden !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
    line-height: 1.08 !important;
    text-align: center !important;
  }
}

@media (max-width: 420px) {
  body.adventure-rpg-page {
    --adventure-difficulty-width: 62px;
    --adventure-map-width: 132px;
    --adventure-restart-width: 76px;
  }

  body.adventure-rpg-page .adventure-controlbar {
    justify-content: flex-start !important;
  }

  body.adventure-rpg-page .adventure-controlbar .difficulty-top-button,
  body.adventure-rpg-page .adventure-controlbar .map-name-field {
    gap: 4px !important;
  }

  body.adventure-rpg-page .adventure-controlbar .difficulty-top-button > span,
  body.adventure-rpg-page .adventure-controlbar .map-name-field > span {
    display: none !important;
  }

  body.adventure-rpg-page .adventure-controlbar .difficulty-top-button select {
    max-width: 48px !important;
    padding-inline: 0 !important;
  }

  body.adventure-rpg-page #monsterWaveText {
    width: auto !important;
    max-width: 112px !important;
    text-align: left !important;
  }
}

@media (max-width: 420px) {
  body.adventure-rpg-page {
    --adventure-hero-chip-width: 76px;
    --adventure-difficulty-width: 72px;
    --adventure-map-width: 134px;
    --adventure-level-font: 9px;
  }

  body.adventure-rpg-page .adventure-controlbar {
    justify-content: center !important;
    gap: 7px !important;
  }

  body.adventure-rpg-page .adventure-controlbar .difficulty-top-button,
  body.adventure-rpg-page .adventure-controlbar .map-name-field,
  body.adventure-rpg-page .adventure-controlbar .adventure-hero-chip {
    flex-grow: 0 !important;
    flex-shrink: 0 !important;
  }

  body.adventure-rpg-page .adventure-controlbar .adventure-hero-chip {
    width: var(--adventure-hero-chip-width) !important;
    min-width: var(--adventure-hero-chip-width) !important;
    padding-inline: 5px !important;
    justify-content: center !important;
    gap: 3px !important;
  }

  body.adventure-rpg-page .adventure-controlbar .adventure-hero-chip strong {
    min-width: 24px !important;
    font-size: var(--adventure-level-font) !important;
    text-align: left !important;
  }
}
/* Adventure size 2: large phones and small tablets. */
@media (min-width: 421px) and (max-width: 767px) {
  body.adventure-rpg-page {
    --adventure-page-pad: 10px;
    --adventure-shell-width: 680px;
    --adventure-shell-top: 8px;
    --adventure-section-gap: 10px;
    --adventure-panel-radius: 20px;
    --adventure-control-radius: 16px;
    --adventure-topbar-columns: 48px minmax(88px, 0.8fr) minmax(150px, 1fr) max-content;
    --adventure-topbar-gap: 5px;
    --adventure-topbar-height: 66px;
    --adventure-topbar-pad: 8px;
    --adventure-back-size: 44px;
    --adventure-back-font: 14px;
    --adventure-title-size: 19px;
    --adventure-subtitle-size: 8px;
    --adventure-chip-height: 44px;
    --adventure-chip-pad: 0 8px;
    --adventure-select-height: 32px;
    --adventure-deck-font: 11px;
    --adventure-hero-chip-width: 72px;
    --adventure-avatar-size: 30px;
    --adventure-level-font: 12px;
    --adventure-actions-columns: 52px 48px 48px;
    --adventure-action-gap: 5px;
    --adventure-action-size: 48px;
    --adventure-guide-width: 52px;
    --adventure-guide-font: 12px;
    --adventure-icon-size: 22px;
    --adventure-control-wrap: nowrap;
    --adventure-control-gap: 8px;
    --adventure-controlbar-height: 58px;
    --adventure-controlbar-pad: 8px;
    --adventure-control-height: 42px;
    --adventure-control-inline: 12px;
    --adventure-control-font: 13px;
    --adventure-control-select-max: 86px;
    --adventure-difficulty-width: 136px;
    --adventure-map-width: 148px;
    --adventure-more-width: 70px;
    --adventure-restart-width: 94px;
    --adventure-pressure-columns: 140px minmax(0, 1fr);
    --adventure-pressure-height: 36px;
    --adventure-pressure-pad: 6px 10px;
    --adventure-battle-height: 176px;
    --adventure-lower-pad: 12px 10px 10px;
    --adventure-lower-gap: 10px;
    --adventure-hint-width: 280px;
    --adventure-hint-height: 30px;
    --adventure-hint-gap: 10px;
    --adventure-hint-font: 12px;
    --adventure-board-pad: 10px;
    --adventure-card-columns: 3;
    --adventure-card-height: 52px;
    --adventure-card-gap: 9px;
    --adventure-card-font: 15px;
    --adventure-reward-height: 68px;
    --adventure-reward-pad: 7px;
    --adventure-reward-gap: 6px;
    --adventure-reward-font: 10px;
    --adventure-reward-item-height: 32px;
    --adventure-reward-icon-size: 20px;
    --adventure-nav-width: 680px;
  }
}

/* Adventure size 3: tablets and middle-width desktop windows. */
@media (min-width: 768px) and (max-width: 1199px) {
  body.adventure-rpg-page {
    --adventure-page-pad: 24px;
    --adventure-shell-width: 960px;
    --adventure-shell-top: 14px;
    --adventure-section-gap: 14px;
    --adventure-panel-radius: 24px;
    --adventure-control-radius: 18px;
    --adventure-topbar-columns: 58px minmax(132px, 0.8fr) minmax(260px, 1fr) max-content;
    --adventure-topbar-gap: 8px;
    --adventure-topbar-height: 76px;
    --adventure-topbar-pad: 10px 14px;
    --adventure-back-size: 50px;
    --adventure-back-font: 15px;
    --adventure-title-size: 24px;
    --adventure-subtitle-size: 10px;
    --adventure-chip-height: 50px;
    --adventure-chip-pad: 0 12px;
    --adventure-select-height: 36px;
    --adventure-deck-font: 13px;
    --adventure-hero-chip-width: 86px;
    --adventure-avatar-size: 34px;
    --adventure-level-font: 13px;
    --adventure-actions-columns: 58px 54px 54px;
    --adventure-action-gap: 7px;
    --adventure-action-size: 54px;
    --adventure-guide-width: 58px;
    --adventure-guide-font: 13px;
    --adventure-icon-size: 24px;
    --adventure-control-wrap: nowrap;
    --adventure-control-gap: 10px;
    --adventure-controlbar-height: 70px;
    --adventure-controlbar-pad: 10px 14px;
    --adventure-control-height: 48px;
    --adventure-control-inline: 16px;
    --adventure-control-font: 14px;
    --adventure-control-select-max: 104px;
    --adventure-difficulty-width: 154px;
    --adventure-map-width: 190px;
    --adventure-more-width: 80px;
    --adventure-restart-width: 112px;
    --adventure-pressure-columns: 170px minmax(0, 1fr);
    --adventure-pressure-height: 42px;
    --adventure-pressure-pad: 7px 14px;
    --adventure-battle-height: 220px;
    --adventure-lower-pad: 16px 14px 12px;
    --adventure-lower-gap: 12px;
    --adventure-hint-width: 300px;
    --adventure-hint-height: 32px;
    --adventure-hint-gap: 12px;
    --adventure-hint-font: 13px;
    --adventure-board-pad: 12px;
    --adventure-card-columns: 4;
    --adventure-card-height: 54px;
    --adventure-card-gap: 10px;
    --adventure-card-font: 16px;
    --adventure-reward-height: 64px;
    --adventure-reward-pad: 8px;
    --adventure-reward-gap: 8px;
    --adventure-reward-font: 11px;
    --adventure-reward-item-height: 34px;
    --adventure-reward-icon-size: 22px;
    --adventure-nav-width: 960px;
  }
}

/* Adventure size 4: desktop and wide desktop. */
@media (min-width: 1200px) {
  body.adventure-rpg-page {
    --adventure-page-pad: 40px;
    --adventure-shell-width: 1180px;
    --adventure-shell-top: 18px;
    --adventure-section-gap: 14px;
    --adventure-panel-radius: 24px;
    --adventure-control-radius: 18px;
    --adventure-topbar-columns: 58px minmax(170px, 0.75fr) minmax(360px, 1fr) max-content;
    --adventure-topbar-gap: 10px;
    --adventure-topbar-height: 78px;
    --adventure-topbar-pad: 10px 14px;
    --adventure-back-size: 52px;
    --adventure-back-font: 15px;
    --adventure-title-size: 27px;
    --adventure-subtitle-size: 11px;
    --adventure-chip-height: 52px;
    --adventure-chip-pad: 0 14px;
    --adventure-select-height: 38px;
    --adventure-deck-font: 14px;
    --adventure-hero-chip-width: 92px;
    --adventure-avatar-size: 36px;
    --adventure-level-font: 14px;
    --adventure-actions-columns: 64px 58px 58px;
    --adventure-action-gap: 8px;
    --adventure-action-size: 58px;
    --adventure-guide-width: 64px;
    --adventure-guide-font: 14px;
    --adventure-icon-size: 26px;
    --adventure-control-wrap: nowrap;
    --adventure-control-gap: 12px;
    --adventure-controlbar-height: 72px;
    --adventure-controlbar-pad: 10px 16px;
    --adventure-control-height: 50px;
    --adventure-control-inline: 18px;
    --adventure-control-font: 15px;
    --adventure-control-select-max: 110px;
    --adventure-difficulty-width: 164px;
    --adventure-map-width: 206px;
    --adventure-more-width: 82px;
    --adventure-restart-width: 114px;
    --adventure-pressure-columns: 180px minmax(0, 1fr);
    --adventure-pressure-height: 44px;
    --adventure-pressure-pad: 8px 16px;
    --adventure-battle-height: 240px;
    --adventure-lower-pad: 16px 14px 14px;
    --adventure-lower-gap: 12px;
    --adventure-hint-width: 320px;
    --adventure-hint-height: 34px;
    --adventure-hint-gap: 12px;
    --adventure-hint-font: 13px;
    --adventure-board-pad: 12px;
    --adventure-card-columns: 6;
    --adventure-card-height: 50px;
    --adventure-card-gap: 10px;
    --adventure-card-font: 16px;
    --adventure-reward-height: 62px;
    --adventure-reward-pad: 8px;
    --adventure-reward-gap: 8px;
    --adventure-reward-font: 11px;
    --adventure-reward-item-height: 34px;
    --adventure-reward-icon-size: 22px;
    --adventure-nav-width: 860px;
  }
}

/* Boss gate popup icon: crop sprite sheet to the normal first frame. */
body.adventure-rpg-page .ability-reward-panel .reward-icon.reward-boss.has-image {
  background-position: 0 0 !important;
  background-repeat: no-repeat !important;
  background-size: 400% 400% !important;
}
