/* ═══════════════════════════════════════════════════════════
   Level- & Achievement-System Styles
   ═══════════════════════════════════════════════════════════ */

/* ── Level Card ── */
.level-card {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 1.25rem;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}

.level-main {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.level-emoji-display {
  font-size: 1.75rem;
  width: 3rem;
  height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle, rgba(110, 231, 255, 0.12) 0%, rgba(139, 92, 246, 0.08) 100%);
  border: 2px solid rgba(110, 231, 255, 0.25);
  border-radius: 0.75rem;
  box-shadow: 0 0 12px rgba(110, 231, 255, 0.1);
  flex-shrink: 0;
}

.level-info {
  flex: 1;
}

.level-number {
  font-size: 0.7rem;
  font-weight: 600;
  color: rgba(110, 231, 255, 0.7);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0;
}

.level-name {
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
}

/* ── Progress Bar ── */
.level-progress-section {
  margin-top: 0.25rem;
}

.level-xp-text {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: #94a3b8;
  font-weight: 500;
  margin-bottom: 0.375rem;
}

.level-progress-bar {
  width: 100%;
  height: 0.5rem;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 9999px;
  overflow: hidden;
  position: relative;
}

.level-progress-fill {
  height: 100%;
  border-radius: 9999px;
  background: linear-gradient(90deg, #6ee7ff 0%, #8b5cf6 50%, #ffd700 100%);
  box-shadow: 0 0 12px rgba(110, 231, 255, 0.4);
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.level-progress-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.2) 50%, transparent 100%);
  animation: shimmer 2s ease-in-out infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.level-progress-label {
  font-size: 0.8rem;
  color: #64748b;
  margin-top: 0.5rem;
  text-align: center;
}

.level-progress-label strong {
  color: #94a3b8;
}

/* ── Medals Section (innerhalb der Level-Card) ── */
.medals-section {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.medals-title {
  font-size: 1rem;
  font-weight: 700;
  color: #94a3b8;
  margin: 0 0 0.75rem 0;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.medals-subtitle {
  display: none;
}

.medals-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
}

@media (max-width: 640px) {
  .medals-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 0.375rem;
  }
}

@media (max-width: 400px) {
  .medals-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

/* ── Medal Item ── */
.medal-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0.375rem 0.25rem;
  border-radius: 0.75rem;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.medal-item:hover {
  transform: translateY(-2px);
}

.medal-earned:hover {
  box-shadow: 0 4px 20px rgba(255, 255, 255, 0.05);
}

.medal-locked {
  opacity: 0.55;
}

.medal-locked:hover {
  opacity: 0.7;
}

/* ── Medal Circle ── */
.medal-circle {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  border: 2px solid rgba(75, 85, 99, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.25rem;
  transition: transform 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease, background-color 0.4s ease;
  background: rgba(75, 85, 99, 0.08);
}

.medal-earned .medal-circle {
  animation: medal-pulse 3s ease-in-out infinite;
}

@keyframes medal-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}

.medal-emoji {
  font-size: 1.25rem;
  line-height: 1;
}

.medal-name {
  font-size: 0.65rem;
  font-weight: 600;
  color: #e2e8f0;
  margin-bottom: 0.0625rem;
}

.medal-tier {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.medal-tier-locked {
  color: #4b5563;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.55rem;
}

/* ── Level-Up Overlay ── */
.level-up-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0);
  pointer-events: none;
  transition: background 0.5s ease;
}

.level-up-overlay.level-up-visible {
  background: rgba(0, 0, 0, 0.6);
  pointer-events: auto;
}

.level-up-overlay.level-up-hiding {
  background: rgba(0, 0, 0, 0);
  transition: background 0.5s ease;
}

.level-up-card {
  background: rgba(17, 20, 28, 0.97);
  border: 1px solid rgba(110, 231, 255, 0.2);
  border-radius: 2rem;
  padding: 2.5rem 3rem;
  text-align: center;
  transform: scale(0.6);
  opacity: 0;
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 0 60px rgba(110, 231, 255, 0.15), 0 0 120px rgba(139, 92, 246, 0.1);
}

.level-up-visible .level-up-card {
  transform: scale(1);
  opacity: 1;
}

.level-up-hiding .level-up-card {
  transform: scale(0.8);
  opacity: 0;
  transition: transform 0.4s ease-in, opacity 0.4s ease-in;
}

