/* ==============================================================================
   DragondarnDE - PWA App Styles (Install Banner, Bottom Bar, Offline, Cockpit)
   ============================================================================== */

:root {
  --pwa-bottom-bar-height: 64px;
  --pwa-safe-bottom: env(safe-area-inset-bottom, 0px);
  --pwa-safe-top: env(safe-area-inset-top, 0px);
}

/* Safe-area support for installed standalone apps */
html.pwa-standalone body {
  padding-top: var(--pwa-safe-top);
}

html.pwa-standalone .navbar {
  top: var(--pwa-safe-top);
}

/* Navbar Install / App Pill Button */
.btn-nav-pwa {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  height: 38px;
  padding: 0 0.85rem;
  border-radius: var(--radius-full);
  background: rgba(255, 87, 34, 0.14);
  border: 1px solid rgba(255, 87, 34, 0.42);
  color: #ffb199;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.18s ease, background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
  white-space: nowrap;
  font-family: inherit;
}

.btn-nav-pwa:hover {
  background: linear-gradient(135deg, var(--primary) 0%, #e64a19 100%);
  border-color: var(--primary);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(255, 87, 34, 0.35);
}

.btn-nav-pwa.is-installed {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.35);
  color: #6ee7b7;
  padding: 0 0.7rem;
}

.btn-nav-pwa.is-installed:hover {
  background: rgba(16, 185, 129, 0.24);
  border-color: #10b981;
  color: #fff;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.25);
}

@media (max-width: 992px) {
  .btn-nav-pwa .pwa-nav-label {
    display: none;
  }
  .btn-nav-pwa {
    width: 38px;
    padding: 0;
    justify-content: center;
  }
}

/* ==============================================================================
   1. Offline & Reconnect Status Bar
   ============================================================================== */
.pwa-offline-bar {
  position: fixed;
  top: calc(10px + var(--pwa-safe-top));
  left: 50%;
  transform: translate(-50%, -140%);
  z-index: 10450;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 1.05rem;
  border-radius: 999px;
  background: rgba(14, 19, 31, 0.96);
  border: 1px solid rgba(245, 158, 11, 0.5);
  color: #fef3c7;
  font-size: 0.82rem;
  font-weight: 600;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
  max-width: calc(100vw - 1.5rem);
}

.pwa-offline-bar.visible {
  transform: translate(-50%, 0);
  opacity: 1;
  pointer-events: auto;
}

.pwa-offline-bar.is-online {
  border-color: rgba(16, 185, 129, 0.55);
  color: #d1fae5;
}

.pwa-offline-bar .pwa-offline-queue-pill {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
}

/* ==============================================================================
   2. Service Worker Update Banner
   ============================================================================== */
.pwa-update-banner {
  position: fixed;
  top: calc(16px + var(--pwa-safe-top));
  right: 16px;
  z-index: 10460;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  background: rgba(18, 24, 38, 0.97);
  border: 1px solid rgba(255, 87, 34, 0.5);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.7), 0 0 20px rgba(255, 87, 34, 0.2);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  max-width: min(390px, calc(100vw - 2rem));
  transform: translateY(-130%);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
}

.pwa-update-banner.visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.pwa-update-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(255, 87, 34, 0.18);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1rem;
}

.pwa-update-text {
  flex: 1;
  min-width: 0;
}

.pwa-update-title {
  font-size: 0.86rem;
  font-weight: 700;
  color: #fff;
}

.pwa-update-sub {
  font-size: 0.76rem;
  color: var(--text-secondary);
}

.pwa-update-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* ==============================================================================
   3. Smart Install Prompt Banner
   ============================================================================== */
.pwa-install-banner {
  position: fixed;
  bottom: calc(1.25rem + var(--pwa-safe-bottom));
  right: 1.25rem;
  z-index: 9950;
  width: min(395px, calc(100vw - 2rem));
  background: rgba(16, 22, 34, 0.97);
  border: 1px solid rgba(255, 87, 34, 0.42);
  border-radius: 18px;
  padding: 1rem 1.05rem;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.78), 0 0 28px rgba(255, 87, 34, 0.16);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  transform: translateY(130%);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.28s ease;
}

