/* ============================================================
   CLASH — Responsive Media Queries & Mobile / Tablet Layouts
   File: css/responsive.css
   ============================================================ */

/* ══════════════════════════════════════════════════════════════
       RESPONSIVE BREAKPOINTS
       ══════════════════════════════════════════════════════════════ */

/* ── Medium / Tablet Landscape (769px - 1024px) ──────────── */
@media (max-width: 1024px) {
  :root {
    --hud-padding: 10px 16px;
    --hud-gap: 12px;
    --hud-bottom: 16px;
  }

  #selectorsWrapper {
    gap: 24px;
  }

  .hero-select-container {
    grid-template-columns: repeat(3, auto);
    justify-content: center;
    width: fit-content;
    margin: 0 auto;
    gap: 8px;
  }

  .hero-card {
    padding: 2px;
  }

  .hero-avatar {
    width: 44px;
    height: 44px;
    margin-bottom: 0;
  }

  .hero-card h3 {
    font-size: 13px;
  }

  .hero-desc {
    font-size: 8px;
    margin-bottom: 10px;
  }

  .hero-stats {
    font-size: 10px;
    gap: 0;
  }

  .hero-card.stats-open .hero-stats {
    padding-top: 10px;
  }

  .player-hud {
    max-width: 600px;
  }

  .player-hud.p1-side,
  .player-hud.p2-side {
    max-width: 420px;
  }

  .abil {
    width: 48px;
    height: 48px;
  }

  .abil .k {
    font-size: 8px;
  }

  .abil .n {
    font-size: 7px;
  }

  #modeSelectContainer {
    max-width: 460px;
  }

  .lobby-panel {
    max-width: 400px;
  }

  .match-stats-duration {
    padding: 12px 22px;
  }

  .player-stats-col {
    min-width: 200px;
  }

  #minimap {
    bottom: auto;
    top: 10px;
    right: 10px;
    z-index: 15;
  }

  .kf {
    top: 120px;
  }
}

/* ── Tablet Portrait / Small Laptop (481px - 768px) ──────── */
@media (max-width: 768px) {
  :root {
    --hud-padding: 8px 12px;
    --hud-gap: 10px;
    --hud-bottom: 12px;
  }

  .player-hud.centered {
    max-width: 100%;
  }

  .player-hud.p1-side,
  .player-hud.p2-side {
    width: calc(50% - 16px);
    max-width: 380px;
  }

  .abil {
    width: 44px;
    height: 44px;
  }

  .abil .k {
    font-size: 7px;
    padding: 0 3px;
  }

  .abil .n {
    font-size: 6.5px;
  }

  .portrait-container {
    width: 48px;
    height: 48px;
  }

  .portrait-level-badge {
    width: 17px;
    height: 17px;
    font-size: 8px;
    bottom: -3px;
  }

  .hud-stats-gold {
    min-width: 72px;
    padding-left: 10px;
  }

  .stat-mini {
    font-size: 10px;
  }

  .gold-mini-wrap .gold-val {
    font-size: 14px;
  }

  .gold-mini-wrap svg {
    width: 12px;
    height: 12px;
  }

  #selectorsWrapper {
    gap: 20px;
  }

  .select-col {
    min-width: 240px;
  }

  .hero-select-container {
    grid-template-columns: repeat(3, auto);
    justify-content: center;
    width: fit-content;
    margin: 0 auto;
    gap: 7px;
  }

  .hero-card {
    padding: 2px;
  }

  .hero-avatar {
    width: 40px;
    height: 40px;
    margin-bottom: 0;
  }

  .hero-card h3 {
    font-size: 12px;
  }

  .hero-desc {
    font-size: 7px;
    margin-bottom: 8px;
    letter-spacing: 1px;
  }

  .hero-stats {
    font-size: 9px;
  }

  .hero-card.stats-open .hero-stats {
    padding-top: 8px;
  }

  .hero-stats div {
    padding: 3px 4px;
  }

  #modeSelectContainer {
    max-width: 100%;
    gap: 2px;
    padding: 3px;
  }

  #overlay .mode-btn {
    min-width: 80px;
    padding: 8px 10px;
    font-size: 9px;
    letter-spacing: 0.5px;
  }

  #coopTypeContainer,
  #sandboxTypeContainer,
  #lobbyRoleContainer,
  .lobby-role-container {
    padding: 3px;
  }

  #coopTypeContainer .lobby-role-btn,
  #sandboxTypeContainer .lobby-role-btn,
  #lobbyRoleContainer .lobby-role-btn,
  .lobby-role-container .lobby-role-btn {
    min-width: 80px;
    font-size: 9px;
    padding: 8px 10px;
  }

  #coopSettings,
  #pvpSettings {
    padding: 12px 16px;
  }

  #coopMatchupSelect,
  #pvpMatchupSelect {
    font-size: 10px;
    padding: 8px 14px;
  }

  .lobby-panel {
    max-width: 100%;
    padding: 14px 16px;
  }

  .code-display {
    font-size: 20px;
    padding: 8px 20px;
    letter-spacing: 6px;
  }

  #overlay #joinCodeInput {
    font-size: 16px;
    max-width: 180px;
  }

  .match-stats-vs-divider {
    display: none;
  }

  #playersStatsWrapper {
    flex-direction: column;
    align-items: center;
    gap: 20px;
  }

  .player-stats-col {
    max-width: 100%;
    width: 100%;
  }

  .match-stats-duration {
    padding: 10px 18px;
    gap: 10px;
  }

  .duration-text .stat-val {
    font-size: 20px;
  }

  .player-stats-col .stat-card {
    padding: 12px 8px;
  }

  .player-stats-col .stat-val {
    font-size: 14px;
  }

  .player-stats-col .stat-label {
    font-size: 6.5px;
    letter-spacing: 0.8px;
  }

  .stat-card-icon {
    width: 24px;
    height: 24px;
    margin-bottom: 6px;
  }

  .ch {
    font-size: 9px;
    line-height: 1.8;
    padding: 8px 12px;
  }

  .ch kbd {
    font-size: 8px;
    padding: 0 3px;
  }

  .kf {
    top: 80px;
    right: 10px;
  }

  .km {
    font-size: 10px;
    padding: 6px 12px;
  }

  .menu-divider {
    max-width: 160px;
    margin-bottom: 12px;
  }

  #shop {
    max-width: 100%;
    padding: 16px;
    border-radius: var(--radius-md);
  }

  .potions-grid {
    gap: 6px;
  }

  .potion-card {
    padding: 8px 6px 6px 6px;
  }

  .potion-card .p-name {
    font-size: 10px;
  }

  .potion-card .p-desc {
    font-size: 7px;
  }

  .potion-card .p-price {
    font-size: 8px;
  }
}