.level-up-emoji {
  font-size: 4rem;
  margin-bottom: 0.75rem;
  animation: emoji-bounce 0.6s ease infinite alternate;
}

@keyframes emoji-bounce {
  0% { transform: translateY(0); }
  100% { transform: translateY(-8px); }
}

.level-up-title {
  font-size: 2.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, #6ee7ff 0%, #8b5cf6 50%, #ffd700 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.25rem;
}

.level-up-name {
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.5rem;
}

.level-up-subtitle {
  font-size: 0.9rem;
  color: #94a3b8;
}

/* ── Sphere XP Badge (auf Entdeckungsseite) ── */
.sphere-xp-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  margin-left: auto;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.7rem;
  font-weight: 600;
  color: #94a3b8;
  white-space: nowrap;
  transition: background-color 0.3s ease, border-color 0.3s ease;
}
 
.sphere-xp-badge:hover {
  background: rgba(255, 255, 255, 0.06);
}

.sphere-xp-badge .xp-icon {
  font-size: 0.75rem;
  line-height: 1;
}

.sphere-xp-badge .xp-value {
  letter-spacing: 0.02em;
}

.sphere-xp-progress {
  width: 2.5rem;
  height: 0.25rem;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 9999px;
  overflow: hidden;
}

.sphere-xp-progress-fill {
  height: 100%;
  border-radius: 9999px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Medal Toast (globale Erfolgsanzeige) ── */
.medal-toast {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1.25rem;
  background: rgba(17, 20, 28, 0.96);
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05);
  transform: translateX(120%);
  opacity: 0;
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.4s ease;
  pointer-events: none;
  max-width: 320px;
}

.medal-toast.medal-toast-visible {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

.medal-toast.medal-toast-hiding {
  transform: translateX(120%);
  opacity: 0;
  transition: transform 0.4s ease-in, opacity 0.3s ease-in;
}

.medal-toast-icon {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
  border: 2px solid;
  transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.medal-toast-body {
  flex: 1;
  min-width: 0;
}

.medal-toast-tier {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.125rem;
}

.medal-toast-sphere {
  font-size: 1rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
}

.medal-toast-sub {
  font-size: 0.7rem;
  color: #94a3b8;
  margin-top: 0.125rem;
}

/* ── XP Toast (kleinere Anzeige für XP-Gewinn) ── */
.xp-toast {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 9998;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  background: rgba(17, 20, 28, 0.95);
  border-radius: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  transform: translateX(120%);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
  pointer-events: none;
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
}

.xp-toast.xp-toast-visible {
  transform: translateX(0);
  opacity: 1;
}

.xp-toast.xp-toast-hiding {
  transform: translateX(120%);
  opacity: 0;
  transition: transform 0.3s ease-in, opacity 0.2s ease-in;
}

.xp-toast-icon {
  font-size: 1.1rem;
  line-height: 1;
}

/* ── Ausweis-Buttons ── */
.ausweis-btn-group {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.ausweis-btn-group .ausweis-btn {
  margin-top: 0;
  flex: 1;
}

.ausweis-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  margin-top: 1.25rem;
  padding: 0.625rem 1rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.75rem;
  color: #94a3b8;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
  font-family: inherit;
}

.ausweis-btn:hover {
  background: rgba(110, 231, 255, 0.08);
  border-color: rgba(110, 231, 255, 0.25);
  color: #6ee7ff;
  box-shadow: 0 0 20px rgba(110, 231, 255, 0.1);
}

.ausweis-btn:active {
  transform: scale(0.97);
}

.ausweis-btn-secondary {
  background: rgba(139, 92, 246, 0.06);
  border-color: rgba(139, 92, 246, 0.2);
}

.ausweis-btn-secondary:hover {
  background: rgba(139, 92, 246, 0.12);
  border-color: rgba(139, 92, 246, 0.35);
  color: #8b5cf6;
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.1);
}

.ausweis-btn-export-main {
  background: rgba(52, 211, 153, 0.06);
  border-color: rgba(52, 211, 153, 0.2);
}

.ausweis-btn-export-main:hover {
  background: rgba(52, 211, 153, 0.12);
  border-color: rgba(52, 211, 153, 0.35);
  color: #34d399;
  box-shadow: 0 0 20px rgba(52, 211, 153, 0.1);
}

/* ── Ausweis-Modal ── */
.ausweis-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0);
  pointer-events: none;
  transition: background 0.4s ease;
}