.pwa-install-banner.visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.pwa-install-header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 0.8rem;
}

.pwa-install-app-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: #090c13;
  border: 1px solid rgba(255, 87, 34, 0.45);
  padding: 4px;
  object-fit: contain;
  flex-shrink: 0;
}

.pwa-install-info {
  flex: 1;
  min-width: 0;
}

.pwa-install-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.25;
}

.pwa-install-desc {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 0.2rem;
}

.pwa-install-close {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.pwa-install-close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
}

.pwa-install-features {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.85rem;
}

.pwa-install-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
}

.pwa-install-chip i {
  color: var(--secondary);
}

.pwa-install-actions {
  display: flex;
  gap: 0.55rem;
}

.pwa-install-actions .btn-primary {
  flex: 1;
  justify-content: center;
  padding: 0.58rem 0.95rem;
  font-size: 0.84rem;
}

.pwa-install-actions .btn-outline {
  padding: 0.58rem 0.85rem;
  font-size: 0.82rem;
}

/* ==============================================================================
   4. Mobile & Standalone App Bottom Navigation Bar
   ============================================================================== */
.pwa-bottom-nav {
  display: none;
}

@media (max-width: 768px) {
  body.pwa-bottom-nav-enabled {
    padding-bottom: calc(var(--pwa-bottom-bar-height) + var(--pwa-safe-bottom) + 8px);
  }

  .pwa-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 980;
    height: calc(var(--pwa-bottom-bar-height) + var(--pwa-safe-bottom));
    padding-bottom: var(--pwa-safe-bottom);
    background: rgba(11, 15, 25, 0.95);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: center;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.55);
    transition: transform 0.25s ease, opacity 0.25s ease;
  }

  body.cinema-modal-open .pwa-bottom-nav,
  body.pwa-hide-bottom-nav .pwa-bottom-nav {
    transform: translateY(110%);
    opacity: 0;
    pointer-events: none;
  }

  .pwa-bottom-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.22rem;
    height: var(--pwa-bottom-bar-height);
    color: var(--text-secondary);
    text-decoration: none;
    background: transparent;
    border: none;
    cursor: pointer;
    font-family: inherit;
    position: relative;
    padding: 0.25rem 0.15rem;
    transition: color 0.18s ease, transform 0.15s ease;
  }

  .pwa-bottom-item:active {
    transform: scale(0.93);
  }

  .pwa-bottom-item i {
    font-size: 1.12rem;
    line-height: 1;
  }

  .pwa-bottom-item span {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    line-height: 1.1;
  }

  .pwa-bottom-item.active {
    color: var(--primary);
  }

  .pwa-bottom-item.active::before {
    content: "";
    position: absolute;
    top: 0;
    left: 24%;
    right: 24%;
    height: 2.5px;
    border-radius: 0 0 4px 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
  }

  .pwa-bottom-badge {
    position: absolute;
    top: 8px;
    right: calc(50% - 16px);
    min-width: 15px;
    height: 15px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-size: 0.62rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid #0b0f19;
  }

  /* Lift floating buttons & toasts cleanly above bottom bar */
  body.pwa-bottom-nav-enabled .btn-back-to-top {
    bottom: calc(var(--pwa-bottom-bar-height) + var(--pwa-safe-bottom) + 14px);
  }

  body.pwa-bottom-nav-enabled .cookie-floating-trigger {
    bottom: calc(var(--pwa-bottom-bar-height) + var(--pwa-safe-bottom) + 14px);
    left: 14px;
  }

  body.pwa-bottom-nav-enabled .toast-container {
    bottom: calc(var(--pwa-bottom-bar-height) + var(--pwa-safe-bottom) + 66px);
  }

  body.pwa-bottom-nav-enabled .pwa-install-banner {
    bottom: calc(var(--pwa-bottom-bar-height) + var(--pwa-safe-bottom) + 12px);
    right: 0.75rem;
    left: 0.75rem;
    width: auto;
  }
}

