:root {
  --bg-color: #0a0a0c;
  --surface-color: #16161a;
  --text-color: #e2e2e6;
  --accent-color: #4f46e5;
  --border-color: rgba(255, 255, 255, 0.1);
  --glass-bg: rgba(30, 30, 35, 0.7);
  --glass-border: rgba(255, 255, 255, 0.08);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Outfit', 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.5;
  overflow-x: hidden;
}

.app-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 20px;
  display: flex;
  flex-direction: column;
  gap: 40px;
  min-height: 100vh;
}

.app-header {
  text-align: center;
}

.app-header h1 {
  font-size: 3rem;
  margin-bottom: 10px;
  background: linear-gradient(135deg, #fff 0%, #a5b4fc 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.app-header p {
  color: #94a3b8;
  font-size: 1.1rem;
}

.app-main {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 40px;
  align-items: start;
}

@media (max-width: 900px) {
  .app-main {
    grid-template-columns: 1fr;
  }
  .preview-section {
    position: static;
  }
}

.preview-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: sticky;
  top: 40px;
  width: 320px;
}

.canvas-wrapper {
  padding: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 300px;
  background: radial-gradient(circle at center, rgba(79, 70, 229, 0.1) 0%, transparent 70%), var(--glass-bg);
  width: 100%;
}

canvas {
  max-width: 100%;
  max-height: 350px;
  height: auto;
  filter: drop-shadow(0 20px 40px rgba(0,0,0,0.5));
  border-radius: 12px;
  cursor: grab;
}

canvas:active {
  cursor: grabbing;
}

.drag-hint {
  position: absolute;
  bottom: 20px;
  background: rgba(0, 0, 0, 0.6);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  color: #a5b4fc;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.canvas-wrapper:hover .drag-hint {
  opacity: 1;
}

.premium-card {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

.action-bar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}

.deck-container {
  margin-top: 20px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 20px;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px dashed transparent;
  width: 100%;
}

.deck-container:hover {
  background: rgba(79, 70, 229, 0.05);
  transform: translateY(-2px);
}

.deck-container.drag-over {
  border-color: var(--accent-color);
  background: rgba(79, 70, 229, 0.1);
  transform: scale(1.02);
}

.deck-stack {
  position: relative;
  width: 60px;
  height: 90px;
}

.deck-stack img {
  position: absolute;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.5));
  transition: transform 0.3s ease;
}

.deck-info h4 {
  color: #fff;
  margin-bottom: 4px;
}

.deck-info span {
  font-size: 0.9rem;
  color: #94a3b8;
}

.button {
  background: var(--accent-color);
  color: white;
  border: none;
  padding: 12px 16px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 1;
}


.button:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}

.button:active {
  transform: translateY(0);
}

.button.secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
}

.button.small {
  padding: 8px 16px;
  font-size: 0.85rem;
  border-radius: 10px;
  flex: none;
}

.controls-section {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.control-group {
  padding: 24px;
}

.control-group h3 {
  margin-bottom: 20px;
  font-size: 1.25rem;
  color: #fff;
  border-left: 4px solid var(--accent-color);
  padding-left: 12px;
}

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

.asset-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 10px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: #94a3b8;
  width: 100%;
}

.asset-item img {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: contain;
  transition: transform 0.2s ease;
}

.asset-item span {
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
  text-align: center;
}

.asset-item:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

.asset-item:hover img {
  transform: scale(1.05);
}

.asset-item.active {
  background: rgba(79, 70, 229, 0.15);
  border-color: var(--accent-color);
  color: #fff;
}

.asset-item.active img {
  transform: scale(1.1);
}

.empty-slot {
  width: 100%;
  aspect-ratio: 2/3;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  font-size: 0.8rem;
  color: #475569;
}

.app-footer {
  text-align: center;
  padding: 40px 0;
  color: #475569;
  border-top: 1px solid var(--glass-border);
}

.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  background: var(--surface-color);
  color: #fff;
  border-radius: 12px;
  z-index: 1000;
  animation: slideUp 0.3s ease-out;
  box-shadow: 0 15px 30px rgba(0,0,0,0.4);
}

@keyframes slideUp {
  from { transform: translate(-50%, 20px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

/* Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  padding: 20px;
}

.modal-content {
  width: 100%;
  max-width: 800px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.modal-header {
  padding: 20px 30px;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.close-button {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 2rem;
  cursor: pointer;
  line-height: 1;
}

.close-button:hover {
  color: #fff;
}

.deck-list {
  padding: 30px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
}

.deck-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all 0.3s ease;
}

.deck-item:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--accent-color);
}

.deck-item-preview {
  width: 100%;
  aspect-ratio: 2/3;
  background: rgba(0,0,0,0.2);
  border-radius: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px;
}

.deck-item-preview canvas {
  max-width: 100%;
  max-height: 100%;
  filter: none;
}

.modal-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.deck-item-info {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.qty-input {
  width: 40px;
  background: transparent;
  border: none;
  color: #fff;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 600;
  outline: none;
}

/* Remove arrows from number input */
.qty-input::-webkit-inner-spin-button,
.qty-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.style-select {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  color: #fff;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  outline: none;
  transition: all 0.3s ease;
}

.style-select:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent-color);
}

/* Style Upload Modal */
.style-upload-modal {
  max-width: 600px;
}

.upload-form {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.modal-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  color: #fff;
  padding: 12px;
  border-radius: 8px;
  outline: none;
}

.upload-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.upload-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed var(--glass-border);
  padding: 16px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.upload-box span {
  font-size: 0.85rem;
  color: #94a3b8;
  font-weight: 500;
}

.upload-box input[type="file"] {
  font-size: 0.8rem;
  color: #cbd5e1;
}

.full-width {
  width: 100%;
}

.modal-footer {
  margin-top: 10px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.9rem;
  color: #cbd5e1;
}

.deck-item-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.quantity-control {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0,0,0,0.3);
  padding: 4px 8px;
  border-radius: 8px;
}

.qty-btn {
  background: transparent;
  border: none;
  color: var(--accent-color);
  font-weight: bold;
  cursor: pointer;
  padding: 0 4px;
}

.remove-btn {
  background: rgba(239, 68, 68, 0.1);
  border: none;
  color: #ef4444;
  padding: 6px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.remove-btn:hover {
  background: rgba(239, 68, 68, 0.2);
}

::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
  background: var(--surface-color);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #2a2a30;
}