.ausweis-modal-overlay.visible {
  background: rgba(0, 0, 0, 0.7);
  pointer-events: auto;
}

.ausweis-modal-overlay.hiding {
  background: rgba(0, 0, 0, 0);
  transition: background 0.3s ease;
}

.ausweis-modal {
  background: rgba(17, 20, 28, 0.97);
  border: 1px solid rgba(110, 231, 255, 0.15);
  border-radius: 1.5rem;
  padding: 2rem 2.25rem;
  width: 90%;
  max-width: 460px;
  transform: scale(0.85);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 0 60px rgba(110, 231, 255, 0.1), 0 0 120px rgba(139, 92, 246, 0.08);
}

.ausweis-modal-overlay.visible .ausweis-modal {
  transform: scale(1);
  opacity: 1;
}

.ausweis-modal-overlay.hiding .ausweis-modal {
  transform: scale(0.9);
  opacity: 0;
  transition: transform 0.3s ease-in, opacity 0.3s ease-in;
}

.ausweis-modal-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 0.25rem;
  text-align: center;
}

.ausweis-modal-subtitle {
  font-size: 0.8rem;
  color: #64748b;
  text-align: center;
  margin-bottom: 1.5rem;
}

.ausweis-modal label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.375rem;
}

.ausweis-modal input[type="text"] {
  width: 100%;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0.75rem;
  color: #fff;
  font-size: 1rem;
  font-family: inherit;
  font-weight: 600;
  outline: none;
  transition: border-color 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
  margin-bottom: 1.25rem;
}

.ausweis-modal input[type="text"]:focus {
  border-color: rgba(110, 231, 255, 0.4);
  box-shadow: 0 0 20px rgba(110, 231, 255, 0.1);
  background: rgba(255, 255, 255, 0.07);
}

.ausweis-modal input[type="text"]::placeholder {
  color: #4b5563;
  font-weight: 400;
}

.ausweis-modal-actions {
  display: flex;
  gap: 0.75rem;
}

.ausweis-modal-actions button {
  flex: 1;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
  font-family: inherit;
  border: none;
}

.ausweis-modal-cancel {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  color: #94a3b8;
}

.ausweis-modal-cancel:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
}

.ausweis-modal-confirm {
  background: linear-gradient(135deg, rgba(110, 231, 255, 0.15) 0%, rgba(139, 92, 246, 0.15) 100%);
  border: 1px solid rgba(110, 231, 255, 0.25) !important;
  color: #6ee7ff;
}

.ausweis-modal-confirm:hover {
  background: linear-gradient(135deg, rgba(110, 231, 255, 0.25) 0%, rgba(139, 92, 246, 0.25) 100%);
  box-shadow: 0 0 25px rgba(110, 231, 255, 0.2);
}

/* ── Ausweis Karte (Screen Preview) ── */
.ausweis-card-container {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 0;
}

.ausweis-card {
  width: 324px;
  height: 204px;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  background: #0b1628;
  border: 1px solid rgba(110, 231, 255, 0.15);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5), 0 0 30px rgba(110, 231, 255, 0.08);
  font-family: 'Inter', Arial, Helvetica, sans-serif;
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 14px 18px;
}

.ausweis-card-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  pointer-events: none;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.ausweis-card *:not(.ausweis-card-bg) {
  position: relative;
  z-index: 1;
}

.ausweis-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.ausweis-card-label {
  font-size: 0.55rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: rgba(110, 231, 255, 0.7);
}

.ausweis-card-domain {
  font-size: 0.6rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.4);
  letter-spacing: 0.05em;
}

.ausweis-card-name {
  font-size: 1.35rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.01em;
  margin-bottom: auto;
  text-shadow: 0 0 20px rgba(110, 231, 255, 0.15);
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ausweis-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-top: auto;
}

.ausweis-card-rank {
  display: flex;
  align-items: center;
  gap: 5px;
}

.ausweis-card-rank-emoji {
  font-size: 1rem;
  line-height: 1;
}

.ausweis-card-rank-name {
  font-size: 0.65rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.7);
}

.ausweis-card-medals {
  display: flex;
  gap: 4px;
  align-items: center;
}

.ausweis-card-medal {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  border: 1.5px solid rgba(75, 85, 99, 0.4);
  background: rgba(75, 85, 99, 0.1);
  transition: border-color 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
}