/* ==============================================================================
   5. Pull-to-Refresh Indicator (Standalone Mobile)
   ============================================================================== */
.pwa-ptr-indicator {
  position: fixed;
  top: calc(10px + var(--pwa-safe-top));
  left: 50%;
  transform: translate(-50%, -80px);
  z-index: 10440;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(20, 27, 42, 0.96);
  border: 1px solid rgba(255, 87, 34, 0.5);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.pwa-ptr-indicator.ready {
  background: var(--primary);
  color: #fff;
}

/* ==============================================================================
   6. PWA App-Zentrale / Settings & iOS Install Guide Modal
   ============================================================================== */
.pwa-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10550;
  background: rgba(5, 8, 15, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.pwa-modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.pwa-modal-dialog {
  width: 100%;
  max-width: 600px;
  max-height: calc(100dvh - 2rem);
  background: linear-gradient(165deg, rgba(22, 30, 46, 0.98) 0%, rgba(12, 16, 26, 0.99) 100%);
  border: 1px solid rgba(255, 87, 34, 0.35);
  border-radius: 20px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.8), 0 0 36px rgba(255, 87, 34, 0.14);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: scale(0.96);
  transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

.pwa-modal-backdrop.active .pwa-modal-dialog {
  transform: scale(1);
}

.pwa-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.15rem 1.35rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
}

.pwa-modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.pwa-modal-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #090c13;
  border: 1px solid rgba(255, 87, 34, 0.45);
  padding: 3px;
}

.pwa-modal-title {
  font-size: 1.08rem;
  font-weight: 800;
  color: #fff;
  margin: 0;
}

.pwa-modal-sub {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.pwa-modal-body {
  padding: 1.25rem 1.35rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.pwa-status-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
}

@media (max-width: 540px) {
  .pwa-status-grid {
    grid-template-columns: 1fr;
  }
}

.pwa-stat-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 0.75rem 0.85rem;
}

.pwa-stat-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 700;
}

.pwa-stat-value {
  font-size: 0.92rem;
  font-weight: 700;
  color: #fff;
  margin-top: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.pwa-section-box {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 0.95rem 1rem;
}

.pwa-section-heading {
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.pwa-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.pwa-toggle-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.pwa-toggle-row:first-of-type {
  padding-top: 0;
}

.pwa-toggle-info strong {
  display: block;
  font-size: 0.88rem;
  color: #fff;
}

.pwa-toggle-info span {
  display: block;
  font-size: 0.76rem;
  color: var(--text-secondary);
}

.pwa-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.pwa-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.pwa-switch-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  transition: background-color 0.2s ease;
}

.pwa-switch-slider::before {
  content: "";
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s ease;
}

.pwa-switch input:checked + .pwa-switch-slider {
  background: var(--primary);
}

.pwa-switch input:checked + .pwa-switch-slider::before {
  transform: translateX(20px);
}

.pwa-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.pwa-shortcut-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

@media (max-width: 480px) {
  .pwa-shortcut-grid {
    grid-template-columns: 1fr;
  }
}

.pwa-shortcut-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 0.8rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 600;
  transition: border-color 0.18s ease, background-color 0.18s ease;
}

.pwa-shortcut-link:hover {
  border-color: var(--primary);
  background: rgba(255, 87, 34, 0.1);
}

.pwa-shortcut-link i {
  color: var(--secondary);
}

