:root {
  --bg-dark: #0a0b10;
  --bg-surface: #12141c;
  --bg-card: rgba(22, 25, 38, 0.85);
  --bg-glass: rgba(26, 30, 46, 0.65);
  --border-color: rgba(99, 102, 241, 0.2);
  --border-focus: #6366f1;
  --accent-primary: #6366f1;
  --accent-secondary: #06b6d4;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #06b6d4 100%);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius: 12px;
  --shadow-lg: 0 10px 30px -5px rgba(0, 0, 0, 0.5), 0 0 20px rgba(99, 102, 241, 0.15);
}

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

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  background-image: radial-gradient(circle at 15% 15%, rgba(99, 102, 241, 0.12) 0%, transparent 40%),
                    radial-gradient(circle at 85% 85%, rgba(6, 182, 212, 0.08) 0%, transparent 45%);
}

.app-wrapper {
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  margin-bottom: 24px;
}

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

.logo-badge {
  width: 44px;
  height: 44px;
  background: var(--accent-gradient);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 1.2rem;
  color: #fff;
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.4);
}

.brand-text h1 {
  font-size: 1.35rem;
  font-weight: 700;
  background: linear-gradient(135deg, #ffffff, #cbd5e1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.badge-tag {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  background: rgba(6, 182, 212, 0.2);
  color: var(--accent-secondary);
  border-radius: 6px;
  margin-left: 8px;
}

.brand-text p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* Resource Load Banner */
.load-banner {
  background: var(--bg-card);
  border: 2px dashed var(--border-color);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  margin-bottom: 24px;
  transition: all 0.25s ease;
}

.load-banner.dragover {
  border-color: var(--accent-secondary);
  background: rgba(6, 182, 212, 0.08);
}

.banner-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  color: var(--accent-primary);
}

.load-banner h2 {
  font-size: 1.3rem;
  margin-bottom: 8px;
}

.load-banner p {
  color: var(--text-muted);
  font-size: 0.9rem;
  max-width: 600px;
  margin: 0 auto 20px;
}

.upload-actions {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.status-pills {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.status-badge {
  font-size: 0.8rem;
  padding: 4px 12px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.badge-success {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
  border-color: rgba(16, 185, 129, 0.4);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
  border-color: rgba(245, 158, 11, 0.4);
}

.badge-danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.4);
}

/* Nav Tabs */
.nav-tabs {
  display: flex;
  gap: 8px;
  background: var(--bg-surface);
  padding: 6px;
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  margin-bottom: 24px;
}

.nav-tab {
  flex: 1;
  padding: 10px 18px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.92rem;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.nav-tab:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.04);
}

.nav-tab.active {
  background: var(--accent-gradient);
  color: #fff;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* Tab Panels */
.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
  animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Splash Studio Layout */
.target-selector-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.target-pills-container {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.target-pill {
  padding: 6px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.target-pill:hover {
  color: var(--text-main);
  border-color: var(--accent-primary);
}

.target-pill.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fff;
}

.studio-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

@media (max-width: 1024px) {
  .studio-grid { grid-template-columns: 1fr; }
}

.studio-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
}

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

.card-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

/* Mockup Frame & Overlay */
.mockup-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 1532 / 1032;
  background: #0a0d14;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: aspect-ratio 0.2s ease;
}

.mockup-img, .mockup-canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.mockup-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px 24px;
  background: linear-gradient(180deg, rgba(0,0,0,0.35) 0%, transparent 35%, transparent 70%, rgba(0,0,0,0.7) 100%);
  transition: opacity 0.2s ease;
}

.mockup-overlay.hidden-overlay {
  opacity: 0;
}

.overlay-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ps-logo-text {
  font-weight: 900;
  font-size: 1.3rem;
  letter-spacing: -0.02em;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,0.8);
}

.overlay-bottom {
  color: rgba(255, 255, 255, 0.85);
  text-shadow: 0 1px 4px rgba(0,0,0,0.8);
}

.overlay-version {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.overlay-credits {
  font-size: 0.72rem;
  opacity: 0.75;
  margin-bottom: 12px;
}

.overlay-progress-bar {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
  overflow: hidden;
}

.overlay-progress-fill {
  width: 65%;
  height: 100%;
  background: #38bdf8;
}

/* Dropzone in Custom Card */
.image-dropzone {
  width: 100%;
  aspect-ratio: 1532 / 1032;
  border: 2px dashed var(--border-color);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: rgba(255, 255, 255, 0.02);
}

.image-dropzone:hover, .image-dropzone.dragover {
  border-color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.06);
}