.ausweis-card-medal.earned {
  border-color: var(--medal-color, #94a3b8);
  background: radial-gradient(circle, var(--medal-color-alpha, rgba(148,163,184,0.15)) 0%, transparent 100%);
  box-shadow: 0 0 8px var(--medal-color-alpha, rgba(148,163,184,0.2));
}

.ausweis-card-xp {
  font-size: 0.5rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.35);
  text-align: right;
  margin-top: 4px;
  letter-spacing: 0.05em;
}

/* ── Ausweis Karte Rückseite (Screen Preview) ── */
.ausweis-card-container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1.5rem 0;
}

.ausweis-card-back {
  border: 1px solid rgba(139, 92, 246, 0.15);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5), 0 0 30px rgba(139, 92, 246, 0.06);
}

.ausweis-card-back-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  text-align: center;
  gap: 0.5rem;
}

.ausweis-card-back-motto {
  font-size: 0.85rem;
  font-weight: 700;
  background: linear-gradient(135deg, #6ee7ff 0%, #8b5cf6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.ausweis-card-back-qr {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.ausweis-qr-placeholder {
  width: 72px;
  height: 72px;
  border-radius: 0.5rem;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 6px;
}

.ausweis-card-back-url {
  font-size: 0.55rem;
  font-weight: 700;
  color: rgba(110, 231, 255, 0.6);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.ausweis-card-back-date {
  font-size: 0.45rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.25);
  letter-spacing: 0.03em;
}

/* ── Ausweis Preview Actions (3 buttons) ── */
.ausweis-preview-actions {
  flex-wrap: wrap;
}

.ausweis-btn-export {
  flex: 1;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  border: 1px solid rgba(139, 92, 246, 0.25) !important;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.12) 0%, rgba(110, 231, 255, 0.08) 100%);
  color: #8b5cf6;
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}

.ausweis-btn-export:hover {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.22) 0%, rgba(110, 231, 255, 0.15) 100%);
  border-color: rgba(139, 92, 246, 0.4) !important;
  color: #a78bfa;
  box-shadow: 0 0 25px rgba(139, 92, 246, 0.15);
}

.ausweis-btn-export:active {
  transform: scale(0.97);
}

/* ── Export Modal ── */
.export-modal {
  max-width: 380px;
}

.export-qr-container {
  display: flex;
  justify-content: center;
  margin-bottom: 1.25rem;
}

.export-qr-code {
  width: 180px;
  height: 180px;
  border-radius: 1rem;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(110, 231, 255, 0.1);
  padding: 12px;
  box-shadow: 0 0 30px rgba(110, 231, 255, 0.05);
}

.export-qr-code svg {
  width: 100%;
  height: 100%;
}

.export-qr-fallback {
  padding: 2rem;
  text-align: center;
  color: #64748b;
  font-size: 0.85rem;
}

.export-code-section {
  margin-bottom: 1.25rem;
}

.export-code-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.375rem;
}

.export-code-row {
  display: flex;
  gap: 0.5rem;
}

.export-code-row input[type="text"] {
  flex: 1;
  padding: 0.625rem 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0.75rem;
  color: #6ee7ff;
  font-size: 0.75rem;
  font-family: 'Courier New', monospace;
  font-weight: 600;
  outline: none;
  transition: border-color 0.3s ease;
  min-width: 0;
}

.export-code-row input[type="text"]:focus {
  border-color: rgba(110, 231, 255, 0.4);
}

.export-copy-btn {
  padding: 0.625rem 0.875rem;
  background: rgba(110, 231, 255, 0.1);
  border: 1px solid rgba(110, 231, 255, 0.2);
  border-radius: 0.75rem;
  color: #6ee7ff;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.3s ease, border-color 0.3s ease, transform 0.2s ease;
  font-family: inherit;
  flex-shrink: 0;
}

.export-copy-btn:hover {
  background: rgba(110, 231, 255, 0.18);
  border-color: rgba(110, 231, 255, 0.35);
}

.export-copy-btn:active {
  transform: scale(0.95);
}

/* ── Import Modal ── */
.import-modal textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0.75rem;
  color: #6ee7ff;
  font-size: 0.8rem;
  font-family: 'Courier New', monospace;
  font-weight: 600;
  outline: none;
  resize: vertical;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
  margin-bottom: 1.25rem;
  min-height: 60px;
}

.import-modal textarea:focus {
  border-color: rgba(139, 92, 246, 0.4);
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.1);
}

.import-modal textarea::placeholder {
  color: #4b5563;
  font-family: 'Inter', sans-serif;
  font-weight: 400;
}