/* ── Small Mobile / Phablet Portrait (481px - 640px) ─────── */
@media (max-width: 640px) {
  .hero-select-container {
    grid-template-columns: repeat(3, auto);
    justify-content: center;
    width: fit-content;
    margin: 0 auto;
    gap: 6px;
  }

  .hero-card {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2px;
    gap: 0;
  }

  .hero-avatar {
    margin-bottom: 0;
    width: 36px;
    height: 36px;
  }

  .hero-card h3 {
    text-align: left;
    margin-bottom: 0;
  }

  .hero-desc {
    margin-bottom: 0;
    text-align: left;
  }

  .hero-stats {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    border-top: none;
    padding-top: 0;
    gap: 6px;
    margin-left: auto;
    justify-content: flex-end;
    max-width: 50%;
  }

  .hero-stats div {
    background: transparent !important;
    padding: 0;
    width: auto;
    gap: 4px;
  }
}

/* ── Mobile Portrait (480px and below) ───────────────────── */
@media (max-width: 480px) {
  :root {
    --hud-padding: 6px 10px;
    --hud-gap: 8px;
    --hud-bottom: 10px;
  }

  .player-hud.centered {
    width: calc(100% - 20px);
  }

  .player-hud.p1-side,
  .player-hud.p2-side {
    width: calc(50% - 14px);
    max-width: none;
  }

  .abil {
    width: 38px;
    height: 38px;
  }

  .abil .k {
    font-size: 6.5px;
    padding: 0 2px;
    border-radius: 2px;
  }

  .abil .n {
    font-size: 6px;
  }

  .portrait-container {
    width: 40px;
    height: 40px;
  }

  .portrait-level-badge {
    width: 15px;
    height: 15px;
    font-size: 7px;
  }

  .hud-stats-gold {
    min-width: 60px;
    padding-left: 8px;
  }

  .stat-mini {
    font-size: 9px;
  }

  .stat-lbl {
    font-size: 8px;
  }

  .gold-mini-wrap .gold-val {
    font-size: 12px;
  }

  .gold-mini-wrap svg {
    width: 10px;
    height: 10px;
  }

  .bar-wrap {
    height: 12px;
  }

  .bar-val {
    font-size: 8px;
  }

  #overlay h1 {
    margin-bottom: 2px;
  }

  #overlay p {
    font-size: 10px;
    max-width: 320px;
    margin-bottom: 10px;
  }

  #modeSelectContainer {
    border-radius: var(--radius-md);
    margin-bottom: 14px;
  }

  #overlay .mode-btn {
    min-width: 70px;
    padding: 7px 8px;
    font-size: 8px;
    letter-spacing: 0.3px;
  }

  #coopTypeContainer,
  #sandboxTypeContainer,
  #lobbyRoleContainer,
  .lobby-role-container {
    margin-top: 10px;
    border-radius: var(--radius-md);
  }

  #coopTypeContainer .lobby-role-btn,
  #sandboxTypeContainer .lobby-role-btn,
  #lobbyRoleContainer .lobby-role-btn,
  .lobby-role-container .lobby-role-btn {
    min-width: 70px;
    font-size: 8px;
    padding: 7px 8px;
  }

  #coopSettings,
  #pvpSettings {
    margin-top: 8px;
    margin-bottom: 8px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
  }

  #coopSettings label,
  #pvpSettings label {
    font-size: 8px;
    letter-spacing: 1.5px;
  }

  #coopMatchupSelect,
  #pvpMatchupSelect {
    font-size: 9px;
    padding: 7px 10px;
    min-height: 36px;
  }

  .lobby-panel {
    padding: 12px 14px;
    border-radius: var(--radius-md);
    margin-top: 10px;
  }

  #overlay .lobby-role-btn {
    padding: 7px 14px;
    font-size: 9px;
    min-height: 32px;
  }

  .code-display {
    font-size: 18px;
    padding: 6px 16px;
    letter-spacing: 4px;
  }

  #overlay #joinCodeInput {
    font-size: 14px;
    padding: 8px 10px;
    letter-spacing: 3px;
    max-width: 160px;
    min-height: 38px;
  }

  #overlay #hostActionBtn,
  #overlay #joinActionBtn {
    font-size: 9px;
    padding: 9px 20px;
    min-width: 140px;
    min-height: 38px;
    letter-spacing: 1.5px;
  }

  #netStatus,
  #netStatusHost,
  #joinCodeLabel {
    font-size: 7px;
  }

  #selectorsWrapper {
    gap: 16px;
    margin-bottom: 20px;
  }

  .select-col {
    min-width: 200px;
  }

  .select-col h4 {
    font-size: 9.5px;
    letter-spacing: 2px;
    margin-bottom: 10px;
    padding: 4px 12px;
  }

  .hero-select-container {
    grid-template-columns: repeat(3, auto);
    justify-content: center;
    width: fit-content;
    margin: 0 auto;
    gap: 5px;
  }

  .hero-card {
    padding: 2px;
    border-radius: 10px;
    min-height: auto;
  }

  .hero-avatar {
    width: 34px;
    height: 34px;
    margin-bottom: 0;
    border-width: 1.5px;
    border-radius: 8px;
  }

  .hero-avatar svg {
    width: 16px;
    height: 16px;
  }

  .hero-card h3 {
    font-size: 11px;
    margin-bottom: 2px;
  }

  .hero-desc {
    font-size: 7px;
    margin-bottom: 6px;
    letter-spacing: 0.5px;
    padding: 1px 5px;
  }

  .hero-stats {
    font-size: 8px;
    gap: 2px;
  }

  .hero-card.stats-open .hero-stats {
    padding-top: 6px;
  }

  .hero-stats div {
    padding: 2px 4px;
    border-radius: 4px;
    font-size: 8px;
  }

  .hero-stats div span {
    font-size: 8.5px;
  }

  #matchStatsContainer {
    padding: 16px 12px;
    border-radius: var(--radius-lg);
    gap: 14px;
    margin-bottom: 20px;
  }

  .match-stats-duration {
    padding: 8px 14px;
    gap: 8px;
    border-radius: var(--radius-md);
  }

  .duration-icon {
    width: 22px;
    height: 22px;
  }

  .duration-text .stat-val {
    font-size: 18px;
    letter-spacing: 1px;
  }

  .duration-text .stat-label {
    font-size: 7px;
    letter-spacing: 1px;
    margin-top: 3px;
  }

  .stats-grid {
    gap: 6px;
  }

  .stat-card {
    padding: 10px 6px;
    border-radius: var(--radius-md);
  }

  .stat-val {
    font-size: 16px;
  }

  .stat-label {
    font-size: 7px;
    letter-spacing: 1px;
    margin-top: 4px;
  }

  .stat-card-icon {
    width: 20px;
    height: 20px;
    margin-bottom: 6px;
  }

  .player-stats-col .stat-card {
    padding: 10px 6px;
  }

  .player-stats-col .stat-val {
    font-size: 13px;
  }

  .player-stats-col .stat-label {
    font-size: 6px;
  }

  .stats-col-title {
    font-size: 9px;
    letter-spacing: 2px;
    margin-bottom: 10px;
  }

  #overlay #oBtn {
    width: 170px;
    height: 36px;
    line-height: 34px;
    font-size: 10px;
    letter-spacing: 1.5px;
    text-indent: 1.5px;
    margin-top: 12px;
    white-space: nowrap;
  }

  .menu-divider {
    max-width: 120px;
    margin-bottom: 10px;
  }

  .exit-btn {
    width: 32px;
    height: 32px;
    top: 10px;
    left: 10px;
  }


  .audio-mute-btn {
    width: 32px;
    height: 32px;
    top: 10px;
    right: 10px;
  }

  .match-timer {
    font-size: 11px;
    padding: 4px 10px;
    min-width: 64px;
  }

  .ch {
    font-size: 8px;
    line-height: 1.7;
    padding: 6px 10px;
    border-radius: var(--radius-md);
  }

  .ch kbd {
    font-size: 7px;
    padding: 0 2px;
    border-radius: 2px;
  }

  .kf {
    top: 70px;
    right: 6px;
    gap: 4px;
  }

  .km {
    font-size: 9px;
    padding: 5px 10px;
    border-radius: var(--radius-sm);
  }

  .confirm-modal-content {
    padding: 16px;
    border-radius: var(--radius-md);
  }

  .confirm-modal-content h2 {
    font-size: 16px;
    margin-bottom: 12px;
    letter-spacing: 1px;
  }

  .confirm-modal-content p {
    font-size: 11px;
    margin-bottom: 18px;
    line-height: 1.5;
  }

  .confirm-btn {
    font-size: 10px;
    padding: 8px 16px;
    min-width: 100px;
    min-height: 38px;
  }

  #shop {
    padding: 10px;
    width: 96%;
  }

  #shop h2 {
    font-size: 13px;
    margin-bottom: 8px;
  }

  .shop-section-title {
    font-size: 8px;
    letter-spacing: 1.5px;
    margin-top: 8px;
    margin-bottom: 3px;
  }

  .potions-grid {
    gap: 4px;
  }

  .potion-card {
    padding: 6px 4px 4px 4px;
    border-radius: var(--radius-sm);
  }

  .potion-card .p-name {
    font-size: 9px;
  }

  .potion-card .p-desc {
    display: none;
  }

  .potion-card .p-price {
    font-size: 7px;
    top: 3px;
    right: 4px;
  }

  .si {
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    min-height: 32px;
  }

  .si .in,
  .si-num {
    font-size: 10.5px;
  }

  .si .is {
    font-size: 8.5px;
  }

  .si .ic {
    font-size: 10.5px;
  }

  .shop-exit-text {
    font-size: 9px;
    margin-top: 10px;
  }

  .shop-kbd {
    font-size: 8px;
    padding: 2px 5px;
  }

  #minimap {
    bottom: auto;
    top: 10px;
    right: 10px;
    border-radius: var(--radius-md);
  }
}

