/* Waifu Store Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #0b0b0f;
  color: #e2e8f0;
  line-height: 1.5;
  overflow-x: hidden;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

/* Disable text selection and context menu */
* {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

img {
  -webkit-user-drag: none;
  -khtml-user-drag: none;
  -moz-user-drag: none;
  -o-user-drag: none;
  user-drag: none;
  pointer-events: none;
}

/* App Layout */
#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.app-header {
  background: #13131a;
  border-bottom: 1px solid #2a2a35;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo {
  font-size: 20px;
}

.title {
  font-size: 18px;
  font-weight: 600;
  color: #f1f5f9;
}

.wallet {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

#wallet-crystals {
  font-size: 16px;
  color: #cbd5e1;
  font-weight: 800;
}

/* Center wallet action buttons on all devices */
.wallet .wallet-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Navigation Tabs */
.tabs {
  display: flex;
  background: #13131a;
  border-bottom: 1px solid #2a2a35;
}

.tab {
  flex: 1;
  padding: 12px 16px;
  background: transparent;
  border: none;
  color: #9ca3af;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border-bottom: 2px solid transparent;
}

.tab:hover {
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.05);
}

.tab.active {
  color: #f1f5f9;
  border-bottom-color: #8b5cf6;
}

/* Main Content */
.main {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
}

.screen {
  max-width: 100%;
}

.screen.hidden {
  display: none;
}

/* Grid Layout */
.grid {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.category {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.category-title {
  font-size: 18px;
  font-weight: 600;
  color: #f1f5f9;
  margin: 0;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

/* Store: force two items per row */
#screen-store .category-grid {
  grid-template-columns: repeat(2, 1fr);
}
/* Ensure store root grid shows two per row even without wrapper */
#store-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

/* Wallpaper Cards */
.wallpaper-card {
  background: #1a1a23;
  border: 1px solid #2a2a35;
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.2s;
  cursor: default;
}

.wallpaper-card:hover {
  border-color: #4c1d95;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.15);
}

.wallpaper-preview {
  position: relative;
  aspect-ratio: 3/4;
  overflow: hidden;
  pointer-events: none;
}

.wallpaper-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.price-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(139, 92, 246, 0.9);
  color: white;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}

.owned-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(34, 197, 94, 0.9);
  color: white;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}

.wallpaper-info {
  padding: 12px 12px 6px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.wallpaper-name { display: none; }

.wallpaper-category { font-size: 15px; color: #d3d7de; text-align: center; }
.wallpaper-category.prominent { font-size: 18px; font-weight: 700; }

.wallpaper-actions {
  padding: 10px 12px 16px;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  white-space: nowrap;
  pointer-events: auto;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: #8b5cf6;
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: #7c3aed;
}

.btn-secondary {
  background: #374151;
  color: #e2e8f0;
}

.btn-secondary:hover:not(:disabled) {
  background: #4b5563;
}

.btn-light {
  background: #2a2a35;
  color: #e2e8f0;
}

.btn-light:hover:not(:disabled) {
  background: #374151;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-md {
  padding: 10px 14px;
  font-size: 14px;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.modal.hidden {
  display: none;
}

.modal-content {
  position: relative;
  max-width: 100%;
  max-height: 100%;
  background: #1a1a23;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #2a2a35;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1001;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

/* Image Viewer */
.viewer {
  position: relative;
  max-width: 100vw;
  max-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.viewer-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  pointer-events: none;
  -webkit-user-drag: none;
  -khtml-user-drag: none;
  -moz-user-drag: none;
  -o-user-drag: none;
  user-drag: none;
}

.viewer-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.viewer-watermark {
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  backdrop-filter: blur(4px);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 48px 16px;
  color: #9ca3af;
  font-size: 16px;
}

/* Responsive Design */
@media (max-width: 480px) {
  .app-header {
    padding: 8px 12px;
  }
  
  .main {
    padding: 12px;
  }
  
  .category-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  
  .wallet {
    flex-direction: column;
    align-items: center;
    gap: 6px;
  }
  
  .btn-sm {
    padding: 4px 8px;
    font-size: 11px;
  }
}

/* Smaller Stars pack cards */
#stars-grid.category-grid {
  grid-template-columns: repeat(2, 1fr);
}

.stars-card .wallpaper-preview {
  height: 90px;
  aspect-ratio: auto;
}

.stars-card .owned-badge {
  font-size: 10px;
  padding: 3px 6px;
}

.stars-card .wallpaper-name {
  font-size: 13px;
}

.stars-card .wallpaper-category {
  font-size: 11px;
}

.stars-card .btn.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

/* Anti-screenshot and download protection */
.no-save {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -khtml-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
  -khtml-user-drag: none;
  -moz-user-drag: none;
  -o-user-drag: none;
  user-drag: none;
}

/* Disable print */
@media print {
  * {
    display: none !important;
  }
}

/* Disable text selection on images */
img::selection {
  background: transparent;
}

img::-moz-selection {
  background: transparent;
}

/* Notifications */
.notify-root {
  position: fixed;
  top: 12px;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  pointer-events: none;
}

.notify-card {
  pointer-events: auto;
  max-width: 92vw;
  width: 520px;
  background: linear-gradient(135deg, #11131a, #1a1a23);
  border: 1px solid #2a2a35;
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
  animation: notif-slide 220ms ease-out;
}

.notify-card.success { border-color: rgba(34,197,94,0.4); box-shadow: 0 10px 30px rgba(34,197,94,0.15); }
.notify-title { font-size: 15px; font-weight: 800; color: #e8eef6; margin-bottom: 4px; }
.notify-sub { font-size: 12px; color: #9ca3af; }
.notify-actions { margin-top: 10px; display:flex; gap:8px; justify-content:flex-end; }
.notify-actions .btn { padding: 6px 10px; font-size: 12px; }

@keyframes notif-slide {
  from { transform: translateY(-12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