/* ── Import Choice Buttons ── */
.import-choice-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  margin-bottom: 1rem;
}

.import-choice-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border-radius: 0.875rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, transform 0.2s ease;
  font-family: inherit;
  text-align: left;
  width: 100%;
}

.import-choice-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}

.import-choice-btn:active {
  transform: translateY(0);
}

.import-choice-overwrite {
  border-color: rgba(110, 231, 255, 0.15);
}

.import-choice-overwrite:hover {
  border-color: rgba(110, 231, 255, 0.3);
  box-shadow: 0 0 20px rgba(110, 231, 255, 0.08);
}

.import-choice-preview {
  border-color: rgba(139, 92, 246, 0.15);
}

.import-choice-preview:hover {
  border-color: rgba(139, 92, 246, 0.3);
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.08);
}

.import-choice-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
  width: 2rem;
  text-align: center;
}

.import-choice-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: #e2e8f0;
  line-height: 1.2;
}

.import-choice-desc {
  display: block;
  font-size: 0.7rem;
  color: #64748b;
  margin-top: 0.125rem;
}

.import-choice-disabled .import-choice-btn {
  opacity: 0.4;
  pointer-events: none;
}

/* ── Auto Import Info ── */
.auto-import-info {
  text-align: center;
  padding: 0.875rem;
  margin-bottom: 1rem;
  background: rgba(110, 231, 255, 0.05);
  border: 1px solid rgba(110, 231, 255, 0.1);
  border-radius: 0.875rem;
}

.auto-import-name {
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 0.25rem;
}

.auto-import-xp {
  font-size: 0.8rem;
  font-weight: 600;
  color: #6ee7ff;
}

/* ── Import Confirmation Modal ── */
.import-confirm-modal {
  max-width: 420px;
}

.import-confirm-warn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 0.75rem;
  margin-bottom: 1rem;
  color: #fca5a5;
  font-size: 0.8rem;
  font-weight: 600;
}

.import-confirm-warn-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.import-compare-table {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0.75rem;
  overflow: hidden;
  margin-bottom: 1.25rem;
}

.import-compare-header {
  display: grid;
  grid-template-columns: 1fr auto auto auto auto;
  gap: 0.25rem 0.5rem;
  padding: 0.5rem 0.875rem;
  font-size: 0.65rem;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(255, 255, 255, 0.02);
}

.import-compare-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto auto;
  gap: 0.25rem 0.5rem;
  padding: 0.5rem 0.875rem;
  font-size: 0.8rem;
  color: #e2e8f0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  align-items: center;
}

.import-compare-row:last-of-type {
  border-bottom: none;
}

.import-compare-sphere {
  font-weight: 600;
  white-space: nowrap;
}

.import-compare-local {
  text-align: right;
  color: #94a3b8;
  font-variant-numeric: tabular-nums;
}

.import-compare-arrow {
  text-align: center;
  color: #4b5563;
  font-size: 0.75rem;
}

.import-compare-new {
  text-align: right;
  color: #e2e8f0;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.import-compare-diff {
  text-align: right;
  font-weight: 700;
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}

.import-diff-gain {
  color: #34d399;
}

.import-diff-loss {
  color: #f87171;
}

.import-diff-same {
  color: #4b5563;
}

.import-compare-total {
  display: grid;
  grid-template-columns: 1fr auto auto auto auto;
  gap: 0.25rem 0.5rem;
  padding: 0.625rem 0.875rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
  align-items: center;
}

.import-confirm-danger-btn {
  flex: 1;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  border: 1px solid rgba(239, 68, 68, 0.3) !important;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.12) 0%, rgba(239, 68, 68, 0.06) 100%);
  color: #f87171;
  transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.import-confirm-danger-btn:hover {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.22) 0%, rgba(239, 68, 68, 0.12) 100%);
  border-color: rgba(239, 68, 68, 0.5) !important;
  box-shadow: 0 0 25px rgba(239, 68, 68, 0.15);
  color: #fca5a5;
}

.import-confirm-danger-btn:active {
  transform: scale(0.97);
}

/* ── Responsive ── */
@media (max-width: 480px) {
  .ausweis-btn-group {
    flex-direction: column;
    gap: 0.5rem;
  }

  .ausweis-preview-actions {
    flex-direction: column;
  }

  .ausweis-preview-actions button {
    width: 100% !important;
  }

  .export-qr-code {
    width: 150px;
    height: 150px;
  }

  .export-code-row {
    flex-direction: column;
  }

  .export-copy-btn {
    width: 100%;
    text-align: center;
  }
}