/* ── Ultra-small (360px and below) ───────────────────────── */
@media (max-width: 360px) {
  :root {
    --hud-padding: 5px 8px;
    --hud-gap: 6px;
    --hud-bottom: 8px;
  }

  .player-hud.p1-side,
  .player-hud.p2-side {
    width: calc(50% - 12px);
  }

  .abil {
    width: 34px;
    height: 34px;
    gap: 2px;
  }

  .abil .k {
    font-size: 6px;
  }

  .abil .n {
    font-size: 5.5px;
  }

  .portrait-container {
    width: 34px;
    height: 34px;
  }

  .portrait-level-badge {
    width: 13px;
    height: 13px;
    font-size: 6px;
  }

  .hud-stats-gold {
    min-width: 50px;
    padding-left: 6px;
  }

  .stat-mini {
    font-size: 8px;
  }

  .gold-mini-wrap .gold-val {
    font-size: 10px;
  }

  .bar-wrap {
    height: 10px;
  }

  .bar-val {
    font-size: 7px;
  }

  .hero-card {
    padding: 6px 8px;
  }

  .hero-avatar {
    width: 28px;
    height: 28px;
    margin-bottom: 0;
  }

  .hero-avatar svg {
    width: 14px;
    height: 14px;
  }

  .hero-card h3 {
    font-size: 10px;
  }

  .hero-desc {
    font-size: 6px;
    margin-bottom: 0;
  }

  .hero-stats {
    font-size: 7px;
    padding-top: 0;
  }

  .hero-stats div {
    padding: 0;
  }

  .hero-stats div span {
    font-size: 7px;
  }

  #overlay .mode-btn {
    min-width: 60px;
    padding: 6px 6px;
    font-size: 7px;
  }

  .match-stats-duration {
    padding: 6px 10px;
  }

  .duration-text .stat-val {
    font-size: 15px;
  }

  .stat-card {
    padding: 8px 4px;
  }

  .stat-val {
    font-size: 14px;
  }

  .stat-label {
    font-size: 6px;
  }

  .stat-card-icon {
    width: 18px;
    height: 18px;
    margin-bottom: 4px;
  }

  .code-display {
    font-size: 16px;
    padding: 5px 12px;
    letter-spacing: 3px;
  }
}

