/* WE 王國冒險者中心：手機版正式修正層 */
@media (max-width: 900px) {
  html,
  body.kingdom-v2-page {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  body.kingdom-v2-page {
    background-attachment: scroll;
  }

  .v2-topbar {
    width: 100%;
    min-width: 0;
    gap: 8px;
  }

  .v2-brand,
  .v2-session,
  .v2-session > div {
    min-width: 0;
  }

  .v2-brand strong,
  .v2-session strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .v2-main {
    width: 100%;
    max-width: 100%;
    overflow: clip;
    padding: 8px 8px calc(92px + env(safe-area-inset-bottom));
  }

  .v2-dashboard,
  .v2-dashboard-grid,
  .v2-panel,
  .v2-reward-cards,
  .v2-stat-row {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .v2-hero {
    height: auto;
    min-height: 0;
    display: block;
    padding: 10px;
  }

  .v2-hero::after {
    inset: 4px;
    border-width: 12px;
    border-image-width: 11px;
  }

  .v2-hero-scroll {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 15px 20px 14px;
    clip-path: none;
  }

  .v2-hero-scroll::before,
  .v2-hero-scroll::after {
    width: 7px;
  }

  .v2-hero-scroll h1 {
    font-size: clamp(28px, 9vw, 36px);
  }

  .v2-hero-scroll p {
    font-size: 12px;
  }

  .v2-party {
    position: relative;
    inset: auto;
    height: 150px;
    margin-top: 6px;
    opacity: 1;
  }

  .v2-party img {
    bottom: -38px;
    width: 34%;
    height: 190px;
    object-fit: contain;
    border-radius: 0;
  }

  .v2-party-one { left: -2%; }
  .v2-party-two { left: 21%; }
  .v2-party-three { left: 45%; }
  .v2-party-four { left: 69%; }

  .v2-dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: 'profile' 'pass' 'missions' 'stats' 'boss' 'rewards';
    grid-template-rows: none;
    gap: 10px;
  }

  .v2-profile-card,
  .v2-pass-card,
  .v2-mission-board,
  .v2-boss-card,
  .v2-reward-card {
    min-height: 0;
    height: auto;
  }

  .v2-profile-top {
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 12px;
  }

  .v2-profile-art {
    width: 92px;
    height: 105px;
  }

  .v2-profile-top h2 {
    max-width: 100%;
    overflow-wrap: anywhere;
    font-size: clamp(24px, 7vw, 31px);
  }

  .v2-class-tag {
    max-width: 100%;
    padding: 5px 13px;
  }

  .v2-profile-meta div,
  .v2-profile-level,
  .v2-exp-caption {
    flex-wrap: wrap;
    row-gap: 3px;
  }

  .v2-pass-card {
    padding: 16px 14px 14px;
  }

  .v2-qr {
    width: min(168px, 56vw);
    height: min(168px, 56vw);
  }

  .v2-qr canvas,
  .v2-qr img,
  .v2-qr svg {
    width: calc(min(168px, 56vw) - 23px) !important;
    height: calc(min(168px, 56vw) - 23px) !important;
    max-width: 100%;
  }

  .v2-pass-meta {
    grid-template-columns: 1fr;
  }

  .v2-pass-meta span + span {
    border-left: 0;
    border-top: 1px solid rgba(214,162,59,.5);
  }

  .v2-mission-board {
    padding: 12px 13px 14px;
  }

  .v2-mission-board header h2 {
    font-size: 26px;
  }

  .v2-mission-list,
  .v2-mission-list .kingdom-mission-item,
  .v2-mission-list .kingdom-empty-mini {
    width: 100%;
    min-width: 0;
  }

  .v2-mission-list .kingdom-mission-item-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }

  .v2-mission-list h3,
  .v2-mission-list p {
    overflow-wrap: anywhere;
  }

  .v2-stat-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .v2-stat-row article {
    min-width: 0;
    padding: 10px 8px;
  }

  .v2-stat-row article img {
    width: 34px;
    height: 34px;
  }

  .v2-stat-row strong,
  .v2-stat-row small {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .v2-boss-card {
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr);
    min-height: 0;
  }

  .v2-boss-art {
    position: relative;
    right: auto;
    bottom: auto;
    width: auto;
    height: auto;
    min-height: 210px;
    opacity: 1;
  }

  .v2-boss-content {
    min-width: 0;
    padding: 14px 12px 14px 0;
  }

  .v2-boss-content header {
    align-items: flex-start;
    flex-direction: column;
  }

  .v2-boss-content header h2 {
    font-size: 21px;
  }

  .v2-boss-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .v2-boss-button {
    width: 100%;
  }

  .v2-reward-cards {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
  }

  .v2-reward-card {
    grid-template-columns: 90px minmax(0, 1fr);
    grid-template-rows: auto auto auto auto;
    justify-items: stretch;
    align-items: center;
    column-gap: 10px;
    padding: 10px;
    text-align: left;
  }

  .v2-reward-card h3,
  .v2-reward-card > span,
  .v2-reward-card > strong {
    grid-column: 2;
  }

  .v2-reward-card > img {
    grid-column: 1;
    grid-row: 1 / 4;
    width: 84px;
    height: 84px;
  }

  .v2-reward-card button {
    grid-column: 1 / -1;
  }

  .v2-dialog {
    width: calc(100% - 12px);
    max-height: calc(100dvh - 12px);
  }

  .v2-dialog-head {
    padding: 12px 13px;
  }

  .v2-dialog-head h2 {
    font-size: 22px;
  }

  .v2-dialog-body,
  .v2-record-grid {
    max-height: calc(100dvh - 82px);
    padding: 12px;
  }

  .kingdom-toast-stack {
    left: 8px;
    right: 8px;
    top: 76px;
  }

  .kingdom-toast {
    width: 100%;
    min-width: 0;
  }

  .kingdom-mobile-nav {
    left: 6px;
    right: 6px;
    bottom: calc(6px + env(safe-area-inset-bottom));
  }

  .kingdom-mobile-nav a {
    min-width: 0;
    min-height: 54px;
    overflow: hidden;
  }
}