/* ── Print Styles ── */
@media print {
  @page {
    size: auto;
    margin: 0;
  }

  html, body {
    margin: 0 !important;
    padding: 0 !important;
    background: white !important;
    height: auto !important;
    overflow: visible !important;
  }

  .ausweis-print-page {
    position: relative;
    width: 100%;
    height: 100vh;
    page-break-after: always;
    page-break-inside: avoid;
  }

  .ausweis-print-page:last-child {
    page-break-after: avoid;
  }

  .ausweis-print-card {
    width: 85.6mm;
    height: 54mm;
    border-radius: 3mm;
    overflow: hidden;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #0b1628;
    color: #fff;
    font-family: 'Inter', Arial, Helvetica, sans-serif;
    display: flex;
    flex-direction: column;
    padding: 3.5mm 4.5mm;
    box-sizing: border-box;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .ausweis-print-card .ausweis-card-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .ausweis-print-card *:not(.ausweis-card-bg) {
    position: relative;
    z-index: 1;
  }

  .ausweis-print-card .ausweis-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5mm;
  }

  .ausweis-print-card .ausweis-card-label {
    font-size: 4.5pt;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: rgba(110, 231, 255, 0.7);
  }

  .ausweis-print-card .ausweis-card-domain {
    font-size: 5pt;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: 0.05em;
  }

  .ausweis-print-card .ausweis-card-name {
    font-size: 11pt;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.01em;
    margin-bottom: auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .ausweis-print-card .ausweis-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: auto;
  }

  .ausweis-print-card .ausweis-card-rank {
    display: flex;
    align-items: center;
    gap: 1.2mm;
  }

  .ausweis-print-card .ausweis-card-rank-emoji {
    font-size: 8pt;
    line-height: 1;
  }

  .ausweis-print-card .ausweis-card-rank-name {
    font-size: 5.5pt;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.7);
  }

  .ausweis-print-card .ausweis-card-medals {
    display: flex;
    gap: 1mm;
    align-items: center;
  }

  .ausweis-print-card .ausweis-card-medal {
    width: 6mm;
    height: 6mm;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 5.5pt;
    border: 0.4mm solid rgba(75, 85, 99, 0.4);
    background: rgba(75, 85, 99, 0.1);
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .ausweis-print-card .ausweis-card-medal.earned {
    border-color: var(--medal-color, #94a3b8);
    background: radial-gradient(circle, var(--medal-color-alpha, rgba(148,163,184,0.15)) 0%, transparent 100%);
    box-shadow: 0 0 2mm var(--medal-color-alpha, rgba(148,163,184,0.2));
  }

  .ausweis-print-card .ausweis-card-xp {
    font-size: 4pt;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.35);
    text-align: right;
    margin-top: 1mm;
    letter-spacing: 0.05em;
  }

  /* ── Print: Rückseite ── */
  .ausweis-print-back {
    width: 85.6mm;
    height: 54mm;
    border-radius: 3mm;
    overflow: hidden;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #0b1628;
    color: #fff;
    font-family: 'Inter', Arial, Helvetica, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    box-sizing: border-box;
  }

  .ausweis-print-back .ausweis-print-back-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .ausweis-print-back *:not(.ausweis-print-back-bg) {
    position: relative;
    z-index: 1;
  }

  .ausweis-print-back .ausweis-print-back-motto {
    font-size: 8pt;
    font-weight: 700;
    background: linear-gradient(135deg, #6ee7ff 0%, #8b5cf6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 3mm;
  }

  .ausweis-print-back .ausweis-print-back-qr {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1mm;
  }

  .ausweis-print-back .ausweis-qr-placeholder {
    width: 18mm;
    height: 18mm;
    border-radius: 1.5mm;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.03);
    border: 0.3mm solid rgba(255, 255, 255, 0.06);
    padding: 1.5mm;
  }

  .ausweis-print-back .ausweis-print-back-url {
    font-size: 5pt;
    font-weight: 700;
    color: rgba(110, 231, 255, 0.6);
    letter-spacing: 0.1em;
    text-transform: uppercase;
  }

  .ausweis-print-back .ausweis-print-back-date {
    font-size: 4pt;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.25);
    letter-spacing: 0.03em;
    margin-top: 2mm;
  }

}