/* ── Landscape orientation on mobile ─────────────────────── */
@media (max-height: 500px) and (orientation: landscape) {
  #overlay {
    padding: 12px 20px;
    justify-content: center;
  }

  #overlay h1 {
    font-size: 28px;
    margin-bottom: 2px;
  }

  #overlay p {
    font-size: 10px;
    max-width: 360px;
    margin-bottom: 8px;
  }

  #modeSelectContainer {
    margin-bottom: 10px;
  }

  .menu-divider {
    margin-bottom: 6px;
  }

  #selectorsWrapper {
    gap: 16px;
    margin-bottom: 16px;
  }

  .hero-card {
    padding: 8px 6px;
  }

  .hero-avatar {
    width: 30px;
    height: 30px;
    margin-bottom: 4px;
  }

  .hero-card h3 {
    font-size: 11px;
  }

  .hero-desc {
    font-size: 6px;
    margin-bottom: 4px;
  }

  .hero-stats {
    font-size: 8px;
    padding-top: 4px;
  }

  #overlay #oBtn {
    width: 150px;
    height: 32px;
    line-height: 30px;
    margin-top: 10px;
    font-size: 9px;
    letter-spacing: 1px;
    text-indent: 1px;
    white-space: nowrap;
  }

  .match-stats-duration {
    padding: 6px 14px;
  }

  .player-hud {
    --hud-bottom: 6px;
  }

  .abil {
    width: 36px;
    height: 36px;
  }

  .portrait-container {
    width: 36px;
    height: 36px;
  }

  .ch {
    display: none;
  }
}