@media (max-width: 480px) {
  :root { --v2-header: 62px; }

  .v2-topbar {
    grid-template-columns: 46px minmax(0, 1fr);
    padding: 0 7px;
  }

  .v2-brand img {
    width: 42px;
    height: 46px;
  }

  .v2-brand span,
  .v2-session-avatar,
  .v2-session small {
    display: none;
  }

  .v2-session {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px;
    padding-left: 0;
  }

  .v2-session strong {
    font-size: 12px;
  }

  .v2-logout {
    min-height: 34px;
    padding: 0 9px;
    font-size: 12px;
  }

  .v2-main {
    padding-inline: 6px;
  }

  .v2-hero {
    padding: 7px;
  }

  .v2-hero-scroll {
    padding: 13px 13px 12px;
  }

  .v2-hero-scroll strong {
    margin-inline: 0;
    font-size: 12px;
  }

  .v2-party {
    height: 118px;
  }

  .v2-party img {
    bottom: -34px;
    width: 38%;
    height: 155px;
  }

  .v2-party-one { left: -7%; }
  .v2-party-two { left: 18%; }
  .v2-party-three { left: 43%; }
  .v2-party-four { left: 68%; }

  .v2-profile-card {
    padding: 14px 12px 12px;
  }

  .v2-profile-top {
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 9px;
  }

  .v2-profile-art {
    width: 74px;
    height: 86px;
  }

  .v2-profile-top h2 {
    font-size: 23px;
  }

  .v2-profile-level b {
    font-size: 17px;
  }

  .v2-stat-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .v2-boss-card {
    grid-template-columns: 1fr;
  }

  .v2-boss-art {
    position: absolute;
    right: -18px;
    bottom: 0;
    width: 48%;
    height: 48%;
    min-height: 0;
    opacity: .45;
  }

  .v2-boss-content {
    position: relative;
    z-index: 2;
    padding: 14px;
  }

  .v2-boss-stats strong {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .v2-reward-card {
    grid-template-columns: 76px minmax(0, 1fr);
  }

  .v2-reward-card > img {
    width: 72px;
    height: 72px;
  }

  .kingdom-mobile-nav a {
    padding-inline: 2px;
    font-size: 9px;
  }
}