.dropzone-icon {
  width: 48px;
  height: 48px;
  color: var(--accent-primary);
  margin-bottom: 12px;
}

/* Tuner Toolbar */
.tuner-toolbar {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 24px;
}

.tuner-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.control-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

.slider {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent-primary);
  cursor: pointer;
  box-shadow: 0 0 8px var(--accent-primary);
}

.form-select, .form-input {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.88rem;
  outline: none;
}

.form-select:focus, .form-input:focus {
  border-color: var(--accent-primary);
}

.tuner-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

/* Preset Cards Grid */
.preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.preset-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.preset-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent-primary);
}

.preset-thumb {
  width: 100%;
  aspect-ratio: 16 / 10;
  display: block;
}

.preset-info {
  padding: 16px;
}

.preset-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.preset-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 14px;
}

/* Explorer Grid */
.explorer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 20px;
}

.category-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pill {
  padding: 6px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pill.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #fff;
}

.icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.icon-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-card:hover {
  border-color: var(--accent-primary);
  transform: translateY(-2px);
}

.icon-thumb-wrapper {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

.icon-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.icon-placeholder {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.icon-title {
  font-size: 0.75rem;
  font-weight: 600;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 2px;
}

.icon-meta {
  font-size: 0.65rem;
  color: var(--text-muted);
}

.icon-cat-badge {
  font-size: 0.62rem;
  padding: 1px 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  margin-top: 4px;
  color: var(--text-muted);
}

/* Pagination */
.pagination-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--bg-card);
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

/* Buttons */
.btn {
  padding: 8px 16px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.btn-primary {
  background: var(--accent-gradient);
  color: #fff;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
  opacity: 0.95;
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.5);
}

.btn-outline {
  background: transparent;
  border-color: var(--border-color);
  color: var(--text-main);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--accent-primary);
}

.btn-success {
  background: #10b981;
  color: #fff;
}

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

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

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
}

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  width: 100%;
  max-width: 650px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

.guide-step {
  margin-bottom: 18px;
  background: var(--bg-card);
  padding: 14px;
  border-radius: 8px;
  border-left: 3px solid var(--accent-primary);
}

.guide-step h4 {
  font-size: 0.95rem;
  margin-bottom: 4px;
}

.guide-step p, .guide-step code {
  font-size: 0.85rem;
  color: var(--text-muted);
}

code {
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--accent-secondary);
}

/* Language Selector Dropdown */
.lang-dropdown-wrapper {
  position: relative;
}

.lang-dropdown-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 6px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-main);
  font-size: 0.88rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.lang-dropdown-btn:hover {
  border-color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.1);
}

.lang-flag {
  font-size: 1.15rem;
  line-height: 1;
}

.lang-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
  padding: 6px;
  min-width: 140px;
  display: none;
  flex-direction: column;
  gap: 4px;
  z-index: 1000;
  backdrop-filter: blur(12px);
  animation: fadeIn 0.18s ease;
}

.lang-dropdown-wrapper.open .lang-dropdown-menu {
  display: flex;
}

.lang-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: all 0.15s ease;
}

.lang-dropdown-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.lang-dropdown-item.active {
  background: var(--accent-gradient);
  color: #fff;
}

/* Modal Platform Switcher Tabs */
.platform-tabs {
  display: flex;
  gap: 8px;
  background: var(--bg-card);
  padding: 4px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  margin-bottom: 18px;
}

.platform-tab {
  flex: 1;
  padding: 8px 14px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.platform-tab:hover {
  color: var(--text-main);
}

.platform-tab.active {
  background: var(--accent-primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.platform-guide-content {
  display: none;
}

.platform-guide-content.active {
  display: block;
  animation: fadeIn 0.2s ease;
}

/* Toasts */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 2000;
}

.toast {
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 500;
  color: #fff;
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  animation: slideIn 0.25s ease;
}

.toast-success { background: #065f46; border-color: #10b981; }
.toast-error { background: #991b1b; border-color: #ef4444; }
.toast-info { background: #1e1b4b; border-color: #6366f1; }

.toast.fade-out {
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.35s ease;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

.hidden { display: none !important; }