/* ── Short Screens Sizing ────────────────────────── */
@media (max-height: 550px) {
  #shop {
    padding: 8px 12px;
    top: 6px;
    max-height: min(78vh, 380px);
  }

  #shop h2 {
    font-size: 13px;
    margin-bottom: 6px;
  }

  .shop-section-title {
    font-size: 8px;
    margin-top: 6px;
    margin-bottom: 2px;
  }

  .potions-grid {
    gap: 4px;
    margin-bottom: 4px;
  }

  .potion-card {
    padding: 4px 6px;
    min-height: 32px;
  }

  .potion-card .p-name {
    font-size: 8.5px;
  }

  .potion-card .p-desc {
    display: none;
  }

  #shopList,
  #activeShopList {
    gap: 4px;
    margin-top: 4px;
  }

  .si {
    padding: 6px 10px;
    min-height: 30px;
  }

  .si .in,
  .si-num {
    font-size: 10.5px;
  }

  .si .is {
    font-size: 8px;
  }

  .si .ic {
    font-size: 10.5px;
  }

  .shop-exit-text {
    margin-top: 6px;
    font-size: 8px;
  }
}

/* ── High DPI adjustments ────────────────────────────────── */
@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {

  .hero-card::before,
  .lobby-panel::before,
  #modeSelectContainer::before,
  #coopTypeContainer::before,
  #coopSettings::before,
  #pvpSettings::before,
  #singleSettings::before,
  #matchStatsContainer::before {
    height: 1px;
  }
}

/* ── Prefers reduced motion ──────────────────────────────── */
@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  #overlay #oBtn {
    animation: none;
    text-shadow: 0 0 6px rgba(200, 155, 60, 0.15);
  }

  .bar-fill::before {
    animation: none;
  }

  .gold-mini-wrap svg {
    animation: none;
  }

  .buff-icon {
    animation: none;
  }
}