/* iOS Install Guide Steps */
.pwa-ios-steps {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.pwa-ios-step {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 0.8rem 0.9rem;
}

.pwa-ios-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pwa-ios-step-text {
  font-size: 0.86rem;
  color: var(--text-primary);
}

.pwa-ios-step-text small {
  display: block;
  color: var(--text-secondary);
  margin-top: 0.15rem;
}

/* ==============================================================================
   7. Dragon Rank Progress Indicators (Bottom Nav & App-Zentrale Modal)
   ============================================================================== */
.pwa-bottom-rank-bar {
  width: 28px;
  height: 2.5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
  margin-top: 1px;
}

.pwa-bottom-rank-fill {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #ff7043 0%, #fbbf24 100%);
  transition: width 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

.pwa-rank-modal-card {
  --pwa-rank-color: #ff7043;
  --pwa-rank-rgb: 255, 112, 67;
  background: radial-gradient(circle at 95% 15%, rgba(var(--pwa-rank-rgb), 0.14) 0%, rgba(255, 255, 255, 0.03) 65%);
  border: 1px solid rgba(var(--pwa-rank-rgb), 0.35);
  border-radius: 14px;
  padding: 0.95rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.pwa-rank-modal-card.is-max {
  border-color: rgba(255, 215, 0, 0.5);
  box-shadow: 0 0 22px rgba(255, 215, 0, 0.1);
}

.pwa-rank-modal-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.pwa-rank-modal-identity {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
}

.pwa-rank-modal-icon {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: rgba(var(--pwa-rank-rgb), 0.2);
  border: 1px solid rgba(var(--pwa-rank-rgb), 0.45);
  color: var(--pwa-rank-color);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
  box-shadow: 0 0 14px rgba(var(--pwa-rank-rgb), 0.28);
}

.pwa-rank-modal-title-wrap {
  min-width: 0;
}

.pwa-rank-modal-kicker {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.pwa-rank-modal-tier {
  color: var(--pwa-rank-color);
  background: rgba(var(--pwa-rank-rgb), 0.14);
  border: 1px solid rgba(var(--pwa-rank-rgb), 0.3);
  padding: 0 0.4rem;
  border-radius: 999px;
  font-size: 0.65rem;
}

.pwa-rank-modal-title {
  font-size: 1rem;
  font-weight: 800;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pwa-rank-modal-pct {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--pwa-rank-color);
  background: rgba(var(--pwa-rank-rgb), 0.16);
  border: 1px solid rgba(var(--pwa-rank-rgb), 0.35);
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.pwa-rank-modal-card.is-max .pwa-rank-modal-pct {
  color: #ffd700;
  border-color: rgba(255, 215, 0, 0.45);
  background: rgba(255, 215, 0, 0.14);
}

.pwa-rank-modal-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.pwa-rank-modal-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  box-shadow: 0 0 12px rgba(var(--pwa-rank-rgb), 0.45);
  transition: width 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.pwa-rank-modal-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.4rem 0.75rem;
  font-size: 0.76rem;
  color: var(--text-secondary);
}

.pwa-rank-modal-hint {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 600;
}

.pwa-rank-modal-hint i {
  color: var(--pwa-rank-color);
}

.pwa-rank-modal-watch {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.pwa-rank-modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.55rem;
  padding-top: 0.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.pwa-rank-modal-reward {
  font-size: 0.74rem;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.pwa-rank-modal-reward i {
  color: #fbbf24;
}

/* ==============================================================================
   8. Shared PWA Shell Dragon Rank Progress (Sidebar & Mobile Header)
   ============================================================================== */
.pwa-mobile-rank-chip,
.pwa-mobile-header-rank-bar {
  display: none;
}

/* Sidebar Rank Progress Block (Desktop) */
.pwa-site-user-pct-pill,
.pwa-sidebar-user-pct-pill {
  font-size: 0.66rem;
  font-weight: 800;
  color: var(--pwa-rank-color, #fbbf24);
  background: rgba(var(--pwa-rank-rgb, 255, 112, 67), 0.16);
  border: 1px solid rgba(var(--pwa-rank-rgb, 255, 112, 67), 0.36);
  padding: 0.08rem 0.42rem;
  border-radius: 999px;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.pwa-site-user-pct-pill.is-max,
.pwa-sidebar-user-pct-pill.is-max {
  color: #ffd700;
  background: rgba(255, 215, 0, 0.14);
  border-color: rgba(255, 215, 0, 0.45);
}

.pwa-site-user-rank-progress,
.pwa-sidebar-user-rank-progress,
.pwa-sidebar-rank-progress {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  padding: 0 0.65rem 0.58rem;
  text-decoration: none;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 0.45rem;
  transition: background-color 0.16s ease;
}

.pwa-site-user-rank-progress:hover,
.pwa-sidebar-user-rank-progress:hover,
.pwa-sidebar-rank-progress:hover {
  background: rgba(var(--pwa-rank-rgb, 255, 112, 67), 0.08);
}

.pwa-sidebar-rank-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
}

.pwa-sidebar-rank-label {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  font-size: 0.69rem;
  font-weight: 700;
  color: var(--pwa-rank-color, #ff7043);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.pwa-sidebar-rank-label span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.pwa-sidebar-rank-pct {
  font-size: 0.66rem;
  font-weight: 800;
  color: var(--pwa-rank-color, #ff7043);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.pwa-sidebar-rank-progress.is-max .pwa-sidebar-rank-pct {
  color: #ffd700;
}

.pwa-sidebar-rank-track {
  width: 100%;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
  overflow: hidden;
}

.pwa-sidebar-rank-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  box-shadow: 0 0 8px rgba(var(--pwa-rank-rgb, 255, 112, 67), 0.5);
  transition: width 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

.pwa-sidebar-rank-hint {
  font-size: 0.66rem;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

/* Mobile Header Rank Chip & Slim Progress Line */
@media (max-width: 768px) {
  html.pwa-standalone .pwa-mobile-rank-chip {
    --pwa-rank-color: #ff7043;
    --pwa-rank-rgb: 255, 112, 67;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    height: 32px;
    padding: 0 0.52rem;
    border-radius: 999px;
    background: rgba(var(--pwa-rank-rgb), 0.14);
    border: 1px solid rgba(var(--pwa-rank-rgb), 0.42);
    color: var(--pwa-rank-color);
    font-size: 0.72rem;
    font-weight: 800;
    font-family: inherit;
    cursor: pointer;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
  }

  html.pwa-standalone .pwa-mobile-rank-chip.is-max {
    color: #ffd700;
    background: rgba(255, 215, 0, 0.14);
    border-color: rgba(255, 215, 0, 0.45);
  }

  html.pwa-standalone .pwa-mobile-header-rank-bar {
    display: block;
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2.5px;
    background: rgba(255, 255, 255, 0.07);
    overflow: hidden;
    pointer-events: none;
  }

  html.pwa-standalone .pwa-mobile-header-rank-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #ff7043 0%, #fbbf24 100%);
    transition: width 0.45s cubic-bezier(0.16, 1, 0.3, 1);
  }
}

@media (max-width: 390px) {
  html.pwa-standalone .pwa-mobile-rank-chip {
    height: 28px;
    padding: 0 0.42rem;
    font-size: 0.68rem;
    gap: 0.24rem;
  }

  html.pwa-standalone .pwa-site-mobile-actions,
  html.pwa-standalone .pwa-mobile-actions {
    gap: 0.28rem;
  }
}

/* ==============================================================================
   9. PWA Logout Buttons (Sidebar, Desktop Topbar & App-Zentrale Modal)
   ============================================================================== */
.pwa-sidebar-logout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  width: 100%;
  padding: 0.44rem 0.65rem;
  background: rgba(239, 68, 68, 0.08);
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  color: #fca5a5;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background-color 0.16s ease, color 0.16s ease;
}

.pwa-sidebar-logout-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ffffff;
}

.pwa-topbar-user-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.pwa-topbar-logout-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.28);
  color: #fca5a5;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  cursor: pointer;
  font-family: inherit;
  flex-shrink: 0;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.15s ease;
}

.pwa-topbar-logout-btn:hover {
  background: rgba(239, 68, 68, 0.24);
  border-color: rgba(239, 68, 68, 0.6);
  color: #ffffff;
  transform: translateY(-1px);
}

.pwa-modal-logout-btn {
  border-color: rgba(239, 68, 68, 0.4) !important;
  color: #fca5a5 !important;
  background: rgba(239, 68, 68, 0.1) !important;
}

.pwa-modal-logout-btn:hover {
  border-color: rgba(239, 68, 68, 0.7) !important;
  background: rgba(239, 68, 68, 0.24) !important;
  color: #ffffff !important;
}
